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)
总结以上是内存溢出为你收集整理的sqlite DatabaseUtils全部内容,希望文章能够帮你解决sqlite DatabaseUtils所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)