On Mon, Jul 19, 2010 at 3:25 PM, Markus Neteler <[email protected]> wrote: > Hi, > > I am connected to a PostgreSQL database with a timestamp column. > While column type connection etc works there is a problem with the > leading "0". > > The original timestamp > 2010-03-26 05:31:25 > is printed by v.db.select as > 2010-3-26 5:31:25 > > Below an excerpt of debug output: > > D3/3: row = 99 nrows = 100 > D3/3: row 99, col 0, gpgtype 8, sqltype 6: val = '38.1958365' > D3/3: row 99, col 1, gpgtype 8, sqltype 6: val = '15.9744719' > D3/3: row 99, col 2, gpgtype 3, sqltype 3: val = '976451' > D3/3: row 99, col 9, gpgtype 16, sqltype 11: val = '2010-03-26 > 05:31:25' <<--- correctly fetched by PG driver > D3/3: Row fetched > D0/3: sqltype: 6 > D0/3: Fetched valuestring: 38.1958365 > D0/3: sqltype: 6 > D0/3: Fetched valuestring: 15.9744719 > D0/3: sqltype: 3 > D0/3: Fetched valuestring: 976451 > D0/3: sqltype: 6 > D0/3: Fetched valuestring: > D0/3: sqltype: 3 > D0/3: Fetched valuestring: > D0/3: sqltype: 3 > D0/3: Fetched valuestring: > D0/3: sqltype: 6 > D0/3: Fetched valuestring: > D0/3: sqltype: 3 > D0/3: Fetched valuestring: > D0/3: sqltype: 3 > D0/3: Fetched valuestring: > D0/3: sqltype: 11 > D0/3: Fetched valuestring: 2010-3-26 5:31:25 <--- > db_convert_column_value_to_string() failed > 38.1958365|15.9744719|976451|||||||2010-3-26 5:31:25 > > As far as I understand, the formatting is getting lost in > > lib/db/dbmi_base/columnfmt.c > db_convert_column_value_to_string() > > which calls > db_get_column_value() > > Is a kind of internal string conversion needed to maintain the leading "0"? > No clue...
As far as I understand C, db_convert_column_value_to_string() calls lib/db/dbmi_base/valuefmt.c db_convert_value_to_string() that calls, in the datetime case: lib/db/dbmi_base/datetime.c db_convert_value_datetime_into_string() I propose r42866 (trunk), backported to 6.5 and 6.4. cheers! anne -- http://gis.fem-environment.eu/anne-ghisla/ _______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
