     9 
    
         

         

       ,     Delphi  
  ,     .   
        VCL. 
              
Web-,         
.   ,   , , 
      ,   
 .     ,    
  ?    ,   
  ?     ?     
      ! 
             
         
 .           
,             . 
           
    (local)   (remote),  SQL,   
   ,   Delphi. 

      
              
,      (     
     Delphi 2. . .). 

           Borland (Borland Database 
Engine,  BDE)  Delphi   .   


         

      ,      
(,  ),     ,  
      Borland (Borland Database Engine,  
BDE),  Paradox  dBASE. 

      Delphi  BDE 

     ,   Delphi    BDE  
      TQuery. 

        ,  
  

        VCL,   
      (  TQuery)   . 

      

             
:  ,     
 . 

    250 

    ,   ,   Paradox,     
     ,     
.   10, "    SQL",   
  SQL-    Delphi  
 . 

         

       ,   ,     . 
      (database)   ,   
 ,        
- .       
 , , ,      .  
       (tables), 
        .  
     .      ? 
,    ,      .   
   ,       
(fields).        , 
  (record).  . 9.1   CUSTOMER. DB, 
   DEMOS \ DATA, ,   ,   
  Delphi. 

    i. Table : C:\APPS\...\Cuttomei.db  
    Customer'	CustNo j Company	Addit	Addi2 L?J 
    1.221.00:t<auai Dm Shoppe	4-976 Sugartoaf 1-tivy	Suite 103  
    2	U31.ro|Unisco	: PO Box Z-547 
    3	1.351.00;'SigM Diver	1 Neptune Lane 
    4|	1,354.001 Cayman Divers World Unlimited	;POBox541 
    5'	1,356.00 Tom Sawyer Diving Centre	632-1 Third Frydenhoj	} 
    	1,380.00' Blue Jack Aqua Center	|23-738 Paddmglon Lane	Suite 310 S 
    7	1,384.00 VIP Dryers Club	|32MainSt. "t.^^i	,,.. ^Ui-.. ;..<..:<,:.J 
    8	1,510.00: Ocean Paradise	5 PO Box 8745 :^wBfil|SS	^!! ' 
    9'.	1.513 00 Fantastique Aquatica	JZ32 999 !2-77||1	ll?|BiliM||;t^^ , 
    	1,551.00. Marmot Dwers Club	'872 Queen St. ~^TT^~'" 
    It-	1,560.00,The Depth Charge	115243 Underwater Fwy.	I 
    12	1,563.00, Blue Sports	203 12th Ave. Box 746 
    13	1,624.00 Makai SCUBA Club	]POBoi<6534 
    14	1,645 OO'Action Club	PO Box 5451-F 
    15	1.651.00 Jamaica SCUBA Centre	POBox68 :  : \ :	I 
    16	1,680.00 Island Finders	6133 W Stone Avenue  ;,,;:	:;,^ ,',..;, 
,,,,,,, j 
    17:	1.984.00'Advenlure Undersea	: PO Box 744 , ^	1ɹ, ^Sa.aSi1,,") : 
    18	2.118.00 Blue Sports Ctub	,63365 Nez Perce 	KySXS^ i 

    . 9.1.    

             
.         
    .     
  Explorer       
 .        
   ,      
  (..   ). 
        ,    
        ,    
            
.            
 (  /SQL)    
   . 

        

     BDE ,   ,     
 Paradox  dBASE.        . 

        Paradox 

     Paradox      . 

       

     Paradox   15  :    
       ,   
  .       
          
 . 

     9.      251 

    ,    Yes/No  True/False.  
        ( Y  Yes  
N   No)       (   No  
    Yes).       ,   
    Z,   #.      
 Boolean (). 

      

       (referential integrity)  
   .    
,    ,    ,    
.     .     
  (  )     (  
 ,     ).      
  ,         
   .     . 
              
     .     
(cascading delete),    ?   Paradox  BDE 
   ,   . 

      

       ,     , , 
