[GRASS-dev] string madness

Wolf Bergenheim wolf+grass at bergenheim.net
Sat Mar 17 19:06:36 EDT 2007


On 18.03.2007 00:48, Glynn Clements wrote:
>>         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.
> 

Well this occurs if you create an sqlite table with type date (sqlite
allows this since sqlite is typeless and it won't complain).

Then if you connect to it using v.db.connect, it will end up as a DOUBLE
PRECISION layer which is bad. IMO it should default to VARCHAR(255)

Here are the steps I did to reproduce this problem:
first create a table in sqlite:
create table foo(cat int, datum date);
quit and now connect this to a vector map

GRASS 6.3.cvs > v.db.connect layer=2 map=roads table=foo
WARNING: The table <foo> is now part of vector map <roads> and may be
         deleted or overwritten by GRASS modules
WARNING: Select privileges were granted on the table

GRASS 6.3.cvs > v.info map=roads layer=2 -c
Displaying column types/names for database connection of layer 2:
INTEGER|cat
DOUBLE PRECISION|datum
^^^^^^^^^^^^^^^^
This is not right... it should be at least string...

So in other words this might really be an issue... perhaps we should
treat everything which is not numeric as a string when dealing with SQLite?

--Wolf

-- 

<:3 )---- Wolf Bergenheim ----( 8:>




More information about the grass-dev mailing list