From 09e73ac42fe2feb7925d954fed88a2eaa57697f7 Mon Sep 17 00:00:00 2001
From: lpw
Date: Wed, 12 Jun 2024 17:08:18 +0800
Subject: [PATCH] 提交2.9.0

---
 frameworks/FMDB.framework/Headers/FMDatabase.h |  982 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 657 insertions(+), 325 deletions(-)

diff --git a/frameworks/FMDB.framework/Headers/FMDatabase.h b/frameworks/FMDB.framework/Headers/FMDatabase.h
old mode 100755
new mode 100644
index 7dd5f8c..2a4ead2
--- a/frameworks/FMDB.framework/Headers/FMDatabase.h
+++ b/frameworks/FMDB.framework/Headers/FMDatabase.h
@@ -2,6 +2,7 @@
 #import "FMResultSet.h"
 #import "FMDatabasePool.h"
 
+NS_ASSUME_NONNULL_BEGIN
 
 #if ! __has_feature(objc_arc)
     #define FMDBAutorelease(__v) ([__v autorelease]);
@@ -37,59 +38,54 @@
     #define instancetype id
 #endif
 
-
+/**
+ Callback block used by @c executeStatements:withResultBlock:
+ */
 typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary);
 
-
-/** A SQLite ([http://sqlite.org/](http://sqlite.org/)) Objective-C wrapper.
- 
- ### 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.
-
- ### 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](http://sqlite.org/)
- - [FMDB mailing list](http://groups.google.com/group/fmdb)
- - [SQLite FAQ](http://www.sqlite.org/faq.html)
- 
- @warning Do not instantiate a single `FMDatabase` object and use it across multiple threads. Instead, use `<FMDatabaseQueue>`.
-
+/**
+ Enumeration used in checkpoint methods.
  */