,          .  
     ,   ,   
        !    
 ?  - Paradox   .   Paradox 
   ,       
   ,         
  .    
 ,       
     . 

        

           (range), , 
,   (). ,       
  ,    ,  130.    
       
 ,   ,     
     ,   . 
 Paradox          
 ,    . 
            ,  
   .      
    .   ,   
   , Delphi     
  .     
     . 

        Paradox 

      ,  Paradox      . 
    .   ,    
  . 

       

     Paradox    ,   
,      (. 9.1). 

     9.1.     Paradox 

      

    DB           .   ,   
  
    MB              (Binary Large Object  BLOB). 
   ,  -,   
 ,    OLE- 
                .       
      
    XG?, YG?    .     
       
    VAL                
    
    TV                  Database 
Desktop,   ,       
    FAM            TV- 


    252                                      III.     

              
  BDE,     .   
,  ,   . 
     ,        :   
  . 
       ^  

       NET 

       NET        
Paradox.     - ,   
     NET-.      - 
           
 NET-         
.      - Paradox   
          
  ,  NET-. 

      
      Session (    
TSession)     NET-   
.        
NetFileDir  TSession. 
     dBASE   NET-,   Paradox. 

     
        ,     -, 
Delphi   . 


      Paradox 

       Paradox    . 
     BDE Administrator,   
   . 9.2.   BDE Administrator  
