[GRASS-user] problem parsing rows with nulls in column(s) during
input (was: error importing postgresql db)
Markus Neteler
neteler at osgeo.org
Thu Jun 4 15:48:19 EDT 2009
On Wed, Jun 3, 2009 at 3:58 AM, Glynn Clements <glynn at gclements.plus.com> wrote:
>
> Markus Neteler wrote:
>
>> Homework for developers:
>>
>> db_close_database_shutdown_driver() seems to be oversimplified.
>> It calls db_close_database(driver) and db_shutdown_driver(driver)
>> but without testing their return status. Subsequently v.in.ascii cannot
>> issue a G_fatal_error() in case of "dbmi: Protocol error" as it should.
>>
>> db_close_database(driver) looks ok:
>> http://trac.osgeo.org/grass/browser/grass/trunk/lib/db/dbmi_client/c_closedb.c#L26
>>
>> but less sure about db_shutdown_driver(driver):
>> http://trac.osgeo.org/grass/browser/grass/trunk/lib/db/dbmi_client/shutdown.c#L39
>>
>> and not at all about db_close_database_shutdown_driver():
>> http://trac.osgeo.org/grass/browser/grass/trunk/lib/db/dbmi_client/db.c#L62
>> which returns brute-force DB_OK.
>>
>> If db_shutdown_driver(driver) is acceptable, then put if conditions
>> into db_close_database_shutdown_driver() for DB_FAILED on failure?
>
> Something like:
>
> int db_close_database_shutdown_driver(dbDriver * driver)
> {
> int status = db_close_database(driver);
> if (db_shutdown_driver(driver) != 0)
> status = DB_FAILED;
>
> return status;
> }
Thanks, tested and submitted.
> Except that db_shutdown_driver() should return a useful (and portable)
> result, e.g. "WIFEXITED(status) ? WEXITSTATUS(status) : -1" rather
> than the raw status.
... not sure how to implement this...
> Also, I'm unclear as to why db_shutdown_driver() only uses
> DB_PROC_SHUTDOWN_DRIVER on Windows.
... also no idea...
Markus
More information about the grass-user
mailing list