Gambas Documentation - /comp/gb.db

/comp/gb.db

# gb.db

This component allows you to access several database management systems.

Authors | Benoît Minisini, Nigel Gerrard, Andrea Bortolan, Daniel Vostanikian.

Class | Description
--- | ---
Blob | This object is returned by a Blob field, and is used for reading or writing its contents.
Connection | This class represents a connection to a database.
Connections | This class enumerates all connection that are defined in the IDE under the "Connections" project folder.
Database | This class represents a database.
DatabaseUser | This class represents a user of a database.
DB | This class represents the current connection.
Field | This class represents a table field.
Index | This class represents a table index.
Result | This class represents the result of a SQL request.
ResultField | This class represents one of the fields of a Result object.
SQLRequest |
Table | This class represents the definition of a database table.

This component can access the following database management systems:

- PostgreSQL

- MySQL

- SQLite2

- SQLite3

- ODBC

PostgreSQL and MySQL are client/server databases, which means that the connection is made to a server process.

On the other hand, SQLite is a file or memory based database, so there is no server process to connect to. This means that the user may need to include a fully qualified path to the database file if the default is not satisfactory. See the Connection class for more information. The SQLite driver supports the version 3 of SQLite, and falls back to the version 2 driver if needed. See www.sqlite.org for more information.

This component creates an intermediate layer between the specific server and your program, so that you can use exactly the same code whatever database backend you decide to use.

This works only if:

- You create your database by using the database manager or by using this component.

- You use the Find, Create and Edit methods.

- You don't put SQL values directly in the request, but use the substitution feature of the previous methods.

- You don't use the Exec method, that lets you send SQL request directly to the backend, so that you can access its specific features.

If you don't need database independence, do as you like! :-)

### See also

- How To Open a MySQL connection and use it

- ODBC Component Documentation

- Database Datatype Mapping