Python/mSQL Interface 
Author Message
 Python/mSQL Interface

I have experienced a problem with the mSQL module running on Solaris 2.3, using
mSQL 1.0.13 and python 1.3.  Both the mSQL server and the Python are running on
the same machine.  If anyone has any ideas I would be grateful.

The problem is that real values inserted into the database come out garbled, even
though I can check the underlying database and see that they are stored OK.

Here is an example dump of a test table:

   #
   # mSQL Dump  (requires mSQL-1.0.6 or better)
   #
   # Host: localhost    Database: test
   #--------------------------------------------------------

   #
   # Table structure for table 'bar'
   #
   CREATE TABLE bar (
     Url CHAR(100) NOT NULL PRIMARY KEY,
     Heur REAL
   ) \g

   #
   # Dumping data for table 'bar'
   #

   INSERT INTO bar VALUES ('three',5.6)\g
   INSERT INTO bar VALUES ('two',3.4)\g
   INSERT INTO bar VALUES ('one',1.2)\g

Now when I try to access this from Python:

   Python 1.3 (Dec  5 1995)  [GCC 2.7.0]
   Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
   >>> import mSQL
   >>> a = mSQL.connect()
   >>> a.selectdb('test')
   >>> a.query('select * from bar')
   [('three', 2.42078977486e-308), ('two', 2.42092558259e-308), ('one', 2.42102743839e-308)]

So for instance 5.6 has been translated to 2.42078977486e-308

Marko

.Marko Balabanovic.......Department of Computer Science....................

.Gates Building 1A       Phone: 415 725 8783            Fax: 415 725 1449 .
.Stanford CA 94305-9010  Url:   http://www.*-*-*.com/
.USA.......................................................................



Tue, 13 Oct 1998 03:00:00 GMT  
 Python/mSQL Interface

Actually I have managed to fix my own problem.  There is an:

  #include <stdlib.h>

missing from mSQLmodule.c

(Is it only Solaris which needs this for atof to work correctly?)

Marko

.Marko Balabanovic.......Department of Computer Science....................

.Gates Building 1A       Phone: 415 725 8783            Fax: 415 725 1449 .
.Stanford CA 94305-9010  Url:   http://robotics.stanford.edu/people/marko .
.USA.......................................................................



Tue, 13 Oct 1998 03:00:00 GMT  
 Python/mSQL Interface

: Actually I have managed to fix my own problem.  There is an:

:   #include <stdlib.h>

: missing from mSQLmodule.c

: (Is it only Solaris which needs this for atof to work correctly?)

Nope. I had this (in a totally different context) with Linux as well.

-- Matthias



Fri, 16 Oct 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. First release of python mSQL interface available.

2. Python interface to msql

3. Python mSQL Module v2.1 for mSQL 2.0 (and hopefully mSQL 1.X too!)

4. mSQL interface

5. tk interface to msql

6. ANNOUNCE: msqltcl-1.0 - yet another msql tcl interface

7. Python and mSQL

8. msql and python

9. python and msql

10. mSQL 2.0 and Python 1.4

11. Mapping python objects into msql...

12. python<->msql?

 

 
Powered by phpBB® Forum Software