+typedef NS_ENUM(int, FMDBCheckpointMode) {
+    FMDBCheckpointModePassive  = 0, // SQLITE_CHECKPOINT_PASSIVE,
+    FMDBCheckpointModeFull     = 1, // SQLITE_CHECKPOINT_FULL,
+    FMDBCheckpointModeRestart  = 2, // SQLITE_CHECKPOINT_RESTART,
+    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.
 
-@interface FMDatabase : NSObject  {
-    
-    void*               _db;
-    NSString*           _databasePath;
-    BOOL                _logsErrors;
-    BOOL                _crashOnErrors;
-    BOOL                _traceExecution;
-    BOOL                _checkedOut;
-    BOOL                _shouldCacheStatements;
-    BOOL                _isExecutingStatement;
-    BOOL                _inTransaction;
-    NSTimeInterval      _maxBusyRetryTimeInterval;
-    NSTimeInterval      _startBusyRetryTime;
-    
-    NSMutableDictionary *_cachedStatements;
-    NSMutableSet        *_openResultSets;
-    NSMutableSet        *_openFunctions;
+ Usage
 
-    NSDateFormatter     *_dateFormat;
-}
+ The three main classes in FMDB are:
+
+ - @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
+
+ - [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 @c FMDatabase  object and use it across multiple threads. Instead, use @c FMDatabaseQueue .
+
+ */
+
+@interface FMDatabase : NSObject
 
 ///-----------------
 /// @name Properties
@@ -113,80 +109,136 @@
 
 /** Dictionary of cached statements */
 
-@property (atomic, retain) NSMutableDictionary *cachedStatements;
+@property (atomic, retain, nullable) NSMutableDictionary *cachedStatements;
 
 ///---------------------
 /// @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: [http://www.sqlite.org/inmemorydb.html](http://www.sqlite.org/inmemorydb.html))
+ (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*)inPath;
++ (instancetype)databaseWithPath:(NSString * _Nullable)inPath;
 
-/** Initialize 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. @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 @c FMDatabase  object if successful; @c nil  if failure.
+ 
+ */
+
++ (instancetype)databaseWithURL:(NSURL * _Nullable)url;
+
+/** Initialize a @c FMDatabase  object.
+ 
+ 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.
 
-    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 alloc] initWithPath:fileURL.path];
+ @endcode
 
- (For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [http://www.sqlite.org/inmemorydb.html](http://www.sqlite.org/inmemorydb.html))
 
- @param inPath Path of database file
+ (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*)inPath;
+- (instancetype)initWithPath:(NSString * _Nullable)path;
 
+/** Initialize a @c FMDatabase  object.
+ 
+ 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. @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 @c NSURL  of database file.
+ 
+ @return @c FMDatabase  object if successful; @c nil  if failure.
+ 
+ */
+
+- (instancetype)initWithURL:(NSURL * _Nullable)url;
 
 ///-----------------------------------
 /// @name Opening and closing database
 ///-----------------------------------
 
+/// Is the database open or not?
+
+@property (nonatomic) BOOL isOpen;
+
 /** Opening a new database connection
  
  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()](http://sqlite.org/c3ref/open.html)
+ @see [sqlite3_open()](https://sqlite.org/c3ref/open.html)
  @see openWithFlags:
  @see close
  */
@@ -195,23 +247,29 @@
 
 /** 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`
- 
- 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.
-  
- @return `YES` if successful, `NO` on error.
+@code
+SQLITE_OPEN_READWRITE
+@endcode
 
- @see [sqlite3_open_v2()](http://sqlite.org/c3ref/open.html)
+ 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.
+  
+ @return @c YES if successful, @c NO on error.
+
+ @see [sqlite3_open_v2()](https://sqlite.org/c3ref/open.html)
  @see open
  @see close
  */
@@ -220,36 +278,42 @@
 
 /** 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()](http://sqlite.org/c3ref/open.html)
+ @see [sqlite3_open_v2()](https://sqlite.org/c3ref/open.html)
  @see open
  @see close
  */
 
-- (BOOL)openWithFlags:(int)flags vfs:(NSString *)vfsName;
+- (BOOL)openWithFlags:(int)flags vfs:(NSString * _Nullable)vfsName;
 
 /** Closing a database connection
  
- @return `YES` if success, `NO` on error.
+ @return @c YES if success, @c NO on error.
  
- @see [sqlite3_close()](http://sqlite.org/c3ref/close.html)
+ @see [sqlite3_close()](https://sqlite.org/c3ref/close.html)
  @see open
  @see openWithFlags:
  */
@@ -261,12 +325,13 @@
  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.
  */
 
-- (BOOL)goodConnection;
+@property (nonatomic, readonly) BOOL goodConnection;
 
 
 ///----------------------
@@ -275,25 +340,23 @@
 
 /** 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`](http://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](http://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. 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 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 ... 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
  @see lastErrorMessage
- @see [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html)
+ @see [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html)
  */
 
-- (BOOL)executeUpdate:(NSString*)sql withErrorAndBindings:(NSError**)outErr, ...;
+- (BOOL)executeUpdate:(NSString*)sql withErrorAndBindings:(NSError * _Nullable __autoreleasing *)outErr, ...;
 
 /** Execute single update statement
  
@@ -302,41 +365,37 @@
  @warning **Deprecated**: Please use `<executeUpdate:withErrorAndBindings>` instead.
  */
 
-- (BOOL)update:(NSString*)sql withErrorAndBindings:(NSError**)outErr, ... __attribute__ ((deprecated));
+- (BOOL)update:(NSString*)sql withErrorAndBindings:(NSError * _Nullable __autoreleasing *)outErr, ...  __deprecated_msg("Use executeUpdate:withErrorAndBindings: instead");;
 
 /** 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`](http://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](http://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`](http://sqlite.org/c3ref/bind_blob.html)
+ @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 If you want to use this from Swift, please note that you must include `FMDatabaseVariadic.swift` in your project. Without that, you cannot use this method directly, and instead have to use methods such as `<executeUpdate:withArgumentsInArray:>`.
+ @note You cannot use this method from Swift due to incompatibilities between Swift and Objective-C variadic implementations. Consider using `<executeUpdate:values:>` instead.
  */
 
 - (BOOL)executeUpdate:(NSString*)sql, ...;
 
 /** 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`](http://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](http://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.
+ 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 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 optional 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 `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
@@ -345,28 +404,32 @@
  
  @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`](http://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](http://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
@@ -378,23 +441,25 @@
 
 /** 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`](http://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](http://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 2, this throws errors, as if it were defined as follows:
+ In Swift, this throws errors, as if it were defined as follows:
  
- `func executeUpdate(sql: String!, values: [AnyObject]!) 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
@@ -402,19 +467,19 @@
  
  */
 
-- (BOOL)executeUpdate:(NSString*)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error;
+- (BOOL)executeUpdate:(NSString*)sql values:(NSArray * _Nullable)values error:(NSError * _Nullable __autoreleasing *)error;
 
 /** 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`](http://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](http://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
@@ -426,15 +491,15 @@
 
 /** 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`](http://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](http://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
@@ -445,14 +510,14 @@
 
 /** 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()](http://sqlite.org/c3ref/exec.html)
+ @see [sqlite3_exec()](https://sqlite.org/c3ref/exec.html)
 
  */
 
@@ -464,45 +529,45 @@
 
  @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()](http://sqlite.org/c3ref/exec.html)
+ @see [sqlite3_exec()](https://sqlite.org/c3ref/exec.html)
 
  */
 
-- (BOOL)executeStatements:(NSString *)sql withResultBlock:(FMDBExecuteStatementsCallbackBlock)block;
+- (BOOL)executeStatements:(NSString *)sql withResultBlock:(__attribute__((noescape)) FMDBExecuteStatementsCallbackBlock _Nullable)block;
 
 /** Last insert rowid
  
  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.
  
- @see [sqlite3_last_insert_rowid()](http://sqlite.org/c3ref/last_insert_rowid.html)
+ @see [sqlite3_last_insert_rowid()](https://sqlite.org/c3ref/last_insert_rowid.html)
 
  */
 
-- (int64_t)lastInsertRowId;
+@property (nonatomic, readonly) int64_t lastInsertRowId;
 
 /** 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.
  
- @see [sqlite3_changes()](http://sqlite.org/c3ref/changes.html)
+ @see [sqlite3_changes()](https://sqlite.org/c3ref/changes.html)
  
  */
 
-- (int)changes;
+@property (nonatomic, readonly) int changes;
 
 
 ///-------------------------
@@ -511,38 +576,34 @@
 
 /** 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`](http://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.
+ 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 sql The SELECT statement to be performed, with optional `?` placeholders.
+ @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.).
 
- @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 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]>)
- @see [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html)
+ @see [`sqlite3_bind`](https://sqlite.org/c3ref/bind_blob.html)
  
- @note If you want to use this from Swift, please note that you must include `FMDatabaseVariadic.swift` in your project. Without that, you cannot use this method directly, and instead have to use methods such as `<executeQuery:withArgumentsInArray:>`.
+ @note You cannot use this method from Swift due to incompatibilities between Swift and Objective-C variadic implementations. Consider using `<executeQuery:values:>` instead.
  */
 
-- (FMResultSet *)executeQuery:(NSString*)sql, ...;
+- (FMResultSet * _Nullable)executeQuery:(NSString*)sql, ...;
 
 /** 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
@@ -550,56 +611,60 @@
 
  @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=%@`.
  
  */
 
-- (FMResultSet *)executeQueryWithFormat:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
+- (FMResultSet * _Nullable)executeQueryWithFormat:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
 
 /** 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
  @see [`FMResultSet next`](<[FMResultSet next]>)
  */
 
-- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments;
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments;
 
 /** 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 2, this throws errors, as if it were defined as follows:
+ In Swift, this throws errors, as if it were defined as follows:
  
- `func executeQuery(sql: String!, values: [AnyObject]!) throws  -> FMResultSet!`
+ `func executeQuery(sql: String, values: [Any]?) throws  -> FMResultSet!`
 
  @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]>)
@@ -608,29 +673,35 @@
 
  */
 
-- (FMResultSet *)executeQuery:(NSString *)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error;
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql values:(NSArray * _Nullable)values error:(NSError * _Nullable __autoreleasing *)error;
 
 /** 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]>)
  */
 
-- (FMResultSet *)executeQuery:(NSString *)sql withParameterDictionary:(NSDictionary *)arguments;
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withParameterDictionary:(NSDictionary * _Nullable)arguments;
 
 
 // Documentation forthcoming.
-- (FMResultSet *)executeQuery:(NSString*)sql withVAList: (va_list)args;
+- (FMResultSet * _Nullable)executeQuery:(NSString *)sql withVAList:(va_list)args;
+
+/// Prepare SQL statement.
+///
+/// @param sql SQL statement to prepare, generally with `?` placeholders.
+
+- (FMResultSet *)prepare:(NSString *)sql;
 
 ///-------------------
 /// @name Transactions
@@ -638,38 +709,71 @@
 
 /** 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
  @see beginDeferredTransaction
- @see inTransaction
+ @see isInTransaction
+ 
+ @warning    Unlike SQLite's `BEGIN TRANSACTION`, this method currently performs
+             an exclusive transaction, not a deferred transaction. This behavior
+             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 @c beginExclusiveTransaction, instead, not
+             only to make your intent explicit, but also to future-proof your code.
+
  */
 
 - (BOOL)beginTransaction;
 
 /** 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
  @see beginTransaction
- @see inTransaction
+ @see isInTransaction
  */
 
 - (BOOL)beginDeferredTransaction;
+
+/** Begin an immediate transaction
+ 
+ @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
+ @see beginTransaction
+ @see isInTransaction
+ */
+
+- (BOOL)beginImmediateTransaction;
+
+/** Begin an exclusive transaction
+ 
+ @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
+ @see beginTransaction
+ @see isInTransaction
+ */
+
+- (BOOL)beginExclusiveTransaction;
 
 /** Commit a transaction
 
  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
  @see rollback
- @see inTransaction
+ @see isInTransaction
  */
 
 - (BOOL)commit;
@@ -678,27 +782,27 @@
 
  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
  @see commit
- @see inTransaction
+ @see isInTransaction
  */
 
 - (BOOL)rollback;
 
 /** Identify whether currently in a transaction or not
- 
- @return `YES` if currently within transaction; `NO` if not.
- 
+  
  @see beginTransaction
  @see beginDeferredTransaction
  @see commit
  @see rollback
  */
 
-- (BOOL)inTransaction;
+@property (nonatomic, readonly) BOOL isInTransaction;
+
+- (BOOL)inTransaction __deprecated_msg("Use isInTransaction property instead");
 
 
 ///----------------------------------------
@@ -715,25 +819,25 @@
 
 /** 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.
  */
 
-- (BOOL)hasOpenResultSets;
+@property (nonatomic, readonly) BOOL hasOpenResultSets;
 
-/** Return whether should cache statements or not
+/** Whether should cache statements or not
+  */
+
+@property (nonatomic) BOOL shouldCacheStatements;
+
+/** Interupt pending database operation
  
- @return `YES` if should cache statements; `NO` if not.
- */
-
-- (BOOL)shouldCacheStatements;
-
-/** Set whether should cache statements or not
+ This method causes any pending database operation to abort and return at its earliest opportunity
  
- @param value `YES` if should cache statements; `NO` if not.
+ @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.
+ 
  */
 
-- (void)setShouldCacheStatements:(BOOL)value;
-
+- (BOOL)interrupt;
 
 ///-------------------------
 /// @name Encryption methods
@@ -743,7 +847,7 @@
  
  @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/
  
@@ -756,7 +860,7 @@
 
  @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/
 
@@ -767,9 +871,9 @@
 
 /** 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/
  
@@ -780,9 +884,9 @@
 
 /** 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/
 
@@ -796,21 +900,23 @@
 /// @name General inquiry methods
 ///------------------------------
 
-/** The path of the database file
- 
- @return path of database.
- 
+/** The path of the database file.
  */
 
-- (NSString *)databasePath;
+@property (nonatomic, readonly, nullable) NSString *databasePath;
 
-/** The underlying SQLite handle 
+/** The file URL of the database file.
+ */
+
+@property (nonatomic, readonly, nullable) NSURL *databaseURL;
+
+/** The underlying SQLite handle .
  
  @return The `sqlite3` pointer.
  
  */
 
-- (void*)sqliteHandle;
+@property (nonatomic, readonly) void *sqliteHandle;
 
 
 ///-----------------------------
@@ -821,9 +927,9 @@
  
  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()](http://sqlite.org/c3ref/errcode.html)
+ @see [sqlite3_errmsg()](https://sqlite.org/c3ref/errcode.html)
  @see lastErrorCode
  @see lastError
  
@@ -834,20 +940,36 @@
 /** Last error code
  
  Returns the numeric result code or extended result code for 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 Integer value of the last error code.
-
- @see [sqlite3_errcode()](http://sqlite.org/c3ref/errcode.html)
+ 
+ @see [sqlite3_errcode()](https://sqlite.org/c3ref/errcode.html)
  @see lastErrorMessage
  @see lastError
-
+ 
  */
 
 - (int)lastErrorCode;
 
+/** Last extended error code
+ 
+ Returns the numeric extended result code for 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 Integer value of the last extended error code.
+ 
+ @see [sqlite3_errcode()](https://sqlite.org/c3ref/errcode.html)
+ @see [2. Primary Result Codes versus Extended Result Codes](https://sqlite.org/rescode.html#primary_result_codes_versus_extended_result_codes)
+ @see [5. Extended Result Code List](https://sqlite.org/rescode.html#extrc)
+ @see lastErrorMessage
+ @see lastError
+ 
+ */
+
+- (int)lastExtendedErrorCode;
+
 /** 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
@@ -859,19 +981,18 @@
 
 /** Last error
 
- @return `NSError` representing the last error.
+ @return @c NSError  representing the last error.
  
  @see lastErrorCode
  @see lastErrorMessage
  
  */
 
-- (NSError*)lastError;
+- (NSError *)lastError;
 
 
 // description forthcoming
-- (void)setMaxBusyRetryTimeInterval:(NSTimeInterval)timeoutInSeconds;
-- (NSTimeInterval)maxBusyRetryTimeInterval;
+@property (nonatomic) NSTimeInterval maxBusyRetryTimeInterval;
 
 
 ///------------------
@@ -882,50 +1003,50 @@
  
  @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:
  */
 
-- (BOOL)startSavePointWithName:(NSString*)name error:(NSError**)outErr;
+- (BOOL)startSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr;
 
 /** Release 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 rollbackToSavePointWithName:error:
  
  */
 
-- (BOOL)releaseSavePointWithName:(NSString*)name error:(NSError**)outErr;
+- (BOOL)releaseSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr;
 
 /** 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:
  
  */
 
-- (BOOL)rollbackToSavePointWithName:(NSString*)name error:(NSError**)outErr;
+- (BOOL)rollbackToSavePointWithName:(NSString*)name error:(NSError * _Nullable __autoreleasing *)outErr;
 
 /** Start save point
 
  @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:
@@ -933,7 +1054,40 @@
  
  */
 
-- (NSError*)inSavePoint:(void (^)(BOOL *rollback))block;
+- (NSError * _Nullable)inSavePoint:(__attribute__((noescape)) void (^)(BOOL *rollback))block;
+
+
+///-----------------
+/// @name Checkpoint
+///-----------------
+
+/** Performs a WAL checkpoint
+ 
+ @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 @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;
+
+/** 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.
+ @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;
 
 ///----------------------------
 /// @name SQLite library status
@@ -941,27 +1095,63 @@
 
 /** 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()](http://sqlite.org/c3ref/threadsafe.html)
+ @see [sqlite3_threadsafe()](https://sqlite.org/c3ref/threadsafe.html)
  */
 
 + (BOOL)isSQLiteThreadSafe;
+
+/** Examine/set limits
+
+ @param type The type of limit. See https://sqlite.org/c3ref/c_limit_attached.html
+ @param newLimit The new limit value. Use -1 if you don't want to change the limit, but rather only want to check it.
+
+ @return Regardless, returns previous value.
+
+ @see [sqlite3_limit()](https://sqlite.org/c3ref/limit.html)
+*/
+
+- (int)limitFor:(int)type value:(int)newLimit;
 
 /** Run-time library version numbers
  
  @return The sqlite library version string.
  
- @see [sqlite3_libversion()](http://sqlite.org/c3ref/libversion.html)
+ @see [sqlite3_libversion()](https://sqlite.org/c3ref/libversion.html)
  */
 
 + (NSString*)sqliteLibVersion;
 
+/// The FMDB version number as a string in the form of @c "2.7.8" .
+///
+/// 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;
 
-+ (SInt32)FMDBVersion;
+/** The FMDB version
 
+ 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 @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., @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 __deprecated_msg("Use FMDBUserVersion instead");
 
 ///------------------------
 /// @name Make SQL function
@@ -970,65 +1160,206 @@
 /** Adds SQL functions or aggregates or to redefine the behavior of existing SQL functions or aggregates.
  
  For example:
- 
-    [queue inDatabase:^(FMDatabase *adb) {
 
-        [adb executeUpdate:@"create table ftest (foo text)"];
-        [adb executeUpdate:@"insert into ftest values ('hello')"];
-        [adb executeUpdate:@"insert into ftest values ('hi')"];
-        [adb executeUpdate:@"insert into ftest values ('not h!')"];
-        [adb executeUpdate:@"insert into ftest values ('definitely not h!')"];
+@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];
+}];
 
-        [adb makeFunctionNamed:@"StringStartsWithH" maximumArguments:1 withBlock:^(sqlite3_context *context, int aargc, sqlite3_value **aargv) {
-            if (sqlite3_value_type(aargv[0]) == SQLITE_TEXT) {
-                @autoreleasepool {
-                    const char *c = (const char *)sqlite3_value_text(aargv[0]);
-                    NSString *s = [NSString stringWithUTF8String:c];
-                    sqlite3_result_int(context, [s hasPrefix:@"h"]);
-                }
-            }
-            else {
-                NSLog(@"Unknown formart for StringStartsWithH (%d) %s:%d", sqlite3_value_type(aargv[0]), __FUNCTION__, __LINE__);
-                sqlite3_result_null(context);
-            }
-        }];
+FMResultSet *rs = [db executeQuery:@"SELECT * FROM employees WHERE RemoveDiacritics(first_name) LIKE 'jose'"];
+NSAssert(rs, @"Error %@", [db lastErrorMessage]);
+@endcode
 
-        int rowCount = 0;
-        FMResultSet *ars = [adb executeQuery:@"select * from ftest where StringStartsWithH(foo)"];
-        while ([ars next]) {
-            rowCount++;
-            NSLog(@"Does %@ start with 'h'?", [rs stringForColumnIndex:0]);
-        }
-        FMDBQuickCheck(rowCount == 2);
-    }];
+ @param name Name of function.
 
- @param name Name of function
+ @param arguments Maximum number of parameters.
 
- @param count Maximum number of parameters
+ @param block The block of code for the function.
 
- @param block The block of code for the function
-
- @see [sqlite3_create_function()](http://sqlite.org/c3ref/create_function.html)
+ @see [sqlite3_create_function()](https://sqlite.org/c3ref/create_function.html)
  */
 
-- (void)makeFunctionNamed:(NSString*)name maximumArguments:(int)count withBlock:(void (^)(void *context, int argc, void **argv))block;
+- (void)makeFunctionNamed:(NSString *)name arguments:(int)arguments block:(void (^)(void *context, int argc, void * _Nonnull * _Nonnull argv))block;
 
+- (void)makeFunctionNamed:(NSString *)name maximumArguments:(int)count withBlock:(void (^)(void *context, int argc, void * _Nonnull * _Nonnull argv))block __deprecated_msg("Use makeFunctionNamed:arguments:block:");
+
+- (SqliteValueType)valueType:(void *)argv;
+
+/**
+ Get integer value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The integer value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (int)valueInt:(void *)value;
+
+/**
+ Get long value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The long value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (long long)valueLong:(void *)value;
+
+/**
+ Get double value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The double value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (double)valueDouble:(void *)value;
+
+/**
+ Get @c NSData  value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The data object.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (NSData * _Nullable)valueData:(void *)value;
+
+/**
+ Get string value of parameter in custom function.
+ 
+ @param value The argument whose value to return.
+ @return The string value.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (NSString * _Nullable)valueString:(void *)value;
+
+/**
+ Return null value from custom function.
+ 
+ @param context The context to which the null value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultNullInContext:(void *)context NS_SWIFT_NAME(resultNull(context:));
+
+/**
+ Return integer value from custom function.
+ 
+ @param value The integer value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultInt:(int) value context:(void *)context;
+
+/**
+ Return long value from custom function.
+ 
+ @param value The long value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultLong:(long long)value context:(void *)context;
+
+/**
+ Return double value from custom function.
+ 
+ @param value The double value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultDouble:(double)value context:(void *)context;
+
+/**
+ Return @c NSData  object from custom function.
+ 
+ @param data The @c NSData  object to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultData:(NSData *)data context:(void *)context;
+
+/**
+ Return string value from custom function.
+ 
+ @param value The string value to be returned.
+ @param context The context to which the value will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultString:(NSString *)value context:(void *)context;
+
+/**
+ Return error string from custom function.
+ 
+ @param error The error string to be returned.
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultError:(NSString *)error context:(void *)context;
+
+/**
+ Return error code from custom function.
+ 
+ @param errorCode The integer error code to be returned.
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultErrorCode:(int)errorCode context:(void *)context;
+
+/**
+ Report memory error in custom function.
+ 
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultErrorNoMemoryInContext:(void *)context NS_SWIFT_NAME(resultErrorNoMemory(context:));
+
+/**
+ Report that string or BLOB is too long to represent in custom function.
+ 
+ @param context The context to which the error will be returned.
+ 
+ @see makeFunctionNamed:arguments:block:
+ */
+- (void)resultErrorTooBigInContext:(void *)context NS_SWIFT_NAME(resultErrorTooBig(context:));
 
 ///---------------------
 /// @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:
@@ -1036,7 +1367,7 @@
  @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.
 
  */
 
@@ -1044,7 +1375,7 @@
 
 /** 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:
@@ -1057,7 +1388,7 @@
 
 /** 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:
@@ -1065,16 +1396,16 @@
  @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 *)format;
+- (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:
@@ -1083,13 +1414,13 @@
  @see storeableDateFormat:
  */
 
-- (NSDate *)dateFromString:(NSString *)s;
+- (NSDate * _Nullable)dateFromString:(NSString *)s;
 
 /** 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:
@@ -1098,20 +1429,20 @@
  @see storeableDateFormat:
  */
 
-- (NSString *)stringFromDate:(NSDate *)date;
+- (NSString * _Nullable)stringFromDate:(NSDate *)date;
 
 @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`](http://www.sqlite.org/c3ref/stmt.html)
+ - @c FMDatabase 
+ - @c FMResultSet
+ - [@c sqlite3_stmt ](https://sqlite.org/c3ref/stmt.html)
  */
 
 @interface FMStatement : NSObject {
@@ -1135,7 +1466,7 @@
 
 /** SQLite sqlite3_stmt
  
- @see [`sqlite3_stmt`](http://www.sqlite.org/c3ref/stmt.html)
+ @see [@c sqlite3_stmt ](https://sqlite.org/c3ref/stmt.html)
  */
 
 @property (atomic, assign) void *statement;
@@ -1160,3 +1491,4 @@
 
 #pragma clang diagnostic pop
 
+NS_ASSUME_NONNULL_END

--
Gitblit v1.8.0