ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBDatabase.pas
(Generate patch)

Comparing ibx/trunk/runtime/IBDatabase.pas (file contents):
Revision 35 by tony, Tue Jan 26 14:38:47 2016 UTC vs.
Revision 37 by tony, Mon Feb 15 14:44:25 2016 UTC

# Line 594 | Line 594 | end;
594  
595   procedure TIBDataBase.CheckDatabaseName;
596   begin
597 <  if (FDBName = '') then
597 >  if (Trim(FDBName) = '') then
598      IBError(ibxeDatabaseNameMissing, [nil]);
599   end;
600  
# Line 1014 | Line 1014 | var
1014    TempDBParams: TStrings;
1015    I: integer;
1016    aDBName: string;
1017 +
1018 +  {Call error analysis}
1019 +  sqlcode: Long;
1020 +  IBErrorCode: Long;
1021 +  status_vector: PISC_STATUS;
1022   begin
1023    CheckInactive;
1024    CheckDatabaseName;
# Line 1054 | Line 1059 | begin
1059    finally
1060     TempDBParams.Free;
1061    end;
1062 <  if Call(isc_attach_database(StatusVector, Length(aDBName),
1062 >  repeat
1063 >    if Call(isc_attach_database(StatusVector, Length(aDBName),
1064                           PChar(aDBName), @FHandle,
1065                           FDPBLength, FDPB), False) > 0 then
1066 <  begin
1067 <    FHandle := nil;
1068 <    IBDataBaseError;
1069 <  end;
1066 >    begin
1067 >      {$IFDEF UNIX}
1068 >      if IsEmbeddedServer and (Pos(':',aDBName) = 0) then
1069 >      begin
1070 >        status_vector := StatusVector;
1071 >        IBErrorCode := StatusVectorArray[1];
1072 >        sqlcode := isc_sqlcode(StatusVector);
1073 >
1074 >        if ((sqlcode = -901) and (IBErrorCode = 335544382)) {Access permissions on firebird temp}
1075 >           or
1076 >           ((sqlcode = -902) and (IBErrorCode = 335544373)) {Security DB Problem}
1077 >           then
1078 >           begin
1079 >             aDBName := 'localhost:' + aDBName;
1080 >             Continue;
1081 >           end;
1082 >      end;
1083 >      {$ENDIF}
1084 >      FHandle := nil;
1085 >      IBDataBaseError;
1086 >    end;
1087 >  until FHandle <> nil;
1088    if not (csDesigning in ComponentState) then
1089      FDBName := aDBName; {Synchronise at run time}
1090    FDBSQLDialect := GetDBSQLDialect;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines