476 |
|
implementation |
477 |
|
|
478 |
|
uses IBSQLMonitor, IBCustomDataSet, IBDatabaseInfo, IBSQL, IBUtils, |
479 |
< |
typInfo, FBMessages, IBErrorCodes; |
479 |
> |
typInfo, FBMessages, IBErrorCodes, RegExpr; |
480 |
|
|
481 |
|
{ TIBDatabase } |
482 |
|
|
611 |
|
end; |
612 |
|
|
613 |
|
procedure TIBDataBase.CreateDatabase(createDatabaseSQL: string); |
614 |
< |
var info: IDBInformation; |
615 |
< |
ConnectionType: integer; |
616 |
< |
SiteName: string; |
614 |
> |
var RegexObj: TRegExpr; |
615 |
|
begin |
616 |
|
CheckInactive; |
617 |
|
FAttachment := FirebirdAPI.CreateDatabase(createDatabaseSQL,FSQLDialect); |
618 |
< |
info := FAttachment.GetDBInformation(isc_info_db_id); |
619 |
< |
info[0].DecodeIDCluster(ConnectionType,FDBName,SiteName); |
618 |
> |
RegexObj := TRegExpr.Create; |
619 |
> |
try |
620 |
> |
{extact database file spec} |
621 |
> |
RegexObj.ModifierG := false; {turn off greedy matches} |
622 |
> |
RegexObj.Expression := '^ *CREATE +(DATABASE|SCHEMA) +''(.*)'''; |
623 |
> |
if RegexObj.Exec(AnsiUpperCase(createDatabaseSQL)) then |
624 |
> |
FDBName := system.copy(createDatabaseSQL,RegexObj.MatchPos[2],RegexObj.MatchLen[2]); |
625 |
> |
finally |
626 |
> |
RegexObj.Free; |
627 |
> |
end; |
628 |
|
if assigned(FOnCreateDatabase) and (FAttachment <> nil) then |
629 |
|
OnCreateDatabase(self); |
630 |
|
end; |