[GRASS-dev] implementing drop column into DBF driver

Markus Neteler neteler at itc.it
Fri Feb 2 17:08:54 EST 2007


Martin,

nice, I have tested it successfully (DBF driver).
Also written v.db.dropcol and tested that with DBF and PG
driver.

Once you changes are in CVS, I'll submit v.db.dropcol.
Still it would be good to have more people testing the
proposed patch.

Thanks
Markus

On Fri, Feb 02, 2007 at 05:35:19PM +0100, Martin Landa wrote:
> Hi,
> 
> I have tried to solve this problem. I think in a very ugly way, but it
> seems to work (see the attached patch).
> 
> Regards, Martin
> 
> 2006/12/4, Markus Neteler <neteler at itc.it>:
> >Hi,
> >
> >I tried to implement drop column into DBF driver to get
> >rid of columns like 'cat_' when re-importing an exported map:
> >echo "ALTER TABLE mymap DROP COLUMN cat_" | db.execute
> >
> >Attached the changes to lib/db/sqlp/ and /db/drivers/dbf/
> >
> >The idea is to load the table internally in SQLP_DROP_COLUMN
> >(such as SQLP_ADD_COLUMN does) but to jump over the column
> >which we want to drop.
> >So I took load_table() and made it load_table_selective(),
> >most likely in an ugly way.
> >
> >While ugly, it could work but apparently I never reach
> >SQLP_DROP_COLUMN. It bails out with
> >
> >...
> >D3/3: sql: ALTER TABLE mymap DROP COLUMN cat_
> >D3/3: SQL statement parsed successfully: ALTER TABLE mymap DROP COLUMN cat_
> >...
> >D3/3: add_column(): tab = 11, type = 3, name = edg_id, width = 20, 
> >decimals = 6
> >D3/3: Doing SQL command <8> on DBF table... (see include/sqlp.h)
> >dbmi: Protocol error
> >D2/3: G__home home = /home/neteler
> >ERROR: Error while executing: "ALTER TABLE mymap DROP COLUMN cat_
> >       "
> >
> >I have no clue why. Help is welcome.
> >
> >Thanks,
> >Markus




More information about the grass-dev mailing list