BUG 7.0.3 - query with params - dont return any record

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

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

Postby amarildolacerda » 14.05.2013, 17:56

/*

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
Fresh Boarder
Fresh Boarder
Posts: 20
Joined: 27.12.2012, 09:31

Postby serbod » 15.05.2013, 09:44

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

Postby amarildolacerda » 30.08.2013, 03:30

Today, I test you sugestion with 7.0.4.... (fbclient.dll 2.5.3 )
The problem continue the same.

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

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

Postby EgonHugeist » 07.09.2013, 00:08

Hi,

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

You want to help? 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

Postby amarildolacerda » 21.10.2013, 15:26

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: 913
Joined: 11.05.2012, 12:32
Location: Poland

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

Postby miab3 » 22.10.2013, 00:21

@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

Postby amarildolacerda » 08.11.2013, 14:33

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 -- viewtopic.php?f=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 Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

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

Postby EgonHugeist » 09.11.2013, 12:58

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

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

Image


Return to “Firebird”

Who is online

Users browsing this forum: No registered users and 1 guest