TIBSQL
V 1.01 2003.11.09.
Content
The TIBSQL a nativ, single users SQL system for Delpi progrms without use BDE. It support a subset of the standard SQL language. ( TIBSQL language ). The TIBSQL not use indexes, load the full tables into memory. The TIBSQL wrote in Delphi4.
If a application use TIBSQL must be two DLL file::
TIBSQL.DLL, BORLANDMM.DLL
The BORLANDMM.DLL is in Borland delphi system, licence is in
delphi sytem too.
TIBSQL LICENSE
This software is freeware. You may use
it for your commercial
software or for your own use. You may not sell these
components
as is or
with some changes.
LIMITED WARRANTY AND DISCLAIMER
No warranties are
given to you. All your possible demands
will be disclaimed.
LIMITATION OF LIABILITY
No liabilities are given to
you. All your possible demands
will be disclaimed.
The TIBSQL wrote in delphi4, tested it in delphi7 too.
Author:: Tibor Fogler RoBIT Bt (http://www.robitbt.hu E-mail: foglert@robitbt.hu)
//TIBSQLError code
const
TIBSQL_OK =
0;
TIBSQL_ValueDbError = 3;
TIBSQL_NoResult =
4;
TIBSQL_TableNotFound = 5;
TIBSQL_OddQuote =
6;
TIBSQL_SQLsyntaxerror = 7;
TIBSQL_OddBracket =
8; l
TIBSQL_UnionError = 9;
// expressin errors
TIBSQL_ExprError =
10;
TIBSQL_ColumnNotFound = 11;
TIBSQL_ZeroDivide =
12;
TIBSQL_OtherExprError = 19;
// Parser
Errors
TIBSQL_ParseError1 = 31;
TIBSQL_ParseError2 =
32;
TIBSQL_ParseError3 = 33;
TIBSQL_ParsesyntaxError = 39;
type
TTIBSQLHandler = Pointer; //
TIBSQL handler
TTIBSQLCursor = Pointer; // TIBSQL
Cursorr
var
//
-----------------------------------------------------------------------------
//
Simple rutins
//
-----------------------------------------------------------------------------
TIBSQLconnect: Function (DBPath, DBname :
String) : TTIBSQLHandler;
TIBSQLDisconnect: Procedure (var DBH :
TTIBSQLHandler);
TIBSQLExecSQL:
Function (DBH : TTIBSQLHandler; SQLstr : String) : TTIBSQLCursor;
TIBSQLgettablenames:
Function (DBH : TTIBSQLHandler) : Tstrings;
//
------------------------------------------------------------------------------
//
Cursor handle rutins
//
------------------------------------------------------------------------------
TIBSQLRecordCount: Function (DBC :
TTIBSQLCursor) : Integer;
TIBSQLColumnCount: Function (DBC : TTIBSQLCursor) :
Integer;
TIBSQLGo: Procedure (DBC : TTIBSQLCursor; RecNo :
Integer);
TIBSQLgetColumnType: Function (DBC : TTIBSQLCursor;
ColumnNo : Integer): String;
TIBSQLgetColumnName: Function (DBC :
TTIBSQLCursor; ColumnNo : Integer): String;
TIBSQLgetColumnSize: Function (DBC : TTIBSQLCursor; ColumnNo
: Integer): Integer;
TIBSQLgetString: Function (DBC : TTIBSQLCursor; ColumnNo :
Integer): String;
TIBSQLgetInteger: Function
(DBC : TTIBSQLCursor; ColumnNo : Integer): Integer;
TIBSQLgetFloat: Function (DBC : TTIBSQLCursor; ColumnNo :
Integer): Double;
TIBSQLgetDate: Function
(DBC : TTIBSQLCursor; ColumnNo : Integer): TDateTime;
TIBSQLgetLogical: Function (DBC : TTIBSQLCursor; ColumnNo :
Integer): Boolean;
TIBSQLCloseCursor:
Procedure (var DBC : TTIBSQLCursor);
//
-----------------------------------------------------------------------
// Error handle
rutins
//
-----------------------------------------------------------------------
TIBSQLgetStatus: Function (DBH :
TTIBSQLHandler) : Integer;
TIBSQLgetErrorInfo: Function (DBH : TTIBSQLHandler) :
String;
Function TIBSQLgetErrormsg :
String; // Error
message in Hungarian
// Dll loading
Procedure TIBSQLLoadDll;
In the application's dpr file, in USES section
then first unit must be the "ShareMem"
Use the TIBSQL::
uses .....TIBSQLDLL,......
1. TIBSQLLoadDll; |
After the TIBSQLExecSQL always must be call the TIBSQLCloseCursor.
Handle the result table:
for i := 0 to TIBSQLRecordCount(TIBSQLCursor) - 1
do |
The INSERT, UPDATE, DELETE SQL statements work in memory, Write into the disk the next FLUSH, COMMIT, END TRANSACTION, START TRANSACTION sql statements, or the call disconnect.
A database is a subdirectory in the "DBPath". (DBPath set in the TIBSQLConnect)
A table is a CSV file in the "DBPath\DBname" directory.
The records are in the files standart delimeted string
The 1. record store the column names,
the 2.
record store the column types,
the 3. record store the data size (in the
memory format),
the
next records store the data.
Open the TIBSQLDLL.DPR in Delphi, and Build it..
Open the TIBSQLDLL_DEMO.DPR in Delphi, and Build it..
Budapest 2003.10.13. Fogler Tibor
www.robitbt.hu
foglert@robitbt.hu