[GRASS-dev] adding 'desc' to dbf sql driver

Moritz Lennert mlennert at club.worldonline.be
Fri Sep 22 05:09:34 EDT 2006


Hi,

Reworking on d.vect.chart I need to be able to sort the reults of a 
select in descending order. As the dbf driver doesn't allow this, I have 
been trying to see how to extend the driver.

IIUC, it's "just" a question of conditionalising the qsort call on line 
566 of db/drivers/dbf/dbfexe.c, and (would this be enough ?) use

qsort(set, nset, sizeof(int), -cmp_row);

if the desc keyword is present.

However, I have some trouble understanding the parsing of the sql 
statement.

If I understand correctly, we would need to extent the SQLPSTMT 
structure in include/sqlp.h to include a flag for 'desc' (and possible 
'asc') and the parser to identify and set that flag.

But this is as far as I get. Could someone help me with this ?

Thanks,

Moritz




More information about the grass-dev mailing list