BDEADMIN.     ,     BDE. 

    | -'BDE Adoiiniilidtoi 
    |1 Edit View Ofitions Help 
    &: X  ^ ( 
    1  Database Afiases	Definition otDefautDD 
    . Config Database |	Definition | 
    :' ' ^ Databases :; i SQ DBDEMOSj! ! ^|31	TypePATH DEFAULT 
DRIVER	STANDARD C:\Appt\Ddpni32'\OBJREPOS 'PARADOX 
    || :" SQ SalonEasy //. 

    . 9.2.  BDE Administrator    BDE 
    
       . 
     Block Size ( ).     ( 
)   Paradox     Block Size. 
    1 024       
 (32 768).        : 
    PhysicalFileSize = Block Size / 1024 * 64 

     9.      253 

    Fill Factor ( ).   ,   
     ,    BDE 
 .       
      . 
    Strict Integrity ( ).     
  ,   !   (,  
    BDE).      
False,           , 
  .     True,    
      . 

      dBASE 

      dBASE       PC-,    
   ,    , 
  .    dBASE  
  ,       . 

        

         Paradox,   dBASE   
  .  . 9.2      dBASE-. 

     9.2.     dBASE 

      

    DBF                    
    DBT                  BLOB- (-,   OLE-) 
    MDX                         
    NDX                        

            
 . 

       

      ,  ,    
  . , ,      
,      ,    
.    dBASE      
 . 
     Expression Indexes ( ).     
,     . ,  
   FIRSTNAME ()  SURNAME ().   
SURNAME+FIRSTNAME   ,     
   .       . 
      ,   
     ,    .  
   ,    ,       
,   ,   . 
    U Subset Index (  ).   .  
  ,    .  
  ,         
 SURNAME, , , Blogs,      
   ,        
  Blogs.      
  ,    ,   
   (       
          
   ).       , 
          . 

      

       dBASE     ,  
  . ,   ,   
    . 
         API-  BDE 
DbiUndeleteRecord.     ,   
,   DbiPackTable.    
   BDE32.HLP,     BDE. 

    254  III.     


      dBASE 

     dBASE      ,  
   ,     . 
       .          
     . 
        .   dBASE  
     ,    , , 
, , -, OLE-   .    
,        
    .      
  ,      
   dBASE  ,      Paradox  
     . 

    Paradox  dBASE:  ? 

           Paradox  dBASE, 
  . 
        .   , 
 ,    ,     
   Paradox   SQL- .    
      Paradox  SQL-. 
     .   Paradox    
 dBASE  .    ,    
    ,    Paradox 
 . 
     ,   , ,        
NET-,     Paradox. 
        
             ,  
   ,    BDE. 

     TTable  TQuery 

             ,   
  TQuery    ,   
SQL-.     ,  
SQL-,    (datasets).    
   TQuery    ,   . 

     

        TQuery   ,   
      . 

     Active 

     Active   ,  ,  
  .     True,      
 .  Open  Close    ,   
  Active,      .  
         
tbICust  . 
    {   ,   Active. } tbICust.Active 
:= True; 
    {   . } tbICust.Active := False; 
    (       Open. } tbICust.Open; 
    {   . } tbICust.Close; 


     9.                                  255 


     
           .  
     close   post  
   Active  False. 

     BOF  EOF 

      ,       :  
 (BOF)    (EOF).  BOF  True   . 
        . 

      First. 
      Prior (    ). 
    j    EOF  True   . 
    !,      . 
    '    Last. 
       Next (    ). 

       EOF      .  
         
 (),     qryResult  TQuery. 

    var 
    iSum : Integer; 
    begin 
    {  . } 
    iSum := 0; 
    {    . } qryResult.First; 
    {     . ) 
    while not qryResult.Eof do 
    begin 
    {   . ) 
    Inc(iSum, qryResult.Fields  Name('Age').As Integer) ; 
    {    . } qryResult.Next ; 
    end; 
    end; 


     DatabaseName 

        ,     
   .    BDE-,  DBDEMOS,  
      Paradox  dBASE.    
    ; '"""  " '""      

     DBHandle  Handle 

             
 BDE.     ,    - 
      Delphi. 
     DBHandle    BDE   , 
 ,      Handle   
   .     
,   tbICust  TTabJ-e    
.     DbiPackTable  
      "5 

    C^cJc (Dbi PackTable (tbICust. DBHandle, tbICust. Handle, "'""^ 
Nil,Nil,True) ) ; 


    256  III.     


     Fields  FieldCount 

     Fields    TField,   
       .  FieldCount 
   TField  .     
      tbIStock     
IbFieldList  TListBox. 

    var 
    iCount : Integer; 
    begin 
    (      TListBox. } 
    IbFieldList Clear; 
    {   . } for iCount := 0 to tbIStock.FieldCount - 1 do 
    {       TListBox. ) 
IbFieldList.Items.Add(tbIStock.Fields[iCount].FieldName) ; 
    end; 


     Modified 

      Modified   , , 
    (       ).  
  ,      qryResult  
TQuery,  ,    . 

    If qryResult.Modified then if MessageDIg('Save record?',mtConfirmation,[mbYes,mbNo],0) 
    = mrYes then qryResult.Post; 


     RecordCount 

     RecordCount        
      .   
      tbICust  TTable  
   pnlProgress  TPanel    
 . 

    var 
    iRecNo, iRecCount : Iteger; 
    begin 
    (     . } 
    iRecCount := tbICust.RecordCount; 
    {    . } iRecNo := 1; 
    tbICust.First; 
    {    . } 
    while not tbICust.EOF do 
    begin 
    {   . } 
    pnlProgress.Caption:=IntToStr(100 * iRecNo div iRecCount) + '%'; 
    {   . } 
    {    . } tbICust.Next; 
    Inc(iRecNo) ; 
    end; 
    end; 


     

      TTable  TQuery    ,  
       .  
~    ,   
     . 

     9.      
    9  Delphi 3.   257 


     FieldByName 

     FieldByName         ,  
     Fields.        
          .  
      FieldByName,  
 ,   CustNo      ( , 
 0   Fields). 

    {      . } 
    tbICust.Edit; 
    {   CustNo  100    FieldByName. } 
     tbICust.FieldByName('CustNo').Aslnteger := 100; 
    {   CustNo  100   Fields[]. } 
    tbICust.Fields[0].Aslnteger := 100; 

       4)aa ,    ^  
   FieldByName.    
     . 

     Edit, Insert, Post  Cancel 

           ,   
   .  Edit     
