SQLiteStatement
instead.@Deprecated public static class DatabaseUtils.InsertHelper extends Object
This class is not thread-safe.
Modifier and Type | Field and Description |
---|---|
static int |
TABLE_INFO_PRAGMA_COLUMNNAME_INDEX
Deprecated.
These are the columns returned by sqlite's "PRAGMA
table_info(...)" command that we depend on.
|
static int |
TABLE_INFO_PRAGMA_DEFAULT_INDEX
Deprecated.
This field was accidentally exposed in earlier versions of the platform
so we can hide it but we can't remove it.
|
Constructor and Description |
---|
InsertHelper(SQLiteDatabase db,
String tableName)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(int index,
boolean value)
Deprecated.
Bind the value to an index.
|
void |
bind(int index,
byte[] value)
Deprecated.
Bind the value to an index.
|
void |
bind(int index,
double value)
Deprecated.
Bind the value to an index.
|
void |
bind(int index,
float value)
Deprecated.
Bind the value to an index.
|
void |
bind(int index,
int value)
Deprecated.
Bind the value to an index.
|
void |
bind(int index,
long value)
Deprecated.
Bind the value to an index.
|
void |
bind(int index,
String value)
Deprecated.
Bind the value to an index.
|
void |
bindNull(int index)
Deprecated.
Bind null to an index.
|
void |
close()
Deprecated.
Close this object and release any resources associated with
it.
|
long |
execute()
Deprecated.
Execute the previously prepared insert or replace using the bound values
since the last call to prepareForInsert or prepareForReplace.
|
int |
getColumnIndex(String key)
Deprecated.
Returns the index of the specified column.
|
long |
insert(ContentValues values)
Deprecated.
Performs an insert, adding a new row with the given values.
|
void |
prepareForInsert()
Deprecated.
Prepare the InsertHelper for an insert.
|
void |
prepareForReplace()
Deprecated.
Prepare the InsertHelper for a replace.
|
long |
replace(ContentValues values)
Deprecated.
Performs an insert, adding a new row with the given values.
|
public static final int TABLE_INFO_PRAGMA_COLUMNNAME_INDEX
public static final int TABLE_INFO_PRAGMA_DEFAULT_INDEX
public InsertHelper(SQLiteDatabase db, String tableName)
db
- the SQLiteDatabase to insert intotableName
- the name of the table to insert intopublic int getColumnIndex(String key)
key
- the column namepublic void bind(int index, double value)
index
- the index of the slot to which to bindvalue
- the value to bindpublic void bind(int index, float value)
index
- the index of the slot to which to bindvalue
- the value to bindpublic void bind(int index, long value)
index
- the index of the slot to which to bindvalue
- the value to bindpublic void bind(int index, int value)
index
- the index of the slot to which to bindvalue
- the value to bindpublic void bind(int index, boolean value)
index
- the index of the slot to which to bindvalue
- the value to bindpublic void bindNull(int index)
index
- the index of the slot to which to bindpublic void bind(int index, byte[] value)
index
- the index of the slot to which to bindvalue
- the value to bindpublic void bind(int index, String value)
index
- the index of the slot to which to bindvalue
- the value to bindpublic long insert(ContentValues values)
values
- the set of values with which to populate the
new rowpublic long execute()
Note that calling bind() and then execute() is not thread-safe. The only thread-safe way to use this class is to call insert() or replace().
public void prepareForInsert()
public void prepareForReplace()
public long replace(ContentValues values)
values
- the set of values with which to populate the
new rowpublic void close()
insert()
after
calling this method is undefined.