0

I really have two questions: 1/ how to read/check sqlite db table offline? 2/ Why is a sqlite table column of boolean type set to NULL?

ad 1/ I have downloaded sqlite3.exe and when i use the cmd > .dump quotes_table i see all rows like

INSERT INTO quotes_table` VALUES................ INSERT INTO quotes_table` VALUES................ INSERT INTO quotes_table` VALUES................ INSERT INTO quotes_table` VALUES................ etc 

Is this correct as i was expecting to see just the values and not the queries?

ad 2/ I alter+updated the quotes_table by

db.execSQL("ALTER TABLE quotes_table ADD COLUMN quoteUsed boolean"); db.execSQL("UPDATE 'quotes_table' SET quoteUsed = 0"); 

I read on http://www.sqlite.org/datatype3.html sqlite use 0 and 1 for boolean type so i thought putting quoteUsed = 0 should be OK, but the value reads NULL. How can i fix this?

regards,

ps: FYI just installed SQLite manager addon for Firefox and it makes things easier

1
  • 1
    store 1 or 0 as string in DB and retrieve them using Boolean.parseBoolean(s); Commented Dec 12, 2013 at 10:32

2 Answers 2

2

1/ how to read/check sqlite db table offline?

Normally, SQLite is used with local databases, so database exists or does not exists - "offline" doesn't apply.

2/ Why is a sqlite table column of boolean type set to NULL?

SQLite doesn't have a boolean data type. It's affinity is NUMERIC. Check Datatypes In SQLite Version 3

NULL values, as in other DBMS, means nothing assigned.

when i use the cmd > .dump quotes_table i see all rows like ...

DUMP is used to extract all data from database. Actually, it returns SQL statements you may use to rebuild a new database from scratch.

To get data only, use SQL queries (check SELECT statement).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, for all the info appreciate it
1

when i use the cmd > .dump quotes_table i see all rows like

...

Is this correct as i was expecting to see just the values and not the queries?

Yes, .dump creates the SQL that would produce an identical database.

2/ I alter+updated the quotes_table by

...

I read on http://www.sqlite.org/datatype3.html sqlite use 0 and 1 for boolean type so i thought putting quoteUsed = 0 should be OK, but the value reads NULL. How can i fix this?

Nothing really wrong with the SQL. How are you reading the value?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.