android.database.sqlite
Class SQLiteDatabase
java.lang.Object
android.database.sqlite.SQLiteClosable
android.database.sqlite.SQLiteDatabase
public class SQLiteDatabase
- extends SQLiteClosable
Method Summary |
void |
beginTransaction()
|
void |
beginTransactionWithListener(SQLiteTransactionListener transactionListener)
|
void |
close()
|
SQLiteStatement |
compileStatement(String sql)
|
static SQLiteDatabase |
create(SQLiteDatabase.CursorFactory factory)
|
int |
delete(String table,
String whereClause,
String[] whereArgs)
|
void |
endTransaction()
|
void |
execSQL(String sql)
|
void |
execSQL(String sql,
Object[] bindArgs)
|
protected void |
finalize()
|
static String |
findEditTable(String tables)
|
long |
getMaximumSize()
|
long |
getPageSize()
|
String |
getPath()
|
Map<String,String> |
getSyncedTables()
|
int |
getVersion()
|
long |
insert(String table,
String nullColumnHack,
ContentValues values)
|
long |
insertOrThrow(String table,
String nullColumnHack,
ContentValues values)
|
long |
insertWithOnConflict(String table,
String nullColumnHack,
ContentValues initialValues,
int conflictAlgorithm)
|
boolean |
inTransaction()
|
boolean |
isDbLockedByCurrentThread()
|
boolean |
isDbLockedByOtherThreads()
|
boolean |
isOpen()
|
boolean |
isReadOnly()
|
void |
markTableSyncable(String table,
String deletedTable)
|
void |
markTableSyncable(String table,
String foreignKey,
String updateTable)
|
boolean |
needUpgrade(int newVersion)
|
protected void |
onAllReferencesReleased()
|
static SQLiteDatabase |
openDatabase(String path,
SQLiteDatabase.CursorFactory factory,
int flags)
|
static SQLiteDatabase |
openOrCreateDatabase(File file,
SQLiteDatabase.CursorFactory factory)
|
static SQLiteDatabase |
openOrCreateDatabase(String path,
SQLiteDatabase.CursorFactory factory)
|
Cursor |
query(boolean distinct,
String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy,
String limit)
|
Cursor |
query(String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy)
|
Cursor |
query(String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy,
String limit)
|
Cursor |
queryWithFactory(SQLiteDatabase.CursorFactory cursorFactory,
boolean distinct,
String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy,
String limit)
|
Cursor |
rawQuery(String sql,
String[] selectionArgs)
|
Cursor |
rawQueryWithFactory(SQLiteDatabase.CursorFactory cursorFactory,
String sql,
String[] selectionArgs,
String editTable)
|
static int |
releaseMemory()
|
long |
replace(String table,
String nullColumnHack,
ContentValues initialValues)
|
long |
replaceOrThrow(String table,
String nullColumnHack,
ContentValues initialValues)
|
void |
setLocale(Locale locale)
|
void |
setLockingEnabled(boolean lockingEnabled)
|
long |
setMaximumSize(long numBytes)
|
void |
setPageSize(long numBytes)
|
void |
setTransactionSuccessful()
|
void |
setVersion(int version)
|
int |
update(String table,
ContentValues values,
String whereClause,
String[] whereArgs)
|
int |
updateWithOnConflict(String table,
ContentValues values,
String whereClause,
String[] whereArgs,
int conflictAlgorithm)
|
boolean |
yieldIfContended()
|
boolean |
yieldIfContendedSafely()
|
boolean |
yieldIfContendedSafely(long sleepAfterYieldDelay)
|
CONFLICT_ROLLBACK
public static final int CONFLICT_ROLLBACK
- See Also:
- Constant Field Values
CONFLICT_ABORT
public static final int CONFLICT_ABORT
- See Also:
- Constant Field Values
CONFLICT_FAIL
public static final int CONFLICT_FAIL
- See Also:
- Constant Field Values
CONFLICT_IGNORE
public static final int CONFLICT_IGNORE
- See Also:
- Constant Field Values
CONFLICT_REPLACE
public static final int CONFLICT_REPLACE
- See Also:
- Constant Field Values
CONFLICT_NONE
public static final int CONFLICT_NONE
- See Also:
- Constant Field Values
SQLITE_MAX_LIKE_PATTERN_LENGTH
public static final int SQLITE_MAX_LIKE_PATTERN_LENGTH
- See Also:
- Constant Field Values
OPEN_READWRITE
public static final int OPEN_READWRITE
- See Also:
- Constant Field Values
OPEN_READONLY
public static final int OPEN_READONLY
- See Also:
- Constant Field Values
NO_LOCALIZED_COLLATORS
public static final int NO_LOCALIZED_COLLATORS
- See Also:
- Constant Field Values
CREATE_IF_NECESSARY
public static final int CREATE_IF_NECESSARY
- See Also:
- Constant Field Values
onAllReferencesReleased
protected void onAllReferencesReleased()
- Specified by:
onAllReferencesReleased
in class SQLiteClosable
releaseMemory
public static int releaseMemory()
setLockingEnabled
public void setLockingEnabled(boolean lockingEnabled)
beginTransaction
public void beginTransaction()
beginTransactionWithListener
public void beginTransactionWithListener(SQLiteTransactionListener transactionListener)
endTransaction
public void endTransaction()
setTransactionSuccessful
public void setTransactionSuccessful()
inTransaction
public boolean inTransaction()
isDbLockedByCurrentThread
public boolean isDbLockedByCurrentThread()
isDbLockedByOtherThreads
public boolean isDbLockedByOtherThreads()
yieldIfContended
public boolean yieldIfContended()
yieldIfContendedSafely
public boolean yieldIfContendedSafely()
yieldIfContendedSafely
public boolean yieldIfContendedSafely(long sleepAfterYieldDelay)
getSyncedTables
public Map<String,String> getSyncedTables()
openDatabase
public static SQLiteDatabase openDatabase(String path,
SQLiteDatabase.CursorFactory factory,
int flags)
openOrCreateDatabase
public static SQLiteDatabase openOrCreateDatabase(File file,
SQLiteDatabase.CursorFactory factory)
openOrCreateDatabase
public static SQLiteDatabase openOrCreateDatabase(String path,
SQLiteDatabase.CursorFactory factory)
create
public static SQLiteDatabase create(SQLiteDatabase.CursorFactory factory)
close
public void close()
getVersion
public int getVersion()
setVersion
public void setVersion(int version)
getMaximumSize
public long getMaximumSize()
setMaximumSize
public long setMaximumSize(long numBytes)
getPageSize
public long getPageSize()
setPageSize
public void setPageSize(long numBytes)
markTableSyncable
public void markTableSyncable(String table,
String deletedTable)
markTableSyncable
public void markTableSyncable(String table,
String foreignKey,
String updateTable)
findEditTable
public static String findEditTable(String tables)
compileStatement
public SQLiteStatement compileStatement(String sql)
throws SQLException
- Throws:
SQLException
query
public Cursor query(boolean distinct,
String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy,
String limit)
queryWithFactory
public Cursor queryWithFactory(SQLiteDatabase.CursorFactory cursorFactory,
boolean distinct,
String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy,
String limit)
query
public Cursor query(String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy)
query
public Cursor query(String table,
String[] columns,
String selection,
String[] selectionArgs,
String groupBy,
String having,
String orderBy,
String limit)
rawQuery
public Cursor rawQuery(String sql,
String[] selectionArgs)
rawQueryWithFactory
public Cursor rawQueryWithFactory(SQLiteDatabase.CursorFactory cursorFactory,
String sql,
String[] selectionArgs,
String editTable)
insert
public long insert(String table,
String nullColumnHack,
ContentValues values)
insertOrThrow
public long insertOrThrow(String table,
String nullColumnHack,
ContentValues values)
throws SQLException
- Throws:
SQLException
replace
public long replace(String table,
String nullColumnHack,
ContentValues initialValues)
replaceOrThrow
public long replaceOrThrow(String table,
String nullColumnHack,
ContentValues initialValues)
throws SQLException
- Throws:
SQLException
insertWithOnConflict
public long insertWithOnConflict(String table,
String nullColumnHack,
ContentValues initialValues,
int conflictAlgorithm)
delete
public int delete(String table,
String whereClause,
String[] whereArgs)
update
public int update(String table,
ContentValues values,
String whereClause,
String[] whereArgs)
updateWithOnConflict
public int updateWithOnConflict(String table,
ContentValues values,
String whereClause,
String[] whereArgs,
int conflictAlgorithm)
execSQL
public void execSQL(String sql)
throws SQLException
- Throws:
SQLException
execSQL
public void execSQL(String sql,
Object[] bindArgs)
throws SQLException
- Throws:
SQLException
finalize
protected void finalize()
- Overrides:
finalize
in class Object
isReadOnly
public boolean isReadOnly()
isOpen
public boolean isOpen()
needUpgrade
public boolean needUpgrade(int newVersion)
getPath
public final String getPath()
setLocale
public void setLocale(Locale locale)
Copyright © 2008-2011. All Rights Reserved.