mysql_query syntax error while sql string have length more than 256 chars
I have an error like this :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bla..bla..' at line 1.
while call my function below:
function InsertSQL(strSQL: AnsiString; CS: TCriticalSection; var ErrMsg: AnsiString): boolean;
var
td: TDBCfg;
SockMySQL: PMySQL;
SQL: PChar;
begin
CS.Acquire;
Result := False;
try
{alokasi memory query}
SQL := StrAlloc(Length(strSQL)+1);
{Get database settings}
td := TDbCfg.Create;
td := GetDbConfig;
{Make MySQL Connection}
if CreateDbConn(td, SockMySQL, ErrMsg) then
begin
StrPCopy(SQL, strSQL);
if mysql_query(SockMySQL, SQL) <> 0 then
ErrMsg := 'InsertSQL->'+PCharToStr(mysql_error(SockMySQL))
else
Result := True;
end;
except on E:Exception do
ErrMsg := 'InsertSQL->'+E.Message;
end;
td.Free;
StrDispose(SQL);
mysql_close(SockMySQL);
CS.Release;
end;
The function always got this error while length of my strSQL contains more than 256 chars.
Anyone can help me to fix this function?
Thanks and best regard!
Subject
Written By
Posted
mysql_query syntax error while sql string have length more than 256 chars
August 31, 2010 08:11PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.