    26  

    Borland Database Engine 

     Borland Database Engine (BDE)     
  (DLL  Dynamic Link Library),   
      Delphi. BDE    
Delphi,        Borland (, 
Paradox  Windows, Visual dBASE, Borland C++ Builder  .),   
    BDE  IDAPI (Independent Database 
Application Programming Interface     
  ).   Borland  IDAPI   
   ,    ODBC  
Microsoft      . 
        BDE   
   Delphi,    
  BDE  ,      .  Delphi 
       ,    
 BDE.   ,    ,   
  BDE      . 
          ,  BDE?    
    ,    
    Delphi.  ,   
,      ,     
   BDE       
   Delphi. 
        BDE     . -,  
         
 Delphi VCL,       
  BDE     . -,  
   Delphi      
-,       
.          
 Refresh,           
  DataSet. 
        BDE       
    ,   VCL Delphi,     
 Delphi.      BDE,   
   BDE,       
Delphi     BDE. 

       BDE  ODBC 

        BDE  ODBC,  , 
,   BDE       
,    ODBC.  ODBC   
   ,    ,    
.     ODBC  , 
   ,        
  API ODBC;   

    496  IV.    

          ,  ,  , 
   ODBC   . 
     BDE    .  ,   SQL Link 
     ,    
        Delphi. , SQL-  
    ,   
      ,     
  .    SQL,   
  ,    ,   
     .     
 SQL        
 ,  API BDE   DbiBeginTran,    
 .            
 BDE     .   
API    Delphi BeginTransaction  TDatabase,  
    ,      SQL. 
 ,      ,   
 ,        . , ,  
  ODBC       
, BDE    API    . 

     

     BDE    .  ,   
      .     
    (,     
  dBASE,  dBASE III, IV, V, FoxPro  Clipper). 
        BDE,   
,         Delphi. 
    1.	      Delphi. 
    2.	  BDE. 
    3.	BDE       SQL Links. 
    4.	   ,       . 
      , ..    SQL Links,   
 ,    . 
    BDE  - .  ,    
   .     ,  
  BDE   ,       
  BDE  ODBC.     , 
    -      
   BDE. 
    BDE    /.  ,    
     ,   
   :  ,  ,  
  ..      / 
 "  "  BDE   
  (API),     
  .   BDE   API   
,         .  
         / 
         , 
  ,      . 

       

         BDE    , 
      .   
       .  
       
  . 

     26. Borland Database Engine 497 

       

    BDE       .  BDE 
    ,      
     . 

      

        BDE     
.     ,    
    BDE    .   
  ,       
 . 

      

     ,        
,  BDE     . 
          
     .    
  BDE        
  ,     . 

      BLOB 

             (binary large 
objects  BLOB)  BDE   .   
       . 
 ,      BLOB,   
BDE         . 
        ,     
   . 

     

     BDE   ,    
,    dBASE  Paradox.   Borland   
    . 

      

      BDE      
 ,      .  
     (Query By Example  QBE)   
SQL-       . ,  
    dBASE    SQL,   
        SQL. 

     SQL 

      , BDE      
       QBE,    
   Paradox,      
 SQL.   QBE-  SQL-  BDE 
     SQL. 

     Restructure 

         Restructure   
    dBASE  Paradox,     
.  , ,     
,      . 

    498	 IV.    

       

     BDE         . 
     BDE       
    .      
     . 

       

    BDE          
.      TBatchMove   
  Delphi  Data Pump. 

        

         /, BDE   
      .     
   ,        . 

      

    BDE      ,   
       VCL Delphi   
   .     
        ,   
  .       
   . 

      SQL 

      SQL  BDE    -.    
       SQL   
     ,      
,       BLOB. 

      

       ,  ,     
BDE.         ,  
   . 

      

      BDE      
    .      
,     .. 

       

       BDE    BDE  
 .       
,       BDE  
 . 

       BDE 

       (API  Application Programming Interface) 
BDE          
    (ISAM),     (SQL)  . 
       API,     
. ,          

     26. Borland Database Engine 499 

      SQL     ,  
