Re: [pysqlite] Trouble with create_function interface to sqlite
Raul Garcia Garcia <[email protected]> Thu, 29 May 2008 06:32:34 +0000 (UTC)
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Gerhard Häring <gh@...> writes: > So the only way out here is to make sure the function does not get a > string in the first place. Let it operate on a BLOB (buffer in Python) > instead. > > The function would then look like this: > > def to_ascii(buf): > s = str(buf) > ... > > And you'd have to change your SQL call so that the function gets a BLOB > parameter, something like: > > select to_ascii(cast(? as blob)) ... I've tested it and works like a charm. Of course, to_ascii receives a buffer and its contents are the string encoded in iso-8859-1. Thanks a lot, Gerhard :) Kind regards, -- rgg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Raul Garcia Garcia mailto:raul.garciagarcia@... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _______________________________________________ list-pysqlite mailing list [email protected] http://itsystementwicklung.de/cgi-bin/mailman/listinfo/list-pysqlite