ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/IBUtils.pas
(Generate patch)
# Line 33 | Line 33
33  
34   unit IBUtils;
35   {$IFDEF MSWINDOWS}
36 < {$DEFINE WINDOWS}
36 > {$DEFINE WINDOWS}
37 > {$IF CompilerVersion >= 28}
38 > {Delphi XE7 onwards}}
39 > {$define HASREQEX}
40 > {$IFEND}
41   {$ENDIF}
42  
43   {$IFDEF FPC}
44   {$Mode Delphi}
45   {$codepage UTF8}
46 + {$define HASREQEX}
47   {$ENDIF}
48  
49 +
50   interface
51  
52   uses Classes, SysUtils;
# Line 268 | Line 274
274  
275   implementation
276  
277 + {$IFDEF HASREQEX}
278   uses RegExpr;
279 + {$ENDIF}
280  
281   function Max(n1, n2: Integer): Integer;
282   begin
# Line 371 | Line 379
379  
380   {Extracts the Database Connect string from a Create Database Statement}
381  
382 + {$IFDEF HASREQEX}
383   function ExtractConnectString(const CreateSQL: AnsiString;
384    var ConnectString: AnsiString): boolean;
385   var RegexObj: TRegExpr;
# Line 388 | Line 397
397      RegexObj.Free;
398    end;
399   end;
400 + {$ELSE}
401 + {cruder version of above for old versions of Delphi}
402 + function ExtractConnectString(const CreateSQL: AnsiString;
403 +  var ConnectString: AnsiString): boolean;
404 + var i: integer;
405 + begin
406 +  Result := false;
407 +  i := Pos('''',CreateSQL);
408 +  if i > 0 then
409 +  begin
410 +    ConnectString := CreateSQL;
411 +    delete(ConnectString,1,i);
412 +    i := Pos('''',ConnectString);
413 +    if i > 0 then
414 +    begin
415 +      delete(ConnectString,i,Length(ConnectString)-i+1);
416 +      Result := true;
417 +    end;
418 +  end;
419 + end;
420 + {$ENDIF}
421  
422   {Format an SQL Identifier according to SQL Dialect with encapsulation if necessary}
423  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines