Database
Class Database
| Property | Description
|
| DatabaseName As String | Specifies the name of the database that will be connected. This is typically only used by database servers (not SQLite)
|
| Host As String | Specifies the host address (either a name or IP address) for connecting to a database. This is typically only used by database servers (not SQLite).
|
| Password As String | Specifies the password (if needed) that is used to connect to the database. This is typically only used by database servers (not SQLite)
|
| Username As String | Specifies the user name (if needed) that is used to connect to the database. This is typically only used by database servers (not SQLite)
|
| Method Prototype | Description
|
| Sub Close() | Terminates the connection to the database
|
| Sub Commit() | Ends a transaction and makes any pending changes permanent
|
| Function Connect() As Boolean | Initiates a connection to the database
|
| Function Error() As Boolean | Returns True if an error occurred using either SQLExecute() or SQLSelect()
|
| Function ErrorCode() As Integer | Returns the database-specific error code. Only applicable when Error is True.
|
| Function ErrorMessage() As String | Returns the database-specific description of the error. Only applicable when Error is True.
|
| Function FieldSchema( TableName As String ) As RecordSet | Returns a RecordSet containing the list of all the columns for the specified table.
|
| Function IndexSchema( TableName As String ) As RecordSet | Returns a RecordSet describing indexes in the specified table.
|
| Sub Rollback() | Ends a transaction and discards any pending changes.
|
| Sub SQLExecute( Query As String ) | Executes an SQL command (INSERT, UPDATE, CREATE, etc.)
|
| Function SQLSelect( Query As String ) As RecordSet | Executes and SQL SELECT command. SQL is database-specific.
|
| Function TableSchema() As RecordSet | Returns a RecordSet containing the list of all the tables in the database.
|
The Database class cannot usefully be subclassed by your code. The built-in database subclasses (
MySQLDatabase,
PostgreSQLDatabase,
REALSQLDatabase and
SQLiteDatabase) are used to connect to specific databases.