[DB-SIG] None and BOOLEAN columns

M.-A. Lemburg mal@lemburg.com
Wed, 06 Mar 2002 12:49:17 +0100

"Dittmar, Daniel" wrote:
> What is the expected behaviour with regard to NULL, TRUE, FALSE and BOOLEAN
> columns?
> In the SAP DB driver, I translate None (or any other value interpreted as
> false) to a SQL False value, so there is currently no possibility to insert
> a real NULL value.
> On SELECT, I translate both NULL and FALSE to None.
> Admittedly, this comes from my own Python + SQL style, where I use None as
> false on the Python side and try to stay away from three valued logic on the
> SQL side.
> What do other drivers do?

I'd suggest to use PyObject_IsTrue() on the input side and
to return Py_True/Py_False on the output side.

None should always map to NULL on input.

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/