.       ,   
   , Delphi    
  .   '" Edit  ,   
     ,    
         . 
     Insert         
    .     
  MerozTPost         
Cancel   . 
            tbICust 
      . 

    {   . ) tbICust.Insert; 
    { ,    . ) 
    if MessageDIg('Save record',mtConfirmation,[mbYes,mbNo],0) = mrYes then 
    (  . } 
    tbICust.Post; 
    else 
    {  . } 
    tbICust.Cancel; 


     First, Last, Prior, Next  MoveBy 

            . 
 First (), Last (), Prior ()  Next 
(),  ,    . 
     MoveBy     ,    
 Next  Prior,       
    .  MoveBy   ,  
 ,   ,      
    .      
      . 

    tbICust.Last; 
    if tbICust.MoveBy(5)  5 then MessageDIg('Unable to move forward five records'); 


     Locate 

     Locate    ,   
.        . 
    1.  ,    . 
    2.   (, ,   ..). 

    258                                       III.     

    3.  TLocateOptions,     .  
loCaselnsensitive    ,      
 (,         
).  loPartialKey ,   BDE   
   ,     . 
, John    Jo, a Doe     Do. 

      
       loPartialKey,     
     ,      loCaselnsensitive. 

     Locate        FindKey 
(  ). 
      Locate         . 
 FindKey ,  ,    , 
    . 
       Locate ,       
  (   )    
 . ,       ,  
     BDE     
   ,   . 
      Locate       : TQuery 
 .  FindKey        
.                            "~;"' - '"" 

     

        TQuery        
,       .   
    .   
       ,  
 ,     TQuery   . 

     BeforeXXX 

      BeforeXXX    : BeforeCancel, 
BeforeClose, BeforeDelete, foreEdit, Beforelnsert, BeforeOpen, BeforePost  
BeforeScroll. ,        
,      . 
           BeforeDelete,    
    Delete,     ,  
 BDE   .    
     BeforeDelete,    
.       . 

    procedure TForml.tbICustBeforeDelete(DataSet: TDataSet); 
    begin 
    ( ,    . } 
    if tbIOrders.FindKey ([DataSet.FieldByName('CustNo').Aslnteger]) then ( 
 HCKnB4H^nb^^,_.ci^y.aJJajs^^a^OTMeH^^y^       } raT?e~E'xceptTon. 
