[GRASS-user] v.in.db accept DECIMAL'S?

Jhon Ortiz eljhonjhon at hotmail.com
Tue Apr 7 15:11:10 EDT 2009



> On Tue, Apr 7, 2009 at 9:25 AM, Markus Neteler <neteler at osgeo.org> wrote:
> > On Tue, Apr 7, 2009 at 12:47 AM, Jhon Ortiz <eljhonjhon at hotmail.com> wrote:
> >> Hi all,
> >>
> >> I'm trying to create a new vector (points) map from a mysql database table
> >>
> >> v.in.db --overwrite table=data_wells driver=mysql
> >> database="host=localhost,dbname=Eoceno" x=Este y=Norte z=Salinity_Index
> >> key=Cat output=Pozos
> >>
> >> but I get this error:
> >>
> >> WARNING: MySQL driver: column 'Salinity_Index', type 246 is not supported
> >
> >
> > I have searched that and found
> >
> > grep 246 /usr/include/mysql/mysql_com.h
> >                        MYSQL_TYPE_NEWDECIMAL=246,
> >
> > I suspect that this change is sufficient to solve the problem:
> > --- db/drivers/mysql/describe.c (revision 36267)
> > +++ db/drivers/mysql/describe.c (working copy)
> > @@ -177,6 +177,7 @@
> >        break;
> >
> >     case MYSQL_TYPE_DECIMAL:
> > +    case MYSQL_TYPE_NEWDECIMAL:
> >        *sqltype = DB_SQL_TYPE_DECIMAL;
> >        break;
> 
> Ah, I already suggested it in 2007 to someone else but there was
> no feedback:
> https://wald.intevation.org/tracker/index.php?func=detail&aid=524&group_id=21&atid=204
> 
> > Do you have a possibility to compile and test?
> 
> Please :) Or someone else with a running Mysql installation.
> 

Thanks for your help Markus,

I change in

db/drivers/mysql/describe.c

case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
     *sqltype = DB_SQL_TYPE_DECIMAL;
       break;

and then compiled..

Now, when I tried

v.in.db --overwrite table=data_wells driver=mysql database="host=localhost,dbname=Eoceno" 
x=Este y=Norte z=Salinity_Index key=Cat output=Pozos3

The error is:

Writing features...
ERROR: x/y/z column must be integer or double

I change the decimal type by double in mi MySQL database table and now is working..

Thanks again,


John Ortiz
Biostratigraphic Group - ICP
Bogotá - Colombia



_________________________________________________________________
Más rápido, sencillo y seguro. Descárgate ya el nuevo Internet Explorer 8 ¡Es gratis!
http://www.vivelive.com/ie8 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20090407/91a4faee/attachment.html


More information about the grass-user mailing list