0

This is my query and associative variables:

public static final String DATABASE_NAME = "HDL_db";
public static final String TABLE_NAME = "HDL_table";
public static final String COL_3 = "Arrival_Time";

public static final int database_version = 1;
public String CREATE_QUERY = "CREATE TABLE " + TABLE_NAME + " (" +
                COL_3 + " DATE)";

This is the resultant query format in SQLite Manager (Mozilla Firefox add-on):

CREATE TABLE HDL_table(Arrival TimeDATE)

should be:

CREATE TABLE HDL_table (Arrival_Time DATE) [based on spaces I have added in original query]

and so leaves me with the following table structure in SQLite Manager:

SQLite Manager Table Structure

I want to have the 'Name' column set to 'Arrival_Time' and the 'Type' set to 'DATE' .. because it will be a date that workers arrive on site.

Personally, I think the spaces in the query are the problem, however when I add in the spaces in the original query, export and run the database file through SQLite Manager and check the resultant table structure .. it is in the wrong format.

Any help with this would be great, thanks.

  • does your project required SQLite Manager (Mozilla Firefox add-on)? It seems that the problem is from the plugin. – Inducesmile Mar 03 '16 at 23:46
  • Well SQLite is an open-source database so it doesn't need to be locally hosted, the file can just be exported and dumped into SQLite Manager. It shouldn't be the plugin as many other people have been fine with it. Personally (as I mentioned), I think it is to do with my spacing in the query. – Tom Dunwoody Mar 04 '16 at 00:21

1 Answers1

0

In your column's name must not contain spaces. SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values:

"CREATE TABLE IF NOT EXISTS HDL_table (_id integer primary key, arrival_time text)"

Source: https://www.sqlite.org/datatype3.html

  • I noticed I shouldn't contain spaces as I changed it to Arrival_Name. I still got the same result. Thanks for the info on Dates and Times though. – Tom Dunwoody Mar 04 '16 at 00:23