@ZeroGeek
2015-10-21T09:06:33.000000Z
字数 1294
阅读 717
每周主题
目前Android中最新SQLite为3.4.0版本。
| 类名 | 说明 |
|---|---|
| SQLiteClosable | An object created from a SQLiteDatabase that can be closed. |
| SQLiteCursor | A Cursor implementation that exposes results from a query on a SQLiteDatabase. |
| SQLiteDatabase | Exposes methods to manage a SQLite database. |
| SQLiteOpenHelper | A helper class to manage database creation and version management. |
| SQLiteProgram | A base class for compiled SQLite programs. |
| SQLiteQuery | Represents a query that reads the resulting rows into a SQLiteQuery. |
| SQLiteQueryBuilder | This is a convience class that helps build SQL queries to be sent to SQLiteDatabase objects. |
| SQLiteStatement | Represents a statement that can be executed against a database. |
SQLiteDatabase db; // db的声明
db.beginTransaction();try {...db.setTransactionSuccessful();} finally {db.endTransaction();}
private String getCategoryNameById(long id){String querySql = "select name from t_category where categoryPOID = ? and depth = 2";String[] args = {String.valueOf(id),};Cursor c = null;String name = "";try {c = db.rawQuery(querySql, args);if(c.moveToFirst()){name = c.getString(c.getColumnIndex("name"));}} finally {closeCursor(c);}return name;}/*** 释放游标*/protected void closeCursor(Cursor c) {if (c != null) {if (!c.isClosed()) {c.close();c = null;}}}
http://androiddoc.qiniudn.com/reference/android/database/sqlite/package-summary.html
http://androiddoc.qiniudn.com/reference/android/database/sqlite/SQLiteDatabase.html
