From ef0be0be5be0cf990772e0965b239ed32ea6a276 Mon Sep 17 00:00:00 2001 From: "rosenfield.albert" Date: Tue, 24 Jun 2008 10:00:02 +0000 Subject: [PATCH] Bugfix: send prepared statements in widestring to MySQL. --- .../zeosdbo/src/component/ZAbstractDataset.pas | 4 ++-- .../zeosdbo/src/component/ZAbstractRODataset.pas | 4 ++-- .../zeosdbo/src/component/ZStoredProcedure.pas | 4 ++-- components/zeosdbo/src/dbc/ZDbcASA.pas | 12 ++++++------ components/zeosdbo/src/dbc/ZDbcAdo.pas | 12 ++++++------ components/zeosdbo/src/dbc/ZDbcConnection.pas | 16 ++++++++-------- components/zeosdbo/src/dbc/ZDbcDbLib.pas | 12 ++++++------ components/zeosdbo/src/dbc/ZDbcInterbase6.pas | 12 ++++++------ components/zeosdbo/src/dbc/ZDbcIntfs.pas | 4 ++-- components/zeosdbo/src/dbc/ZDbcMySql.pas | 4 ++-- components/zeosdbo/src/dbc/ZDbcOracle.pas | 6 +++--- components/zeosdbo/src/dbc/ZDbcPostgreSql.pas | 6 +++--- components/zeosdbo/src/dbc/ZDbcSqLite.pas | 6 +++--- 13 files changed, 51 insertions(+), 51 deletions(-) diff --git a/components/zeosdbo/src/component/ZAbstractDataset.pas b/components/zeosdbo/src/component/ZAbstractDataset.pas index 8ce7e227..461bf6af 100644 --- a/components/zeosdbo/src/component/ZAbstractDataset.pas +++ b/components/zeosdbo/src/component/ZAbstractDataset.pas @@ -130,7 +130,7 @@ type procedure DOAfterApplyUpdates; {bangfauzan addition} - function CreateStatement(const SQL: string; Properties: TStrings): + function CreateStatement(const SQL: WideString; Properties: TStrings): IZPreparedStatement; override; function CreateResultSet(const SQL: WideString; MaxRows: Integer): IZResultSet; override; @@ -291,7 +291,7 @@ end; @returns a created DBC statement. } function TZAbstractDataset.CreateStatement( - const SQL: string; Properties: TStrings): IZPreparedStatement; + const SQL: WideString; Properties: TStrings): IZPreparedStatement; var Temp: TStrings; begin diff --git a/components/zeosdbo/src/component/ZAbstractRODataset.pas b/components/zeosdbo/src/component/ZAbstractRODataset.pas index 7a5e2769..7af6dfa3 100644 --- a/components/zeosdbo/src/component/ZAbstractRODataset.pas +++ b/components/zeosdbo/src/component/ZAbstractRODataset.pas @@ -286,7 +286,7 @@ type function AllocRecordBuffer: PChar; override; procedure FreeRecordBuffer(var Buffer: PChar); override; procedure CloseBlob(Field: TField); override; - function CreateStatement(const SQL: string; Properties: TStrings): + function CreateStatement(const SQL: WideString; Properties: TStrings): IZPreparedStatement; virtual; function CreateResultSet(const SQL: WideString; MaxRows: Integer): IZResultSet; virtual; @@ -1505,7 +1505,7 @@ end; @param Properties a statement specific properties. @returns a created DBC statement. } -function TZAbstractRODataset.CreateStatement(const SQL: string; Properties: TStrings): +function TZAbstractRODataset.CreateStatement(const SQL: WideString; Properties: TStrings): IZPreparedStatement; var Temp: TStrings; diff --git a/components/zeosdbo/src/component/ZStoredProcedure.pas b/components/zeosdbo/src/component/ZStoredProcedure.pas index 43e258c8..218f1401 100644 --- a/components/zeosdbo/src/component/ZStoredProcedure.pas +++ b/components/zeosdbo/src/component/ZStoredProcedure.pas @@ -79,7 +79,7 @@ type { property CallableResultSet: IZCallableStatement read FCallableStatement write FCallableStatement;} - function CreateStatement(const SQL: string; Properties: TStrings): + function CreateStatement(const SQL: WideString; Properties: TStrings): IZPreparedStatement; override; procedure SetStatementParams(Statement: IZPreparedStatement; ParamNames: TStringDynArray; Params: TParams; @@ -121,7 +121,7 @@ uses @param Properties a statement specific properties. @returns a created DBC statement. } -function TZStoredProc.CreateStatement(const SQL: string; Properties: TStrings): +function TZStoredProc.CreateStatement(const SQL: WideString; Properties: TStrings): IZPreparedStatement; var I: Integer; diff --git a/components/zeosdbo/src/dbc/ZDbcASA.pas b/components/zeosdbo/src/dbc/ZDbcASA.pas index c552eee4..437f18f9 100644 --- a/components/zeosdbo/src/dbc/ZDbcASA.pas +++ b/components/zeosdbo/src/dbc/ZDbcASA.pas @@ -111,9 +111,9 @@ type // procedure CreateNewDatabase(SQL: String); function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; - function CreateCallableStatement(const SQL: string; Info: TStrings): + function CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; override; procedure Commit; override; @@ -369,11 +369,11 @@ end; @return a new CallableStatement object containing the pre-compiled SQL statement } -function TZASAConnection.CreateCallableStatement(const SQL: string; +function TZASAConnection.CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; begin if IsClosed then Open; - Result := TZASACallableStatement.Create(Self, SQL, Info); + Result := TZASACallableStatement.Create(Self, String(SQL), Info); end; {** @@ -403,11 +403,11 @@ end; @return a new PreparedStatement object containing the pre-compiled statement } -function TZASAConnection.CreatePreparedStatement(const SQL: string; +function TZASAConnection.CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; - Result := TZASAPreparedStatement.Create(Self, SQL, Info); + Result := TZASAPreparedStatement.Create(Self, String(SQL), Info); end; {** diff --git a/components/zeosdbo/src/dbc/ZDbcAdo.pas b/components/zeosdbo/src/dbc/ZDbcAdo.pas index c5d2d1d2..2ad00c84 100644 --- a/components/zeosdbo/src/dbc/ZDbcAdo.pas +++ b/components/zeosdbo/src/dbc/ZDbcAdo.pas @@ -107,9 +107,9 @@ type destructor Destroy; override; function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; - function CreateCallableStatement(const SQL: string; Info: TStrings): + function CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; override; function NativeSQL(const SQL: string): string; override; @@ -366,10 +366,10 @@ end; pre-compiled statement } function TZAdoConnection.CreatePreparedStatement( - const SQL: string; Info: TStrings): IZPreparedStatement; + const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; - Result := TZAdoPreparedStatement.Create(FPLainDriver, Self, SQL, Info); + Result := TZAdoPreparedStatement.Create(FPLainDriver, Self, String(SQL), Info); end; {** @@ -398,11 +398,11 @@ end; @return a new CallableStatement object containing the pre-compiled SQL statement } -function TZAdoConnection.CreateCallableStatement(const SQL: string; Info: TStrings): +function TZAdoConnection.CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; begin if IsClosed then Open; - Result := TZAdoCallableStatement.Create(FPlainDriver, Self, SQL, Info); + Result := TZAdoCallableStatement.Create(FPlainDriver, Self, String(SQL), Info); end; {** diff --git a/components/zeosdbo/src/dbc/ZDbcConnection.pas b/components/zeosdbo/src/dbc/ZDbcConnection.pas index b92d2e8b..a3209923 100644 --- a/components/zeosdbo/src/dbc/ZDbcConnection.pas +++ b/components/zeosdbo/src/dbc/ZDbcConnection.pas @@ -120,9 +120,9 @@ type function CreateRegularStatement(Info: TStrings): IZStatement; virtual; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; virtual; - function CreateCallableStatement(const SQL: string; Info: TStrings): + function CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; virtual; property Driver: IZDriver read FDriver write FDriver; @@ -145,9 +145,9 @@ type function PrepareCall(const SQL: string): IZCallableStatement; function CreateStatementWithParams(Info: TStrings): IZStatement; - function PrepareStatementWithParams(const SQL: string; Info: TStrings): + function PrepareStatementWithParams(const SQL: WideString; Info: TStrings): IZPreparedStatement; - function PrepareCallWithParams(const SQL: string; Info: TStrings): + function PrepareCallWithParams(const SQL: WideString; Info: TStrings): IZCallableStatement; function CreateNotification(const Event: string): IZNotification; virtual; @@ -547,7 +547,7 @@ end; @return a new PreparedStatement object containing the pre-compiled statement } -function TZAbstractConnection.PrepareStatementWithParams(const SQL: string; +function TZAbstractConnection.PrepareStatementWithParams(const SQL: WideString; Info: TStrings): IZPreparedStatement; begin Result := CreatePreparedStatement(SQL, Info); @@ -564,7 +564,7 @@ end; @param Info a statement parameters. @returns a created statement. } -function TZAbstractConnection.CreatePreparedStatement(const SQL: string; +function TZAbstractConnection.CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; begin Result := nil; @@ -617,7 +617,7 @@ end; @return a new CallableStatement object containing the pre-compiled SQL statement } -function TZAbstractConnection.PrepareCallWithParams(const SQL: string; +function TZAbstractConnection.PrepareCallWithParams(const SQL: WideString; Info: TStrings): IZCallableStatement; begin Result := CreateCallableStatement(SQL, Info); @@ -629,7 +629,7 @@ end; @param Info a statement parameters. @returns a created statement. } -function TZAbstractConnection.CreateCallableStatement(const SQL: string; +function TZAbstractConnection.CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; begin Result := nil; diff --git a/components/zeosdbo/src/dbc/ZDbcDbLib.pas b/components/zeosdbo/src/dbc/ZDbcDbLib.pas index fbc5e83f..083783b9 100644 --- a/components/zeosdbo/src/dbc/ZDbcDbLib.pas +++ b/components/zeosdbo/src/dbc/ZDbcDbLib.pas @@ -119,9 +119,9 @@ type destructor Destroy; override; function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; - function CreateCallableStatement(const SQL: string; Info: TStrings): + function CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; override; function NativeSQL(const SQL: string): string; override; @@ -497,10 +497,10 @@ end; pre-compiled statement } function TZDBLibConnection.CreatePreparedStatement( - const SQL: string; Info: TStrings): IZPreparedStatement; + const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; - Result := TZDBLibPreparedStatementEmulated.Create(Self, SQL, Info); + Result := TZDBLibPreparedStatementEmulated.Create(Self, String(SQL), Info); end; {** @@ -530,10 +530,10 @@ end; pre-compiled SQL statement } function TZDBLibConnection.CreateCallableStatement( - const SQL: string; Info: TStrings): IZCallableStatement; + const SQL: WideString; Info: TStrings): IZCallableStatement; begin if IsClosed then Open; - Result := TZDBLibCallableStatement.Create(Self, SQL, Info); + Result := TZDBLibCallableStatement.Create(Self, String(SQL), Info); end; {** diff --git a/components/zeosdbo/src/dbc/ZDbcInterbase6.pas b/components/zeosdbo/src/dbc/ZDbcInterbase6.pas index ae9a1f13..2daaa4ff 100644 --- a/components/zeosdbo/src/dbc/ZDbcInterbase6.pas +++ b/components/zeosdbo/src/dbc/ZDbcInterbase6.pas @@ -128,9 +128,9 @@ type procedure CreateNewDatabase(const SQL: String); function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; - function CreateCallableStatement(const SQL: string; Info: TStrings): + function CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; override; function CreateSequence(const Sequence: string; BlockSize: Integer): @@ -581,10 +581,10 @@ end; pre-compiled statement } function TZInterbase6Connection.CreatePreparedStatement( - const SQL: string; Info: TStrings): IZPreparedStatement; + const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; - Result := TZInterbase6PreparedStatement.Create(Self, SQL, Info); + Result := TZInterbase6PreparedStatement.Create(Self, String(SQL), Info); end; {** @@ -613,11 +613,11 @@ end; @return a new CallableStatement object containing the pre-compiled SQL statement } -function TZInterbase6Connection.CreateCallableStatement(const SQL: string; +function TZInterbase6Connection.CreateCallableStatement(const SQL: WideString; Info: TStrings): IZCallableStatement; begin if IsClosed then Open; - Result := TZInterbase6CallableStatement.Create(Self, SQL, Info); + Result := TZInterbase6CallableStatement.Create(Self, String(SQL), Info); end; {** diff --git a/components/zeosdbo/src/dbc/ZDbcIntfs.pas b/components/zeosdbo/src/dbc/ZDbcIntfs.pas index f78f6616..58743dfb 100644 --- a/components/zeosdbo/src/dbc/ZDbcIntfs.pas +++ b/components/zeosdbo/src/dbc/ZDbcIntfs.pas @@ -213,9 +213,9 @@ type function PrepareCall(const SQL: string): IZCallableStatement; function CreateStatementWithParams(Info: TStrings): IZStatement; - function PrepareStatementWithParams(const SQL: string; Info: TStrings): + function PrepareStatementWithParams(const SQL: WideString; Info: TStrings): IZPreparedStatement; - function PrepareCallWithParams(const SQL: string; Info: TStrings): + function PrepareCallWithParams(const SQL: WideString; Info: TStrings): IZCallableStatement; function CreateNotification(const Event: string): IZNotification; diff --git a/components/zeosdbo/src/dbc/ZDbcMySql.pas b/components/zeosdbo/src/dbc/ZDbcMySql.pas index 9f73bbbd..292a6951 100644 --- a/components/zeosdbo/src/dbc/ZDbcMySql.pas +++ b/components/zeosdbo/src/dbc/ZDbcMySql.pas @@ -116,7 +116,7 @@ type destructor Destroy; override; function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; procedure Commit; override; @@ -533,7 +533,7 @@ end; @return a new PreparedStatement object containing the pre-compiled statement } -function TZMySQLConnection.CreatePreparedStatement(const SQL: string; +function TZMySQLConnection.CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; diff --git a/components/zeosdbo/src/dbc/ZDbcOracle.pas b/components/zeosdbo/src/dbc/ZDbcOracle.pas index 4a1b0702..4fe6e03d 100644 --- a/components/zeosdbo/src/dbc/ZDbcOracle.pas +++ b/components/zeosdbo/src/dbc/ZDbcOracle.pas @@ -120,7 +120,7 @@ type destructor Destroy; override; function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; procedure Commit; override; @@ -507,11 +507,11 @@ end; @return a new PreparedStatement object containing the pre-compiled statement } -function TZOracleConnection.CreatePreparedStatement(const SQL: string; +function TZOracleConnection.CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; - Result := TZOraclePreparedStatement.Create(FPlainDriver, Self, SQL, Info); + Result := TZOraclePreparedStatement.Create(FPlainDriver, Self, String(SQL), Info); end; {** diff --git a/components/zeosdbo/src/dbc/ZDbcPostgreSql.pas b/components/zeosdbo/src/dbc/ZDbcPostgreSql.pas index 8838356b..8ef094b5 100644 --- a/components/zeosdbo/src/dbc/ZDbcPostgreSql.pas +++ b/components/zeosdbo/src/dbc/ZDbcPostgreSql.pas @@ -164,7 +164,7 @@ TZPgCharactersetType = ( destructor Destroy; override; function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; function CreateSequence(const Sequence: string; BlockSize: Integer): IZSequence; override; @@ -568,11 +568,11 @@ end; pre-compiled statement } function TZPostgreSQLConnection.CreatePreparedStatement( - const SQL: string; Info: TStrings): IZPreparedStatement; + const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; Result := TZPostgreSQLPreparedStatement.Create(FPlainDriver, - Self, SQL, Info, FHandle); + Self, String(SQL), Info, FHandle); end; {** diff --git a/components/zeosdbo/src/dbc/ZDbcSqLite.pas b/components/zeosdbo/src/dbc/ZDbcSqLite.pas index 8e60262e..b0e1a62a 100644 --- a/components/zeosdbo/src/dbc/ZDbcSqLite.pas +++ b/components/zeosdbo/src/dbc/ZDbcSqLite.pas @@ -110,7 +110,7 @@ type destructor Destroy; override; function CreateRegularStatement(Info: TStrings): IZStatement; override; - function CreatePreparedStatement(const SQL: string; Info: TStrings): + function CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; override; procedure Commit; override; @@ -389,11 +389,11 @@ end; @return a new PreparedStatement object containing the pre-compiled statement } -function TZSQLiteConnection.CreatePreparedStatement(const SQL: string; +function TZSQLiteConnection.CreatePreparedStatement(const SQL: WideString; Info: TStrings): IZPreparedStatement; begin if IsClosed then Open; - Result := TZSQLitePreparedStatement.Create(FPlainDriver, Self, SQL, + Result := TZSQLitePreparedStatement.Create(FPlainDriver, Self, String(SQL), Info, FHandle); end;