On Tue, Dec 22, 2009 at 9:58 AM, Gijs Molenaar <[email protected]> wrote:
>
> Just committed the REAL/DOUBLE fix, this encoding
> thingy has to wait until January, sorry.
>

One thing I noticed is that the mapi backend has
some magic to handle both Unicode and UTF-8
strings when passed in.

Enlcosed below is the python script I used to
exercise the encoding machinery.

Thanks!

m

import monetdb.sql
from monetdb.monetdb_exceptions import OperationalError

con = monetdb.sql.connect(username="test", password="test", database="test")
c = con.cursor()
try:
        c.execute('drop table test')
        c.execute('COMMIT')
except OperationalError, e:
        c.execute('ROLLBACK')
        print "drop table test failed:", e
        pass

c.execute('create table test (id int, s varchar(30))')
c.execute('COMMIT')

#
# cafe is in unicode here.
#

cafe  = u"caf" + unichr(0x00E9)

print 'cafe.__repr__()              =', cafe.__repr__()
print 'cafe.encode("utf8").__repr() =', cafe.encode("utf8").__repr__()

c.execute('insert into test values (%s,%s)', (1,cafe))
#c.execute('insert into test values (%s,%s)', (1,cafe.encode("utf8")))
c.execute('COMMIT')

c.execute("select s from test where id = %d" % (1,))
row = c.fetchone()

print row

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Monetdb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-developers

Reply via email to