0

i got this error when i start my app:

12-20 22:27:01.447: ERROR/Database(716): Failure 1 (near ":00": syntax error) on 0x1a4338 when preparing 'CREATE TABLE permission ( fk_email1 varchar(100) NOT NULL, fk_email2 varchar(100) NOT NULL, validated tinyint(4) default 0, hour1 time default 08:00:00, hour2 time default 20:00:00, date1 date default NULL, date2 date default NULL, weekend tinyint(4) default 0, fk_type varchar(45) default NULL, PRIMARY KEY (fk_email1,fk_email2))'.

here is the code where i am creating the database:

private static final String PERMISSION_TABLE_CREATE = 
"CREATE TABLE permission (" 
"fk_email1 varchar(100) NOT NULL, fk_email2 varchar(100) NOT NULL, "
"validated tinyint(4) default 0, hour1 time default 08:00:00, "
"hour2 time default 20:00:00, date1 date default NULL, "
"date2 date default NULL, weekend tinyint(4) default 0, "
"fk_type varchar(45) default NULL, PRIMARY KEY  (fk_email1,fk_email2))";

private static final String USER_TABLE_CREATE = "CREATE TABLE user ( "
"email varchar(100) NOT NULL, password varchar(45) default NULL, "
"fullName varchar(80) default NULL, "
"mobilePhone varchar(14) default NULL, "
"mobileOperatingSystem varchar(20) default NULL, PRIMARY KEY  (email))";

what i am doing bad?

3 Answers 3

2

Check the SQLLite documentation. I don't believe it has a type affinity for the "TIME" datatype. If it does, the defaults will probably have to be in quotes.

SQLite is very funny about datatypes (essentially, all data is untyped) and you can substantially shorten your DDL by getting rid of VARCHAR lengths (or even VARCHAR in favor of TEXT).

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

Comments

1

Obviously definition of your time row is wrong

Please check SQLite docs

You can try "YYYY-MM-DD HH:MM:SS.SSS" format, but better store value as an INTEGER (Unix Time)

Comments

1

http://www.sqlite.org/faq.html#q2

(2) What datatypes does SQLite support?

SQLite uses dynamic typing. Content can be stored as INTEGER, REAL, TEXT, BLOB, or as NULL.

Use INTEGER, for instance, it can store Java's long.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.