Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALTER TABLE "poems_table" RENAME TO 'poems_table_TMP';
- CREATE TABLE
- "poems_table" ( "id" INTEGERL, "title" text, "poem" text,
- "subject" text, "years" text, "favorite" INTEGER, PRIMARY KEY ("id") );
- INSERT INTO "poems_table" ("id", "title", "poem", "subject",
- "years", "favorite") SELECT "id", "title", "poem", "subject",
- "years", "favorite" FROM "poems_table_TMP";
- DROP TABLE
- "poems_table_TMP";
- public class PoemsDbHelper extends SQLiteAssetHelper {
- private static String DB_NAME = "info.db";
- private static final int DB_VERSION = 2;
- public PoemsDbHelper(Context context) {
- super(context, DB_NAME, null, DB_VERSION);
- }
- public Cursor getPoems_table() {
- // SQLiteDatabase db = getWritableDatabase();
- // db.close();
- SQLiteDatabase db = getReadableDatabase();
- SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
- String[] sqlSelect = {"id", "title", "poem", "subject", "years", "favorite"};
- String sqlTables = "poems_table";
- qb.setTables(sqlTables);
- Cursor c = qb.query(db, sqlSelect, null, null,
- null, null, null);
- c.moveToFirst();
- return c;
- }
Add Comment
Please, Sign In to add comment