2007/11/23, Oleg Broytmann <[EMAIL PROTECTED]>:
> On Fri, Nov 23, 2007 at 10:53:48AM -0300, Leandro Sales wrote:
> > SELECT db_container.id, db_container.container_id,
> > db_container.child_name FROM db_container, db_object WHERE
> > (((db_object.title) = ('Heathen Chemistry
> >
> > Where is the rest of the SQL statement?
>
> Wow, wow, VIM comes to help! My VIM is instructed to show binary codes in
> text files - and it shows:
>
> SELECT COUNT(*) FROM db_container, db_object WHERE (((db_object.title) = 
> ('Heathen Chemistry<00>(Retail)')) AND ((db_container.id) = (db_object.id)))
>
>    Oh, no! There is NULL charcter there! That's a no-no - SQLite cannot
> quote null characters. Either you have to use BLOBCol or handle nulls at
> the application level.
>    Currently BLOBCol on sqlite uses sqlite.encode() and sqlite.decode() if
> the very module sqlite (PySQLite version 1) is found, and uses base64 if
> the sqlite module is not available. This is problematic, so in the future
> BLOBCol will use only base64. So if you are going to switch to BLOBCol
> - make sure you only have PySQLite2 or sqlite3 modules, not sqlite.
>    Or switch the backend. MySQL and PostgreSQL
>
> Oleg.
> --
>      Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
>            Programmers don't die, they just GOSUB without RETURN.
>

Yes!!! I just notice this too.

Thus, I just update my encoding function to:

def _enc(string, encoding="utf-8"):
    string = string.replace('\x00', '')
    if not isinstance(string, unicode):
        return unicode(string, encoding, errors="ignore")
    return string

Thank you very much, Oleg.

Leandro.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to