[GRASS-dev] implementing drop column into DBF driver

Martin Landa landa.martin at gmail.com
Fri Feb 2 11:35:19 EST 2007


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
>
>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>
>
>


-- 
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbf-drop-col-3.diff.gz
Type: application/x-gzip
Size: 2060 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20070202/84ce75e4/dbf-drop-col-3.diff.gz


More information about the grass-dev mailing list