GPKGConnectionPool
Objective-C
@interface GPKGConnectionPool : NSObject
Swift
class GPKGConnectionPool : NSObject
Connection pool to manage retrieving a sqlite3 connection to a database file. Connections should be released after the database operation has completed. Opens connections as needed and keeps a configured amount of connections open for us.
-
Get the number of unused connections to keep open and available for use
Declaration
Objective-C
+ (int)openConnectionsPerPool;Swift
class func openConnectionsPerPool() -> Int32Return Value
open connection per pool
-
Set the number of unused connections to keep open and available for use
Declaration
Objective-C
+ (void)setOpenConnectionsPerPool:(int)connections;Swift
class func setOpenConnectionsPer(_ connections: Int32)Parameters
connectionsopen connection per pool
-
Get the check connections state, when true used connections are checked to see if they are left open for long periods of time or indefinitly
Declaration
Objective-C
+ (BOOL)checkConnections;Swift
class func checkConnections() -> BoolReturn Value
check connections flag
-
Set the check connections state, when true used connections are checked to see if they are left open for long periods of time or indefinitly
Declaration
Objective-C
+ (void)setCheckConnections:(BOOL)check;Swift
class func setCheckConnections(_ check: Bool)Parameters
checkcheck connections flag
-
Get the check connections frequency in seconds as the minimum time to wait before checking for stale open connections
Declaration
Objective-C
+ (int)checkConnectionsFrequency;Swift
class func checkConnectionsFrequency() -> Int32Return Value
check frequency in seconds
-
Set the check connections frequency in seconds as the minimum time to wait before checking for stale open connections
Declaration
Objective-C
+ (void)setCheckConnectionsFrequency:(int)frequency;Swift
class func setCheckConnectionsFrequency(_ frequency: Int32)Parameters
frequencycheck frequency in seconds
-
Get the check connections warning time in seconds as the time an open connection causes warnings for being stale
Declaration
Objective-C
+ (int)checkConnectionsWarningTime;Swift
class func checkConnectionsWarningTime() -> Int32Return Value
warning time in seconds
-
Set the check connections warning time in seconds as the time an open connection causes warnings for being stale
Declaration
Objective-C
+ (void)setCheckConnectionsWarningTime:(int)time;Swift
class func setCheckConnectionsWarningTime(_ time: Int32)Parameters
timewarning time in seconds
-
Get the maintain statck traces state, when check connections is enabled and when true, stack traces are maintained from the thread that checks out a connection
Declaration
Objective-C
+ (BOOL)maintainStackTraces;Swift
class func maintainStackTraces() -> BoolReturn Value
maintain stack traces flag
-
Set the maintain statck traces state, when check connections is enabled and when true, stack traces are maintained from the thread that checks out a connection
Declaration
Objective-C
+ (void)setMaintainStackTraces:(BOOL)maintain;Swift
class func setMaintainStackTraces(_ maintain: Bool)Parameters
maintainmaintain stack traces flag
-
Initialize
Declaration
Objective-C
- (instancetype)initWithDatabaseFilename:(NSString *)filename;Swift
init!(databaseFilename filename: String!)Parameters
filenameGeoPackage filename
Return Value
new connection
-
Close the connection pool, closing all connections
Declaration
Objective-C
- (void)close;Swift
func close() -
Get a connection for single database reads (do not maintain open result sets), such as counts. The connection must be released when done.
Declaration
Objective-C
- (GPKGDbConnection *)connection;Swift
func connection() -> GPKGDbConnection!Return Value
connection
-
Get a connection for database reads that maintain open result sets, such as row queries. The connection must be released when done.
Declaration
Objective-C
- (GPKGDbConnection *)resultConnection;Swift
func resultConnection() -> GPKGDbConnection!Return Value
connection for result sets
-
Get a connection for database updates. The connection must be released when done.
Declaration
Objective-C
- (GPKGDbConnection *)writeConnection;Swift
func writeConnection() -> GPKGDbConnection!Return Value
connection for writing
-
Begin an exclusive transaction on the database
Declaration
Objective-C
- (void)beginTransaction;Swift
func beginTransaction() -
Begin an exclusive transaction on the database, resetting other open connections upon commit
Declaration
Objective-C
- (void)beginResettableTransaction;Swift
func beginResettableTransaction() -
Commit an active transaction
Declaration
Objective-C
- (void)commitTransaction;Swift
func commitTransaction() -
Rollback an active transaction
Declaration
Objective-C
- (void)rollbackTransaction;Swift
func rollbackTransaction() -
Determine if currently within a transaction
Declaration
Objective-C
- (BOOL)inTransaction;Swift
func inTransaction() -> BoolReturn Value
true if in transaction
-
Release a connection, either adding it back to available pool connections or closing it
Declaration
Objective-C
- (BOOL)releaseConnection:(GPKGDbConnection *)connection;Swift
func releaseConnection(_ connection: GPKGDbConnection!) -> BoolParameters
connectionconnection
Return Value
true if released
-
Release a connection by id, either adding it back to available pool connections or closing it
Declaration
Objective-C
- (BOOL)releaseConnectionWithId:(NSNumber *)connectionId;Swift
func releaseConnection(withId connectionId: NSNumber!) -> BoolParameters
connectionIdconnection id
Return Value
true if released
-
Total connection count of open available and used connections
Declaration
Objective-C
- (NSUInteger)connectionCount;Swift
func connectionCount() -> UIntReturn Value
connection count
-
Add a custom function to be created on write connections
Declaration
Objective-C
- (void)addWriteFunction:(GPKGConnectionFunction *)function;Swift
func addWrite(_ function: GPKGConnectionFunction!)Parameters
functionwrite connection function
-
Add a custom function to be created on write connections
Declaration
Objective-C
- (void)addWriteFunctions:(NSArray<GPKGConnectionFunction *> *)functions;Swift
func addWrite(_ functions: [GPKGConnectionFunction]!)Parameters
functionswrite connection functions
-
Execute the statement once on all open connections, waiting for used connections
Declaration
Objective-C
- (void)execAllConnectionStatement:(NSString *)statement;Swift
func execAllConnectionStatement(_ statement: String!)Parameters
statementSQL statement
-
Execute the statement on all open and new connections, waiting for used connections
Declaration
Objective-C
- (void)execPersistentAllConnectionStatement:(NSString *)statement asName:(NSString *)name;Swift
func execPersistentAllConnectionStatement(_ statement: String!, asName name: String!)Parameters
statementSQL statement
nameunique statement key name
-
Remove a persistent statement
Declaration
Objective-C
- (NSString *)removePersistentAllConnectionStatementWithName:(NSString *)name;Swift
func removePersistentAllConnectionStatement(withName name: String!) -> String!Parameters
nameSQL statement key name
Return Value
removed statement or nil if not found
-
Clear all persistent statements
Declaration
Objective-C
- (int)clearPersistentStatements;Swift
func clearPersistentStatements() -> Int32Return Value
removed statement count
View on GitHub
GPKGConnectionPool Class Reference