You do not have a column called modified in the items table.

On Aug 13, 1:03 pm, easy <[email protected]> wrote:
> Hi,
>
> I created SQLite base with 3 tables and custom ContentProvider.  I had
> a crash on first call method query.
> I tried to get cursor from base via db.query(table, columns,...) it
> worked correctly.
>
> The exception is android.database.sqlite.SQLiteException: no such
> column: modified: , while compiling: SELECT items._id, items.name FROM
> items ORDER BY modified ASC
>
> Whats wrong?
>
> The method is below:
>
> @Override
>         public Cursor query(Uri url, String[] projection, String selection,
>                         String[] selectionArgs, String sort) {
>                 SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
>                 String tableName = getTableName(url);
>                 final int uri = urlMatcher.match(url);
>                 qb.setTables(tableName);
>                 String defaultOrderBy = null;
>
>                 if (isCollectionUri(url)) {
>                         switch (uri) {
>                         case ITEMS_URI_CODE:
>                                 qb.setProjectionMap(itemsMap);
>                                 defaultOrderBy = Items.DEFAULT_SORT_ORDER;
>                                 break;
>                         case LISTS_URI_CODE:
>                                 qb.setProjectionMap(listsMap);
>                                 defaultOrderBy = Lists.DEFAULT_SORT_ORDER;
>                                 break;
>                         case CELLS_URI_CODE:
>                                 qb.setProjectionMap(cellsMap);
>                                 defaultOrderBy = Cells.DEFAULT_SORT_ORDER;
>                                 break;
>                         default:
>                                 throw new IllegalArgumentException("Unknown 
> URL " + url);
>
>                         }
>
>                 }
>                 else {
>                         qb.appendWhere("_id=" + url.getPathSegments().get(1));
>                 }
>
>                 String orderBy;
>
>                 if (TextUtils.isEmpty(sort)) {
>                         orderBy = defaultOrderBy;
>                 } else {
>                         orderBy = sort;
>                 }
>                 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>                 // this method throw sqliteexception: no such column: 
> modified....
>                 Cursor c = qb.query(db, projection, selection, selectionArgs, 
> null,
>                                 null, orderBy);
>
>                 c.setNotificationUri(getContext().getContentResolver(), url);
>                 return c;
>         }
>
> The Log is 08-13 11:49:59.471: ERROR/AndroidRuntime(5237): Caused by:
> android.database.sqlite.SQLiteException: no such column: modified: ,
> while compiling: SELECT items._id, items.name FROM items ORDER BY
> modified ASC

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to