Contents Up Previous Next

Database

Database classes overview

Every database object represents an ODBC connection. The connection may be closed and reopened.

database-close
database-create
database-delete
database-error-occurred
database-get-database-name
database-get-data-source
database-get-error-code
database-get-error-message
database-get-error-number
database-is-open
database-open


database-close

long ( database-close long id)

Resets the statement handles of any associated recordset objects, and disconnects from the current data source.


database-create

long ( database-create)

Creates a new ODBC database handle and returns an id. The constructor of the first wxDatabase instance of an application initializes the ODBC manager.


database-delete

long ( database-delete long id)

Destructor. Resets and destroys any associated wxRecordSet instances.

The destructor of the last wxDatabase instance will deinitialize the ODBC manager.


database-error-occurred

long ( database-error-occurred long id)

Returns 1 if the last action caused an error.


database-get-database-name

string ( database-get-database-name long id)

Returns the name of the database associated with the current connection.


database-get-data-source

string ( database-get-data-source long id)

Returns the name of the connected data source.


database-get-error-code

string ( database-get-error-code long id)

Returns the error code of the last ODBC function call. This will be a string containing one of:

SQL_ERROR General error.
SQL_INVALID_HANDLE An invalid handle was passed to an ODBC function.
SQL_NEED_DATA ODBC expected some data.
SQL_NO_DATA_FOUND No data was found by this ODBC call.
SQL_SUCCESS The call was successful.
SQL_SUCCESS_WITH_INFO The call was successful, but further information can be obtained from the ODBC manager.


database-get-error-message

string ( database-get-error-message long id)

Returns the last error message returned by the ODBC manager.


database-get-error-number

long ( database-get-error-number long id)

Returns the last native error. A native error is an ODBC driver dependent error number.


database-is-open

long ( database-is-open long id)

Returns 1 if a connection is open.


database-open

long ( database-open long id string datasource optional long exclusive = 1 optional string readonly = 1 optional string username = "ODBC" optional string password = "")

Connect to a data source. datasource contains the name of the ODBC data source. The parameters exclusive and readonly are not used.