[GRASS-dev] string madness

Glynn Clements glynn at gclements.plus.com
Sat Mar 17 18:48:33 EDT 2007


Markus Neteler wrote:

> With DEBUG=4 I get output from get_column_info() in describe.c
> 
> ...
> D4/4: decltype = varchar ( 80 )
> D3/4: litetype = 3
> D2/4: col: condatm, nkcols 12, litetype : 3, sqltype 13
> D4/4: decltype = date			<--- from PostgreSQL originally
> D3/4: litetype = 2			<--- should be 3 ideally
> D2/4: col: datacens, nkcols 13, litetype : 2, sqltype 6   <-- the problem
> D4/4: decltype = varchar ( 80 )
> D3/4: litetype = 3
> D2/4: col: datains, nkcols 14, litetype : 3, sqltype 13
> D4/4: decltype = varchar ( 80 )
> D3/4: litetype = 3
> ...
> 
> #### some minutes later ###########
> 
> I GOT IT!
> 
> this patch:
> diff -u -r1.4 describe.c
> --- describe.c  4 Jul 2006 09:24:14 -0000       1.4
> +++ describe.c  17 Mar 2007 22:34:08 -0000
> @@ -199,7 +199,11 @@
>         *litetype = sqlite3_column_type ( statement, col );
>      }
> 
> -    G_debug ( 3, "litetype = %d", *litetype );
> +    /* Date support hack */
> +    if ( strcmp(decltype, "date") == 0 ) {
> +       *litetype = SQLITE_TEXT;
> +       G_debug ( 4, " date found, new litetype = %d", *litetype );
> +    }
> 
>      switch ( *litetype) {
>         case SQLITE_INTEGER:

This patch is entirely inappropriate. You're adding a hack to fix a
specific broken table. Instead, you need to figure out why the table
is getting created wrong in the first place. Once that's fixed, you
don't need this hack.

> Submitted to CVS.

And about to be reverted.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list