BUG 7.0.3 - query with params - dont return any record

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
amarildolacerda
Junior Boarder
Junior Boarder
Posts: 30
Joined: 12.08.2011, 12:42
Location: Brazil
Contact:

BUG 7.0.3 - query with params - dont return any record

Post 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


*/
serbod
Junior Boarder
Junior Boarder
Posts: 27
Joined: 27.12.2012, 09:31

Post 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;
amarildolacerda
Junior Boarder
Junior Boarder
Posts: 30
Joined: 12.08.2011, 12:42
Location: Brazil
Contact:

Re: BUG 7.0.3 - query with params - dont return any record

Post by amarildolacerda »

Today, I test you sugestion with 7.0.4.... (fbclient.dll 2.5.3 )
The problem continue the same.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: BUG 7.0.3 - query with params - dont return any record

Post by EgonHugeist »

Hi,

do we really talk about firebird? I'll check your issue..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
amarildolacerda
Junior Boarder
Junior Boarder
Posts: 30
Joined: 12.08.2011, 12:42
Location: Brazil
Contact:

Re: BUG 7.0.3 - query with params - dont return any record

Post 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
miab3
Zeos Test Team
Zeos Test Team
Posts: 1309
Joined: 11.05.2012, 12:32
Location: Poland

Re: BUG 7.0.3 - query with params - dont return any record

Post 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
amarildolacerda
Junior Boarder
Junior Boarder
Posts: 30
Joined: 12.08.2011, 12:42
Location: Brazil
Contact:

Re: BUG 7.0.3 - query with params - dont return any record

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: BUG 7.0.3 - query with params - dont return any record

Post 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.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Post Reply