[SOLVED] ClientCodepage don't apply to Parameters SQL query
Posted: 04.04.2012, 10:00
I have MySQL base with cp1251 codepage tables
ZConnection.ClientCodepage: cp1251
If i use
then data inserted in correct codapge, but if
then data inserted in UTF-8 regardless of the setting ClientCodepage and this method impossible for me. As I understand it this occurs in ZDbcMySqlStatement unit:
How to fix it?
Zeos from SVN /trunk, revision 1082
Delphi XE
ZConnection.ClientCodepage: cp1251
If i use
Code: Select all
ZQuery.SQL.Text:='INSERT INTO `testtable` (`name`) VALUES (''сyrillic text Текст'')';
ZQuery.ExecSQL;
Code: Select all
ZQuery.SQL.Text:='INSERT INTO `testtable` (`name`) VALUES (:txtparam)';
ZQuery.Params[0].AsString:='сyrillic text Текст';
ZQuery.ExecSQL;
Code: Select all
function TZMySQLEmulatedPreparedStatement.GetEscapeString(const Value: string): string;
...
{$IFDEF DELPHI12_UP}
BufferLen := FPlainDriver.GetEscapeString(Buffer, PAnsiChar(UTF8Encode(Value)), Length(PAnsiChar(UTF8Encode(Value))))
else
BufferLen := FPlainDriver.GetRealEscapeString(FHandle, Buffer, PAnsiChar(UTF8Encode(Value)), Length(PAnsiChar(UTF8Encode(Value))));
...
end;
Zeos from SVN /trunk, revision 1082
Delphi XE