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

2009-04-07 Thread Markus Neteler
On Tue, Apr 7, 2009 at 12:47 AM, Jhon Ortiz eljhonj...@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;

Do you have a possibility to compile and test?

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

2009-04-07 Thread Markus Neteler
On Tue, Apr 7, 2009 at 9:25 AM, Markus Neteler nete...@osgeo.org wrote:
 On Tue, Apr 7, 2009 at 12:47 AM, Jhon Ortiz eljhonj...@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=detailaid=524group_id=21atid=204

 Do you have a possibility to compile and test?

Please :) Or someone else with a running Mysql installation.

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

2009-04-07 Thread Moritz Lennert

On 07/04/09 21:11, Jhon Ortiz wrote:


  On Tue, Apr 7, 2009 at 9:25 AM, Markus Neteler nete...@osgeo.org wrote:
   On Tue, Apr 7, 2009 at 12:47 AM, Jhon Ortiz 
eljhonj...@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=detailaid=524group_id=21atid=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..


The following (in combination with Marjus' patch) might make it work 
with decimal:


Index: lib/db/dbmi_base/sqlCtype.c
===
--- lib/db/dbmi_base/sqlCtype.c (révision 36609)
+++ lib/db/dbmi_base/sqlCtype.c (copie de travail)
@@ -17,6 +17,8 @@
return DB_C_TYPE_DOUBLE;
 case DB_SQL_TYPE_DOUBLE_PRECISION:
return DB_C_TYPE_DOUBLE;
+case DB_SQL_TYPE_DECIMAL:
+   return DB_C_TYPE_DOUBLE;
 case DB_SQL_TYPE_SERIAL:
return DB_C_TYPE_INT;
 }

But I'm not sure whether it might have any negative consequences to 
automatically associate decimal with double. I can't think of anything 
obvious, but needs testing.


Moritz
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

2009-04-07 Thread Markus Neteler
On Tue, Apr 7, 2009 at 9:11 PM, Jhon Ortiz eljhonj...@hotmail.com wrote:
 On Tue, Apr 7, 2009 at 9:25 AM, Markus Neteler nete...@osgeo.org wrote:
  On Tue, Apr 7, 2009 at 12:47 AM, Jhon Ortiz eljhonj...@hotmail.com
...
  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,
...
(unrelated error + fix skipped)

 ... and now is working..

Excellent.
Fixed in 6.4.svn, 6.5.svn and 7.svn.

Markus
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

2009-04-06 Thread Jhon Ortiz

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
Writing features...
Segmentation fault

In my MySQL database table Salinity_Index are decimals numbers and the column 
type is DECIMAL(6,3) NULLMy question is, Can I work with decimals number in 
module v.in.db?

Need I work with decimals numbers in other column type, maybe FLOAT, DOUBLE?

I'm using GRASS 6.4.0RC3 in ubuntu Hardy and MySQL 5.0.51a-3ubuntu5.4

Some advice?

Regards,


John Ortiz
Bioestratigraphic 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 ___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user