Page 1 of 1
BUG 7.0.3 - query with params - dont return any record
Posted: 14.05.2013, 17:56
by amarildolacerda
/*
CREATE TABLE CTPROD_ATALHO_TITULO (
CODIGO DOUBLE PRECISION NOT NULL,
NOME CHAR(20),
PRIORIDADE DOUBLE PRECISION
);
insert into CTPROD_ATALHO_TITULO (codigo,nome) values (3,'TEST');
*/
db := TZConnection.create(self);
db.Protocol := 'firebird-2.5';
db.User := 'sysdba';
db.Password := 'masterkey';
db.Database := 'c:\dados\store_paf.fdb';
db.HostName := 'maquinareal';
db.LibraryLocation := 'c:\windows\system32\fbclient.dll';
db.Connect;
// dont work - ( I roolback my code to 7.0-beta... its not work )
q:=TZQuery.create(self);
try
q.SQL.Text := 'select * from ctprod_atalho_titulo where codigo=:codigo';
q.Connection := db;
q.ParamByName('codigo').asString := '3';
q.open;
if q.eof then
showMessage('Did not keep any record, but there was...');
finally
q.free;
end;
// work Fine
q:=TZQuery.create(self);
try
q.SQL.Text := 'select * from ctprod_atalho_titulo where codigo=''3'' ';
q.Connection := db;
q.open;
if q.eof=false then
showMessage('Ok this work ...');
finally
q.free;
end;
/*
if I change to -> q.paramByName('codigo').asInteger := 3; its work fine
*/
Posted: 15.05.2013, 09:44
by serbod
Try this:
q.Connection := db;
q.SQL.Text := 'select * from ctprod_atalho_titulo where codigo=:codigo';
q.Prepare;
q.ParamByName('codigo').asString := '3';
q.open;
Re: BUG 7.0.3 - query with params - dont return any record
Posted: 30.08.2013, 03:30
by amarildolacerda
Today, I test you sugestion with 7.0.4.... (fbclient.dll 2.5.3 )
The problem continue the same.
Re: BUG 7.0.3 - query with params - dont return any record
Posted: 07.09.2013, 00:08
by EgonHugeist
Hi,
do we really talk about firebird? I'll check your issue..
Re: BUG 7.0.3 - query with params - dont return any record
Posted: 21.10.2013, 15:26
by amarildolacerda
Yes, Its Firebird 2.5.3
I Updated to 7.1.2-Stable...
I did the same test and the problem appear too.
Its not solved.
-----------------------------------------
Inspecting Zeos Code, I think that occur in :
GetPlainDriver.isc_dsql_execute2(@FStatusVector, GetTrHandle, @StmtHandle,
GetDialect, FParamSQLData.GetData, SQLData.GetData); //expecting a result
Re: BUG 7.0.3 - query with params - dont return any record
Posted: 22.10.2013, 00:21
by miab3
@amarildolacerda,
Open \dbc\ZDbcInterbaseUtils.pas and
replace line 2543:
SQL_LONG : PInteger (sqldata)^ := Round(ZStrToFloat(Value) * IBScaleDivisor[sqlscale]); //AVZ
with:
SQL_LONG : PInteger (sqldata)^ := StrToInt(String(Value));
Michal
Re: BUG 7.0.3 - query with params - dont return any record
Posted: 08.11.2013, 14:33
by amarildolacerda
Hello Michel,
I notice that my datatype was DOUBLE (not LONG), then I do this change... Its work ok. (7.1.2-stable).
I think is better to see with AVZ why this dont work...
case SQLCode of
SQL_TEXT : EncodeString(SQL_TEXT, Index, Value);
SQL_VARYING : EncodeString(SQL_VARYING, Index, Value);
// SQL_LONG : PInteger (sqldata)^ := Round(ZStrToFloat(Value) * IBScaleDivisor[sqlscale]); //AVZ --
http://zeoslib.sourceforge.net/viewtopi ... =17&t=3767
SQL_LONG : PInteger (sqldata)^ := StrToInt(String(Value));
SQL_SHORT : PInteger (sqldata)^ := StrToInt(String(Value));
SQL_TYPE_DATE : EncodeString(SQL_DATE, Index, Value);
// SQL_DOUBLE : PDouble (sqldata)^ := ZStrToFloat(Value) * IBScaleDivisor[sqlscale]; //AVZ
SQL_DOUBLE : PDouble (sqldata)^ := ZStrToFloat(Value) ;//* IBScaleDivisor[sqlscale]; //AVZ
// SQL_D_FLOAT,
// SQL_FLOAT : PSingle (sqldata)^ := ZStrToFloat(Value) * IBScaleDivisor[sqlscale]; //AVZ
// SQL_INT64 : PInt64(sqldata)^ := Trunc(ZStrToFloat(Value) * IBScaleDivisor[sqlscale]); //AVZ - INT64 value was not recognized
SQL_D_FLOAT,
SQL_FLOAT : PSingle (sqldata)^ := ZStrToFloat(Value);//* IBScaleDivisor[sqlscale]; //AVZ
SQL_INT64 : PInt64(sqldata)^ := Trunc(ZStrToFloat(Value));//* IBScaleDivisor[sqlscale]); //AVZ - INT64 value was not recognized
Re: BUG 7.0.3 - query with params - dont return any record
Posted: 09.11.2013, 12:58
by EgonHugeist
amarildolacerda wrote:QL_DOUBLE : PDouble (sqldata)^ := ZStrToFloat(Value) ;//* IBScaleDivisor[sqlscale]; //AVZ
seems corect to me. I'll apply this patch.
amarildolacerda wrote:QL_D_FLOAT,
SQL_FLOAT : PSingle (sqldata)^ := ZStrToFloat(Value);//* IBScaleDivisor[sqlscale]; //AVZ
SQL_INT64 : PInt64(sqldata)^ := Trunc(ZStrToFloat(Value));//* IBScaleDivisor[sqlscale]); //AVZ - INT64 value was not recognized
nope i don't think this is right to omit the IBScaleDivisor[sqlscale] for SQL_INT64 but the index of IBScaleDivisor[sqlscale] can be wrong.
So i'll check the changes now.