[GRASS-dev] Re: [GRASS GIS] #338: d.vect / v.univar does not work for layer > 1 ; v.db.join has bugs (corrected here)

Glynn Clements glynn at gclements.plus.com
Wed Oct 22 11:45:58 EDT 2008


Moritz Lennert wrote:

> >  > 2) v.db.join: The layer option was missing in v.db.addcol and, in
> >  db.execute, 'driver' and 'database' options were missing thus breaking it
> >  for layer > 1
> > 
> >  Fixed in Revision 33971.
> 
> I would like to port this to grass7. Does attached diff look correct 
> (seems straightforward, but no experience with python scripting, yet, so 
> just making sure) ?

> -	if grass.run_command('v.db.addcol', map = map, columns = colspec) != 0:
> +	if grass.run_command('v.db.addcol', map = map, columns = colspec, layer = layer) != 0:

This looks okay.

>  	stmt = template.substitute(table = maptable, column = column,
>  				   otable = otable, ocolumn = ocolumn,
> -				   colname = colname)
> +				   colname = colname, database = database, driver = driver)

This won't do anything, as the template doesn't contain substitutions
for $database and $driver. Nor can they be added, as the template is
just the SQL statement. The database and driver would need to be
passed to db.execute, e.g.:

-	if grass.write_command('db.execute', stdin = stmt) != 0:
+	if grass.write_command('db.execute', stdin = stmt, database = database, driver = driver) != 0:

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


More information about the grass-dev mailing list