By Gregor Markowski

Freeware 17 Dec 2009

In category

DB-Aware Components > Direct DB Access > MS SQL


The suite of eight data-aware components:
  • TSQLCE_Database
  • TSQL_Database
  • TSQL_Dataset
  • TSQL_UpdateSQL
  • TSQL_Query
  • TSQL_StoredProc
  • TSQL_Function
  • TSQL_CreateAlterDrop
for direct access of Microsoft SQL Server (2008, 2005 and 2000 and Compact Editions 3.x) databases. The only thing You need is client library installed on the computer (sqlncli10, sqlncli or sqlsrv32, but Native Client library is recommended for SQL Servers 2000 as well) or Compact Edition Servers 3.x if You want to access *.sdf files. The components are largely based on my own non-standard ideas and I have created these components with minimum programming code (all DCUs weigh ONLY 395KB). Wherever the original Borland code was not optimal I have overridden it, but generally I’ve tried to take the maximum advantage of Borland code.

You will be amazed at the potentiality and efficiency of MSSQL DAC components that set a new standard, unattainable for other components being usually heavy, overgrown and complicated. TSQL_Dataset is the only dataset component that besides simplest (and slowest together) static data access method, supports dynamic data access and partial (growing) records fetching (IN MANY CASES EVEN HUNDREDS TIME FASTER THEN STATIC METHOD; see Readme.txt and Readme_comparision.txt for more details).

TSQLCE_Database is a component for access of Microsoft SQL Servers Compact Edition ver 3.x; important properties:

  • ClientDriver: (cdAutoDetect, cdSqlSrvCe__3_5, cdSqlSrvCe__3_0);
    • the best way is to install both versions (3.1 and 3.5) and to use the default cdAutoDetect value, because TSQLCE_Database will choose for You the proper driver to connect to the database
  • ConnectOptions: a set of three options
    • coCreateIfNotExists
    • coCreateEncrypted
    • coOpenExclusive
  • for customizing the behavior of TSQLCE_Database during establishing connection to the database

At design time TSQL_Database detects all running MS SQL Servers very fast and let You choose server and instance name from the drop down list of ServerName property.

TSQL_StoredProc :

  • implemented all MS SQL Server procedure features i.e. output parameters and multiple rowsets
  • returned rowsets (if any) can be accessed (at run-time only) by public property
    • Rowsets[RowsetNo] : TSQL_Dataset
    • published property FreeRowsetOn_CDS_read: applied when a Rowset is used as data supplier for ClientDataSet - if set to True (default) then all stored records are released from memory after ClientDataSet has finished getting records from the rowset
  • preparing and unpreparing is performed automatically
    • the only thing You need to do is to assign parameter values and call ExecProc method

Here are some features of the most important component, i.e. TSQL_Dataset:
  • the fastest SQL Server data access (when Unidirectional = True, also as replacement for all dbExpress drivers; when used as data supplier for ClientDataSet, TSQL_Dataset automatically sets Unidirectional to True and allocates 0 bytes for fetched records)
  • one component for all recordsets, ReadOnly and not ReadOnly i.e. physical Tables
    • You can also select from Table-valued functions, for example: SELECT * FROM aTable_ValuedFunction(:par_1,:par_2,:par_3,:par_N)
    • public property TableValuedFunction lets You choose required function from the dropped down list at designtime
  • published property SQLStatement is divided into four sections: SELECT...FROM... , WHERE , GROUP BY , ORDER BY
  • statements based on one table with joined other recordsets ARE TREATED AS TABLES i.e. NOT READONLY DATASETS
  • three strategies for accessing of data:
    • daStaticAccess (nonTable Datasets are always accessed in this manner) - all fields of fetched records are stored in memory; this is the conventional and the slowest method of data access)
    • daDynamicAccess - purely record identifying fields are stored in memory (if there is no primary/unique key / Identity field for the table then it is marked as ReadOnly)
    • daPartialFetch - all fields are stored in memory but records are fetched and appended in progressive manner during each call of one of search method (i.e. Locate, LocateNearest, FindKey, FindNearest) so You have the guarantee that searched records are fetched
  • each table based TSQL_Dataset, immediately after it is opened, returns the real RecordCount in the rowset and can be browsed from bottom without any time delay
  • ingenious algorithms for FASTEST exact and nearest record locating
  • MasterSourceFields are defined regardless of IndexFieldNames, it means You can sort detail Dataset as You want without loosing link to MasterSource
    • in dsInsert state, TSQL_Dataset assigns for You MasterFields values to appropriate LinkedFields automatically
    • You can use Borland Field Link Designer at design-time to set relationship between master-detail fields
  • allowed multiple reference for same parameter (listed only once in Params property), for example: SELECT * FROM dbo.PERSONS WHERE (:BirthPlace_ID = 0 OR BIRTHPLACE_ID = :BirthPlace_ID) AND (:BirthDate = 0 OR BIRTHDATE >= :BirthDate)
  • records are stored with minimum allocation of memory (each null field value takes just one bit of memory and string fields occupy only actual length)
  • all field types are fully supported
    • decimal fields up to size 38.x (stored in packed format with minimum memory allocation as well)
    • each SQL_VARIANT fields is created as TmVariantField (a little bit improved TVariantField descendant) and handled (read and write) as native SQL type, for example even if field value is set AsString = '2001-01-01 12:34:56' it wil be stored as SQL_DATETIME
  • when performing Delete, UpdateStatus returns usDeleted and after deletion succeded DataEvent(deUpdateRecord, 0) is sent before Resync is called, so at this moment deleted Record is still in the Buffer retuned by ActiveBuffer
  • and much more; see Readme.txt for more information
  • see History.txt for changes
  • try DEMO-exe to feel the power of MSSQL DAC


  • Status: Trial (work while IDE is running)
  • Source: FNC
  • Size: 1115260 - 1134008kB


  • Delphi 2006 (Win32)
  • Delphi 2007 (VCL)
  • Delphi 6
  • Delphi 7