[GRASS-user] problem parsing rows with nulls in column(s) during input (was: error importing postgresql db)

Glynn Clements glynn at gclements.plus.com
Tue Jun 2 21:58:28 EDT 2009


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;
}

Except that db_shutdown_driver() should return a useful (and portable)
result, e.g. "WIFEXITED(status) ? WEXITSTATUS(status) : -1" rather
than the raw status.

Also, I'm unclear as to why db_shutdown_driver() only uses
DB_PROC_SHUTDOWN_DRIVER on Windows.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list