In unit ZPlainMySQLDriver.pas function "TZMySQL40PlainDriver.SetAutocommit" is incorrect
[syntax="delphi"]
function TZMySQL40PlainDriver.SetAutocommit(Handle: PZMySQLConnect; mode: Boolean): Boolean;
var
query: AnsiString;
testResult: Integer;
begin
if (mode = True) then
query := 'AUTOCOMMIT=1'
else
query := 'AUTOCOMMIT=0';
testResult := MYSQL_API.mysql_query(ZPlainMySql40.PMYSQL(Handle),pchar(query));
Result := (testResult = 0);
end;
[/syntax]
Correct is
[syntax="delphi"]
function TZMySQL40PlainDriver.SetAutocommit(Handle: PZMySQLConnect; mode: Boolean): Boolean;
var
query: AnsiString;
testResult: Integer;
begin
if (mode = True) then
query := 'SET AUTOCOMMIT=1' // Add SET
else
query := 'SET AUTOCOMMIT=0'; // Add SET
testResult := MYSQL_API.mysql_query(ZPlainMySql40.PMYSQL(Handle),pchar(query));
Result := (testResult = 0);
end;
[/syntax]
autocommit
Moderators: gto, cipto_kh, EgonHugeist
autocommit
Dorin Hongu
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi Dorin,
Thanks for this report. Does this missing 'Set' cause the function call to fail? As far as I remember it always was without SET and this is the first complaint. For mysql versions 4.1 and up we use a direct library call.
Well, I'll change it like you said. Should it also be changed for mysql3.xx?
Can you please file new bugs in the bug tracker?
Mark
Thanks for this report. Does this missing 'Set' cause the function call to fail? As far as I remember it always was without SET and this is the first complaint. For mysql versions 4.1 and up we use a direct library call.
Well, I'll change it like you said. Should it also be changed for mysql3.xx?
Can you please file new bugs in the bug tracker?
Mark
Always was without SET but function never call.
Old procedure not call FPlaindriver.SetAutocommit
[syntax="delphi"]
procedure TZMySQLConnection.SetAutoCommit(AutoCommit: Boolean);
var
SQL: PChar;
begin
if AutoCommit <> Self.AutoCommit then
begin
inherited SetAutoCommit(AutoCommit);
if not Closed then
begin
if AutoCommit then
SQL := 'SET AUTOCOMMIT=1'
else SQL := 'SET AUTOCOMMIT=0';
FPlainDriver.ExecQuery(FHandle, SQL);
CheckMySQLError(FPlainDriver, FHandle, lcExecute, SQL);
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, SQL);
end;
end;
end;
[/syntax]
new procedure call FPlaindriver.SetAutocommit
[syntax="delphi"]
procedure TZMySQLConnection.SetAutoCommit(AutoCommit: Boolean);
begin
if AutoCommit <> Self.AutoCommit then
begin
inherited SetAutoCommit(AutoCommit);
if not Closed then
begin
if not FPlaindriver.SetAutocommit(FHandle, AutoCommit) then
CheckMySQLError(FPlainDriver, FHandle, lcExecute, 'Native SetAutoCommit '+BoolToStrEx(AutoCommit)+'call');
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, 'Native SetAutoCommit '+BoolToStrEx(AutoCommit)+'call');
end;
end;
end;
[/syntax]
Old procedure not call FPlaindriver.SetAutocommit
[syntax="delphi"]
procedure TZMySQLConnection.SetAutoCommit(AutoCommit: Boolean);
var
SQL: PChar;
begin
if AutoCommit <> Self.AutoCommit then
begin
inherited SetAutoCommit(AutoCommit);
if not Closed then
begin
if AutoCommit then
SQL := 'SET AUTOCOMMIT=1'
else SQL := 'SET AUTOCOMMIT=0';
FPlainDriver.ExecQuery(FHandle, SQL);
CheckMySQLError(FPlainDriver, FHandle, lcExecute, SQL);
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, SQL);
end;
end;
end;
[/syntax]
new procedure call FPlaindriver.SetAutocommit
[syntax="delphi"]
procedure TZMySQLConnection.SetAutoCommit(AutoCommit: Boolean);
begin
if AutoCommit <> Self.AutoCommit then
begin
inherited SetAutoCommit(AutoCommit);
if not Closed then
begin
if not FPlaindriver.SetAutocommit(FHandle, AutoCommit) then
CheckMySQLError(FPlainDriver, FHandle, lcExecute, 'Native SetAutoCommit '+BoolToStrEx(AutoCommit)+'call');
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, 'Native SetAutoCommit '+BoolToStrEx(AutoCommit)+'call');
end;
end;
end;
[/syntax]
Dorin Hongu