Delphi         , 
  .          ,  
   .   ,   ,    
 dBASE  Paradox    , BDE   
        API,    ,  
   . 
       API BDE      
,      ,   . 
,      dBASE   Clipper, 
  Paradox   ,      
    /,    . 

      

      ,     BDE  ODBC,  
   . 
    Q	    . 
    Q	       BDE. 
    	    (,   ). 
           , , 
      . 

      BDE 

      ,   BDE,    
 ,   .     
. 26.1. 

     26.1.    BDE 

    				 

BATTblDesc                      	    
CANHdr                             	    
CBPROGRESSDesc       			       
RESTcbDesc                    	      
CFGDesc                          	  
CLlENTinfo                        	  - 
CRTblDesc                        	   
CURProps                          	   
DBDesc                                 
DBlEnumFld                       	   
DBlEnv                                BDE 
DBlErrinf					    
DBIQryProgress     			   
DRVType                           	  
FlLEDesc                              
FlLTERlnfo                     	  
FLDDesc             			  
FLDType               			   

    500	 IV.    

     . 26.1. 	 
    FMLDesc		 
    FMTBcd	-  
    FMTDate	  
    FMTNumber	  
    FMTTime	  
    DbiFUNCArgDesc		     
    DbiFUNCDesc		    
    IDXDesc		 
    IDXType		  
    LDDesc		  
    LOCKDesc		 
    RECProps		  
    RINTDesc		  
    SECDesc		 
    SESInfo		   
    SPDesc		  
    SPParamDesc		   
    SYSConfig		  
    SYSInfo		  BDE 
    SYSVersion		  BDE 
    TBLBaseDesc		    
    TblExtDesc		    
    TBLFullDesc		    
    TBLType		  
    USERDesc		 
    VCHKDesc		  
    Xlnfo		 

      ,  BDE   ,   . 26.2. 
    
     26.2. ,   BDE 
    
    
    		 
    hDBICur	hDBIObj	  
    hDBIDb	hDBIObj	   
    hDBIObj	UINT32	 	 
    hDBIQry	hDBIObj	  
    hDBISes	hDBIObj	  
    hDBIStmt	hDBIObj	  	 

     26. Borland Database Engine 501 

     . 26.2. 

    		 

    hDBIXact	UINT32	  
    hDBIXlt	hDBIObj	  
    phDBICfg	^hDBICfg	    
    phDBICur	1	    
    phDBIDb	"hDBIDb	     
    phDBIObj	^hDBIObj	     
    phDBIQry	AhDBIQry	    
    phDBISes	^hDBISes	    
    Phdbistmt	~hdbistmt	    
    phDBIXact	AhDBIXact	    
    phDBIXlt	"hDBIXlt	    

          hDBlDb  hDBlCur. 
 hDBiob     ,   hDBICur 
   .     DBHandle  
Handle  TDBDataSet  TBDEDataSet. 

           

      ,       
  ,     BDE,    
    Delphi.     ,  
       .     
     Delphi.    , 
    BDE,     . 
    1.      BDE. 
    2.     . 
    3.      . 
    4.      . 
    5.      . 
    6.        . 
    7.     . 
    8.       . 
    9.        . 
    10.  ,    . 
    11.     . 
    12.   . 
     26.1  ,      . 
         BDE, 
   ,     Object Pascal,     
  OnClick  Button. 

502  IV.    


     26.1.      , 
   Object Pascal     OnClick 
    
    
    { {           { {          
Copyright () 1996 Borland International {	****} } } } } } 
    {	**** ) 
      Object Pascal --  . } unit BDETEMP; 
    interface 
    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
