What was the text in the exception -- it's usually pretty informative.

On Aug 13, 3:57 am, easy <[email protected]> wrote:
> Hi all,
>
> I created ContentProvider for database with three tables.
> SQLiteException was thrown on first call query. My method and commets
> are 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;
>                 }
>                 
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>                 //qb.query 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 db is not null

-- 
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