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

Moritz Lennert mlennert at club.worldonline.be
Wed Oct 22 12:02:30 EDT 2008


On 22/10/08 17:45, Glynn Clements wrote:
> 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:

Duh, should have seen this if I had looked more carefully ! Thanks. 
Committed.

Moritz


More information about the grass-dev mailing list