[GRASS-dev] implementing drop column into DBF driver

Daniel Calvelo dca.gis at gmail.com
Tue Dec 5 01:28:04 EST 2006


Hi Markus,

Check st->nCol and whether st->Col[0] exist at the time you call
load_table_selective. It seems that the bang happens around the point
you call the function; the sqpAddColumn should have put your colname
there, but...

Daniel.

On 12/4/06, Markus Neteler <neteler at itc.it> wrote:
> 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
>
>
>


-- 
-- Daniel Calvelo Aros




More information about the grass-dev mailing list