[pysqlite] Trouble with create_function interface to sqlite
"Raul Garcia Garcia" <[email protected]> Wed, 28 May 2008 18:01:35 +0200
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Greetings, I've got a problem with the create_function interface in pysqlite2 2.4.1 I've got a SQLite3 database which have strings encoded in iso-8859-1 rather than in utf8. I manage them via a text_factory, but the problem is that if I define a function with create_function to apply over a string column, the value received by the function is None if the string is not a proper utf8 one. I've delved into the pysqlite source and seen that pysqlite sets the "preferred types" parameter of sqlite_create_function to SQLITE_UTF8 instead of SQLITE_ANY. Does exist a way to change this parameter? The function I try to implement is a clone of PostgreSQL's to_ascii, which eliminates all diacritics from the text. I've tried to register/adapt types but the type system isn't used in a statement like this one: "SELECT * from table where to_ascii(name) == value" Kind regards, -- rgg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Raul Garcia Garcia mailto:[email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -