dimanche 24 janvier 2016

Android SQLite table creation failure

I am writing tests for my database and right now the table below is not building and the test is failing with this SQL command being built: " CREATE TABLE location (_id INTEGER PRIMARY KEY,location_setting TEXT UNIQUE NOT NULL, city_name TEXT NOT NULL, coord_lat REAL NOT NULL coord_long REAL NOT NULL ); ". I am pretty certain there is some syntax error yet I am new to databases in android and honestly need help.

Table creation:

@Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        final String SQL_CREATE_LOCATION_TABLE = "CREATE TABLE " + LocationEntry.TABLE_NAME + " (" +
                LocationEntry._ID + " INTEGER PRIMARY KEY," +
                LocationEntry.COLUMN_LOCATION_SETTING + " TEXT UNIQUE NOT NULL, " +
                LocationEntry.COLUMN_CITY_NAME + " TEXT NOT NULL, " +
                LocationEntry.COLUMN_COORD_LAT + " REAL NOT NULL " +
                LocationEntry.COLUMN_COORD_LONG + " REAL NOT NULL " +
                " );";
    }

Thanks for the help.

Aucun commentaire:

Enregistrer un commentaire