On 24 Sep 2014, at 1:33pm, Nathaniel Trellice <napt...@yahoo.co.uk> wrote:

> Without the INSERT call, my test code runs through without crashing. 
> Attempting the INSERT call in the shell tool crashes it too. Following your 
> advice, the output of the .schema command looks dodgy:
> 
> CREATE TABLE test_table (name TEXT DEFAULT ('joe'), interest TEXT DEFAULT 
> (?1));
> 
> I'm an SQLite newbie, though, so maybe that's right. Or perhaps bound 
> parameters aren't 'resolved' in a "CREATE TABLE" statement?

You got it right.  As you can see from the above, SQLite did not make the 
substitution for your bound value and the '?1' made it all the way to the table 
definition.  You should, of course, be seeing your 'golf' value there instead.  
I'm going to have to let someone else tell you whether you should or shouldn't 
be able to bind DEFAULT values.  I don't know.

But having allowed that to happen SQLite now has a definition for a table, and 
that definition has bad syntax.  And that bad syntax is causing SQLite to 
crash.  And that is a no-no and will be fixed.  I have no idea how it'll be 
fixed but it will.  Thanks for posting the details of your problem and a clear 
way to reproduce it.

In the meantime if you need your program to set default values for table 
columns at runtime you'll have to do it by editing the command's text instead 
of using binding.  Which you already know is bad for reasons you listed in your 
first post.  Sorry for the inconvenience.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to