I'm using PostgreSQL 8.3 since this version has been released, always with Zeos Query, ROQuery etc.. But I'm new on ZMetadata component.
In past I get metadata from PostgreSQL using direct queries, which precess was not so easy to do. My reference was always this wiki http://pt.wikibooks.org/wiki/PostgreSQL ... /Metadados (don't know about english version).
However, inspecting metadata result, I've noticed missing and incorrect information about numeric type. Numeric type in Pg is defined by precision and scale ( see http://www.postgresql.org/docs/8.3/inte ... IC-DECIMAL).
Since data returning by metadata seems to be wrong, I turn back to those old SQL scripts and changed Zeos code a little, for testing, so:
unit ZDbcPostgreSqlMetadata.pas
else if (PgType = 'numeric') or (PgType = 'decimal') then
begin
{
//Old code here
AttTypMod := GetInt(8) - 4;
Result.UpdateInt(7, (AttTypMod shr 16) and $FFFF);
Result.UpdateInt(9, AttTypMod and $FFFF);
Result.UpdateInt(10, 10);
}
AttTypMod := GetIntByName('atttypmod') - 4;
Result.UpdateInt(7, (AttTypMod div 65536)); //precision
Result.UpdateInt(9, (AttTypMod mod 65536)); //scale
Result.UpdateInt(10, 10); //base?
Here's my point: those changes solved my problem, and inspecting the whole system, seems to work fine. But, are those changes accurate?
[patch_done] PgSQL - Possible metadata mistaken information
Moderators: gto, EgonHugeist
-
- Fresh Boarder
- Posts: 6
- Joined: 08.07.2009, 21:20
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi, I suppse you're more a postgres expert than I am. So I suppose your changes are accuate.
However, concerning performance I would like to see you using GetInt instead of GetIntByName. (ByName involves an extra array search). Can you cange yur patch and test it for your test case? Afterwards I'll feed the change to the test suite to see if that keeps running.
Mark
However, concerning performance I would like to see you using GetInt instead of GetIntByName. (ByName involves an extra array search). Can you cange yur patch and test it for your test case? Afterwards I'll feed the change to the test suite to see if that keeps running.
Mark
-
- Fresh Boarder
- Posts: 6
- Joined: 08.07.2009, 21:20
Since there was many places in this procedure where Get<field>ByName was used, and SQL for 7.4 and above PostgreSQL versions return absolutelly the same columns, there were no excuses for using "ByName" statements. So I made a little more improvements on code, removing all "ByName"s.
It would be desirable to remove every "ByName" statement in this unit. Maybe I got time to do it next week
(Changes Attached)
It would be desirable to remove every "ByName" statement in this unit. Maybe I got time to do it next week
(Changes Attached)
You do not have the required permissions to view the files attached to this post.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
shmarchiori,
Thanks for the patch!
Do you care doing your changes against svn testing branch (or trunk or a snapshot)? Because I want to do patches as much as possible in testing branch and trunk first before backporting them to 6.6-patches. And the dbc metadata units have changed quite a lot between 6.6 and 7.x so it's difficult to compare changed 6.6 version to 7.x versions using winmerge.
SVN. Rev 673.
Mark
Thanks for the patch!
Do you care doing your changes against svn testing branch (or trunk or a snapshot)? Because I want to do patches as much as possible in testing branch and trunk first before backporting them to 6.6-patches. And the dbc metadata units have changed quite a lot between 6.6 and 7.x so it's difficult to compare changed 6.6 version to 7.x versions using winmerge.
SVN. Rev 673.
Mark
-
- Fresh Boarder
- Posts: 6
- Joined: 08.07.2009, 21:20
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
shmarchiori,
You'll have to decide if you want to have a second, experimental version of zeoslib (7.X) hanging around on your computer. With the possible risk of using the wrong version for your real projects.
If no : Just do as you did today : change your 6.6 copy and send me the new version. I'll compare and dat the right changes in testing branch. This is more work for me. But reasonable for small patches.
If yes : download the most recent testing or trunk version from http://zeosdownloads.firmos.at/downloads/snapshots/ or use svn to checkout a working copy from the repository directly. See here for more information ("Downloading" paragraph). There's also a link to a very small manual about svn usage.
After downloading you can do the changes to the 7.x version, and test them. Then you can send me the changed file again that can easily merge, test and commit. Or when you're using svn, you can send an svn diff(patch) file. That's even easier.
Mark
You'll have to decide if you want to have a second, experimental version of zeoslib (7.X) hanging around on your computer. With the possible risk of using the wrong version for your real projects.
If no : Just do as you did today : change your 6.6 copy and send me the new version. I'll compare and dat the right changes in testing branch. This is more work for me. But reasonable for small patches.
If yes : download the most recent testing or trunk version from http://zeosdownloads.firmos.at/downloads/snapshots/ or use svn to checkout a working copy from the repository directly. See here for more information ("Downloading" paragraph). There's also a link to a very small manual about svn usage.
After downloading you can do the changes to the 7.x version, and test them. Then you can send me the changed file again that can easily merge, test and commit. Or when you're using svn, you can send an svn diff(patch) file. That's even easier.
Mark
-
- Fresh Boarder
- Posts: 6
- Joined: 08.07.2009, 21:20