Create ('Unable to delete customer .'^TT" end; 

          .  
,       , ,  ,  
   . 
    ,       . 
         TDataSet ( 
 TQuery),     ,   
  . 

     AfterXXX 

      AfterXXX    : AfterCancel, 
AfterClose, AfterDelete, AfterEdit, Afterlnsert, AfterOpen, AfterPost  
AfterScroll.     BeforeXXX    
    .    ,   
   ,      . 
         .  
      Panel,    
         . 

    procedure TForml ,'tblCustAfterPost (DataSet: TDataSet); 
    begin 
    {    TPanel. } 
    pnlStatus.Caption := 'Record saved successfully'; 
    end; 


     9.                                  259 


     OnCalcFields 

     Delphi     (calculated fields), .. , 
 ,      .   
    .  OnCalcFields  
     . 
          ,   
.     ,  
  . 
    1.         
 (  TQuery). 
    2.   Fields Editor ( )   . 
   ,    . 9.3. 
    3.           New 
Field ( ).    New Field,   . 9.4. 

    . 9.3.          
  

    . 9.4.   New Field     
   

    4.     .   
  Calculated   Field type ( ).    , 
        . 
    ,     UpperName,    
  Name,   .     
 UpperName,     . 

    procedure TFormI.tbCustCalcFields(DataSet: TDataSet) ; 
    begin 
    (   . } with DataSet do 
    FieldByName('UpperName').AsString := 
    Uppercase(FieldByName('Name').AsString) ; 
    end; 


       TTable 

           ,   
  TQuery. 

     

          ,  
    . 

     TableName 

             .  
TableName       .    
  TTable,  TableName   ,  
BDE  .  TableName     
     Delphi Object Inspector. 

    260  III.     


     Exclusive 

     Exclu5ive     ,  
     .     
   ,        
       .   ,  
        
,       . 
         ,    
 Exclusive  True,   ,    
  . 

    with tbICust do begin 
    {  . } 
    Close; 
    {   . } tbICust.Exclusive := True; 
    {   ,     . } tbICust.Open; 
    end; 

     IndexName 

     IndexName      .  
   IndexName  ,   
,   BDE       
.         
  IndexName    . ,  
    .    
,      . 
        ,  
    Name,   Name Index.    
    Name Index     
   Do,    Doe.    
   . 

    with tbICust do begin try 
    {      Namelndex. } tbICust.IndexName 
:= 'Namelndex'; 
    {     Do. ) if tbICust.FindKey(['Do']) then begin    
         ^   V-' 
    (   . ) Edit; 
    {  . } FieldByName('Name').AsString :='Doe' ; 
    (    . ) Post; 
    end; 
    finally 
    {     . } tbICust.IndexName := ''; 
    end;                     -~: 
    end; 


     

      TTable       .   
    .    
    . 

     9.                                  261 


     LockTable 

     LockTable     ,  
  .       . 
     Read.  BDE       
   ,     .   
 ,        
           . 
       ItReadLock. 
     Write.         
    .      
.      ,     
  ,       
      .    , 
  ,       
  ,       .  
    ItWriteLock. 
             
        10%. 

    with tbIStock do begin 
    {  . } 
    LockTable(ItWriteLock) ; 
    try 
    (     . } First; 
    {     . } 
    while not EOF do 
    begin 
    {    10%. } 
    FieldByName('Price').AsFloat := 
    FieldByName('Price').AsFloat * 1.1; 
    {    . } 
    Next; 
    end; 
    finally 
    {      . } UnlockTable(ItWriteLock) ; 
    end; 
    end; 


     SetRange 

     SetRange         
,       . 
      ,   Paradox  dBASE, ,   
 ,   . 
            
PurchaseDateIndex,      :  1/1/1997  31/12/1997. 

    with tbIOrder do 
    begin 
    {      Purchase Date ( ). } 
    IndexName := 'PurchaseDateIndex'; 


    262                                      III.     


    try 
    {    . } 
    SetRangef[EncodeDate(1997,1,1)],[EncodeDate(1997,12,31)]) ; 
    {     . } 
    finally 
    {   . } 
    IndexName := '' ; 
    end; 
    end; 


       TQuery 

     TQuery     SQL   
      .    
   .                             1 

     

      TQuery   ,    
    . 

     Params  ParamCount 

     SQL     (parameters),  
    SQL-.   Params 
    ,   ParamCount   
  .        10, 
"    SQL". 

     RequestLive  CanModify 

      RequestLive     , 
         
   .     RequestLive 
 True   ,   BDE   ,  
 .   RequestLive    False. 
  CanModify  True,      
,  False,       . 
              RequestLive  True  ,  
    ;  .    
 SQL-,      ,  
, , ,       
    . 

     UniDirectionaI 

            
.     UniDirectionaI  True,  
     Query       
.   UniDirectionaI    False,  
       . 

     

     TQuery   ,    
  .     ExecSQL.   
  Open,   SQL    .  
   DELETE,    ,  
 ,    WHERE.    
  ExecSQL   ,     
  TempStorage. 

    with qryEmpty do 
    begin 
    {    SQL. } 
    SQL.Clear; 
    {  . }                                     .'.,. 


     9.                                  263 


    SQL.Add('delete * from TempStorage'); 
    (  . } ExecSQL; 
    end; 


       

           ,  , , 
    ,   
           
   ,  .    
    ,       
.    -   , 
       ,  
    .  , ,  
 ,     ,     
   . 
             
-.       
,           . 

       

       ,   File^New Data 
Module.  'i4'f1F'l^S3BBBEsB      
  ,         