StdCtrls, ToolWin, ComCtrls, BDE; 
    type 
    TForml = class(TForm) 
    Buttonl: TButton; 
    procedure ButtonlClick(Sender: TObject); private 
    { Private declarations } public 
    { Public declarations } end; 
    var 
    Forml: TForml; 
    implementation {$R *.DFM} 
    procedure TForml.ButtonlClick(Sender: TObject); var 
    hDb :  hDBIDb;	//   . 
    hCur : hDBICur;	//   . 
    szTblName : String; 
    szTblType : String; 
    CursorProps : CURProps;	//  . 
    pRecBuf : pByte;	//    . 
    EmpNo : Integer; 
    isBlank : BOOL; function Chk(ErrorValue : DBIResult) : DBIResult; 
    var 
    dbi_status : String; 
    dbi_string : String; 
    Errlnfo  : DBIErrlnfo; 
    count : Integer; begin 
    dbi_status:=''; 
    dbi_string:=''; 
    if (ErrorValue <> DBIERR_NONE) then begin DbiGetErrorInfo(TRUE, Errlnfo); 
    if (Errlnfo.iError = ErrorValue) then begin dbi_status:='  ERROR '+Errlnfo.szErrCode; 
    With Errlnfo do 

     26. Borland Database Engine 503 

    for count:=low(szContext) to high(szContext) do 
    if (strcomp(Errlnfo.szContext[count], '') <> 0) then 
    dbi_status :=  dbi_status+'    '+Errlnfo.szContext[count] end else begin 
    SetLength(dbi_string, DBIMAXMSGLEN); DbiGetErrorString(ErrorValue, 
PChar(dbi_string)); dbi_status := '  ERROR '+dbi_string; end; MessageBox(0, PChar(dbi_status), 
    'BDE Error', MB_OK or MB_ICONEXCLAMATION); end; 
    result:=ErrorValue; end; begin 
    hDB := nil; 
    hCur := nil; 
    ShowMessage('Initialize the engine.'); 
    Chk(DbiInit (nil));	//  1. 
    ShowMessage('Set up the debug layer.'); 
    DbiDebugLayerOptions(DEBUGON or OUTPUTTOFILE or FLUSHEVERYOP, 
'TRACE.TXT');	//  2. 
    ShowMessage('Open a database.'); 
    Chk(DbiOpenDatabase(        //  3. 
    nil,	//    (). nil -  STANDARD. 
    nil,	//  . nil -  STANDARD. 
    dbiREADWRITE,	// ,    . 
    dbiOPENSHARED,	//    . 
    nil,	// .   STANDARD  . 
    ,	//   . 
    nil,	//   . 
    nil,	//   . 
    hDb));	//   . 
    ShowMessage('Set the work directory.'); Chk(DbiSetDirectory(        // 
 4. 
    hDb,	//   . 
    'D:\Program Files\Borland\Delphi 3\Demos\Data')); 
    //   . 
    ShowMessage('Set the temporary directory.'); Chk(DbiSetPrivateDir(       
//  5. 
    'D:\WINDOWS\TEMP'));    //     . 
    szTblName:='EMPLOYEE'; 
    szTblType:=szPARADOX; 
    ShowMessage('Create a cursor by opening a table.'); 
    Chk(DbiOpenTable(	//  6. 
    hDb,	//   .     *' 
    PChar(szTblName),       //   . 
    PChar(szTblType),      //   (   ). 
    nil,	//   (). 
    nil,	//    (   dBASE). 
    ,	//   (0 - ). 
    dbiREADWRITE,	// ,    . 
    dbiOPENSHARED,	//    . 
    xltFIELD,	//   ( , xltFIELD). 
    FALSE,	//    . 
    nil,	//  . 
    hCur));	//  . 
    ShowMessage('Retrieve the	table''s properties.'); 
    ChkfDbiGetCursorProps(	//  7. 
    hCur,	//  . 

    504  IV.    

    CursorProps));         //   . 
    ShowMessage('Allocate a record buffer area.'); GetMem(pRecBuf, 
CursorProps.iRecBufSize * 
    sizeOf(BYTE));         //  8. if (pRecBuf = nil) then 
    ShowMessage('Error allocating buffer.') else begin 
    ShowMessage('Set cursor to the crack before the first record.'); 
