comp • gb.db • connection

Connection (gb.db)

This class represents a connection to a database.

To connect to a database, create a connection object, fill the needed properties, and call the Open method.

This class inherits _Connection.
This class is
Creates a new connection object.
creatable
.

Properties

Methods
Returns the charset used by the database.
Charset  
Return the list of collations available in the database
Collations  
Returns a collection of all databases managed by the database server.
Databases  
Returns the code of the last error raised by the database driver.
Error  
Return the handle of the connection.
Handle  
Returns or sets the host where the database server resides.
Host  
Return or set if the database charset should be ignored.
IgnoreCharset  
Return the value of the last serial field used in an INSERT statement.
LastInsertId  
Returns or sets the user used for establishing the connection.
Login  
Returns or sets the name of the database you want to connect to.
Name  
Returns if the connection is opened.
Opened  
Returns or sets the password used for establishing the connection.
Password  
Returns or sets the TCP/IP port used for establishing the connection.
Port  
Returns a SQLRequest object on that connection.
SQL  
Returns a virtual collection used for managing the tables of the database.
Tables  
Return or set the connection timeout in seconds.
Timeout  
Represents the type of the database server you want to connect to.
Type  
A synonymous for the Login property.
User  
Returns a collection of all users registered in the database server.
Users  
Returns the version of the database that the driver has connected to.
Version  
Apply a template to the connection, i.e. replicate the database structure described by the template string into the current database.
ApplyTemplate  
Start a transaction.
Begin  
Close the connection.
Close  
Commit a transaction.
Commit  
Return a copy of the connection object.
Copy  
Returns a read/write Result object used for creating records in the specified table.
Create  
Removes records from a database table.
Delete  
Returns a read/write Result object used for editing records in the specified table.
Edit  
Executes an arbitrary SQL request, and returns a read-only Result containing the result of the request.
Exec  
Returns a read-only Result object used for querying records in the specified table.
Find  
Format some blob data into a quoted string that can be inserted into a SQL query.
FormatBlob  
Return the structure of the database as a template string.
GetTemplate  
Limits the number of records returned by the next query.
Limit  
Opens a connection to the specified database.
Open  
Returns a quoted identifier so that you can freely insert it into a query.
Quote  
Cancel a transaction.
Rollback  
Creates a SQL sentence by substituting its arguments into a format string.
Subst  

SQLite connections

For SQLite connections, the following algorithm is used:

  • If Name is null, then a memory database is opened.

  • If Name is an absolute path, then this path is used.

  • If Name is a relative path, then:

    • If Host is null, then the database is located in the application temporary directory. See Temp$() for more information.

    • Otherwise, Host gives the database directory, and the database path is the result of concatenating Host and Name.

ODBC connections

For ODBC connections, the following algorithm is used:

  • If Host are defined and also Login, it will connect using it as DSN name.

  • If Host has semicolons at least one, it will assume the property holds a ConnStr.

  • If Host has no semicolons, it will connect using it as DSN name.

    • Otherwise, it will use the ConnStr in .Host to call ODBC SQLDriverConnect function.

See also