[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'sqldb' (#fcl)

Reference for unit 'sqldb'

A set of classes for connecting to SQL databases and running SQL commands on them.







Database access layer




The SQLDB unit defines four main classes to handle data in SQL based databases.

  1. TSQLConnection represents the connection to the database. Here, properties pertaining to the connection (machine, database, user password) must be set. This is an abstract class, which should not be used directly. Per database type (mysql, firebird, postgres, oracle, sqlite) a descendent should be made and used.
  2. TSQLQuery is a #fcl.db.TDataset descendent which can be used to view and manipulate the result of an SQL select query. It can also be used to execute all kinds of SQL statements.
  3. TSQLTransaction represents the transaction in which an SQL command is running. SQLDB supports multiple simultaneous transactions in a database connection. For databases that do not support this functionality natively, it is simulated by maintaining multiple connections to the database.
  4. TSQLScript can be used when many SQL commands must be executed on a database, for example when creating a database.

There is also a unified way to retrieve schema information, and a registration for connector types. More information on how to use these components can be found in UsingSQLDB.

Related topics



Using SQLDB to access databases



Using the universal TSQLConnector type



Retrieving Schema Information



Automatic generation of update SQL statements



Using parameters

Documentation generated on: Nov 14 2015