Chk(DbiSetToBegin(hCur)); //  9. 
    //     //  . 
    ShowMessage('Retrieve the	record from the cursor.'); 
    Chk(DbiGetNextRecordf	//  10. 
    hCur,	//  . 
    dbiNOLOCK,	//  . 
    pRecBuf,	//     . 
    nil));	//  ,  
    //  .   	//   . 
    ShowMessage('Retrieve the	field from the record.'); 
    Chk(DbiGetField(	//  11. 
    hCur,	//  . 
    1,	//  . 
    pRecBuf,	// ,    . 
    @EmpNo,	// ,   . 
    isBlank)) ;	// , ,    . 
    ShowMessage('The retrieved field value is '+ 
    IntToStr(EmpNo)+'.'); end; 
    ShowMessage('Free  all  allocation.'); if   (pRecBuf  <>  nil)   then	//   
   12. 
    FreeMem(pRecBuf);	//            , if   
(hCur <> nil)     then 
    Chk(DbiCloseCursor(hCur));//      . DbiExit;	//  
  BDE. end; end.                                                
                                                     * 
     ,       OnClick 
  Delphi.          
  ,   .      
EMPLOYEE,    C:\Program Files\Borland\Delphi 3\Demos\Data, 
        . 
         BDE   Uses.  BDE 
        BDE.    
   Uses  ,     
  BDE. 
        Delphi    
        API BDE,   
        ,    
 . 

      BDE   Delphi 

        BDE   
,           
   Delphi,     
    BDE.    
    LiveQuery,     
27, "   ".    BDE 
DBiQExecDirect       BeforeOpen  
 .  26.2     LiveQuery. 

     26. Borland Database Engine	505 

     26.2.  LiveQuery,   BDE   DBiQExecDirect 

    unit Liveqry; interface 
    uses 
    SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, 
Forms, Dialogs, Db, DBTables, BDE; 
    const 
    DEFAULTCREATEVIEWSQL = 'CREATE VIEW %s AS '; DEFAULTDROPVIEWSQL = 'DROP 
VIEW %s'; DEFAULTTABLENAMEFORMAT = 'TV%s'; 
    type 
    TLiveQuery = class (TTable) private 
    { Private declarations } 
    FCreateViewSQL : String; 
    FDropViewSQL : String; 
    FTableNameFormat : TFileName; 
    FSQL : TStrings; 
    procedure SetQuery(Value: TStrings); protected 
    { Protected declarations } 
    procedure CreateTemporaryView; 
    procedure DropTemporaryView; 
    procedure DoBeforeOpen; override; 
    procedure DoAfterClose; override; public 
    { Public declarations } 
    constructor Create(AOwner: TComponent); override; 
    destructor Destroy; override; published 
    { Published declarations } 
    property CreateViewSQL : String read FCreateViewSQL write FCreateViewSQL; 
    property DropViewSQL : String read  FDropViewSQL write FDropViewSQL; 
    property SQL : TStrings read FSQL write SetQuery; 
    property TableNameFormat : 
    TFileName read FTableNameFormat write FTableNameFormat; end; 
    procedure Register; implementation 
    constructor TLiveQuery.Create(AOwner: TComponent); begin 
    inherited Create(AOwner); 
    FSQL := TStringList.Create; 
    FCreateViewSQL := DEFAULTCREATEVIEWSQL; 
    FDropViewSQL := DEFAULTDROPVIEWSQL; 
    FTableNameFormat := DEFAULTTABLENAMEFORMAT; end; 
    destructor TLiveQuery.Destroy; begin 
    if Active then begin Close; 
    DropTemporaryView; end; 
    SQL.Free; 
    inherited Destroy; end; 

    506	 IV.    

    procedure TLiveQuery.SetQuery(Value: TStrings); begin 
    ChecklnActive; 
    SQL.Assign(Value); end; 
    procedure TLiveQuery.CreateTemporaryView; var 
    TemporaryDB : TDatabase; WorkSQL : TStrings; begin 
    WorkSQL := TStringList.Create; WorkSQL.AddStrings(SQL); 
    TableName:=Format(TableNameFormat, [FormatDateTime('yymmddhhnnss',Now)]); 
