[bug_fixed] wrong fieldtype mapping

In this forum all bug reports concerning the 6.x branch will be gahtered. You have the possibility to track the bug fix process.

Moderators: EgonHugeist, mdaems

dcd
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 23.11.2006, 14:44

[bug_fixed] wrong fieldtype mapping

Postby dcd » 23.11.2006, 15:11

hi!

i started to use zeos with firebird recently (after forget ibx), all was fine, until now.

i have a select like this:

select t1.someStringField, t2.someFloatField*t1.someIntField as someName
from TABLE1 t1
left outer join TABLE2 t2 on ... etc.

when i open the query, the DataType of the second field will be ftInteger, instead of ftFloat! :cry:

but if i remove the first field from the select (t1.someStringField), the DataType will be ftFloat, which is correct!
another solution is to exchange the order of fields in t2.someFloatField*t1.someIntField to t1.someIntField*t2.someFloatField. it will also give me ftFloat, nice.

i debugged a bit, and found the method TZAbstractResultSetMetadata.ReadColumnByName where things go wrong:

Code: Select all

  if not TableColumns.IsNull(5) then
    ColumnInfo.ColumnType := TZSQLType(TableColumns.GetInt(5));

before the above line, the ColumnInfo.ColumnType is ok (float), but it overwrites it to integer, don't really understand why?


i have ton's of sql's, so please don't tell me to review all of them. :(

thanks

User avatar
cipto_kh
Senior Boarder
Senior Boarder
Posts: 83
Joined: 28.09.2005, 11:22
Location: Indonesia
Contact:

Re: wrong fieldtype mapping

Postby cipto_kh » 24.11.2006, 09:16

Yes, I had this problem too :( and one of my solution to casting that field into number(n,m), but it need more attention (since you must add this after you look that your field doesn't behave correctly) :(

Is anybody know it only problem with Firebird or other DB will act like this too?

DarthWombat
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.01.2009, 06:44

Postby DarthWombat » 15.01.2009, 06:48

G'day...
It looks like I'm getting this problem with PostgreSQL 7 as well. Has anyone addressed this issue since your last post?
Regards,
Alex

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Postby mdaems » 15.01.2009, 11:05

Did you find a corresponding bug report with sample project in the bug tracker at http://zeosbugs.firmos.at/ ? If not, please file a report with (the simplest possible) test case attached. Don't forget table creation/population scripts. I've postgres installed since some time, so I can test using pg now.
I'm limited in time, however. So the better the test cases are, the sooner I'l have a look at it.

Mark
Image

DarthWombat
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.01.2009, 06:44

Postby DarthWombat » 15.01.2009, 22:13

G'day...

I'm pretty sure that this is the same issue:
http://zeosbugs.firmos.at/view.php?id=150

It does appear that this problem would be exhibited across all database engines. A possible work-around might be to explicitly specify the table name for fields in the select clause, but this may not work every time.

I hope this helps.

DarthWombat
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 15.01.2009, 06:44

Postby DarthWombat » 18.01.2009, 23:09

G'day again...

It looks like Mark has fixed this issue by patching ZGenericSqlAnalyser.pas (http://fisheye2.atlassian.com/changelog/zeos/?cs=568). I have thrown a few test cases at it and it appears to be fine now.

I mistakenly thought there might be some remaining issues with sub-queries, but all is well because I don't think there is any overwriting of column attributes from metadata for fields returned by subqueries.

Thanks, Mark, for solving this problem so quickly!

Alex. :thanks:

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Postby mdaems » 19.01.2009, 08:37

Hi Alex,

If everybody who found an error would debug as much as you did, zeoslib would have been free of bugs by now. Without your work this ug would have been around much longer. I'll make sure the patch will be merged into the 6.6-patches branch soon. So it will be available in next maintenance release for version 6.6.

Mark
Image


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest