meta data for this page
  •  

Specifying WHERE clauses in ibec_Extract

ibec_ExtractMetadata allows specification of WHERE clauses for each data table. To specify these clauses you should create variable with a list of WHERE's in the form <table_name>=<where_clause>:

  WhereClauses[0] = 'HELP_ITEMS=where item_id > 1000';
  WhereClauses[1] = 'GOODS=where id < 500000';
  WhereClauses[2] = 'DT_TRANSFER=where transfer_id in (4, 6, 7)';

and indicate the variable name in the WhereVar option of the Options parameter of the function:

   WhereVar=WhereClauses;

Example

  execute ibeblock
  as
  begin
    cbb = 'execute ibeblock (
             LogLine variant)
           as
           begin
             ibec_progress(LogLine);
           end';
       WhereClauses[0] = 'HELP_ITEMS=where item_id > 1000';
    WhereClauses[1] = 'GOODS=where id < 500000';
    WhereClauses[2] = 'DT_TRANSFER=where transfer_id in (4, 6, 7)';
       DB = ibec_CreateConnection(__ctInterBase,                                  
   
'DBName="LOCALHOST/3060:D:\FB2_DATA\FORMTEST.FDB";
                                ClientLib=C:\Program Files\Firebird\bin\fbclient.dll;
                                User=SYSDBA; Password=masterkey; Names=NONE; SqlDialect=3');
    try
      ibec_ExtractMetadata(DB, 'D:\myscript.sql',
                               'GenerateCreate;
                                IncludePassword;
                                SetGenerators;
                                ExtractDescriptions;
                                UseComment;
                                MaxFileSize=500;
                                DecodeDomains;
                                ExtractBLOBs;
                                TrimStrings;
                                DateFormat=YYYY-MM-DD;
                                Domains=NONE;
                                Tables=NONE;
                                Views=NONE;
                                Procedures=NONE;
                                Triggers=NONE;
                                Generators=NONE;
                                Exceptions=NONE;
                                UDFs=NONE;
                                Roles=NONE;
                                DataTables=HELP_ITEMS,GOODS,DT_TRANSFER;
                                WhereVar=WhereClauses', cbb);
 finally:
 
      ibec_CloseConnection(DB);
    end;
  end;