Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:06:07+00:00 2026-06-13T05:06:07+00:00

public class ListsSQLiteOpenHelper extends SQLiteOpenHelper { public static final int VERSION = 1; public

  • 0
public class ListsSQLiteOpenHelper extends SQLiteOpenHelper {

public static final int VERSION = 1;
public static final String DB_NAME  = "lightsettings_db.sqlite";
public static final String ITEMS_TABLE  = "light_setting_items";
public static final String ITEM_ID = "id";
public static final String ITEM_TYPE = "type";
public static final String ITEM_VALUE = "values";
public static final String ITEM_BUSTYPE = "bustype";
public static final String ITEM_LIGHTTYPE = "lighttype";
public static final String ITEM_SELECT  = "select";

public ListsSQLiteOpenHelper(Context context) {
    super(context, DB_NAME, null, VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
    createTable(db);
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

}


protected void createTable(SQLiteDatabase db) {
    db.execSQL(
            "create table " + ITEMS_TABLE +" (" +
            ITEM_ID + " integer primary key autoincrement not null," +
            ITEM_TYPE + " text" +
            ITEM_VALUE + " text" +
            ITEM_BUSTYPE + " text" +
            ITEM_LIGHTTYPE + " text" +
            ITEM_SELECT + " text" +
            ");"
        );
}
}
private ArrayList<Entry> currentEntries;

private long lineNumber = 1;

private SQLiteDatabase database;

@Override
public void onCreate() {
    super.onCreate();
    ListsSQLiteOpenHelper helper = new ListsSQLiteOpenHelper(this);
    database = helper.getWritableDatabase();
    if(currentEntries == null){
        loadItems();
    }
}

private void loadItems() {
    currentEntries = new ArrayList<Entry>();

    Cursor itemsCursor = database.query(
            ITEMS_TABLE,
            new String[] {ITEM_ID, ITEM_TYPE, ITEM_VALUE, ITEM_BUSTYPE, ITEM_LIGHTTYPE, ITEM_SELECT},
            null, null, null, null, String.format("%s,%s", ITEM_SELECT, ITEM_TYPE));

    itemsCursor.moveToFirst();
    Entry e;
    if(!itemsCursor.isAfterLast()){
        do{
            long id = itemsCursor.getLong(0);
            String type = itemsCursor.getString(1);
            String value = itemsCursor.getString(2);
            String bustype = itemsCursor.getString(3);
            String lighttype = itemsCursor.getString(4);
            String boolvalue = itemsCursor.getString(5);
            boolean select = Boolean.parseBoolean(boolvalue);
            e = new Entry(id, type, value, bustype, lighttype);
            e.setRowId(id);
            e.setSelected(select);
            currentEntries.add(e);
        } while(itemsCursor.moveToNext());
    }

    itemsCursor.close();
}

I get syntax error on

database.query(ITEMS_TABLE,
                new String[] {ITEM_ID, ITEM_TYPE, ITEM_VALUE, ITEM_BUSTYPE, ITEM_LIGHTTYPE, ITEM_SELECT},
                null, null, null, null, String.format("%s,%s", ITEM_SELECT, ITEM_TYPE));

I don’t understand why did I get this error:

10-19 17:01:37.925: E/AndroidRuntime(23164): java.lang.RuntimeException: Unable to create application com.example.abc.EntryManagerApplication: android.database.sqlite.SQLiteException: near “values”: syntax error: , while compiling: SELECT id, type, values, bustype, lighttype, selected FROM light_setting_items ORDER BY selected,type

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:06:08+00:00Added an answer on June 13, 2026 at 5:06 am

    ’values’ is a SQL keyword. If you insist on using it as a field name, put it between double quotes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class ListsSQLiteOpenHelper extends SQLiteOpenHelper { public static final int VERSION = 1; public
public class BobDatabase extends SQLiteOpenHelper{ private static final String DATABASE_NAME = bob.db; private static
public class ReplyWithAddressService extends Service{ public static final String GOOGLE_GEOCODER = http://maps.googleapis.com/maps/api/geocode/json?latlng=; private String
public class upload extends Activity { private static final int CAMERA_REQUEST = 1888; private
public class SaveData extends Activity implements OnClickListener { private DataManipulator dh; static final int
public class A { private A(int param1, String param2) {} public static A createFromCursor(Cursor
public class Base{ protected String str; public static final Base ERROR = new Base(error);
public class DBAdapter { public static final String COLUMN_ID = ID; public static final
public class Encryption { private static final int[] encrypt = {2, 9, 3, 4,
public class MCQSample extends Activity implements OnClickListener{ TextView title; String gotBread; RadioGroup AnswerRG; int

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.