// Path: src/org/nerdcircus/android/klaxon/Pager.java
// public static final class Pages implements BaseColumns
// {
//     public static final String TABLE_NAME = "pages";
//     public static final Cursor query(ContentResolver cr, String[] projection)
//     {
//         return cr.query(CONTENT_URI, 
//                         projection,
//                         null,
//                         null,
//                         DEFAULT_SORT_ORDER);
//     }
// 
//     public static final Cursor query(ContentResolver cr, String[] projection,
//                                    String where, String orderBy)
//     {
//         return cr.query(CONTENT_URI, projection, where, null,
//                                      orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
//     }
// 
//     /**
//      * The content:// style URL for this table
//      */
//     public static final Uri CONTENT_URI =
//         Uri.parse("content://org.nerdcircus.android.klaxon/pages");
// 
//     /**
//      * The default sort order for this table
//      */
//     public static final String DEFAULT_SORT_ORDER = "created DESC";
// 
//     /**
//      * The subject of the page
//      * <P>Type: TEXT</P>
//      */
//     public static final String SUBJECT = "subject";
// 
//     /**
//      * The text of the page
//      * <P>Type: TEXT</P>
//      */
//     public static final String BODY = "body";
// 
//     /**
//      * The timestamp for when the page was created
//      * <P>Type: INTEGER (long)</P>
//      */
//     public static final String CREATED_DATE = "created";
// 
//     /**
//      * The service center address from which the page was received.
//      * <P>Type: TEXT</P>
//      */
//     public static final String SERVICE_CENTER = "sc_addr";
// 
//     /**
//      * The originating address
//      * <P>Type: TEXT</P>
//      */
//     public static final String SENDER = "sender_addr";
// 
//     /**
//      * Acknowledgement status
//      * <P>Type: INTEGER</P>
//      */
//     public static final String ACK_STATUS = "ack_status";
// 
//     /**
//      * Email From address
//      * <P>Type: TEXT</P>
//      */
//     public static final String FROM_ADDR = "email_from_addr";
// 
//     /**
//      * String to identify the transport over which this page was received.
//      * <P>Type: TEXT</P>
//      */
//     public static final String TRANSPORT = "transport";
// 
//     /**
//      * Reply Uri - can be used to reply out-of-band to the sender.
//      * <P>Type: TEXT</P>
//      */
//     public static final String REPLY_URI = "reply_uri";
// }
// 
// Path: src/org/nerdcircus/android/klaxon/Pager.java
// public static final class Replies implements BaseColumns
// {
//     public static final String TABLE_NAME = "replies";
//     public static final Cursor query(ContentResolver cr, String[] projection)
//     {
//         return cr.query(CONTENT_URI, 
//                         projection,
//                         null,
//                         null,
//                         DEFAULT_SORT_ORDER);
//     }
// 
//     public static final Cursor query(ContentResolver cr, String[] projection,
//                                    String where, String orderBy)
//     {
//         return cr.query(CONTENT_URI, projection, where, null,
//                                      orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
//     }
// 
//     /**
//      * The content:// style URL for this table
//      */
//     public static final Uri CONTENT_URI =
//         Uri.parse("content://org.nerdcircus.android.klaxon/reply");
// 
//     /**
//      * Short name of our reply.
//      */
//     public static final String NAME = "name";
// 
//     /**
//      * content of the reply.
//      */
//     public static final String BODY = "body";
//     /**
//      * new "ack status". integer. 
//      */
//     public static final String ACK_STATUS = "ack_status";
//     /**
//      * whether this item should be shown in the menu.
//      */
//     public static final String SHOW_IN_MENU = "show_in_menu";
// 
//     /**
//      * The default sort order for this table
//      */
//     public static final String DEFAULT_SORT_ORDER = "name ASC";
// }


