android.database
Class DatabaseUtils

java.lang.Object
  extended by android.database.DatabaseUtils

public class DatabaseUtils
extends Object


Nested Class Summary
static class DatabaseUtils.InsertHelper
           
 
Field Summary
static int STATEMENT_ABORT
           
static int STATEMENT_ATTACH
           
static int STATEMENT_BEGIN
           
static int STATEMENT_COMMIT
           
static int STATEMENT_DDL
           
static int STATEMENT_OTHER
           
static int STATEMENT_PRAGMA
           
static int STATEMENT_SELECT
           
static int STATEMENT_UNPREPARED
           
static int STATEMENT_UPDATE
           
 
Constructor Summary
DatabaseUtils()
           
 
Method Summary
static void appendEscapedSQLString(StringBuilder sb, String sqlString)
           
static String[] appendSelectionArgs(String[] originalValues, String[] newValues)
           
static void appendValueToSql(StringBuilder sql, Object value)
           
static void bindObjectToProgram(SQLiteProgram prog, int index, Object value)
           
static ParcelFileDescriptor blobFileDescriptorForQuery(SQLiteDatabase db, String query, String[] selectionArgs)
           
static ParcelFileDescriptor blobFileDescriptorForQuery(SQLiteStatement prog, String[] selectionArgs)
           
static String concatenateWhere(String a, String b)
           
static void createDbFromSqlStatements(Context context, String dbName, int dbVersion, String sqlStatements)
           
static void cursorDoubleToContentValues(Cursor cursor, String field, ContentValues values, String key)
           
static void cursorDoubleToContentValuesIfPresent(Cursor cursor, ContentValues values, String column)
           
static void cursorDoubleToCursorValues(Cursor cursor, String field, ContentValues values)
           
static void cursorFloatToContentValuesIfPresent(Cursor cursor, ContentValues values, String column)
           
static void cursorIntToContentValues(Cursor cursor, String field, ContentValues values)
           
static void cursorIntToContentValues(Cursor cursor, String field, ContentValues values, String key)
           
static void cursorIntToContentValuesIfPresent(Cursor cursor, ContentValues values, String column)
           
static void cursorLongToContentValues(Cursor cursor, String field, ContentValues values)
           
static void cursorLongToContentValues(Cursor cursor, String field, ContentValues values, String key)
           
static void cursorLongToContentValuesIfPresent(Cursor cursor, ContentValues values, String column)
           
static void cursorRowToContentValues(Cursor cursor, ContentValues values)
           
static void cursorShortToContentValuesIfPresent(Cursor cursor, ContentValues values, String column)
           
static void cursorStringToContentValues(Cursor cursor, String field, ContentValues values)
           
static void cursorStringToContentValues(Cursor cursor, String field, ContentValues values, String key)
           
static void cursorStringToContentValuesIfPresent(Cursor cursor, ContentValues values, String column)
           
static void cursorStringToInsertHelper(Cursor cursor, String field, DatabaseUtils.InsertHelper inserter, int index)
           
static void dumpCurrentRow(Cursor cursor)
           
static void dumpCurrentRow(Cursor cursor, PrintStream stream)
           
static void dumpCurrentRow(Cursor cursor, StringBuilder sb)
           
static String dumpCurrentRowToString(Cursor cursor)
           
static void dumpCursor(Cursor cursor)
           
static void dumpCursor(Cursor cursor, PrintStream stream)
           
static void dumpCursor(Cursor cursor, StringBuilder sb)
           
static String dumpCursorToString(Cursor cursor)
           
static String getCollationKey(String name)
           
static String getHexCollationKey(String name)
           
static int getSqlStatementType(String sql)
           
static long longForQuery(SQLiteDatabase db, String query, String[] selectionArgs)
           
static long longForQuery(SQLiteStatement prog, String[] selectionArgs)
           
static long queryNumEntries(SQLiteDatabase db, String table)
           
