DbiAddIndex...Help me please. 
Author Message
 DbiAddIndex...Help me please.

Is there anybody out there?  I require some help on the Dbi calling

I need to use DbiAddIndex to index and un-indexed .dbf file,  but have no
idea on how to call this routine.

If you can include a comprehensive example... it would be appreciated.

Thanks in advance.

Luke Chiam

http://www.*-*-*.com/ ~chiamtl



Sun, 20 Dec 1998 03:00:00 GMT  
 DbiAddIndex...Help me please.

Quote:

>Is there anybody out there?  I require some help on the Dbi calling
>I need to use DbiAddIndex to index and un-indexed .dbf file,  but have no
>idea on how to call this routine.
>If you can include a comprehensive example... it would be appreciated.
>Thanks in advance.

Here's the code that I put into our book for DbiAddIndex().  It works
in both Delphi 1 and 2.

{ DbiGetErrorString() }
function IsDbiOk( iResult : DBIResult ) : boolean;
var
   szErrorStr: DBIMsg;
begin
   Result := iResult = DBIERR_NONE;
   if not Result then
   begin
      DbiGetErrorString( iResult, szErrorStr );
      ShowMessage( 'Error ' + IntToStr(iResult) + ': ' + StrPas(
szErrorStr ));
   end; { a DBI Error code }
end; { IsDbiOk() }

{ DbiAddIndex() }
function xbCreateIndex(       { Create an index tag }
   dbHandle    : HDBIDB;      { Data file handle }
   hCursor     : HDBICur;     { Cursor for file }
   sOrdBagName : string;      { Name of index file }
   sOrdName    : string;      { Name of index tag }
   sExpKey     : string;      { Index expression }
   bUnique     : boolean;     { True for unique index, False is
default }
   bDescend    : boolean;     { True for descending index. False is
default }
   sCondition  : string       { Conditional subset for index }
   )           : boolean;
var
   idx         : IDXDesc;
begin
   FillChar( idx, SizeOf( IDXDesc ), 0 ); { zero-out structure }
   with idx do
   begin { Assign index descriptors for creating file }
      bCaseInsensitive := False;
      bExpIdx := not IsValidIdent( sExpKey ); { more than symbol? }
      if bExpIdx then
         iFldsInKey := 0
      else
         iFldsInKey := 1;
      bMaintained := True;
      bSubSet     := Length( sCondition ) > 0;
      if bSubSet then
         StrPCopy( szKeyCond, sCondition );

      StrPCopy( szName, sOrdBagName );
      StrPCopy( szTagName, sOrdName );
      StrPCopy( szKeyExp, sExpKey );

   end; { with idx }

   idx.bUnique       := bUnique;
   idx.bDescending   := bDescend;

   if IsDbiOk( DbiAddIndex( dbHandle, hCursor, nil, nil, idx, nil ) )
then
      Result := True;
end; { xbCreateIndex() }

This code can be found in Xphiles (Xbase for Delphi) an Xbase
migration/support tool I am selling for Delphi, and it can also be
found in the book:

Delphi Database Development by Ted Blue, John Kaster, Greg Lief and
Loren Scott.  ISBN 1-55851-469-4, US $44.95, M&T Books.



Sun, 27 Dec 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. DBIAddIndex "baseorder" error

2. Please Please, help me with memo-fields, real problem

3. Please, please help me with this code.

4. please, I beg of you help me please.

5. PLEASE PLEASE HELP ME

6. Please Please help me

7. Help Drag and drop please please

8. please,please,please H E L P (tic tac toe)

9. Please, please, please H E L P (tic tac toe)

10. Program Idea Please please please

11. Program Idea Please Please Please

12. Graph.tpu for pascal wanted please, please, please.

 

 
Powered by phpBB® Forum Software