gb.db2

Desde 3.20

This component allows you to access several database management systems. 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.

Clase Descripción
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 This class provides a facility to generate a basic SQL request on a single table.
Table This class represents the definition of a database table.

This component can access the following database management systems:
  • PostgreSQL

  • MySQL

  • 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 goal is reached 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! :-)

This component replaces the now deprecated gb.db component.

Its interface is mostly backward-compatible, except for the following:

  1. Support for SQLite 2 has been removed.

  2. The Blob class has been removed. Blob fields are now accessed exactly like string fields.

See also