Unit 'SQLDB' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#fcl]

Reference for unit 'SQLDB'

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

uses

  System,

  sysutils,

  Classes,

  DB,

  

Database access layer.

  BufDataset,

  

Implements a database-aware buffered dataset.

  sqlscript,

  

SQL script support.

  SQLTypes;

  

Types used in various SQL related units.

Overview

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

UsingSQLDB

  

Using SQLDB to access databases.

UniversalConnectors

  

Using the universal TSQLConnector type.

RetrievingSchemaInformation

  

Retrieving Schema Information.

UpdateSQLs

  

Automatic generation of update SQL statements.

UsingParams

  

Using parameters.


Documentation generated on: Nov 26 2024