Subject Re: [firebird-python] next driver version
Author Werner F. Bruhin
On 26/10/2010 16:42, Werner F. Bruhin wrote:
> Hi,
>
> On 21/10/2010 10:55, Hajime Nakagami wrote:
>>> Quickly looking at the doc the module "struct" it looks like it has the
>>> same functionality from Py 2.5+ to Py 3.2.
>> Thaks so much.
>>
>> I will try later (this week end)
>>
> I just gave version 0.2 a try.
>
> - run it through 3to2
> - changed the import "from firebirdsql.fberrmsgs import messages" to
> "from fberrmsgs import messages"
>
> and it runs!
>
> - it created the test database, and the table and some more
>
> But it fails on this "conn.cursor().execute(u"update foo set c=? where
> a=2", [u'Nakagami'])" with the following exception.
>
> Traceback (most recent call last):
> File "fbcore.py", line 1245, in<module>
> conn.cursor().execute(u"update foo set c=? where a=2", [u'Nakagami'])
> File "fbcore.py", line 558, in execute
> self.connection._op_execute(self.stmt_handle, params)
> File "fbcore.py", line 912, in _op_execute
> p.pack_bytes(blr)
> File "C:\Python27\lib\xdrlib.py", line 92, in pack_string
> self.pack_fstring(n, s)
> File "C:\Python27\lib\xdrlib.py", line 85, in pack_fstring
> self.__buf.write(data)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xff' in
> position 11: ordinal not in range(128)
>
> I also see the following output:
> dsn=
> localhost:C:\dev\firebirdNewDriver\pyfirebirdsql2.0\firebirdsql/test.fdb
> [u'\x0b\x00\x00\x00', u'\x02\x00\x00\x00', u'\x06SYSDBA']
>
>
> Any hint of what is the correct way to fix this?
>
Put a couple of print's in to see what the "blr" is at that point, i.e.
added this to _op_execute:
print 'params: %s' % params
print 'blr: %s' % repr(blr)
print 'values: %s' % values

Which returns:
params: [u'\x00\x00\x00\x00\x00\x00\x00\x01']
blr: u'\x05\x02\x04\x00\x02\x00\x0e\x08\x00\x07\x00\xffL'
values:

Doesn't mean much/anything to me, but hopefully it helps:)

Werner