|
pure virtual |
This method performs the same function as connect() with the added capability of digitally signing the contents of the database on close with the pSignKey.
When the database is openned, its signature is verified to detect unauthorized modifications. It is the caller's responsiblity to manage the signature key, that is the same key must be provided for each access otherwise the signature will not match and an error will be returned.
Not all database implementations support this feature and in this case an eNotSupported error is returned. eNotSupported will also be returned if this method is used to connect to an "in memory" database.
On return of eAborted (a missing signture) or eSignatureMismatch (modified data or signature) the database will not be openned. However, to recover from this situation see the P6DBC_RECOVERBADSIG flag defined above. Note, this should only be done with care, since the database may have been tampered with or corrupted.
pURI | [ in ] The URI defines the underlying database to use. Currently supported URIs include: 'sqlite3://filename', 'sqlite://:memory:', and 'postgresql8://user-name/password/hostname/hostaddr/port/database-name', where "sqlite3" and "postgresql8" are the database 'schemes'. |
signAlg | [ in ] Defines the type of signature algorithm used with pSignKey |
pSignKey | [ in ] A key to sign / verify a digital signature of the database (e.g., SH_SHA1) |
pfn | [ in ] Pointer to a callback function to be invoked once the connection is complete or has failed. If set to NULL, then the call is blocking, otherwise it returns immedately with a "eOk" result and a call to this function will happen sometimes in the future. |
pCtx | [ in ] Can be NULL, pointer to a context that is passed to the pfn callback once the connection result is known. This memory is allocated and freed only by the caller. |
Success | P6R::eOk | |
Failure | P6R::eNoMemory | Insuffficient memory to properly initialize the component |
P6R::eNotInitialized | A call to initialize() has not been made. | |
P6R::eNotFound | The 'scheme' in the pURI parameter does not match to any known database implementation. | |
P6R::eInvalidURI | Invalid URI format, or rest of URI does not match scheme | |
P6R::eNotSupported | The database implementation does not support digital signatures. | |
P6R::eSignatureMismatch | The signature or the data has been modified. | |
P6R::eWrongKeyClass | Signning operations require a symetric key. | |
P6R::eInvalidArg | One of the parameters is NULL. | |
P6R::eSignatureMissing | Signature is missing for existing database. |