sqlite DatabaseUtils

前端之家收集整理的这篇文章主要介绍了sqlite DatabaseUtils前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

This class allows users to do multiple inserts into a table but compile the sql insert statement only once,which may increase performance.
此类允许用户对表进行多次插入,但是只编译一次sql插入语句,这可能会提高性能

1.public static final void writeExceptionToParcel(Parcel reply,Exception e)
Special function for writing an exception result at the header of a parcel,to be used when returning an exception from a transaction. exception will be re-thrown by the function in another process
用于在从事务中返回异常时使用的用于在包裹标头处写入异常结果的特殊函数。 异常将被另一个进程中的函数重新抛出

2.public static String sqlEscapeString(String value)

3.public static final void appendValueTosql(StringBuilder sql,Object value)

4.public static void cursorStringToContentValues(Cursor cursor,
String field,
ContentValues values)
从Cursor中的字段读取一个字符串,并将其写入InsertHelper。

5.public static void cursorStringToContentValues(Cursor cursor,
ContentValues values,
String key)
从游标中的字段读取字符串,并将其写入映射。

cursor - The cursor to read from
field - The TEXT field to read
values - The ContentValues to put the value into,with the field as the key
key - The key to store the value with in the map

cursorIntToContentValues
public static void cursorIntToContentValues(Cursor cursor,
ContentValues values)
Reads an Integer out of a field in a Cursor and writes it to a Map.
参数:
cursor - The cursor to read from
field - The INTEGER field to read
values - The ContentValues to put the value into,with the field as the key
cursorIntToContentValues

public static void cursorIntToContentValues(Cursor cursor,
String key)
Reads a Integer out of a field in a Cursor and writes it to a Map.
参数:
cursor - The cursor to read from
field - The INTEGER field to read
values - The ContentValues to put the value into,with the field as the key
key - The key to store the value with in the map

cursorLongToContentValues
public static void cursorLongToContentValues(Cursor cursor,
ContentValues values)
Reads a Long out of a field in a Cursor and writes it to a Map.
参数:
cursor - The cursor to read from
field - The INTEGER field to read
values - The ContentValues to put the value into,with the field as the key

cursorLongToContentValues
public static void cursorLongToContentValues(Cursor cursor,
String key)
Reads a Long out of a field in a Cursor and writes it to a Map.
参数:
cursor - The cursor to read from
field - The INTEGER field to read
values - The ContentValues to put the value into
key - The key to store the value with in the map
cursorDoubleToCursorValues
public static void cursorDoubleToCursorValues(Cursor cursor,
ContentValues values)
Reads a Double out of a field in a Cursor and writes it to a Map.
参数:
cursor - The cursor to read from
field - The REAL field to read
values - The ContentValues to put the value into

cursorDoubleToContentValues
public static void cursorDoubleToContentValues(Cursor cursor,
String key)
Reads a Double out of a field in a Cursor and writes it to a Map.
参数:
cursor - The cursor to read from
field - The REAL field to read
values - The ContentValues to put the value into
key - The key to store the value with in the map

cursorRowToContentValues
public static void cursorRowToContentValues(Cursor cursor,
ContentValues values)
Read the entire contents of a cursor row and store them in a ContentValues.
参数:
cursor - the cursor to read from.
values - the ContentValues to put the row into.

queryNumEntries
public static long queryNumEntries(sqliteDatabase db,
String table)
Query the table for the number of rows in the table.
参数:
db - the database the table is in
table - the name of the table to query
返回:
the number of rows in the table、

longForQuery
public static long longForQuery(sqliteDatabase db,
String query,
String[] selectionArgs)
Utility method to run the query on the db and return the value in the first column of the first row.
用于对数据库运行查询的实用方法,并返回第一行第一列中的值。

createDbFromsqlStatements public static void createDbFromsqlStatements(Context context,String dbName,int dbVersion,String sqlStatements) Creates a db and populates it with the sql statements in sqlStatements. 参数: context - the context to use to create the db dbName - the name of the db to create dbVersion - the version to set on the db sqlStatements - the statements to use to populate the db. This should be a single stringof the form returned by sqlite3’s .dump command (statements separated bysemicolons)

原文链接:https://www.f2er.com/sqlite/198623.html

猜你在找的Sqlite相关文章