static long queryNumEntries(SQLiteDatabase db, String table, String selection)
           
static long queryNumEntries(SQLiteDatabase db, String table, String selection, String[] selectionArgs)
           
static void readExceptionFromParcel(Parcel reply)
           
static void readExceptionWithFileNotFoundExceptionFromParcel(Parcel reply)
           
static void readExceptionWithOperationApplicationExceptionFromParcel(Parcel reply)
           
static String sqlEscapeString(String value)
           
static String stringForQuery(SQLiteDatabase db, String query, String[] selectionArgs)
           
static String stringForQuery(SQLiteStatement prog, String[] selectionArgs)
           
static void writeExceptionToParcel(Parcel reply, Exception e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATEMENT_SELECT

public static final int STATEMENT_SELECT
See Also:
Constant Field Values

STATEMENT_UPDATE

public static final int STATEMENT_UPDATE
See Also:
Constant Field Values

STATEMENT_ATTACH

public static final int STATEMENT_ATTACH
See Also:
Constant Field Values

STATEMENT_BEGIN

public static final int STATEMENT_BEGIN
See Also:
Constant Field Values

STATEMENT_COMMIT

public static final int STATEMENT_COMMIT
See Also:
Constant Field Values

STATEMENT_ABORT

public static final int STATEMENT_ABORT
See Also:
Constant Field Values

STATEMENT_PRAGMA

public static final int STATEMENT_PRAGMA
See Also:
Constant Field Values

STATEMENT_DDL

public static final int STATEMENT_DDL
See Also:
Constant Field Values

STATEMENT_UNPREPARED

public static final int STATEMENT_UNPREPARED
See Also:
Constant Field Values

STATEMENT_OTHER

public static final int STATEMENT_OTHER
See Also:
Constant Field Values
Constructor Detail

DatabaseUtils

public DatabaseUtils()
Method Detail

writeExceptionToParcel

public static final void writeExceptionToParcel(Parcel reply,
                                                Exception e)

readExceptionFromParcel

public static final void readExceptionFromParcel(Parcel reply)

readExceptionWithFileNotFoundExceptionFromParcel

public static void readExceptionWithFileNotFoundExceptionFromParcel(Parcel reply)
                                                             throws FileNotFoundException
Throws:
FileNotFoundException

readExceptionWithOperationApplicationExceptionFromParcel

public static void readExceptionWithOperationApplicationExceptionFromParcel(Parcel reply)
                                                                     throws OperationApplicationException
Throws:
OperationApplicationException

bindObjectToProgram

public static void bindObjectToProgram(SQLiteProgram prog,
                                       int index,
                                       Object value)

appendEscapedSQLString

public static void appendEscapedSQLString(StringBuilder sb,
                                          String sqlString)

sqlEscapeString

public static String sqlEscapeString(String value)

appendValueToSql

public static final void appendValueToSql(StringBuilder sql,
                                          Object value)

concatenateWhere

public static String concatenateWhere(String a,
                                      String b)

getCollationKey

public static String getCollationKey(String name)

getHexCollationKey

public static String getHexCollationKey(String name)

dumpCursor

public static void dumpCursor(Cursor cursor)

dumpCursor

public static void dumpCursor(Cursor cursor,
                              PrintStream stream)

dumpCursor

public static void dumpCursor(Cursor cursor,
                              StringBuilder sb)

dumpCursorToString

public static String dumpCursorToString(Cursor cursor)

dumpCurrentRow

public static void dumpCurrentRow(Cursor cursor)

dumpCurrentRow

public static void dumpCurrentRow(Cursor cursor,
                                  PrintStream stream)

dumpCurrentRow

public static void dumpCurrentRow(Cursor cursor,
                                  StringBuilder sb)

dumpCurrentRowToString

public static String dumpCurrentRowToString(Cursor cursor)

cursorStringToContentValues

public static void cursorStringToContentValues(Cursor cursor,
                                               String field,
                                               ContentValues values)

cursorStringToInsertHelper

public static void cursorStringToInsertHelper(Cursor cursor,
                                              String field,
                                              DatabaseUtils.InsertHelper inserter,
                                              int index)

cursorStringToContentValues

public static void cursorStringToContentValues(Cursor cursor,
                                               String field,
                                               ContentValues values,
                                               String key)

cursorIntToContentValues

public static void cursorIntToContentValues(Cursor cursor,
                                            String field,
                                            ContentValues values)

cursorIntToContentValues

public static void cursorIntToContentValues(Cursor cursor,
                                            String field,
                                            ContentValues values,
                                            String key)

cursorLongToContentValues

public static void cursorLongToContentValues(Cursor cursor,
                                             String field,
                                             ContentValues values)

cursorLongToContentValues

public static void cursorLongToContentValues(Cursor cursor,
                                             String field,
                                             ContentValues values,
                                             String key)

cursorDoubleToCursorValues

public static void cursorDoubleToCursorValues(Cursor cursor,
                                              String field,
                                              ContentValues values)

cursorDoubleToContentValues

public static void cursorDoubleToContentValues(Cursor cursor,
                                               String field,
                                               ContentValues values,
                                               String key)

cursorRowToContentValues

public static void cursorRowToContentValues(Cursor cursor,
                                            ContentValues values)

queryNumEntries

public static long queryNumEntries(SQLiteDatabase db,
                                   String table)

queryNumEntries

public static long queryNumEntries(SQLiteDatabase db,
                                   String table,
                                   String selection)

queryNumEntries

public static long queryNumEntries(SQLiteDatabase db,
                                   String table,
                                   String selection,
                                   String[] selectionArgs)

longForQuery

public static long longForQuery(SQLiteDatabase db,
                                String query,
                                String[] selectionArgs)

longForQuery

public static long longForQuery(SQLiteStatement prog,
                                String[] selectionArgs)

stringForQuery

public static String stringForQuery(SQLiteDatabase db,
                                    String query,
                                    String[] selectionArgs)

stringForQuery

public static String stringForQuery(SQLiteStatement prog,
                                    String[] selectionArgs)

blobFileDescriptorForQuery

public static ParcelFileDescriptor blobFileDescriptorForQuery(SQLiteDatabase db,
                                                              String query,
                                                              String[] selectionArgs)

blobFileDescriptorForQuery

public static ParcelFileDescriptor blobFileDescriptorForQuery(SQLiteStatement prog,
                                                              String[] selectionArgs)

cursorStringToContentValuesIfPresent

public static void cursorStringToContentValuesIfPresent(Cursor cursor,
                                                        ContentValues values,
                                                        String column)

cursorLongToContentValuesIfPresent

public static void cursorLongToContentValuesIfPresent(Cursor cursor,
                                                      ContentValues values,
                                                      String column)

cursorShortToContentValuesIfPresent

public static void cursorShortToContentValuesIfPresent(Cursor cursor,
                                                       ContentValues values,
                                                       String column)

cursorIntToContentValuesIfPresent

public static void cursorIntToContentValuesIfPresent(Cursor cursor,
                                                     ContentValues values,
                                                     String column)

cursorFloatToContentValuesIfPresent

public static void cursorFloatToContentValuesIfPresent(Cursor cursor,
                                                       ContentValues values,
                                                       String column)

cursorDoubleToContentValuesIfPresent

public static void cursorDoubleToContentValuesIfPresent(Cursor cursor,
                                                        ContentValues values,
                                                        String column)

createDbFromSqlStatements

public static void createDbFromSqlStatements(Context context,
                                             String dbName,
                                             int dbVersion,
                                             String sqlStatements)

getSqlStatementType

public static int getSqlStatementType(String sql)

appendSelectionArgs

public static String[] appendSelectionArgs(String[] originalValues,
                                           String[] newValues)


Copyright © 2008-2012. All Rights Reserved.