A "bug" in "my" code is possible.
We are using the QT suite and QString objects do not distinguish between
an uninitialized QString object (pointer == zero) and an empty string ("")
which I think is a flawed lack of distinction. In Lee Crain's Rules Of
Software Development Practices, NULL means nothing is known; empty means
empty. The 2 conditions are distinctly and unambiguously different.
However, I did expect SQLite to enforce the NOT NULL portion of the SQL
creation statements, no matter what. If it cannot for whatever reason,
then I will enforce it in my source code by:
if( 0 == QString.Length( ) )
{
// QString object's state is ambiguous; can be NULL or empty,
// according to QT documentation.
QString = ""; // This line solves the problem.
}
Thanks for your responses,
Lee Crain
______________
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 29, 2008 12:02 PM
To: [email protected]
Subject: Re: [sqlite] How Does NOT NULL produce NULLs?
"Lee Crain" <[EMAIL PROTECTED]> wrote:
> I've created a table with several fields, 3 of which are created using
> these SQL statements:
>
> [description] [varchar](255) NOT NULL DEFAULT ('') COLLATE NOCASE,
>
> [keywords] [varchar](255) NOT NULL DEFAULT ('') COLLATE NOCASE,
>
> [metadata] [varchar](255) NOT NULL DEFAULT ('') COLLATE NOCASE);
>
> __________
>
> Subsequent data insertions of empty strings produce the following data:
>
> (null)|(null)|(null)
>
I am unable to replicate the problem. Are you sure you don't
have a bug in *your* code?
--
D. Richard Hipp <[EMAIL PROTECTED]>
--------------------------------------------------------------------------
---
To unsubscribe, send email to [EMAIL PROTECTED]
--------------------------------------------------------------------------
---
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------