Hi, On Mon, Nov 16, 2015 at 2:20 PM, R Smith <rsmith at rsweb.co.za> wrote: > > > On 2015/11/16 7:59 PM, Igor Korot wrote: >> >> Stephan, >> >> On Mon, Nov 16, 2015 at 12:42 PM, Stephan Beal <sgbeal at googlemail.com> >> wrote: >>> >>> On Mon, Nov 16, 2015 at 6:11 PM, Igor Korot <ikorot01 at gmail.com> wrote: >>> >>>> The variables referenced are defined as "std::string" and the code is in >>>> C++. >>>> >>> the std::string(char const *) constructor does not, last time i checked, >>> accept a NULL value. You will need to pass it "" in that case. >>> >>> [stephan at host:~/tmp]$ cat foo.cpp >>> #include <string> >>> >>> int main(){ >>> std::string s(0); >>> return 0; >>> } >>> >>> [stephan at host:~/tmp]$ gcc -o foo foo.cpp -lstdc++ >>> [stephan at host:~/tmp]$ ./foo >>> terminate called after throwing an instance of 'std::logic_error' >>> what(): basic_string::_S_construct null not valid >>> Aborted >> >> OK, it looks like the value is NULL instead of "". >> I will change the code accordingly. >> >> BTW, are only name, type and pk fields are guaranteed to have a value? > > > Nothing is guaranteed to have a value unless created with NOT NULL in the > field specification in the CREATE TABLE schema SQL. > > Usually (in most DBs) a Primary key is guaranteed to not have NULL values, > but in SQLite it is permissible if the PK is not specifically stated to be > NOT NULL.
Yes. But if I issue this PRAGMA command the field name, field type and the PK are guaranteed to have some values, right? You can't create a field without a name or the type and the field is either part of the PK or not. Please correct me if I'm wrong. Thank you. > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users