GPKGDbConnection

Objective-C

@interface GPKGDbConnection : NSObject

Swift

class GPKGDbConnection : NSObject

Single database connection to a database file opened as part of a connection pool. Wraps a sqlite3 connection.

  • Upon release of a writable connection, other open connections should be reset

    Declaration

    Objective-C

    @property (nonatomic) BOOL resettable;

    Swift

    var resettable: Bool { get set }
  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithConnection:(GPKGSqliteConnection *)connection
                         andReleasable:(BOOL)releasable;

    Swift

    init!(connection: GPKGSqliteConnection!, andReleasable releasable: Bool)

    Parameters

    connection

    sql connection

    releasable

    true if a releasable version of the connection

    Return Value

    db connection

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithConnection:(GPKGSqliteConnection *)connection
                         andReleasable:(BOOL)releasable
                    andWriteReleasable:(BOOL)writeReleasable;

    Swift

    init!(connection: GPKGSqliteConnection!, andReleasable releasable: Bool, andWriteReleasable writeReleasable: Bool)

    Parameters

    connection

    sql connection

    releasable

    true if a releasable version of the connection

    writeReleasable

    true if writable lock is releasable, regardless of it releasable

    Return Value

    db connection

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithDbConnection:(GPKGDbConnection *)connection
                           andReleasable:(BOOL)releasable;

    Swift

    init!(dbConnection connection: GPKGDbConnection!, andReleasable releasable: Bool)

    Parameters

    connection

    db connection

    releasable

    true if a releasable version of the connection

    Return Value

    db connection

  • Initialize

    Declaration

    Objective-C

    - (instancetype)initWithDbConnection:(GPKGDbConnection *)connection
                           andReleasable:(BOOL)releasable
                      andWriteReleasable:(BOOL)writeReleasable;

    Swift

    init!(dbConnection connection: GPKGDbConnection!, andReleasable releasable: Bool, andWriteReleasable writeReleasable: Bool)

    Parameters

    connection

    db connection

    releasable

    true if a releasable version of the connection

    writeReleasable

    true if writable lock is releasable, regardless of it releasable

    Return Value

    db connection

  • Get the connection id

    Declaration

    Objective-C

    - (NSNumber *)connectionId;

    Swift

    func connectionId() -> NSNumber!

    Return Value

    connection id

  • Get the connection

    Declaration

    Objective-C

    - (sqlite3 *)connection;

    Swift

    func connection() -> OpaquePointer!

    Return Value

    connection

  • Release the connection back to the connection pool. If not releasable, does nothing.

    Declaration

    Objective-C

    - (void)releaseConnection;

    Swift

    func releaseConnection()
  • Get the stack trace of when the owning thread checked out the connection.

    Declaration

    Objective-C

    - (NSArray *)stackTrace;

    Swift

    func stackTrace() -> [Any]!

    Return Value

    stack trace, nil when not checked out or not maintaining stack traces

  • Get the date this connection was checked out

    Declaration

    Objective-C

    - (NSDate *)dateCheckedOut;

    Swift

    func dateCheckedOut() -> Date!

    Return Value

    date of checkout, nil if not checked out

    • Determine if this connection is releasable. An instance of a connection is releasable when it is the instance first retrieved for an operation, and not a reference to an active result or write connection. *
    • - returns: true if releasable

    Declaration

    Objective-C

    - (BOOL)isReleasable;

    Swift

    func isReleasable() -> Bool
  • Determine if write access is releasable. This is always true when also releasable. This may be true when not releasable if another connection has the releasable lock but this connection has the write lock.

    Declaration

    Objective-C

    - (BOOL)isWriteReleasable;

    Swift

    func isWriteReleasable() -> Bool

    Return Value

    true if write releasable