Page 1 of 1

[patch_done] Interbase bug w/createNewDatabase in D2009

Posted: 02.03.2009, 19:32
by DavidVTaylor
A typecast is needed in TZInterbase6Connection.CreateNewDatabase to convert the SQL parameter to an AnsiString. The sc_dsql_execute_immediate call expects and PAnsiChar and is getting a pointer to the UnicodeString (see modified version below).

procedure TZInterbase6Connection.CreateNewDatabase(const SQL: String);
var
DbHandle: PISC_DB_HANDLE;
TrHandle: PISC_TR_HANDLE;
begin
Close;
DbHandle := nil;
TrHandle := nil;
FPlainDriver.isc_dsql_execute_immediate(@FStatusVector, @DbHandle, @TrHandle,
0, PAnsiChar(AnsiString(sql)), FDialect, nil); <-- This line
CheckInterbase6Error(FPlainDriver, FStatusVector, lcExecute, SQL);
FPlainDriver.isc_detach_database(@FStatusVector, @DbHandle);
CheckInterbase6Error(FPlainDriver, FStatusVector, lcExecute, SQL);
end;

Posted: 06.03.2009, 08:24
by mariuszekpl
Thx ;)

Posted: 06.03.2009, 16:11
by SlavoF
Thank you David. This is the solution of this thread:
http://zeos.firmos.at/viewtopic.php?t=1680

Posted: 22.03.2009, 08:53
by mdaems
SVN rev. 603