.  . 9.5    ,   
TTimer  TOpenDialog. 

    OpenOalogI Timeri             || 

    II . 9.5.        
  

    |||||||          
  sJ .       
        Add to ^ Repository. 
         2, 
"  Delphi". 

       

         . , , 
     dmApp,    tbICust  . 
     DM App.     
dmApp,    DM_App   uses  . 
             
  tbICust    dmApp. 

    Implementation 
    uses DM_App; 
    procedure DisplayRecordCount; 
    begin with dmApp.tbICust do 
    ShowMessage(Format('Record count = %d',[RecordCount])) ; 
    end; 


       

         TDataModule    
 ,   .      
 ,    ,   
TDataModule, OnCreate  OnDestroy. 
     OnCreate ,    .  
       ,  
        Filter  
TOpenDialog,         
 .  OnDestroy    , 
   OnCreate. 

    264                                      III.     


          

      6, "  Delphi",  7, "  
 Win32",   ,    
    (VCL),   
 .         
          
     ,    TQuery,   
  (, " T^fca^tiiTStringGrid).    
,  , ,     Visual 
Basic,    .     , 
  Delphi         
 (data aware components).   ,    
           . 
 ,   ,   ,  
 .         
 Data Controls  . 
          ,    
  ,      . 

     TDataSource 

             
   Delphi  ,   - 
(data source).          
,        . 

     

      TDataSource   ,   
    . 
     AutoEdit.   ,  ,  
      ,    
   ,     . 
     DataSet.   ,      
.  DataSet     TQuery  . 
     State.     . 

     

     TDataSource   ,     
 . 
     OnDataChange. ,   ( )    
          
.    ,   .  
     ,     
Nil,     .  OnDataChange , 
     ,    
 . 
     OnStateChange. ,   State    
.          
dsBrowse      ds Inactive,    
.       OnStateChange   State 
    OnStateChange, TDataSource  . 
     OnUpdateData.     OnDataChange.  
OnDataChange    ,     
   ,   OnUpdateData   
    ,     
,   . 

            

               
   .         
        . 
     DataSource.   TDataSource,     
    . 
     DataField.  ,       
  . 

     9.                                  265 

            
.  . 9.3      . 

     9.3.       

     	 

    TDBChart	     ,   
     
    TDBGrid	     TQuery.  ,  
,     
    TDBNavigator	      , 
   ,       
    TDBText	   TLabel,      
    TDBEdit	    TEdit,    
 .       :  
         ,  
    
    TDBMemo	  TDBEdit.    
        
    TDBImage	   BLOB   .   
          
    TDBListBox	    
    TDBComboBox	  TDBListBox,    
    
    TDBCheckBox	    TCheckBox,   
 (on/off).        
  Yes/No  True/False,    
   
    TDBRadioGrouop	   ,     
     
    TDBLookupListBox	   TDBListBox.   
TDBLookupListBox       ,   
     TStrings,    TDBListBox 
    TDBLookupComboBox	 TDBLookupListBox,     
  TCornboBox 
    TDBRichEdit	      ,   
   TRichEdit 
    

         

    ,        ,  
     . 

      

            
 ().     BDE     
   .  ,     
  . 

    266                                      IIJ.     

           
CachedUpdates   ApplyUpdates.    CachedUpdates 
 True,   ,     plyUpdates 
      . 

     
       CachedUpdates  False,   , 
    . 
            
 50  . 

    var 
    iCount : Integer; 
    begin 
    with tbCust do 
    begin 
    {     . } CachedUpdates := True; 
    {  50   . } for iCount := 1 to 50 do 
InsertRecord([iCount]) ; 
    {     . } ApplyUpdates; 
    end; 
    end; 


        

          5, " 
 ".   ,  Delphi   
   ,     . 
     EDatabaseError. ,   VCL     
.        
        , 
 EDivByZero  EAccessViolation. 
     EDBEngineError. ,      BDE. 
     -  , 
 EDBEngineError      ErrorCount  
Errors.         
EDBEngineError    TListBox  . 

    var iCount : Integer; 
    begin 
    try 
    { -. } 
    except 
    (    . } 
    on E:EDBEngineError do 
    (    . } 
    for iCount := 0 to E.ErrorCount-1 do 
    {      . } 
    IbMsgs.Items.Add(E.Errors[iCount].Message); 
    end; 
    end; 


     9.                                  267 


     

      ,      
 .          
  .        
  ,        . 
   ,      
           
 . 
        ,    ,  
       .  , 
 BDE       ,  
   TDatabase  StartTransaction, Commit  Rollback. 
     StartTransaction   .  ,  
 ,   , .   
   Commit       . 
   ,   Rollback     
  .        
    .    dbGL  TDatabase. 

    dblTranVal := 100; 
    {  . } 
    dbGL.StartTransaction; 
    try 
    {   . } 
    if not tblGLAcc.FindKey([400.100']) then 
    raise Exception.Create('Unable to locate bank account'); 
    {  . } 
    tbIGLAcc.Edit; 
    tbIGLAcc.FieldByName('Balance').AsFloat := 
    tbIGLAcc.FieldByName('Balance').AsFloat - dblTranval; 
    tbIGLAcc.Post; 
    (  . } dbGL.Commit; 
    except 
    {  . } 
    tbIGL.Rollback; 
    {   . } 
    raise; 
    end; 

            
      . 

     TSession        

       Win32       
 .      
 ,         
  .   24, "  ",  
  ,    ,  
       . 
       ,       
    .    
   TTable   ,  
    ,  , 
    ,      
    . 
     ,  VCL Delphi   ,  
        . 

    268                                      III.     


     Session, TSession  TSessionList 

     BDE         
  Database Desktop   Delphi.   
     (session).    
   ,    . 
     TSession   ,  ,  
Session,          
.  Session       
     .     
  TSession     SessionName   
   ,    . 
      TSessionList     BDE-.  
      TSessionList,   Delphi 
          
  . 

      

         OpenSession  TSessionList.  
OpenSession        
(SessionName).        
 Sessions     TSession.    
,  OpenSession       
TSession.         

    TestSession. 
    var ssnTemp : TSession; 
    begin 
    {  . } 
    ssnTemp := Sessions.OpenSession('TestSession'); 
    {  . } 
    ssnTemp.Free; 
    end; 


       

              
    .     (, TQuery  
TStoredProc)   SessionName,     
 SessionName   TSession,   OpenSession. 
      ,       ^  
.    9.1 ^ ^ftig^^,  3  UTESTTHREAD.PAS, 
'^   . 

    i  9.1. \UDELPHI3\CHP9\UTESTTHREAD. PAS.     
   

    procedure TTestThread.Execute; 
    var 
    ssnLocal : TSession; 
    tbITest : TTable; 
    begin 
    (    . } 
    Priority := tpLowest; 
    try 
    {    . } 
    ssnLocal :=Sessions.OpenSession(ExtractFileName 
(Application.EXEName)+IntToStr(GetTickCount)) ; 
    (    . } 
    tbITest := TTable.Create (Nil); 


     9.                                  269 


    with tbITest do 
    begin 
    (      . } 
    SessionName     := ssnLocal.SessionName; 
    {   :    . } 
    DatabaseName    := 'DBDEMOS'; 
    TableName       := 'Items'; 
    {  . } 
    Open; 
    end; 
    {  ,     . } 
    while not Terminated do 
    (     . } 
    finally 
    {  . ) 
    tbITest.Free; 
    {  . ) 
    ssnLocal.Free; 
    end; 
    end; 


     

         .     
, ,   .   ,      
 ,      ,    ,  
  . 
            , 
 BDE (Paradox  dBASE), a  ,   
   . 
             VCL,  
         TTable  TQuery. 
               
  TDataModule        . 
     ,       VCL 
     .     
        TDataSource 
   .        
 TDataSource         
,  . 
                 
      .   
 ,     ,   
    . 

    270                                       III.     
