Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ccgus/fmdb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAugust "Gus" Mueller <gus@flyingmeat.com>2020-05-12 19:38:22 +0300
committerGitHub <noreply@github.com>2020-05-12 19:38:22 +0300
commit61e51fde7f7aab6554f30ab061cc588b28a97d04 (patch)
tree4610bc88b14e898c6dd09d911cee62d1f043d0af
parenteae75f12436308bfbbaad0737397c9caa8a1cc87 (diff)
parentd09c0d8d94800c498575d9e39a863c3cd2c2667e (diff)
Merge pull request #791 from ccgus/robertmryan/update-documentation2.7.7
Update header comments & documentation
-rw-r--r--src/extra/fts3/FMDatabase+FTS3.h12
-rw-r--r--src/extra/fts3/FMTokenizers.h12
-rw-r--r--src/fmdb/FMDatabase.h556
-rw-r--r--src/fmdb/FMDatabase.m1
-rw-r--r--src/fmdb/FMDatabaseAdditions.h61
-rwxr-xr-xsrc/fmdb/FMDatabasePool.h66
-rwxr-xr-xsrc/fmdb/FMDatabaseQueue.h102
-rw-r--r--src/fmdb/FMResultSet.h123
8 files changed, 482 insertions, 451 deletions
diff --git a/src/extra/fts3/FMDatabase+FTS3.h b/src/extra/fts3/FMDatabase+FTS3.h
index 7240318..f7c57bc 100644
--- a/src/extra/fts3/FMDatabase+FTS3.h
+++ b/src/extra/fts3/FMDatabase+FTS3.h
@@ -36,12 +36,12 @@ extern NSString *const kFTSCommandAutoMerge; // "automerge=%u"
+ (void)registerTokenizer:(id<FMTokenizerDelegate>)tokenizer withKey:(NSString *)key;
/**
- Calls the `fts3_tokenizer()` function on this database, installing tokenizer module with the 'fmdb' name.
+ Calls the @c fts3_tokenizer function on this database, installing tokenizer module with the 'fmdb' name.
*/
- (BOOL)installTokenizerModule;
/**
- Calls the `fts3_tokenizer()` function on this database, installing the tokenizer module with specified name.
+ Calls the @c fts3_tokenizer function on this database, installing the tokenizer module with specified name.
*/
- (BOOL)installTokenizerModuleWithName:(NSString *)name;
@@ -89,8 +89,8 @@ typedef struct FMTokenizerCursor
/**
Enumerate each set of offsets in the result. The column number can be turned into a column name
- using `[FMResultSet columnNameForIndex:]`. The `matchRange` is in UTF-8 byte positions, so it must be
- modified to use with `NSString` data.
+ using `[FMResultSet columnNameForIndex:]`. The @c matchRange is in UTF-8 byte positions, so it must be
+ modified to use with @c NSString data.
*/
- (void)enumerateWithBlock:(void (^)(NSInteger columnNumber, NSInteger termNumber, NSRange matchRange))block;
@@ -102,12 +102,12 @@ typedef struct FMTokenizerCursor
@interface FMResultSet (FTS3)
/**
- Returns a structure containing values from the `offsets()` function. Make sure the column index corresponds
+ Returns a structure containing values from the @c offsets function. Make sure the column index corresponds
to the column index in the SQL query.
@param columnIdx Zero-based index for column.
- @return `FMTextOffsets` structure.
+ @return @c FMTextOffsets structure.
*/
- (FMTextOffsets *)offsetsForColumnIndex:(int)columnIdx;
diff --git a/src/extra/fts3/FMTokenizers.h b/src/extra/fts3/FMTokenizers.h
index 4ba370b..8ac60cb 100644
--- a/src/extra/fts3/FMTokenizers.h
+++ b/src/extra/fts3/FMTokenizers.h
@@ -18,7 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
Create the tokenizer with a given locale. The locale will be used to initialize the string tokenizer and to lowercase the parsed word.
- The locale can be `NULL`, in which case the current locale will be used.
+
+
+ @param locale The locale used by the simple tokenizer. The locale can be @c NULL , in which case the current locale will be used.
*/
- (instancetype)initWithLocale:(CFLocaleRef _Nullable)locale;
@@ -35,12 +37,18 @@ NS_ASSUME_NONNULL_BEGIN
/**
Load a stop-word tokenizer using a file containing words delimited by newlines. The file should be encoded in UTF-8.
+
+ @param wordFileURL The file URL for the list of words.
+ @param tokenizer The @c FMTokenizerDelegate .
+ @param error The @c NSError if there was any error reading the file.
*/
+ (instancetype)tokenizerWithFileURL:(NSURL *)wordFileURL baseTokenizer:(id<FMTokenizerDelegate>)tokenizer error:(NSError * _Nullable *)error;
/**
- Initialize an instance of the tokenizer using the set of words. The words should be lowercase if you're using the
+ Initialize an instance of the tokenizer using the set of words. The words should be lowercase if you're using the
`FMSimpleTokenizer` as the base.
+ @param words The @c NSSet of words.
+ @param tokenizer The @c FMTokenizerDelegate .
*/
- (instancetype)initWithWords:(NSSet *)words baseTokenizer:(id<FMTokenizerDelegate>)tokenizer;
diff --git a/src/fmdb/FMDatabase.h b/src/fmdb/FMDatabase.h
index 472def9..44e9df7 100644
--- a/src/fmdb/FMDatabase.h
+++ b/src/fmdb/FMDatabase.h
@@ -38,9 +38,14 @@ NS_ASSUME_NONNULL_BEGIN
#define instancetype id
#endif
-
+/**
+ Callback block used by @c executeStatements:withResultBlock:
+ */
typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary);
+/**
+ Enumeration used in checkpoint methods.
+ */
typedef NS_ENUM(int, FMDBCheckpointMode) {
FMDBCheckpointModePassive = 0, // SQLITE_CHECKPOINT_PASSIVE,
FMDBCheckpointModeFull = 1, // SQLITE_CHECKPOINT_FULL,
@@ -48,34 +53,37 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
FMDBCheckpointModeTruncate = 3 // SQLITE_CHECKPOINT_TRUNCATE
};
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
+
/** A SQLite ([https://sqlite.org/](https://sqlite.org/)) Objective-C wrapper.
-
- ### Usage
+
+ Usage
+
The three main classes in FMDB are:
- - `FMDatabase` - Represents a single SQLite database. Used for executing SQL statements.
- - `<FMResultSet>` - Represents the results of executing a query on an `FMDatabase`.
- - `<FMDatabaseQueue>` - If you want to perform queries and updates on multiple threads, you'll want to use this class.
+ - @c FMDatabase - Represents a single SQLite database. Used for executing SQL statements.
+
+ - @c FMResultSet - Represents the results of executing a query on an @c FMDatabase .
+
+ - @c FMDatabaseQueue - If you want to perform queries and updates on multiple threads, you'll want to use this class.
+
+ See also
+
+ - @c FMDatabasePool - A pool of @c FMDatabase objects
+
+ - @c FMStatement - A wrapper for @c sqlite_stmt
+
+ External links
- ### See also
-
- - `<FMDatabasePool>` - A pool of `FMDatabase` objects.
- - `<FMStatement>` - A wrapper for `sqlite_stmt`.
-
- ### External links
-
- [FMDB on GitHub](https://github.com/ccgus/fmdb) including introductory documentation
- [SQLite web site](https://sqlite.org/)
- [FMDB mailing list](http://groups.google.com/group/fmdb)
- [SQLite FAQ](https://sqlite.org/faq.html)
-
- @warning Do not instantiate a single `FMDatabase` object and use it across multiple threads. Instead, use `<FMDatabaseQueue>`.
-
- */
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
+ @warning Do not instantiate a single @c FMDatabase object and use it across multiple threads. Instead, use @c FMDatabaseQueue .
+ */
@interface FMDatabase : NSObject
@@ -107,111 +115,110 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/// @name Initialization
///---------------------
-/** Create a `FMDatabase` object.
+/** Create a @c FMDatabase object.
- An `FMDatabase` is created with a path to a SQLite database file. This path can be one of these three:
+ An @c FMDatabase is created with a path to a SQLite database file. This path can be one of these three:
1. A file system path. The file does not have to exist on disk. If it does not exist, it is created for you.
- 2. An empty string (`@""`). An empty database is created at a temporary location. This database is deleted with the `FMDatabase` connection is closed.
- 3. `nil`. An in-memory database is created. This database will be destroyed with the `FMDatabase` connection is closed.
- For example, to create/open a database in your Mac OS X `tmp` folder:
+ 2. An zero-length string. An empty database is created at a temporary location. This database is deleted with the @c FMDatabase connection is closed.
- FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"];
+ 3. @c nil . An in-memory database is created. This database will be destroyed with the @c FMDatabase connection is closed.
- Or, in iOS, you might open a database in the app's `Documents` directory:
+ For example, to open a database in the app's “Application Support” directory:
- NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
- NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"];
- FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
+@code
+NSURL *folder = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+FMDatabase *db = [FMDatabase databaseWithPath:fileURL.path];
+@endcode
(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
@param inPath Path of database file
- @return `FMDatabase` object if successful; `nil` if failure.
+ @return @c FMDatabase object if successful; @c nil if failure.
*/
+ (instancetype)databaseWithPath:(NSString * _Nullable)inPath;
-/** Create a `FMDatabase` object.
+/** Create a @c FMDatabase object.
- An `FMDatabase` is created with a path to a SQLite database file. This path can be one of these three:
+ An @c FMDatabase is created with a path to a SQLite database file. This path can be one of these three:
1. A file system URL. The file does not have to exist on disk. If it does not exist, it is created for you.
- 2. `nil`. An in-memory database is created. This database will be destroyed with the `FMDatabase` connection is closed.
-
- For example, to create/open a database in your Mac OS X `tmp` folder:
-
- FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"];
-
- Or, in iOS, you might open a database in the app's `Documents` directory:
-
- NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
- NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"];
- FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
+
+ 2. @c nil . An in-memory database is created. This database will be destroyed with the @c FMDatabase connection is closed.
+ For example, to open a database in the app's “Application Support” directory:
+
+@code
+NSURL *folder = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+FMDatabase *db = [FMDatabase databaseWithURL:fileURL];
+@endcode
+
(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
@param url The local file URL (not remote URL) of database file
- @return `FMDatabase` object if successful; `nil` if failure.
+ @return @c FMDatabase object if successful; @c nil if failure.
*/
+ (instancetype)databaseWithURL:(NSURL * _Nullable)url;
-/** Initialize a `FMDatabase` object.
+/** Initialize a @c FMDatabase object.
- An `FMDatabase` is created with a path to a SQLite database file. This path can be one of these three:
+ An @c FMDatabase is created with a path to a SQLite database file. This path can be one of these three:
1. A file system path. The file does not have to exist on disk. If it does not exist, it is created for you.
- 2. An empty string (`@""`). An empty database is created at a temporary location. This database is deleted with the `FMDatabase` connection is closed.
- 3. `nil`. An in-memory database is created. This database will be destroyed with the `FMDatabase` connection is closed.
- For example, to create/open a database in your Mac OS X `tmp` folder:
+ 2. A zero-length string. An empty database is created at a temporary location. This database is deleted with the @c FMDatabase connection is closed.
+
+ 3. @c nil . An in-memory database is created. This database will be destroyed with the @c FMDatabase connection is closed.
- FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"];
+ For example, to open a database in the app's “Application Support” directory:
- Or, in iOS, you might open a database in the app's `Documents` directory:
+ @code
+ NSURL *folder = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+ NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+ FMDatabase *db = [[FMDatabase alloc] initWithPath:fileURL.path];
+ @endcode
- NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
- NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"];
- FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
@param path Path of database file.
- @return `FMDatabase` object if successful; `nil` if failure.
+ @return @c FMDatabase object if successful; @c nil if failure.
*/
- (instancetype)initWithPath:(NSString * _Nullable)path;
-/** Initialize a `FMDatabase` object.
+/** Initialize a @c FMDatabase object.
- An `FMDatabase` is created with a local file URL to a SQLite database file. This path can be one of these three:
+ An @c FMDatabase is created with a local file URL to a SQLite database file. This path can be one of these three:
1. A file system URL. The file does not have to exist on disk. If it does not exist, it is created for you.
- 2. `nil`. An in-memory database is created. This database will be destroyed with the `FMDatabase` connection is closed.
-
- For example, to create/open a database in your Mac OS X `tmp` folder:
-
- FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"];
-
- Or, in iOS, you might open a database in the app's `Documents` directory:
-
- NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
- NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"];
- FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
+
+ 2. @c nil . An in-memory database is created. This database will be destroyed with the @c FMDatabase connection is closed.
+ For example, to open a database in the app's “Application Support” directory:
+
+ @code
+ NSURL *folder = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:true error:&error];
+ NSURL *fileURL = [folder URLByAppendingPathComponent:@"test.db"];
+ FMDatabase *db = [[FMDatabase alloc] initWithURL:fileURL];
+ @endcode
+
(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [https://sqlite.org/inmemorydb.html](https://sqlite.org/inmemorydb.html))
- @param url The file `NSURL` of database file.
+ @param url The file @c NSURL of database file.
- @return `FMDatabase` object if successful; `nil` if failure.
+ @return @c FMDatabase object if successful; @c nil if failure.
*/
@@ -229,7 +236,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
The database is opened for reading and writing, and is created if it does not already exist.
- @return `YES` if successful, `NO` on error.
+ @return @c YES if successful, @c NO on error.
@see [sqlite3_open()](https://sqlite.org/c3ref/open.html)
@see openWithFlags:
@@ -240,21 +247,27 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Opening a new database connection with flags and an optional virtual file system (VFS)
- @param flags one of the following three values, optionally combined with the `SQLITE_OPEN_NOMUTEX`, `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, `SQLITE_OPEN_PRIVATECACHE`, and/or `SQLITE_OPEN_URI` flags:
+ @param flags One of the following three values, optionally combined with the @c SQLITE_OPEN_NOMUTEX , @c SQLITE_OPEN_FULLMUTEX , @c SQLITE_OPEN_SHAREDCACHE , @c SQLITE_OPEN_PRIVATECACHE , and/or @c SQLITE_OPEN_URI flags:
- `SQLITE_OPEN_READONLY`
+@code
+SQLITE_OPEN_READONLY
+@endcode
The database is opened in read-only mode. If the database does not already exist, an error is returned.
- `SQLITE_OPEN_READWRITE`
-
+@code
+SQLITE_OPEN_READWRITE
+@endcode
+
The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned.
+
+@code
+SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
+@endcode
- `SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE`
-
- The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for `open` method.
+ The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for @c open method.
- @return `YES` if successful, `NO` on error.
+ @return @c YES if successful, @c NO on error.
@see [sqlite3_open_v2()](https://sqlite.org/c3ref/open.html)
@see open
@@ -265,23 +278,29 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Opening a new database connection with flags and an optional virtual file system (VFS)
- @param flags one of the following three values, optionally combined with the `SQLITE_OPEN_NOMUTEX`, `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, `SQLITE_OPEN_PRIVATECACHE`, and/or `SQLITE_OPEN_URI` flags:
+ @param flags One of the following three values, optionally combined with the @c SQLITE_OPEN_NOMUTEX , `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, @c SQLITE_OPEN_PRIVATECACHE , and/or @c SQLITE_OPEN_URI flags:
- `SQLITE_OPEN_READONLY`
-
- The database is opened in read-only mode. If the database does not already exist, an error is returned.
-
- `SQLITE_OPEN_READWRITE`
-
- The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned.
-
- `SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE`
-
- The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for `open` method.
+@code
+SQLITE_OPEN_READONLY
+@endcode
+
+ The database is opened in read-only mode. If the database does not already exist, an error is returned.
+
+@code
+SQLITE_OPEN_READWRITE
+@endcode
+
+ The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned.
+
+@code
+SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
+@endcode
+
+ The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for @c open method.
@param vfsName If vfs is given the value is passed to the vfs parameter of sqlite3_open_v2.
- @return `YES` if successful, `NO` on error.
+ @return @c YES if successful, @c NO on error.
@see [sqlite3_open_v2()](https://sqlite.org/c3ref/open.html)
@see open
@@ -292,7 +311,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Closing a database connection
- @return `YES` if success, `NO` on error.
+ @return @c YES if success, @c NO on error.
@see [sqlite3_close()](https://sqlite.org/c3ref/close.html)
@see open
@@ -306,9 +325,10 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
This will confirm whether:
- is database open
- - if open, it will try a simple SELECT statement and confirm that it succeeds.
- @return `YES` if everything succeeds, `NO` on failure.
+ - if open, it will try a simple @c SELECT statement and confirm that it succeeds.
+
+ @return @c YES if everything succeeds, @c NO on failure.
*/
@property (nonatomic, readonly) BOOL goodConnection;
@@ -320,17 +340,15 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute single update statement
- This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update.
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update.
- The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description method.
- @param sql The SQL to be performed, with optional `?` placeholders.
-
- @param outErr A reference to the `NSError` pointer to be updated with an auto released `NSError` object if an error if an error occurs. If `nil`, no `NSError` object will be returned.
+ @param sql The SQL to be performed, with optional `?` placeholders. This can be followed by iptional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. @c NSString , @c NSNumber , etc.), not fundamental C data types (e.g. @c int , etc.).
- @param ... Optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. `NSString`, `NSNumber`, etc.), not fundamental C data types (e.g. `int`, `char *`, etc.).
+ @param outErr A reference to the @c NSError pointer to be updated with an auto released @c NSError object if an error if an error occurs. If @c nil , no @c NSError object will be returned.
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see lastError
@see lastErrorCode
@@ -351,22 +369,20 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute single update statement
- This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update.
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update.
- The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description method.
- @param sql The SQL to be performed, with optional `?` placeholders.
+ @param sql The SQL to be performed, with optional `?` placeholders, followed by optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. @c NSString , @c NSNumber , etc.), not fundamental C data types (e.g. @c int , etc.).
- @param ... Optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. `NSString`, `NSNumber`, etc.), not fundamental C data types (e.g. `int`, `char *`, etc.).
-
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see lastError
@see lastErrorCode
@see lastErrorMessage
@see [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html)
- @note This technique supports the use of `?` placeholders in the SQL, automatically binding any supplied value parameters to those placeholders. This approach is more robust than techniques that entail using `stringWithFormat` to manually build SQL statements, which can be problematic if the values happened to include any characters that needed to be quoted.
+ @note This technique supports the use of `?` placeholders in the SQL, automatically binding any supplied value parameters to those placeholders. This approach is more robust than techniques that entail using @c stringWithFormat to manually build SQL statements, which can be problematic if the values happened to include any characters that needed to be quoted.
@note You cannot use this method from Swift due to incompatibilities between Swift and Objective-C variadic implementations. Consider using `<executeUpdate:values:>` instead.
*/
@@ -375,13 +391,11 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute single update statement
- This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other `executeUpdate` methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL. Do not use `?` placeholders in the SQL if you use this method.
-
- @param format The SQL to be performed, with `printf`-style escape sequences.
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other @c executeUpdate methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL. Do not use `?` placeholders in the SQL if you use this method.
- @param ... Optional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement.
+ @param format The SQL to be performed, with `printf`-style escape sequences, followed by optional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement.
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see executeUpdate:
@see lastError
@@ -390,28 +404,32 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@note This method does not technically perform a traditional printf-style replacement. What this method actually does is replace the printf-style percent sequences with a SQLite `?` placeholder, and then bind values to that placeholder. Thus the following command
- [db executeUpdateWithFormat:@"INSERT INTO test (name) VALUES (%@)", @"Gus"];
+@code
+[db executeUpdateWithFormat:@"INSERT INTO test (name) VALUES (%@)", @"Gus"];
+@endcode
is actually replacing the `%@` with `?` placeholder, and then performing something equivalent to `<executeUpdate:>`
- [db executeUpdate:@"INSERT INTO test (name) VALUES (?)", @"Gus"];
+@code
+[db executeUpdate:@"INSERT INTO test (name) VALUES (?)", @"Gus"];
+@endcode
- There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The `VALUES` clause was _not_ `VALUES ('%@')` (like you might have to do if you built a SQL statement using `NSString` method `stringWithFormat`), but rather simply `VALUES (%@)`.
+ There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The `VALUES` clause was _not_ `VALUES ('%@')` (like you might have to do if you built a SQL statement using @c NSString method @c stringWithFormat ), but rather simply `VALUES (%@)`.
*/
- (BOOL)executeUpdateWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);
/** Execute single update statement
- This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
- The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description method.
@param sql The SQL to be performed, with optional `?` placeholders.
- @param arguments A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
+ @param arguments A @c NSArray of objects to be used when binding values to the `?` placeholders in the SQL statement.
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see executeUpdate:values:error:
@see lastError
@@ -423,23 +441,25 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute single update statement
- This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters.
- The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description method.
- This is similar to `<executeUpdate:withArgumentsInArray:>`, except that this also accepts a pointer to a `NSError` pointer, so that errors can be returned.
+ This is similar to @c executeUpdate:withArgumentsInArray: , except that this also accepts a pointer to a @c NSError pointer, so that errors can be returned.
In Swift, this throws errors, as if it were defined as follows:
- `func executeUpdate(sql: String, values: [Any]?) throws -> Bool`
-
+@code
+func executeUpdate(sql: String, values: [Any]?) throws -> Bool { }
+@endcode
+
@param sql The SQL to be performed, with optional `?` placeholders.
- @param values A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
+ @param values A @c NSArray of objects to be used when binding values to the `?` placeholders in the SQL statement.
- @param error A `NSError` object to receive any error object (if any).
+ @param error A @c NSError object to receive any error object (if any).
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see lastError
@see lastErrorCode
@@ -451,15 +471,15 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute single update statement
- This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other `executeUpdate` methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL.
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other @c executeUpdate methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL.
- The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description method.
@param sql The SQL to be performed, with optional `?` placeholders.
- @param arguments A `NSDictionary` of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement.
+ @param arguments A @c NSDictionary of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement.
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see lastError
@see lastErrorCode
@@ -471,15 +491,15 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute single update statement
- This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other `executeUpdate` methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL.
+ This method executes a single SQL update statement (i.e. any SQL that does not return results, such as @c UPDATE , @c INSERT , or @c DELETE . This method employs [`sqlite3_prepare_v2`](https://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](https://sqlite.org/c3ref/step.html) to perform the update. Unlike the other @c executeUpdate methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL.
- The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method.
+ The optional values provided to this method should be objects (e.g. @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData objects), not fundamental data types (e.g. @c int , @c long , @c NSInteger , etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's @c description method.
@param sql The SQL to be performed, with optional `?` placeholders.
@param args A `va_list` of arguments.
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see lastError
@see lastErrorCode
@@ -490,11 +510,11 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute multiple SQL statements
- This executes a series of SQL statements that are combined in a single string (e.g. the SQL generated by the `sqlite3` command line `.dump` command). This accepts no value parameters, but rather simply expects a single string with multiple SQL statements, each terminated with a semicolon. This uses `sqlite3_exec`.
+ This executes a series of SQL statements that are combined in a single string (e.g. the SQL generated by the `sqlite3` command line `.dump` command). This accepts no value parameters, but rather simply expects a single string with multiple SQL statements, each terminated with a semicolon. This uses @c sqlite3_exec .
@param sql The SQL to be performed
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see executeStatements:withResultBlock:
@see [sqlite3_exec()](https://sqlite.org/c3ref/exec.html)
@@ -509,12 +529,12 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param sql The SQL to be performed.
@param block A block that will be called for any result sets returned by any SQL statements.
- Note, if you supply this block, it must return integer value, zero upon success (this would be a good opportunity to use SQLITE_OK),
+ Note, if you supply this block, it must return integer value, zero upon success (this would be a good opportunity to use @c SQLITE_OK ),
non-zero value upon failure (which will stop the bulk execution of the SQL). If a statement returns values, the block will be called with the results from the query in NSDictionary *resultsDictionary.
- This may be `nil` if you don't care to receive any results.
+ This may be @c nil if you don't care to receive any results.
- @return `YES` upon success; `NO` upon failure. If failed, you can call `<lastError>`,
- `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES upon success; @c NO upon failure. If failed, you can call @c lastError ,
+ @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see executeStatements:
@see [sqlite3_exec()](https://sqlite.org/c3ref/exec.html)
@@ -527,7 +547,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
Each entry in an SQLite table has a unique 64-bit signed integer key called the "rowid". The rowid is always available as an undeclared column named `ROWID`, `OID`, or `_ROWID_` as long as those names are not also used by explicitly declared columns. If the table has a column of type `INTEGER PRIMARY KEY` then that column is another alias for the rowid.
- This routine returns the rowid of the most recent successful `INSERT` into the database from the database connection in the first argument. As of SQLite version 3.7.7, this routines records the last insert rowid of both ordinary tables and virtual tables. If no successful `INSERT`s have ever occurred on that database connection, zero is returned.
+ This routine returns the rowid of the most recent successful @c INSERT into the database from the database connection in the first argument. As of SQLite version 3.7.7, this routines records the last insert rowid of both ordinary tables and virtual tables. If no successful @c INSERT statements have ever occurred on that database connection, zero is returned.
@return The rowid of the last inserted row.
@@ -539,7 +559,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** The number of rows changed by prior SQL statement.
- This function returns the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement on the database connection specified by the first parameter. Only changes that are directly specified by the INSERT, UPDATE, or DELETE statement are counted.
+ This function returns the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement on the database connection specified by the first parameter. Only changes that are directly specified by the @c INSERT , @c UPDATE , or @c DELETE statement are counted.
@return The number of rows changed by prior SQL statement.
@@ -556,17 +576,15 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute select statement
- Executing queries returns an `<FMResultSet>` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `<lastErrorMessage>` and `<lastErrorMessage>` methods to determine why a query failed.
+ Executing queries returns an @c FMResultSet object if successful, and @c nil upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the @c lastErrorMessage and @c lastErrorMessage methods to determine why a query failed.
In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
- This method employs [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) for any optional value parameters. This properly escapes any characters that need escape sequences (e.g. quotation marks), which eliminates simple SQL errors as well as protects against SQL injection attacks. This method natively handles `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects. All other object types will be interpreted as text values using the object's `description` method.
-
- @param sql The SELECT statement to be performed, with optional `?` placeholders.
+ This method employs [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html) for any optional value parameters. This properly escapes any characters that need escape sequences (e.g. quotation marks), which eliminates simple SQL errors as well as protects against SQL injection attacks. This method natively handles @c NSString , @c NSNumber , @c NSNull , @c NSDate , and @c NSData objects. All other object types will be interpreted as text values using the object's @c description method.
- @param ... Optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. `NSString`, `NSNumber`, etc.), not fundamental C data types (e.g. `int`, `char *`, etc.).
+ @param sql The SELECT statement to be performed, with optional `?` placeholders, followed by optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. @c NSString , @c NSNumber , etc.), not fundamental C data types (e.g. @c int , etc.).
- @return A `<FMResultSet>` for the result set upon success; `nil` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return A @c FMResultSet for the result set upon success; @c nil upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see FMResultSet
@see [`FMResultSet next`](<[FMResultSet next]>)
@@ -579,15 +597,13 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute select statement
- Executing queries returns an `<FMResultSet>` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `<lastErrorMessage>` and `<lastErrorMessage>` methods to determine why a query failed.
+ Executing queries returns an @c FMResultSet object if successful, and @c nil upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the @c lastErrorMessage and @c lastErrorMessage methods to determine why a query failed.
In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
- @param format The SQL to be performed, with `printf`-style escape sequences.
+ @param format The SQL to be performed, with `printf`-style escape sequences, followed by ptional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement.
- @param ... Optional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement.
-
- @return A `<FMResultSet>` for the result set upon success; `nil` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return A @c FMResultSet for the result set upon success; @c nil upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see executeQuery:
@see FMResultSet
@@ -595,13 +611,17 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@note This method does not technically perform a traditional printf-style replacement. What this method actually does is replace the printf-style percent sequences with a SQLite `?` placeholder, and then bind values to that placeholder. Thus the following command
- [db executeQueryWithFormat:@"SELECT * FROM test WHERE name=%@", @"Gus"];
-
+@code
+[db executeQueryWithFormat:@"SELECT * FROM test WHERE name=%@", @"Gus"];
+@endcode
+
is actually replacing the `%@` with `?` placeholder, and then performing something equivalent to `<executeQuery:>`
-
- [db executeQuery:@"SELECT * FROM test WHERE name=?", @"Gus"];
-
- There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The `WHERE` clause was _not_ `WHERE name='%@'` (like you might have to do if you built a SQL statement using `NSString` method `stringWithFormat`), but rather simply `WHERE name=%@`.
+
+@code
+[db executeQuery:@"SELECT * FROM test WHERE name=?", @"Gus"];
+@endcode
+
+ There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The @c WHERE clause was _not_ `WHERE name='%@'` (like you might have to do if you built a SQL statement using @c NSString method @c stringWithFormat ), but rather simply `WHERE name=%@`.
*/
@@ -609,15 +629,15 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute select statement
- Executing queries returns an `<FMResultSet>` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `<lastErrorMessage>` and `<lastErrorMessage>` methods to determine why a query failed.
+ Executing queries returns an @c FMResultSet object if successful, and @c nil upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the @c lastErrorMessage and @c lastErrorMessage methods to determine why a query failed.
In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
@param sql The SELECT statement to be performed, with optional `?` placeholders.
- @param arguments A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
+ @param arguments A @c NSArray of objects to be used when binding values to the `?` placeholders in the SQL statement.
- @return A `<FMResultSet>` for the result set upon success; `nil` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return A @c FMResultSet for the result set upon success; @c nil upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see -executeQuery:values:error:
@see FMResultSet
@@ -628,11 +648,11 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute select statement
- Executing queries returns an `<FMResultSet>` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `<lastErrorMessage>` and `<lastErrorMessage>` methods to determine why a query failed.
+ Executing queries returns an @c FMResultSet object if successful, and @c nil upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the @c lastErrorMessage and @c lastErrorMessage methods to determine why a query failed.
In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
- This is similar to `<executeQuery:withArgumentsInArray:>`, except that this also accepts a pointer to a `NSError` pointer, so that errors can be returned.
+ This is similar to `<executeQuery:withArgumentsInArray:>`, except that this also accepts a pointer to a @c NSError pointer, so that errors can be returned.
In Swift, this throws errors, as if it were defined as follows:
@@ -640,11 +660,11 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param sql The SELECT statement to be performed, with optional `?` placeholders.
- @param values A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement.
+ @param values A @c NSArray of objects to be used when binding values to the `?` placeholders in the SQL statement.
- @param error A `NSError` object to receive any error object (if any).
+ @param error A @c NSError object to receive any error object (if any).
- @return A `<FMResultSet>` for the result set upon success; `nil` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return A @c FMResultSet for the result set upon success; @c nil upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see FMResultSet
@see [`FMResultSet next`](<[FMResultSet next]>)
@@ -657,15 +677,15 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Execute select statement
- Executing queries returns an `<FMResultSet>` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `<lastErrorMessage>` and `<lastErrorMessage>` methods to determine why a query failed.
+ Executing queries returns an @c FMResultSet object if successful, and @c nil upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the @c lastErrorMessage and @c lastErrorMessage methods to determine why a query failed.
In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other.
@param sql The SELECT statement to be performed, with optional `?` placeholders.
- @param arguments A `NSDictionary` of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement.
+ @param arguments A @c NSDictionary of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement.
- @return A `<FMResultSet>` for the result set upon success; `nil` upon failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return A @c FMResultSet for the result set upon success; @c nil upon failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see FMResultSet
@see [`FMResultSet next`](<[FMResultSet next]>)
@@ -689,7 +709,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Begin a transaction
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see commit
@see rollback
@@ -701,7 +721,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
is likely to change in future versions of FMDB, whereby this method
will likely eventually adopt standard SQLite behavior and perform
deferred transactions. If you really need exclusive tranaction, it is
- recommended that you use `beginExclusiveTransaction`, instead, not
+ recommended that you use @c beginExclusiveTransaction, instead, not
only to make your intent explicit, but also to future-proof your code.
*/
@@ -710,7 +730,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Begin a deferred transaction
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see commit
@see rollback
@@ -722,7 +742,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Begin an immediate transaction
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see commit
@see rollback
@@ -734,7 +754,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Begin an exclusive transaction
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see commit
@see rollback
@@ -748,7 +768,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
Commit a transaction that was initiated with either `<beginTransaction>` or with `<beginDeferredTransaction>`.
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see beginTransaction
@see beginDeferredTransaction
@@ -762,7 +782,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
Rollback a transaction that was initiated with either `<beginTransaction>` or with `<beginDeferredTransaction>`.
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see beginTransaction
@see beginDeferredTransaction
@@ -799,7 +819,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Whether database has any open result sets
- @return `YES` if there are open result sets; `NO` if not.
+ @return @c YES if there are open result sets; @c NO if not.
*/
@property (nonatomic, readonly) BOOL hasOpenResultSets;
@@ -813,7 +833,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
This method causes any pending database operation to abort and return at its earliest opportunity
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
*/
@@ -827,7 +847,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param key The key to be used.
- @return `YES` if success, `NO` on error.
+ @return @c YES if success, @c NO on error.
@see https://www.zetetic.net/sqlcipher/
@@ -840,7 +860,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param key The key to be used.
- @return `YES` if success, `NO` on error.
+ @return @c YES if success, @c NO on error.
@see https://www.zetetic.net/sqlcipher/
@@ -851,9 +871,9 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Set encryption key using `keyData`.
- @param keyData The `NSData` to be used.
+ @param keyData The @c NSData to be used.
- @return `YES` if success, `NO` on error.
+ @return @c YES if success, @c NO on error.
@see https://www.zetetic.net/sqlcipher/
@@ -864,9 +884,9 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Reset encryption key using `keyData`.
- @param keyData The `NSData` to be used.
+ @param keyData The @c NSData to be used.
- @return `YES` if success, `NO` on error.
+ @return @c YES if success, @c NO on error.
@see https://www.zetetic.net/sqlcipher/
@@ -880,7 +900,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/// @name General inquiry methods
///------------------------------
-/** The path of the database file
+/** The path of the database file.
*/
@property (nonatomic, readonly, nullable) NSString *databasePath;
@@ -890,7 +910,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@property (nonatomic, readonly, nullable) NSURL *databaseURL;
-/** The underlying SQLite handle
+/** The underlying SQLite handle .
@return The `sqlite3` pointer.
@@ -907,7 +927,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
Returns the English-language text that describes the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined.
- @return `NSString` of the last error message.
+ @return @c NSString of the last error message.
@see [sqlite3_errmsg()](https://sqlite.org/c3ref/errcode.html)
@see lastErrorCode
@@ -949,7 +969,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Had error
- @return `YES` if there was an error, `NO` if no error.
+ @return @c YES if there was an error, @c NO if no error.
@see lastError
@see lastErrorCode
@@ -961,7 +981,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Last error
- @return `NSError` representing the last error.
+ @return @c NSError representing the last error.
@see lastErrorCode
@see lastErrorMessage
@@ -983,9 +1003,9 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param name Name of save point.
- @param outErr A `NSError` object to receive any error object (if any).
+ @param outErr A @c NSError object to receive any error object (if any).
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see releaseSavePointWithName:error:
@see rollbackToSavePointWithName:error:
@@ -997,9 +1017,9 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param name Name of save point.
- @param outErr A `NSError` object to receive any error object (if any).
+ @param outErr A @c NSError object to receive any error object (if any).
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see startSavePointWithName:error:
@see rollbackToSavePointWithName:error:
@@ -1011,9 +1031,9 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Roll back to save point
@param name Name of save point.
- @param outErr A `NSError` object to receive any error object (if any).
+ @param outErr A @c NSError object to receive any error object (if any).
- @return `YES` on success; `NO` on failure. If failed, you can call `<lastError>`, `<lastErrorCode>`, or `<lastErrorMessage>` for diagnostic information regarding the failure.
+ @return @c YES on success; @c NO on failure. If failed, you can call @c lastError , @c lastErrorCode , or @c lastErrorMessage for diagnostic information regarding the failure.
@see startSavePointWithName:error:
@see releaseSavePointWithName:error:
@@ -1026,7 +1046,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param block Block of code to perform from within save point.
- @return The NSError corresponding to the error, if any. If no error, returns `nil`.
+ @return The NSError corresponding to the error, if any. If no error, returns @c nil .
@see startSavePointWithName:error:
@see releaseSavePointWithName:error:
@@ -1043,18 +1063,18 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Performs a WAL checkpoint
- @param checkpointMode The checkpoint mode for sqlite3_wal_checkpoint_v2
- @param error The NSError corresponding to the error, if any.
- @return YES on success, otherwise NO.
+ @param checkpointMode The checkpoint mode for @c sqlite3_wal_checkpoint_v2
+ @param error The @c NSError corresponding to the error, if any.
+ @return @c YES on success, otherwise @c NO .
*/
- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode error:(NSError * _Nullable *)error;
/** Performs a WAL checkpoint
- @param checkpointMode The checkpoint mode for sqlite3_wal_checkpoint_v2
- @param name The db name for sqlite3_wal_checkpoint_v2
- @param error The NSError corresponding to the error, if any.
- @return YES on success, otherwise NO.
+ @param checkpointMode The checkpoint mode for @c sqlite3_wal_checkpoint_v2
+ @param name The db name for @c sqlite3_wal_checkpoint_v2
+ @param error The @c NSError corresponding to the error, if any.
+ @return @c YES on success, otherwise @c NO .
*/
- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString * _Nullable)name error:(NSError * _Nullable *)error;
@@ -1063,9 +1083,9 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
@param checkpointMode The checkpoint mode for sqlite3_wal_checkpoint_v2
@param name The db name for sqlite3_wal_checkpoint_v2
@param error The NSError corresponding to the error, if any.
- @param logFrameCount If not NULL, then this is set to the total number of frames in the log file or to -1 if the checkpoint could not run because of an error or because the database is not in WAL mode.
- @param checkpointCount If not NULL, then this is set to the total number of checkpointed frames in the log file (including any that were already checkpointed before the function was called) or to -1 if the checkpoint could not run due to an error or because the database is not in WAL mode.
- @return YES on success, otherwise NO.
+ @param logFrameCount If not @c NULL , then this is set to the total number of frames in the log file or to -1 if the checkpoint could not run because of an error or because the database is not in WAL mode.
+ @param checkpointCount If not @c NULL , then this is set to the total number of checkpointed frames in the log file (including any that were already checkpointed before the function was called) or to -1 if the checkpoint could not run due to an error or because the database is not in WAL mode.
+ @return @c YES on success, otherwise @c NO .
*/
- (BOOL)checkpoint:(FMDBCheckpointMode)checkpointMode name:(NSString * _Nullable)name logFrameCount:(int * _Nullable)logFrameCount checkpointCount:(int * _Nullable)checkpointCount error:(NSError * _Nullable *)error;
@@ -1075,7 +1095,7 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Test to see if the library is threadsafe
- @return `NO` if and only if SQLite was compiled with mutexing code omitted due to the SQLITE_THREADSAFE compile-time option being set to 0.
+ @return @c NO if and only if SQLite was compiled with mutexing code omitted due to the @c SQLITE_THREADSAFE compile-time option being set to 0.
@see [sqlite3_threadsafe()](https://sqlite.org/c3ref/threadsafe.html)
*/
@@ -1103,37 +1123,35 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
+ (NSString*)sqliteLibVersion;
-/**
- The FMDB version number as a string in the form of `"2.7.7"`.
-
- If you want to compare version number strings, you can use NSNumericSearch option:
-
- @code
- NSComparisonResult result = [[FMDatabase FMDBUserVersion] compare:@"2.11.0" options:NSNumericSearch];
- @endcode
-
- @returns The version number string.
- */
+/// The FMDB version number as a string in the form of @c "2.7.7" .
+///
+/// If you want to compare version number strings, you can use NSNumericSearch option:
+///
+/// @code
+/// NSComparisonResult result = [[FMDatabase FMDBUserVersion] compare:@"2.11.0" options:NSNumericSearch];
+/// @endcode
+///
+/// @returns The version number string.
+ (NSString*)FMDBUserVersion;
/** The FMDB version
- This returns the FMDB as hexadecimal value, e.g., 0x0243 for version 2.4.3.
+ This returns the FMDB as hexadecimal value, e.g., @c 0x0243 for version 2.4.3.
@warning This routine will not work if any component of the version number exceeds 15.
- For example, if it is version 2.17.3, this will max out at 0x2f3.
- For this reason, we would recommend using `FMDBUserVersion` and with `NSNumericSearch` option, e.g.
+ For example, if it is version @c 2.17.3 , this will max out at @c 0x2f3.
+ For this reason, we would recommend using @c FMDBUserVersion and with @c NSNumericSearch option, e.g.
@code
NSComparisonResult result = [[FMDatabase FMDBUserVersion] compare:@"2.11.0" options:NSNumericSearch];
@endcode
- @returns The version number in hexadecimal, e.g., 0x0243 for version 2.4.3. If any component exceeds what can be
- can be represented in four bits, we'll max it out at 0xf.
+ @returns The version number in hexadecimal, e.g., @c 0x0243 for version 2.4.3. If any component exceeds what can be
+ can be represented in four bits, we'll max it out at @c 0xf .
*/
-+ (SInt32)FMDBVersion;
++ (SInt32)FMDBVersion __deprecated_msg("Use FMDBUserVersion instead");
///------------------------
/// @name Make SQL function
@@ -1142,25 +1160,27 @@ typedef NS_ENUM(int, FMDBCheckpointMode) {
/** Adds SQL functions or aggregates or to redefine the behavior of existing SQL functions or aggregates.
For example:
-
- [db makeFunctionNamed:@"RemoveDiacritics" arguments:1 block:^(void *context, int argc, void **argv) {
- SqliteValueType type = [self.db valueType:argv[0]];
- if (type == SqliteValueTypeNull) {
- [self.db resultNullInContext:context];
- return;
- }
- if (type != SqliteValueTypeText) {
- [self.db resultError:@"Expected text" context:context];
- return;
- }
- NSString *string = [self.db valueString:argv[0]];
- NSString *result = [string stringByFoldingWithOptions:NSDiacriticInsensitiveSearch locale:nil];
- [self.db resultString:result context:context];
- }];
-
- FMResultSet *rs = [db executeQuery:@"SELECT * FROM employees WHERE RemoveDiacritics(first_name) LIKE 'jose'"];
- NSAssert(rs, @"Error %@", [db lastErrorMessage]);
-
+
+@code
+[db makeFunctionNamed:@"RemoveDiacritics" arguments:1 block:^(void *context, int argc, void **argv) {
+ SqliteValueType type = [self.db valueType:argv[0]];
+ if (type == SqliteValueTypeNull) {
+ [self.db resultNullInContext:context];
+ return;
+ }
+ if (type != SqliteValueTypeText) {
+ [self.db resultError:@"Expected text" context:context];
+ return;
+ }
+ NSString *string = [self.db valueString:argv[0]];
+ NSString *result = [string stringByFoldingWithOptions:NSDiacriticInsensitiveSearch locale:nil];
+ [self.db resultString:result context:context];
+}];
+
+FMResultSet *rs = [db executeQuery:@"SELECT * FROM employees WHERE RemoveDiacritics(first_name) LIKE 'jose'"];
+NSAssert(rs, @"Error %@", [db lastErrorMessage]);
+@endcode
+
@param name Name of function.
@param arguments Maximum number of parameters.
@@ -1215,7 +1235,7 @@ typedef NS_ENUM(int, SqliteValueType) {
- (double)valueDouble:(void *)value;
/**
- Get `NSData` value of parameter in custom function.
+ Get @c NSData value of parameter in custom function.
@param value The argument whose value to return.
@return The data object.
@@ -1274,9 +1294,9 @@ typedef NS_ENUM(int, SqliteValueType) {
- (void)resultDouble:(double)value context:(void *)context;
/**
- Return `NSData` object from custom function.
+ Return @c NSData object from custom function.
- @param data The `NSData` object to be returned.
+ @param data The @c NSData object to be returned.
@param context The context to which the value will be returned.
@see makeFunctionNamed:arguments:block:
@@ -1335,17 +1355,19 @@ typedef NS_ENUM(int, SqliteValueType) {
/// @name Date formatter
///---------------------
-/** Generate an `NSDateFormatter` that won't be broken by permutations of timezones or locales.
+/** Generate an @c NSDateFormatter that won't be broken by permutations of timezones or locales.
Use this method to generate values to set the dateFormat property.
Example:
- myDB.dateFormat = [FMDatabase storeableDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+@code
+myDB.dateFormat = [FMDatabase storeableDateFormat:@"yyyy-MM-dd HH:mm:ss"];
+@endcode
@param format A valid NSDateFormatter format string.
- @return A `NSDateFormatter` that can be used for converting dates to strings and vice versa.
+ @return A @c NSDateFormatter that can be used for converting dates to strings and vice versa.
@see hasDateFormatter
@see setDateFormat:
@@ -1353,7 +1375,7 @@ typedef NS_ENUM(int, SqliteValueType) {
@see stringFromDate:
@see storeableDateFormat:
- @warning Note that `NSDateFormatter` is not thread-safe, so the formatter generated by this method should be assigned to only one FMDB instance and should not be used for other purposes.
+ @warning Note that @c NSDateFormatter is not thread-safe, so the formatter generated by this method should be assigned to only one FMDB instance and should not be used for other purposes.
*/
@@ -1361,7 +1383,7 @@ typedef NS_ENUM(int, SqliteValueType) {
/** Test whether the database has a date formatter assigned.
- @return `YES` if there is a date formatter; `NO` if not.
+ @return @c YES if there is a date formatter; @c NO if not.
@see hasDateFormatter
@see setDateFormat:
@@ -1374,7 +1396,7 @@ typedef NS_ENUM(int, SqliteValueType) {
/** Set to a date formatter to use string dates with sqlite instead of the default UNIX timestamps.
- @param format Set to nil to use UNIX timestamps. Defaults to nil. Should be set using a formatter generated using FMDatabase::storeableDateFormat.
+ @param format Set to nil to use UNIX timestamps. Defaults to nil. Should be set using a formatter generated using @c FMDatabase:storeableDateFormat .
@see hasDateFormatter
@see setDateFormat:
@@ -1382,16 +1404,16 @@ typedef NS_ENUM(int, SqliteValueType) {
@see stringFromDate:
@see storeableDateFormat:
- @warning Note there is no direct getter for the `NSDateFormatter`, and you should not use the formatter you pass to FMDB for other purposes, as `NSDateFormatter` is not thread-safe.
+ @warning Note there is no direct getter for the @c NSDateFormatter , and you should not use the formatter you pass to FMDB for other purposes, as @c NSDateFormatter is not thread-safe.
*/
- (void)setDateFormat:(NSDateFormatter * _Nullable)format;
/** Convert the supplied NSString to NSDate, using the current database formatter.
- @param s `NSString` to convert to `NSDate`.
+ @param s @c NSString to convert to @c NSDate .
- @return The `NSDate` object; or `nil` if no formatter is set.
+ @return The @c NSDate object; or @c nil if no formatter is set.
@see hasDateFormatter
@see setDateFormat:
@@ -1404,9 +1426,9 @@ typedef NS_ENUM(int, SqliteValueType) {
/** Convert the supplied NSDate to NSString, using the current database formatter.
- @param date `NSDate` of date to convert to `NSString`.
+ @param date @c NSDate of date to convert to @c NSString .
- @return The `NSString` representation of the date; `nil` if no formatter is set.
+ @return The @c NSString representation of the date; @c nil if no formatter is set.
@see hasDateFormatter
@see setDateFormat:
@@ -1420,15 +1442,15 @@ typedef NS_ENUM(int, SqliteValueType) {
@end
-/** Objective-C wrapper for `sqlite3_stmt`
+/** Objective-C wrapper for @c sqlite3_stmt
- This is a wrapper for a SQLite `sqlite3_stmt`. Generally when using FMDB you will not need to interact directly with `FMStatement`, but rather with `<FMDatabase>` and `<FMResultSet>` only.
+ This is a wrapper for a SQLite @c sqlite3_stmt . Generally when using FMDB you will not need to interact directly with `FMStatement`, but rather with @c FMDatabase and @c FMResultSet only.
- ### See also
+ See also
- - `<FMDatabase>`
- - `<FMResultSet>`
- - [`sqlite3_stmt`](https://sqlite.org/c3ref/stmt.html)
+ - @c FMDatabase
+ - @c FMResultSet
+ - [@c sqlite3_stmt ](https://sqlite.org/c3ref/stmt.html)
*/
@interface FMStatement : NSObject {
@@ -1452,7 +1474,7 @@ typedef NS_ENUM(int, SqliteValueType) {
/** SQLite sqlite3_stmt
- @see [`sqlite3_stmt`](https://sqlite.org/c3ref/stmt.html)
+ @see [@c sqlite3_stmt ](https://sqlite.org/c3ref/stmt.html)
*/
@property (atomic, assign) void *statement;
diff --git a/src/fmdb/FMDatabase.m b/src/fmdb/FMDatabase.m
index 7c1eab6..b03e3a8 100644
--- a/src/fmdb/FMDatabase.m
+++ b/src/fmdb/FMDatabase.m
@@ -33,6 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface FMResultSet ()
- (int)internalStepWithError:(NSError * _Nullable __autoreleasing *)outErr;
++ (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB shouldAutoClose:(BOOL)shouldAutoClose;
@end
diff --git a/src/fmdb/FMDatabaseAdditions.h b/src/fmdb/FMDatabaseAdditions.h
index 2c5467b..0234fc7 100644
--- a/src/fmdb/FMDatabaseAdditions.h
+++ b/src/fmdb/FMDatabaseAdditions.h
@@ -11,11 +11,11 @@
NS_ASSUME_NONNULL_BEGIN
-/** Category of additions for `<FMDatabase>` class.
+/** Category of additions for @c FMDatabase class.
- ### See also
+ See also
- - `<FMDatabase>`
+ - @c FMDatabase
*/
@interface FMDatabase (FMDatabaseAdditions)
@@ -24,24 +24,22 @@ NS_ASSUME_NONNULL_BEGIN
/// @name Return results of SQL to variable
///----------------------------------------
-/** Return `int` value for query
+/** Return @c int value for query
- @param query The SQL query to be performed.
- @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query.
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
- @return `int` value.
+ @return @c int value.
@note This is not available from Swift.
*/
- (int)intForQuery:(NSString*)query, ...;
-/** Return `long` value for query
+/** Return @c long value for query
- @param query The SQL query to be performed.
- @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query.
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
- @return `long` value.
+ @return @c long value.
@note This is not available from Swift.
*/
@@ -50,8 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Return `BOOL` value for query
- @param query The SQL query to be performed.
- @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query.
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
@return `BOOL` value.
@@ -62,8 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Return `double` value for query
- @param query The SQL query to be performed.
- @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query.
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
@return `double` value.
@@ -72,36 +68,33 @@ NS_ASSUME_NONNULL_BEGIN
- (double)doubleForQuery:(NSString*)query, ...;
-/** Return `NSString` value for query
+/** Return @c NSString value for query
- @param query The SQL query to be performed.
- @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query.
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
- @return `NSString` value.
+ @return @c NSString value.
@note This is not available from Swift.
*/
- (NSString * _Nullable)stringForQuery:(NSString*)query, ...;
-/** Return `NSData` value for query
+/** Return @c NSData value for query
- @param query The SQL query to be performed.
- @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query.
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
- @return `NSData` value.
+ @return @c NSData value.
@note This is not available from Swift.
*/
- (NSData * _Nullable)dataForQuery:(NSString*)query, ...;
-/** Return `NSDate` value for query
+/** Return @c NSDate value for query
- @param query The SQL query to be performed.
- @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query.
+ @param query The SQL query to be performed, followed by a list of parameters that will be bound to the `?` placeholders in the SQL query.
- @return `NSDate` value.
+ @return @c NSDate value.
@note This is not available from Swift.
*/
@@ -122,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN
@param tableName The name of the table being looked for.
- @return `YES` if table found; `NO` if not found.
+ @return @c YES if table found; @c NO if not found.
*/
- (BOOL)tableExists:(NSString*)tableName;
@@ -137,7 +130,7 @@ NS_ASSUME_NONNULL_BEGIN
- `rootpage` - The page number of the root b-tree page for tables and indices
- `sql` - The SQL that created the entity
- @return `FMResultSet` of schema; `nil` on error.
+ @return `FMResultSet` of schema; @c nil on error.
@see [SQLite File Format](https://sqlite.org/fileformat.html)
*/
@@ -161,7 +154,7 @@ NS_ASSUME_NONNULL_BEGIN
@param tableName The name of the table for whom the schema will be returned.
- @return `FMResultSet` of schema; `nil` on error.
+ @return `FMResultSet` of schema; @c nil on error.
@see [table_info](https://sqlite.org/pragma.html#pragma_table_info)
*/
@@ -174,7 +167,7 @@ NS_ASSUME_NONNULL_BEGIN
@param tableName The name of the table.
- @return `YES` if column exists in table in question; `NO` otherwise.
+ @return @c YES if column exists in table in question; @c NO otherwise.
*/
- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName;
@@ -185,7 +178,7 @@ NS_ASSUME_NONNULL_BEGIN
@param tableName The name of the table.
- @return `YES` if column exists in table in question; `NO` otherwise.
+ @return @c YES if column exists in table in question; @c NO otherwise.
@see columnExists:inTableWithName:
@@ -201,9 +194,9 @@ NS_ASSUME_NONNULL_BEGIN
@param sql The SQL statement being validated.
- @param error This is a pointer to a `NSError` object that will receive the autoreleased `NSError` object if there was any error. If this is `nil`, no `NSError` result will be returned.
+ @param error This is a pointer to a @c NSError object that will receive the autoreleased @c NSError object if there was any error. If this is @c nil , no @c NSError result will be returned.
- @return `YES` if validation succeeded without incident; `NO` otherwise.
+ @return @c YES if validation succeeded without incident; @c NO otherwise.
*/
diff --git a/src/fmdb/FMDatabasePool.h b/src/fmdb/FMDatabasePool.h
index 4c472be..952fcd9 100755
--- a/src/fmdb/FMDatabasePool.h
+++ b/src/fmdb/FMDatabasePool.h
@@ -12,16 +12,16 @@ NS_ASSUME_NONNULL_BEGIN
@class FMDatabase;
-/** Pool of `<FMDatabase>` objects.
+/** Pool of @c FMDatabase objects.
- ### See also
+ See also
- - `<FMDatabaseQueue>`
- - `<FMDatabase>`
+ - @c FMDatabaseQueue
+ - @c FMDatabase
- @warning Before using `FMDatabasePool`, please consider using `<FMDatabaseQueue>` instead.
+ @warning Before using @c FMDatabasePool , please consider using @c FMDatabaseQueue instead.
- If you really really really know what you're doing and `FMDatabasePool` is what
+ If you really really really know what you're doing and @c FMDatabasePool is what
you really really need (ie, you're using a read only database), OK you can use
it. But just be careful not to deadlock!
@@ -61,16 +61,16 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
+ (instancetype)databasePoolWithPath:(NSString * _Nullable)aPath;
/** Create pool using file URL.
- @param url The file `NSURL` of the database.
+ @param url The file @c NSURL of the database.
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
+ (instancetype)databasePoolWithURL:(NSURL * _Nullable)url;
@@ -80,17 +80,17 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
@param openFlags Flags passed to the openWithFlags method of the database.
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
+ (instancetype)databasePoolWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
/** Create pool using file URL and specified flags
- @param url The file `NSURL` of the database.
+ @param url The file @c NSURL of the database.
@param openFlags Flags passed to the openWithFlags method of the database.
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
+ (instancetype)databasePoolWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
@@ -99,7 +99,7 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
- (instancetype)initWithPath:(NSString * _Nullable)aPath;
@@ -108,7 +108,7 @@ NS_ASSUME_NONNULL_BEGIN
@param url The file `NSURL of the database.
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
- (instancetype)initWithURL:(NSURL * _Nullable)url;
@@ -118,17 +118,17 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
@param openFlags Flags passed to the openWithFlags method of the database
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
- (instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
/** Create pool using file URL and specified flags.
- @param url The file `NSURL` of the database.
+ @param url The file @c NSURL of the database.
@param openFlags Flags passed to the openWithFlags method of the database
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
- (instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
@@ -139,18 +139,18 @@ NS_ASSUME_NONNULL_BEGIN
@param openFlags Flags passed to the openWithFlags method of the database
@param vfsName The name of a custom virtual file system
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
- (instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
/** Create pool using file URL and specified flags.
- @param url The file `NSURL` of the database.
+ @param url The file @c NSURL of the database.
@param openFlags Flags passed to the openWithFlags method of the database
@param vfsName The name of a custom virtual file system
- @return The `FMDatabasePool` object. `nil` on error.
+ @return The @c FMDatabasePool object. @c nil on error.
*/
- (instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
@@ -193,14 +193,14 @@ NS_ASSUME_NONNULL_BEGIN
/** Synchronously perform database operations in pool.
- @param block The code to be run on the `FMDatabasePool` pool.
+ @param block The code to be run on the @c FMDatabasePool pool.
*/
- (void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase *db))block;
/** Synchronously perform database operations in pool using transaction.
- @param block The code to be run on the `FMDatabasePool` pool.
+ @param block The code to be run on the @c FMDatabasePool pool.
@warning Unlike SQLite's `BEGIN TRANSACTION`, this method currently performs
an exclusive transaction, not a deferred transaction. This behavior
@@ -215,32 +215,32 @@ NS_ASSUME_NONNULL_BEGIN
/** Synchronously perform database operations in pool using exclusive transaction.
- @param block The code to be run on the `FMDatabasePool` pool.
+ @param block The code to be run on the @c FMDatabasePool pool.
*/
- (void)inExclusiveTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
/** Synchronously perform database operations in pool using deferred transaction.
- @param block The code to be run on the `FMDatabasePool` pool.
+ @param block The code to be run on the @c FMDatabasePool pool.
*/
- (void)inDeferredTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
/** Synchronously perform database operations on queue, using immediate transactions.
- @param block The code to be run on the queue of `FMDatabaseQueue`
+ @param block The code to be run on the queue of @c FMDatabaseQueue
*/
- (void)inImmediateTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
/** Synchronously perform database operations in pool using save point.
- @param block The code to be run on the `FMDatabasePool` pool.
+ @param block The code to be run on the @c FMDatabasePool pool.
- @return `NSError` object if error; `nil` if successful.
+ @return @c NSError object if error; @c nil if successful.
- @warning You can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. If you need to nest, use `<[FMDatabase startSavePointWithName:error:]>` instead.
+ @warning You can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. If you need to nest, use @c startSavePointWithName:error: instead.
*/
- (NSError * _Nullable)inSavePoint:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
@@ -257,10 +257,10 @@ NS_ASSUME_NONNULL_BEGIN
/** Asks the delegate whether database should be added to the pool.
- @param pool The `FMDatabasePool` object.
- @param database The `FMDatabase` object.
+ @param pool The @c FMDatabasePool object.
+ @param database The @c FMDatabase object.
- @return `YES` if it should add database to pool; `NO` if not.
+ @return @c YES if it should add database to pool; @c NO if not.
*/
@@ -268,8 +268,8 @@ NS_ASSUME_NONNULL_BEGIN
/** Tells the delegate that database was added to the pool.
- @param pool The `FMDatabasePool` object.
- @param database The `FMDatabase` object.
+ @param pool The @c FMDatabasePool object.
+ @param database The @c FMDatabase object.
*/
diff --git a/src/fmdb/FMDatabaseQueue.h b/src/fmdb/FMDatabaseQueue.h
index 27f4012..b3dcf41 100755
--- a/src/fmdb/FMDatabaseQueue.h
+++ b/src/fmdb/FMDatabaseQueue.h
@@ -11,57 +11,63 @@
NS_ASSUME_NONNULL_BEGIN
-/** To perform queries and updates on multiple threads, you'll want to use `FMDatabaseQueue`.
+/** To perform queries and updates on multiple threads, you'll want to use @c FMDatabaseQueue .
- Using a single instance of `<FMDatabase>` from multiple threads at once is a bad idea. It has always been OK to make a `<FMDatabase>` object *per thread*. Just don't share a single instance across threads, and definitely not across multiple threads at the same time.
+ Using a single instance of @c FMDatabase from multiple threads at once is a bad idea. It has always been OK to make a @c FMDatabase object *per thread*. Just don't share a single instance across threads, and definitely not across multiple threads at the same time.
- Instead, use `FMDatabaseQueue`. Here's how to use it:
+ Instead, use @c FMDatabaseQueue . Here's how to use it:
First, make your queue.
- FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath];
+@code
+FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath];
+@endcode
Then use it like so:
- [queue inDatabase:^(FMDatabase *db) {
- [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]];
- [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]];
- [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]];
+@code
+[queue inDatabase:^(FMDatabase *db) {
+ [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]];
+ [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]];
+ [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]];
- FMResultSet *rs = [db executeQuery:@"select * from foo"];
- while ([rs next]) {
- //…
- }
- }];
+ FMResultSet *rs = [db executeQuery:@"select * from foo"];
+ while ([rs next]) {
+ //…
+ }
+}];
+@endcode
An easy way to wrap things up in a transaction can be done like this:
- [queue inTransaction:^(FMDatabase *db, BOOL *rollback) {
- [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]];
- [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]];
- [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]];
+@code
+[queue inTransaction:^(FMDatabase *db, BOOL *rollback) {
+ [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]];
+ [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]];
+ [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]];
- if (whoopsSomethingWrongHappened) {
- *rollback = YES;
- return;
- }
- // etc…
- [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:4]];
- }];
+ // if (whoopsSomethingWrongHappened) {
+ // *rollback = YES;
+ // return;
+ // }
- `FMDatabaseQueue` will run the blocks on a serialized queue (hence the name of the class). So if you call `FMDatabaseQueue`'s methods from multiple threads at the same time, they will be executed in the order they are received. This way queries and updates won't step on each other's toes, and every one is happy.
+ // etc…
+ [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:4]];
+}];
+@endcode
- ### See also
+ @c FMDatabaseQueue will run the blocks on a serialized queue (hence the name of the class). So if you call @c FMDatabaseQueue 's methods from multiple threads at the same time, they will be executed in the order they are received. This way queries and updates won't step on each other's toes, and every one is happy.
- - `<FMDatabase>`
-
- @warning Do not instantiate a single `<FMDatabase>` object and use it across multiple threads. Use `FMDatabaseQueue` instead.
+ @warning Do not instantiate a single @c FMDatabase object and use it across multiple threads. Use @c FMDatabaseQueue instead.
- @warning The calls to `FMDatabaseQueue`'s methods are blocking. So even though you are passing along blocks, they will **not** be run on another thread.
+ @warning The calls to @c FMDatabaseQueue 's methods are blocking. So even though you are passing along blocks, they will **not** be run on another thread.
+
+ @sa FMDatabase
*/
@interface FMDatabaseQueue : NSObject
+
/** Path of database */
@property (atomic, retain, nullable) NSString *path;
@@ -82,16 +88,16 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
+ (nullable instancetype)databaseQueueWithPath:(NSString * _Nullable)aPath;
/** Create queue using file URL.
- @param url The file `NSURL` of the database.
+ @param url The file @c NSURL of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
+ (nullable instancetype)databaseQueueWithURL:(NSURL * _Nullable)url;
@@ -101,16 +107,16 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
@param openFlags Flags passed to the openWithFlags method of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
+ (nullable instancetype)databaseQueueWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
/** Create queue using file URL and specified flags.
- @param url The file `NSURL` of the database.
+ @param url The file @c NSURL of the database.
@param openFlags Flags passed to the openWithFlags method of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
+ (nullable instancetype)databaseQueueWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
@@ -118,7 +124,7 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
- (nullable instancetype)initWithPath:(NSString * _Nullable)aPath;
@@ -127,7 +133,7 @@ NS_ASSUME_NONNULL_BEGIN
@param url The file `NSURL of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
- (nullable instancetype)initWithURL:(NSURL * _Nullable)url;
@@ -137,7 +143,7 @@ NS_ASSUME_NONNULL_BEGIN
@param aPath The file path of the database.
@param openFlags Flags passed to the openWithFlags method of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
- (nullable instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags;
@@ -147,7 +153,7 @@ NS_ASSUME_NONNULL_BEGIN
@param url The file path of the database.
@param openFlags Flags passed to the openWithFlags method of the database.
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
- (nullable instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags;
@@ -158,7 +164,7 @@ NS_ASSUME_NONNULL_BEGIN
@param openFlags Flags passed to the openWithFlags method of the database
@param vfsName The name of a custom virtual file system
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
- (nullable instancetype)initWithPath:(NSString * _Nullable)aPath flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
@@ -169,7 +175,7 @@ NS_ASSUME_NONNULL_BEGIN
@param openFlags Flags passed to the openWithFlags method of the database
@param vfsName The name of a custom virtual file system
- @return The `FMDatabaseQueue` object. `nil` on error.
+ @return The @c FMDatabaseQueue object. @c nil on error.
*/
- (nullable instancetype)initWithURL:(NSURL * _Nullable)url flags:(int)openFlags vfs:(NSString * _Nullable)vfsName;
@@ -197,14 +203,14 @@ NS_ASSUME_NONNULL_BEGIN
/** Synchronously perform database operations on queue.
- @param block The code to be run on the queue of `FMDatabaseQueue`
+ @param block The code to be run on the queue of @c FMDatabaseQueue
*/
- (void)inDatabase:(__attribute__((noescape)) void (^)(FMDatabase *db))block;
/** Synchronously perform database operations on queue, using transactions.
- @param block The code to be run on the queue of `FMDatabaseQueue`
+ @param block The code to be run on the queue of @c FMDatabaseQueue
@warning Unlike SQLite's `BEGIN TRANSACTION`, this method currently performs
an exclusive transaction, not a deferred transaction. This behavior
@@ -220,21 +226,21 @@ NS_ASSUME_NONNULL_BEGIN
/** Synchronously perform database operations on queue, using deferred transactions.
- @param block The code to be run on the queue of `FMDatabaseQueue`
+ @param block The code to be run on the queue of @c FMDatabaseQueue
*/
- (void)inDeferredTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
/** Synchronously perform database operations on queue, using exclusive transactions.
- @param block The code to be run on the queue of `FMDatabaseQueue`
+ @param block The code to be run on the queue of @c FMDatabaseQueue
*/
- (void)inExclusiveTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
/** Synchronously perform database operations on queue, using immediate transactions.
- @param block The code to be run on the queue of `FMDatabaseQueue`
+ @param block The code to be run on the queue of @c FMDatabaseQueue
*/
- (void)inImmediateTransaction:(__attribute__((noescape)) void (^)(FMDatabase *db, BOOL *rollback))block;
@@ -245,7 +251,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Synchronously perform database operations using save point.
- @param block The code to be run on the queue of `FMDatabaseQueue`
+ @param block The code to be run on the queue of @c FMDatabaseQueue
*/
// NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock.
diff --git a/src/fmdb/FMResultSet.h b/src/fmdb/FMResultSet.h
index b48dfd6..bf48e6e 100644
--- a/src/fmdb/FMResultSet.h
+++ b/src/fmdb/FMResultSet.h
@@ -17,11 +17,11 @@ NS_ASSUME_NONNULL_BEGIN
@class FMDatabase;
@class FMStatement;
-/** Represents the results of executing a query on an `<FMDatabase>`.
+/** Represents the results of executing a query on an @c FMDatabase .
- ### See also
+ See also
- - `<FMDatabase>`
+ - @c FMDatabase
*/
@interface FMResultSet : NSObject
@@ -48,17 +48,6 @@ NS_ASSUME_NONNULL_BEGIN
/// @name Creating and closing a result set
///------------------------------------
-/** Create result set from `<FMStatement>`
-
- @param statement A `<FMStatement>` to be performed
-
- @param aDB A `<FMDatabase>` to be used
-
- @return A `FMResultSet` on success; `nil` on failure
- */
-
-+ (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB shouldAutoClose:(BOOL)shouldAutoClose;
-
/** Close result set */
- (void)close;
@@ -71,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
You must always invoke `next` or `nextWithError` before attempting to access the values returned in a query, even if you're only expecting one.
- @return `YES` if row successfully retrieved; `NO` if end of result set reached
+ @return @c YES if row successfully retrieved; @c NO if end of result set reached
@see hasAnotherRow
*/
@@ -117,7 +106,7 @@ NS_ASSUME_NONNULL_BEGIN
@see next
- @warning The `hasAnotherRow` method must follow a call to `<next>`. If the previous database interaction was something other than a call to `next`, then this method may return `NO`, whether there is another row of data or not.
+ @warning The `hasAnotherRow` method must follow a call to `<next>`. If the previous database interaction was something other than a call to `next`, then this method may return @c NO, whether there is another row of data or not.
*/
- (BOOL)hasAnotherRow;
@@ -135,7 +124,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Column index for column name
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return Zero-based index for column.
*/
@@ -146,16 +135,16 @@ NS_ASSUME_NONNULL_BEGIN
@param columnIdx Zero-based index for column.
- @return columnName `NSString` value of the name of the column.
+ @return columnName @c NSString value of the name of the column.
*/
- (NSString * _Nullable)columnNameForIndex:(int)columnIdx;
/** Result set integer value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
- @return `int` value of the result set's column.
+ @return @c int value of the result set's column.
*/
- (int)intForColumn:(NSString*)columnName;
@@ -164,16 +153,16 @@ NS_ASSUME_NONNULL_BEGIN
@param columnIdx Zero-based index for column.
- @return `int` value of the result set's column.
+ @return @c int value of the result set's column.
*/
- (int)intForColumnIndex:(int)columnIdx;
-/** Result set `long` value for column.
+/** Result set @c long value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
- @return `long` value of the result set's column.
+ @return @c long value of the result set's column.
*/
- (long)longForColumn:(NSString*)columnName;
@@ -182,14 +171,14 @@ NS_ASSUME_NONNULL_BEGIN
@param columnIdx Zero-based index for column.
- @return `long` value of the result set's column.
+ @return @c long value of the result set's column.
*/
- (long)longForColumnIndex:(int)columnIdx;
/** Result set `long long int` value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return `long long int` value of the result set's column.
*/
@@ -207,7 +196,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Result set `unsigned long long int` value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return `unsigned long long int` value of the result set's column.
*/
@@ -225,7 +214,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Result set `BOOL` value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return `BOOL` value of the result set's column.
*/
@@ -243,7 +232,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Result set `double` value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return `double` value of the result set's column.
@@ -261,9 +250,9 @@ NS_ASSUME_NONNULL_BEGIN
- (double)doubleForColumnIndex:(int)columnIdx;
-/** Result set `NSString` value for column.
+/** Result set @c NSString value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return String value of the result set's column.
@@ -271,7 +260,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString * _Nullable)stringForColumn:(NSString*)columnName;
-/** Result set `NSString` value for column.
+/** Result set @c NSString value for column.
@param columnIdx Zero-based index for column.
@@ -280,16 +269,16 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString * _Nullable)stringForColumnIndex:(int)columnIdx;
-/** Result set `NSDate` value for column.
+/** Result set @c NSDate value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return Date value of the result set's column.
*/
- (NSDate * _Nullable)dateForColumn:(NSString*)columnName;
-/** Result set `NSDate` value for column.
+/** Result set @c NSDate value for column.
@param columnIdx Zero-based index for column.
@@ -299,11 +288,11 @@ NS_ASSUME_NONNULL_BEGIN
- (NSDate * _Nullable)dateForColumnIndex:(int)columnIdx;
-/** Result set `NSData` value for column.
+/** Result set @c NSData value for column.
This is useful when storing binary data in table (such as image or the like).
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return Data value of the result set's column.
@@ -311,7 +300,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSData * _Nullable)dataForColumn:(NSString*)columnName;
-/** Result set `NSData` value for column.
+/** Result set @c NSData value for column.
@param columnIdx Zero-based index for column.
@@ -322,7 +311,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Result set `(const unsigned char *)` value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return `(const unsigned char *)` value of the result set's column.
*/
@@ -344,7 +333,7 @@ NS_ASSUME_NONNULL_BEGIN
@param columnName Name of the column.
- @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object.
+ @return Either @c NSNumber , @c NSString , @c NSData , or @c NSNull . If the column was @c NULL , this returns `[NSNull null]` object.
@see objectForKeyedSubscript:
*/
@@ -357,7 +346,7 @@ NS_ASSUME_NONNULL_BEGIN
@param columnIdx Zero-based index for column.
- @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object.
+ @return Either @c NSNumber , @c NSString , @c NSData , or @c NSNull . If the column was @c NULL , this returns `[NSNull null]` object.
@see objectAtIndexedSubscript:
*/
@@ -367,20 +356,26 @@ NS_ASSUME_NONNULL_BEGIN
/** Result set object for column.
This method allows the use of the "boxed" syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported:
-
- id result = rs[@"employee_name"];
-
+
+@code
+id result = rs[@"employee_name"];
+@endcode
+
This simplified syntax is equivalent to calling:
- id result = [rs objectForKeyedSubscript:@"employee_name"];
-
+@code
+id result = [rs objectForKeyedSubscript:@"employee_name"];
+@endcode
+
which is, it turns out, equivalent to calling:
- id result = [rs objectForColumnName:@"employee_name"];
+@code
+id result = [rs objectForColumnName:@"employee_name"];
+@endcode
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
- @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object.
+ @return Either @c NSNumber , @c NSString , @c NSData , or @c NSNull . If the column was @c NULL , this returns `[NSNull null]` object.
*/
- (id _Nullable)objectForKeyedSubscript:(NSString *)columnName;
@@ -389,26 +384,32 @@ NS_ASSUME_NONNULL_BEGIN
This method allows the use of the "boxed" syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported:
- id result = rs[0];
+@code
+id result = rs[0];
+@endcode
This simplified syntax is equivalent to calling:
- id result = [rs objectForKeyedSubscript:0];
+@code
+id result = [rs objectForKeyedSubscript:0];
+@endcode
which is, it turns out, equivalent to calling:
- id result = [rs objectForColumnName:0];
+@code
+id result = [rs objectForColumnName:0];
+@endcode
@param columnIdx Zero-based index for column.
- @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object.
+ @return Either @c NSNumber , @c NSString , @c NSData , or @c NSNull . If the column was @c NULL , this returns `[NSNull null]` object.
*/
- (id _Nullable)objectAtIndexedSubscript:(int)columnIdx;
-/** Result set `NSData` value for column.
+/** Result set @c NSData value for column.
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
@return Data value of the result set's column.
@@ -420,7 +421,7 @@ If you don't, you're going to be in a world of hurt when you try and use the dat
- (NSData * _Nullable)dataNoCopyForColumn:(NSString *)columnName NS_RETURNS_NOT_RETAINED;
-/** Result set `NSData` value for column.
+/** Result set @c NSData value for column.
@param columnIdx Zero-based index for column.
@@ -434,20 +435,20 @@ If you don't, you're going to be in a world of hurt when you try and use the dat
- (NSData * _Nullable)dataNoCopyForColumnIndex:(int)columnIdx NS_RETURNS_NOT_RETAINED;
-/** Is the column `NULL`?
+/** Is the column @c NULL ?
@param columnIdx Zero-based index for column.
- @return `YES` if column is `NULL`; `NO` if not `NULL`.
+ @return @c YES if column is @c NULL ; @c NO if not @c NULL .
*/
- (BOOL)columnIndexIsNull:(int)columnIdx;
-/** Is the column `NULL`?
+/** Is the column @c NULL ?
- @param columnName `NSString` value of the name of the column.
+ @param columnName @c NSString value of the name of the column.
- @return `YES` if column is `NULL`; `NO` if not `NULL`.
+ @return @c YES if column is @c NULL ; @c NO if not @c NULL .
*/
- (BOOL)columnIsNull:(NSString*)columnName;