Re: pysqlite design decisions
Roger Binns <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 glyph-TyWPi3/[email protected] wrote: | >They should only ever come back as 8 bit if they are pure ASCII (ie | >7bit). How did this cause any problems? It was intentional this way so | >that simple apps that only ever used ASCII only ever had ASCII. | | Axiom explicitly forbids use of str objects to represent text anywhere. | You get unicode back from text fields, you get str objects back from | blob fields. Using str for blob is a bad idea! You should use the buffer type which makes very unambiguous the difference between a png image and "hello world". Both APSW and pysqlite return blobs as buffer. Back when I originally wrote APSW (December 2004) BitPim supported both the ANSI and Unicode versions of wxPython. Needless to say the ANSI version had no idea what a Unicode string was. Having the ASCII in, ASCII out mode of apsw operation meant that ANSI users of wxPython would work just fine providing they only ever used ASCII data. Unicode users would work fine with the Unicode version. This is all from exactly the same BitPim codebase without having to write any conversion code anywhere. It worked really well. It also helped people on some legacy platforms (eg MacOS 10.2 can't use the Unicode version of wxPython). However it is probably time to take the same approach as pysqlite and always return Unicode strings. That also has the side effect of letting me remove code, which is my favourite thing to do with code :-) | Getting Python's internal test coverage up to a decent level would be a | time-consuming project, and a bit out of scope for this discussion. | Still, I wish somebody would do it - I'm really happy to hear that drh | has put that much thought into testing. He has to. If he didn't then he would have no confidence in changes not breaking things inadvertently. His business is making SQLite changes for paying customers. | Threads are always scary. Pretty much any threaded code that involves | locked, shared data structures is going to be impossible to test | thoroughly - you can call any function at any point from any other | function... you have to reason really hard about where everything's | going to happen. Yup. That is why APSW enforces that each db handle only gets used in one thread. Part of my test suite verifies that checking. | This opinion seems really common. Is there a DB-API 3.0 in the works | that fixes some of the more obvious issues? I have no idea. I didn't even look at DBAPI until apsw was almost finished. My goal has always been an SQLite interface, not a generic database layer. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFdqKVmOOfHg372QQRApvUAKDB3EVUEOhpdvJZDZkJYpWFDlJLPwCg3tYt 0thSvu8eh1KU/1H9UCEH8oE= =RPbV -----END PGP SIGNATURE-----