WorkSQL.Insert(0,Format(CreateViewSQL, [TableName])); 
TemporaryDB:=Session.OpenDatabase(DatabaseName); if (TemporaryDBOnil) then try 
    if (TemporaryDB.IsSQLBased) then begin 
    if (DbiQExecDirect(TemporaryDB.Handle, qrylangSQL, 
    PChar(WorkSQL.Text),nil)<>DBIERR_NONE) then 
    raise EDatabaseError.Create('Error creating temporary view'); end else 
    raise EDatabaseError.Create('Cannot use this component with local tables'! finally 
    Session.CloseDatabase(TemporaryDB) ; WorkSQL.Free; end; end; 
    procedure TLiveQuery.DoBeforeOpen; begin 
    inherited DoBeforeOpen; 
    CreateTemporaryView; end; 
    procedure TLiveQuery.DropTemporaryView; var 
    TemporaryDB : TDatabase; WorkSQL : TStrings; begin 
    WorkSQL:=TStringList.Create; 
    WorkSQL.Add(Format(DropViewSQL, [TableName])); 
TemporaryDB:=Session.OpenDatabase(DatabaseName); if (TemporaryDBOnil) then 
begin try 
    if (TemporaryDB.IsSQLBased) then begin if 
(DbiQExecDirect(TemporaryDB.Handle,qrylangSQL, 
PChar(WorkSQL.Text),nil)<>DBIERR_NONE) then 
    raise EDatabaseError.Create('Error dropping temporary view'); end else 
    raise EDatabaseError.Create('Cannot use this component with local tables') finally 
    Session.CloseDatabase(TemporaryDB); WorkSQL.Free; end; end; end; 
    procedure TLiveQuery.DoAfterClose; begin 
    DropTemporaryView; 
    inherited DoAfterClose; end; 

     26. Borland Database Engine 507 

    procedure  Register;	I 
    begin	I 
    RegisterComponents('Data	Access',    [TLiveQuery]);                        
                                                                       I 
    end;	I 
    end.	I 

         DBiExecDirect.    
 - 1 pa SQL WorkSQL   .   
   Table - J     
.    LiveQuery   - 1  Query,  
      ExecSQL,       . 
   1     DBiExecDirect.    
SQL    | hDBIDb,       
 WorkSQL.	1 
             SQL Server,  
  -;/  LiveQuery     
     DBHandle  .  SQL 
Server    ,     
 ,        
    LiveQuery. Database. Handle    DBiExecDirect. 
       ,     DBiQExecDirect  
  PChar. -	j ,    PChar   Pascal  
   char   *     C++.	j 
       Delphi 2.0,     Pascal   
  C/C++  	:   .    Pascal 
   , , 	j ,   , 
    ,     ,   -	j 
    .	| 

        

      BDE       
    , ..    
 ,     Delphi   BDE. 
    ,    -   >  
      
, -  BDE. 
            DbiGetProp.  . 26.3  

     26.3.   ,     DbiGetProp 

                                                                                     

InterBase                                      gds_db_handle                                         4 
Sybase                                         DBPROCESS NEAR *                             2 
Oracle                                           LDA                                                           64 
ODBC Socket                              HDBC                                                         4 


           
,         
  Sybase. 

    type 
    DBPROCESS = Pointer; 
    var 
    Forml:  TForml; DBProc: DBPROCESS; SizeDBProc: Word; 

    508	 IV.    

 
    function dbname(DBProc: DBPROCESS) : PChar; external 'LIBSYBDB'; 
    implementation ($R *.DFM} 
    procedure TForml.ButtonlClick(Sender: TObject); begin 
    DbiGetProp(hDBiObj(Tablel.DBHandle),dbNATIVEHNDL, DBProc, SizeOf(DBProc), SizeDBProc); 
    Editl.Text:=dbname(DBProc); end; 

         dbname,     
  LIBSYBDB.       
DBPROCESS  .      
 DbiGetProp   dbNATIVEHNDL. 

          

           
   ,          
   ,     ,   
    .       
,       , 
 ,     ..     BDE    
 DbiOpenFunctionList.    ,   
   .      
     DbiGetNextRecord.  
26.326.5    Delphi,    
 DbiOpenFunctionList        
,   ,   .   
     BDE,      
    . 

     26.3.     FuncEx   BDE DbiOpenFunctionList 

    program FUNCEX; 
    uses Forms, FUNCEXOO in 'FUNCEXOO.PAS ' {Forml}; 
    ($R *.RES} 
    begin 
    Application.Initialize; 
    Application.CreateForm(TForml, Forml); 
    Application.Run; end. 
     26.4.    FuncExOO. PAS  
 FuncEx 
    unit FUNCEXOO; interface 
    uses 
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
StdCtrls, DBTables, BDE; 
    type 
    TForml = class(TForm) Labell: TLabel; Label2: TLabel; 

     26. Borland Database Engine 509 

    Label3: TLabel; 
    ComboBoxl: TComboBox; 
    ListBoxl: TListBox; 
    ListBox2: TListBox; 
    Databasel: TDatabase; 
    procedure FormCreate(Sender: TObject); 
    procedure ComboBoxlChange(Sender: TObject); private 
    { Private declarations } public 
    { Public declarations } end; 
    var 
    Forml: TForml; 
    implementation {$R *.DFM) 
    procedure TForml.FormCreate(Sender: TObject); begin 
    Session.GetDatabaseNames(Comboboxl.Items); 
    Comboboxl.Itemlndex:=0; end; 
    procedure TForml.ComboBoxlChange(Sender: TObject); function Chk(ErrorValue 
: DBIResult) : DBIResult; var 
    dbi_status : String; 
    dbi_string : String; 
    Errlnfo  : DBIErrlnfo; 
    count : Integer; begin 
    dbi_status:=''; 
    dbi_string:=''; 
    if (ErrorValue <> DBIERR_NONE) then begin DbiGetErrorInfo(TRUE, Errlnfo); 
    if (Errlnfo.iError = ErrorValue) then begin dbi_status:='  ERROR '+Errlnfo.szErrCode; 
    With Errlnfo do 
    for count:=low(szContext) to high(szContext) do 
    if (strcomp(Errlnfo.szContext[count], '') <> 0) then 
    dbi_status :=  dbi_status+'    '+Errlnfo.szContext[count]; end else begin 
    SetLength(dbi_string, DBIMAXMSGLEN); DbiGetErrorString(ErrorValue, 
PChar(dbi_string)); dbi_status := '  ERROR '+dbi_string; end; MessageBox (0, PChar(dbi_status), 
    'BDE Error',~MB_OK or MB_ICONEXCLAMATION); end; 
    result:=ErrorValue; end; var 
    hCur : hDBiCur; Funclnfo : DBiFUNCDESC; Counter : integer; begin 
    With Databasel do begin Connected:=False; ListBox2.Items.Clear; DatabaseName:=ComboBoxl.Items[ComboBoxl.Itemlndex]; 

    510	 IV.    

    Open; 
    Session.GetTableNames(DatabaseName,'',False,False, ListBoxl.Items); end; 
    Counter:=0; 
    if (Chk(DbiOpenFunctionList(Databasel.Handle, fnListINCL_USER_DEF, @hCur)) 
= DBIERR_NONE) then begin if (hCurOnil) then begin 
    while (DBiGetNextRecord(hCur,dbinolock,SFundnfo, nil)<>DBIERR_EOF) and 
(Counter<50) do begin 
    ListBox2.Items.Add(Funclnfo.szName); Inc(Counter); end; 
    DbiCloseCursor(hCur); ListBox2.Sorted:=True; 
    end else ShowMessage('Error opening cursor'); end; end; 
    end. 

     26.5.   (DFM)  FuncExOO. PAS  
 FuncEx 

    object Forml: TForml Left = 200 Top = 108 Width = 434 Height = 321 Caption 
= 'Forml' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height 
= -11 Font.Name = 'MS Sans Serif Font.Style = [] OnCreate = FormCreate 
PixelsPerlnch = 96 TextHeight = 13 object Labell: TLabel 
    Left = 33 
    Top = 0 
    Width = 36 
    Height = 13 
    Caption = 'Aliases:' end object Label2: TLabel 
    Left = 32 
    Top =40 
    Width = 35 
    Height = 13 
    Caption = 'Tables:' end object Label3: TLabel 
    Left = 216 
    Top =40 
    Width = 98 
    Height = 13 
    Caption = 'Supported functions:' end object ComboBoxl: TComboBox 
    Left = 32 
    Top = 14 
    Width = 177 
    Height = 21 
    Style = csDropDownList 
    ItemHeight = 13 

     26. Borland Database Engine	511 

    Aliases- _____________                                          

Suppcrted functions: 
    CALL	UPPER 
    EMPLOYEE 
    LEASE 
    PROPERTY 
    TENANT 
    WODETAIL 
    WORDER 
    WORKTYPE 

    Puc. 26.1.          FuncEx 

    TabOrder = 1 
    OnChange = ComboBoxlChange end object ListBoxl: TListBox 
    Left = 32 
    Top = 56 
    Width = 177 
    Height = 209 
    ItemHeight = 13 
    TabOrder = 0 end object ListBox2: TListBox 
    Left = 216 
    Top =56 
    Width = 177 
    Height = 209 
    ItemHeight = 13 
    TabOrder = 2 end object Databasel: TDatabase 
    DatabaseName = 'DBDEMOS' 
    SessionName = 'Default' 
    Left = 384 
    Top = 8 end end 

     . 26.1   FuncEx  . 

      

     BDE    dBASE,   
         
  Delphi.     
   ,    dBASE.    
           . 
       BDE      
     dBASE  DBF.    
 dBASE,    (     
)      .     
   -        
 ,         .  
     ,     
 .         
  BDE DbiExtractKey     
.           
.    ,    
 : 

    procedure  TForml.ButtonlClick(Sender:   TObject); var 
    IndexDesc   :   IDXDesc; KeyString   :   String; begin 
    With Tablel  do begin 
    if not Active  then Open; 
    Addlndex('EXPEVAL',Editl.Text,[ixExpression]); 
    Close; 
    IndexName:='EXPEVAL'; 
    Open; 
    DbiGetlndexDesc(Tablel.Handle,0,IndexDesc); 
    SetLength(KeyString,IndexDesc.iKeyLen); 
    DbiExtractKey(Tablel.Handle,nil,PChar(KeyString)); 
    Edit2.Text:=KeyString; 
    Close; 

    512  IV.    

    Deletelndex('EXPEVAL'); IndexName:='DUMMY'; end; end; 

           DbiExtractKey.  
      .  
     Delphi -  
    .  . 26.2 
  ,    DbiExtractKey  
  . 

    Enlej your enptession hefe~ 
    THE '-.LTR!M(STR(3)K MUSKETEERS' 
    Evaluation: 
    THE 3MUSKETEERS1 

    Puc. 26.2.     ,         DbiExtractKey  
  

      

     BDE     ,     
  . ,  ,      
,  ;     ,   
       . 
    U         
.   ,   .  
,      ,    
  . 
              ,  
      . 
       ,   ,      
.      BDE. 
    Q      DbiWriteBlock,   ,  
  . 
    Q     LCK    
DbiAcqPersistTableLock   ,    
         . 
    Q        ,    .  
  ,         
 ,     . 

          SQL 

      SQL      24, 
"   SQL",    25, "  
 /".        
  SQL    BDE. 
    Q         SQL   
 ,         
   . 

     26. Borland Database Engine 513 17   Delphi 3   / 

    Q           
Passthrough.    BDE      
        
  SQL. 
    Q    ,  ,     
DbiGetProps  IDAPI,      . 
    Q          
,  .      
  .        . 
    Q        , 
     . 
    Q     DbiAddFilter, DbiSetRange  DbiSetFieldMap 
      .  
,     ,   
.  ,       
 DataSet. 
          ,    
   ,      . 
    Q         ,  
   DbiSetToEnd  DbiSetToKey.   
-      ,    
    . 

     

    ,           
      Delphi.      
     BDE,      
         Delphi. 

     ... 

     27         
   Delphi.      
         . 

    514	 IV.    