import android.text.TextUtils;
import android.util.Log;
import org.nerdcircus.android.klaxon.Pager.Pages;
import org.nerdcircus.android.klaxon.Pager.Replies;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
    @Override
    public int update(Uri url, ContentValues values, String where, String[] selectionArgs) {
    //XXX: type-specific differences: table name, where clause (if there's an ID specified)
        int count;
        long rowId = 0;
        SQLiteDatabase db = mDbHelper.getWritableDatabase();
        switch (URL_MATCHER.match(url)) {
        case PAGES:
        case PAGE_ID:
            count = db.update(Pages.TABLE_NAME, values, whereClauseWithId(url, where), selectionArgs);
            break;
        case REPLIES:
        case REPLY_ID:
            count = db.update(Replies.TABLE_NAME, values, whereClauseWithId(url, where), selectionArgs);
            break;
        default:
            throw new IllegalArgumentException("Unknown URL " + url);
        }

        getContext().getContentResolver().notifyChange(url, null);
        return count;
    }

    private String getDefaultSortOrderByType(int type){
        switch (type) {
        case PAGES:
            return Pages.DEFAULT_SORT_ORDER;
        case PAGE_ID:
            return Pages.DEFAULT_SORT_ORDER;
        case REPLIES:
// Path: src/org/nerdcircus/android/klaxon/Pager.java
// public static final class Pages implements BaseColumns
// {
//     public static final String TABLE_NAME = "pages";
//     public static final Cursor query(ContentResolver cr, String[] projection)
//     {
//         return cr.query(CONTENT_URI, 
//                         projection,
//                         null,
//                         null,
//                         DEFAULT_SORT_ORDER);
//     }
// 
//     public static final Cursor query(ContentResolver cr, String[] projection,
//                                    String where, String orderBy)
//     {
//         return cr.query(CONTENT_URI, projection, where, null,
//                                      orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
//     }
// 
//     /**
//      * The content:// style URL for this table
//      */
//     public static final Uri CONTENT_URI =
//         Uri.parse("content://org.nerdcircus.android.klaxon/pages");
// 
//     /**
//      * The default sort order for this table
//      */
//     public static final String DEFAULT_SORT_ORDER = "created DESC";
// 
//     /**
//      * The subject of the page
//      * <P>Type: TEXT</P>
//      */
//     public static final String SUBJECT = "subject";
// 
//     /**
//      * The text of the page
//      * <P>Type: TEXT</P>
//      */
//     public static final String BODY = "body";
// 
//     /**
//      * The timestamp for when the page was created
//      * <P>Type: INTEGER (long)</P>
//      */
//     public static final String CREATED_DATE = "created";
// 
//     /**
//      * The service center address from which the page was received.
//      * <P>Type: TEXT</P>
//      */
//     public static final String SERVICE_CENTER = "sc_addr";
// 
//     /**
//      * The originating address
//      * <P>Type: TEXT</P>
//      */
//     public static final String SENDER = "sender_addr";
// 
//     /**
//      * Acknowledgement status
//      * <P>Type: INTEGER</P>
//      */
//     public static final String ACK_STATUS = "ack_status";
// 
//     /**
//      * Email From address
//      * <P>Type: TEXT</P>
//      */
//     public static final String FROM_ADDR = "email_from_addr";
// 
//     /**
//      * String to identify the transport over which this page was received.
//      * <P>Type: TEXT</P>
//      */
//     public static final String TRANSPORT = "transport";
// 
//     /**
//      * Reply Uri - can be used to reply out-of-band to the sender.
//      * <P>Type: TEXT</P>
//      */
//     public static final String REPLY_URI = "reply_uri";
// }
// 
// Path: src/org/nerdcircus/android/klaxon/Pager.java
// public static final class Replies implements BaseColumns
// {
//     public static final String TABLE_NAME = "replies";
//     public static final Cursor query(ContentResolver cr, String[] projection)
//     {
//         return cr.query(CONTENT_URI, 
//                         projection,
//                         null,
//                         null,
//                         DEFAULT_SORT_ORDER);
//     }
// 
//     public static final Cursor query(ContentResolver cr, String[] projection,
//                                    String where, String orderBy)
//     {
//         return cr.query(CONTENT_URI, projection, where, null,
//                                      orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
//     }
// 
//     /**
//      * The content:// style URL for this table
//      */
//     public static final Uri CONTENT_URI =
//         Uri.parse("content://org.nerdcircus.android.klaxon/reply");
// 
//     /**
//      * Short name of our reply.
//      */
//     public static final String NAME = "name";
// 
//     /**
//      * content of the reply.
//      */
//     public static final String BODY = "body";
//     /**
//      * new "ack status". integer. 
//      */
//     public static final String ACK_STATUS = "ack_status";
//     /**
//      * whether this item should be shown in the menu.
//      */
//     public static final String SHOW_IN_MENU = "show_in_menu";
// 
//     /**
//      * The default sort order for this table
//      */
//     public static final String DEFAULT_SORT_ORDER = "name ASC";
// }


// Path: src/org/nerdcircus/android/klaxon/PagerProvider.java
import android.text.TextUtils;
import android.util.Log;
import org.nerdcircus.android.klaxon.Pager.Pages;
import org.nerdcircus.android.klaxon.Pager.Replies;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;

    @Override
    public int update(Uri url, ContentValues values, String where, String[] selectionArgs) {
    //XXX: type-specific differences: table name, where clause (if there's an ID specified)
        int count;
        long rowId = 0;
        SQLiteDatabase db = mDbHelper.getWritableDatabase();
        switch (URL_MATCHER.match(url)) {
        case PAGES:
        case PAGE_ID:
            count = db.update(Pages.TABLE_NAME, values, whereClauseWithId(url, where), selectionArgs);
            break;
        case REPLIES:
        case REPLY_ID:
            count = db.update(Replies.TABLE_NAME, values, whereClauseWithId(url, where), selectionArgs);
            break;
        default:
            throw new IllegalArgumentException("Unknown URL " + url);
        }

        getContext().getContentResolver().notifyChange(url, null);
        return count;
    }

    private String getDefaultSortOrderByType(int type){
        switch (type) {
        case PAGES:
            return Pages.DEFAULT_SORT_ORDER;
        case PAGE_ID:
            return Pages.DEFAULT_SORT_ORDER;
        case REPLIES:
            return Replies.DEFAULT_SORT_ORDER;