Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes anyone know what a Invalid tables exception is?
    primarykey
    data
    text
    <p>I'm working on refining a database that I wrote for my app while ago. The previous database worked fine, but was just messy and I did the stupid thing, try and clean it. This has caused a weird less than helpful error that I can't begin to decipher. After much back tracking and finally coming back and having the database look, as far as I can tell, identical to my previous DB, I am still getting the cursed error.</p> <p>The error:</p> <pre><code>03-02 10:38:30.205: ERROR/AndroidRuntime(505): FATAL EXCEPTION: JobLister: RunThread jobs 03-02 10:38:30.205: ERROR/AndroidRuntime(505): java.lang.IllegalStateException: Invalid tables 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at android.database.sqlite.SQLiteDatabase.findEditTable(SQLiteDatabase.java:1313) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1414) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1370) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1450) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at com.android.appion.arm.database.Database.getRecord(Database.java:120) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at com.android.appion.arm.database.Database.getRecord(Database.java:107) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at com.android.appion.arm.database.Database.getRecord(Database.java:97) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at com.android.appion.arm.activities.JobLister.getJobs(JobLister.java:69) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at com.android.appion.arm.activities.JobLister.access$3(JobLister.java:66) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at com.android.appion.arm.activities.JobLister$2.run(JobLister.java:52) 03-02 10:38:30.205: ERROR/AndroidRuntime(505): at java.lang.Thread.run(Thread.java:1020) </code></pre> <p>So naturally I followed the saw trace and saw that it originated from a call I make in one of my activities to the database I have saved in my service (naturally). </p> <p>The database call from the activity:</p> <pre><code>Cursor c = mService.getDatabase().getRecord(new Table.Jobs()); </code></pre> <p>This all seems correct. Using the service I get the database, and with the database get all records from the Table jobs.</p> <p>The getRecord method stepper and the Jobs table definition:</p> <pre><code>public Cursor getRecord(DataTable table) { return getRecord(table, null); } public Cursor getRecord(DataTable table, String[] columns) { return getRecord(table, columns, null); } /** * Return a Cursor with every item in which data is only coming from columns, * and the records satisfies all selection requirements. * @param table The table to query. * @param columns The columns to retieve data. * @param selection The requirements to base the data collection on. (WHERE statement * without WHERE). * @return The Cursor full of queried items. */ public Cursor getRecord(DataTable table, String[] columns, String selection) { return mDB.query(table.TITLE, (columns == null) ? new String[] {"*"} : columns, selection, null, null, null, null); } </code></pre> <p>And the Table:</p> <pre><code>public static class Jobs extends DataTable { public static final String TITLE = "jobs"; public static final String[] FIELD = {"job_id", "job_name", // User given name "job_contact", // client "job_location", // The location of the job "job_notes", "job_summary", // The byte object of a JobSummary "wkb_name", // the workbench that is being used for the job "job_startdate", "job_enddate"}; public Jobs() { super(); } public String getTable() { return "create table " + TITLE + "(" + FIELD[0] + " integer primary key autoincrement, " + FIELD[1] + " text, " + FIELD[2] + " blob, " + FIELD[3] + " blob, " + FIELD[4] + " text, " + FIELD[5] + " blob, " + FIELD[6] + " blob, " + FIELD[7] + " text, " + FIELD[8] + " text " + ");"; } } </code></pre> <p>Now this style of design worked perfectly with my last data base and is now word for word minus the fact that the jobs table extends DataTable for ease of the initial database creation due to abstraction.</p> <p>Can anyone see anything wrong with this?</p> <p>EDIT::</p> <p>I read the source for the error (<code>SQLiteDatabase.findEditTable()</code>) and it seems that the issue it that there is no data in the table. If that were the case I should get a null Cursor return shouldn't I? Or am I misinterpreting what I'm reading and it really says that the table can't be found?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload