There are a few practices you can use depending on how you want things to
work.

The way I deal with things is that if there is any sort of user interaction,
checks and balances should be done at the UI end.  Which means that if you
require something to be filled in, don't let the user continue on.

Another two ways to do this would be to have the script/language/whatever
handle the exception that the database throws when trying to insert a NULL
value into a field not allowed to have a NULL field.

I use SQLite Expert myself, and there is no flaw with it in regards to
inserting NULL values in a field with a NOT NULL assignment.  It throws the
exception as it should.

On Fri, Jan 7, 2011 at 6:33 PM, tinauser <tinau...@libero.it> wrote:

> Thanks for the answer.
> I'm using the firefox add-on(sqlite manager).I wrongly guessed that
> when creating a table with a field defined as follows:
> "start_script" TEXT NOT NULL
> so without default, the default would be NULL, while apparently is an
> empty string. Indeed, if I try to insert NULL i got an exception.
> So, if I want to force the user to insert something, should I add as
> default NULL?Or is this a problem with SQLite manager?
> Thanks for helping!
>
> On Jan 6, 7:09 pm, Stephen Chrzanowski <pontia...@gmail.com> wrote:
> > insert into YourTable (Field1, NotNullField) values ('Empty String','');
> > insert into YourTable (Field1, NotNullField) values ('Null Value',NULL);
> >
> > The first insert one will work, the second will not.
> >
> > An empty string is NOT considered a NULL value.  An empty string is
> actually
> > considered very valid data.  A value of NULL means that there is no data
> > associated to that particular field.
> >
> > On Wed, Jan 5, 2011 at 12:27 PM, tinauser <tinau...@libero.it> wrote:
> > > Hi there,
> > > I'm an inexpert user of SQLite.
> > > I create a table with a field NOT NULL
> > > However i succesfully insert a record with the NOT NULL field empty.
> > > Shouldn't this be "forbidden"?
> > > Thanks
> > > _______________________________________________
> > > sqlite-users mailing list
> > > sqlite-us...@sqlite.org
> > >http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-us...@sqlite.orghttp://
> sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to