![]() |
#1 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jun 2014
Device: kobo
|
Populating Calibre DB with NON
Hi,
I am trying to develop a tool that coverts an existing database to calibre sqlite db. However, the sqlite driver I am using in my .Net project chokes on the word "NON". See following table examples from calibre source: CREATE TABLE comments ( id INTEGER PRIMARY KEY, book INTEGER NON NULL, text TEXT NON NULL COLLATE NOCASE, UNIQUE(book) ); ... CREATE TABLE data ( id INTEGER PRIMARY KEY, book INTEGER NON NULL, format TEXT NON NULL COLLATE NOCASE, uncompressed_size INTEGER NON NULL, name TEXT NON NULL, UNIQUE(book, format) ); ... As far as I know SQL does not have keyword "NON". Could anybody enlighten me regarding this construct? Tnx. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
the calibre database is sqlite, NON NULL is a constraint that will cause sqlite to raise an error if you try to set a null value for a field declared as non null.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,445
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You should use calibre to create the empty database. If you don't then it is likely that the DB version, the constraints, and the triggers won't be right.
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jun 2014
Device: kobo
|
Thanks for answering.
I know about constrains. However based on "http://www.sqlite.org/lang_keywords.html" there is no SQLite Keyword "NON" (although NOT NULL is ok). Probably the designers of the driver followed this table. |
![]() |
![]() |
![]() |
#5 | |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Jun 2014
Device: kobo
|
Quote:
Yes, that is exactly what I did. However, during the testing I would like to open calibre db in VisualStudio and validate my tool with a unit test. But, as I said, sqlite driver could not get around constraint "NON" - and "NOT" works fine. Is there any difference between the two? |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No difference as far as I know.
|
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
For consistency, I have changed all the NON NULLs to NOT NULLs
https://github.com/kovidgoyal/calibr...fa350817a362d4 |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Populating new reader | AlexBell | Library Management | 3 | 03-15-2013 01:28 AM |
Touch Script: Creating and populating shelves based on calibre tags | Krytes | Kobo Reader | 7 | 10-02-2012 01:57 PM |
Populating Calibre with books already on my Kobo | peterbyron | Kobo Reader | 12 | 07-25-2012 03:44 AM |
<dc:time> Not Populating Properly | PurdueKenny | ePub | 3 | 09-22-2011 09:25 AM |
<dc:date> Not Populating | PurdueKenny | Calibre | 5 | 09-22-2011 09:00 AM |