InsertHelper
open classInsertHelper
kotlin.Any | |
↳ | android.database.DatabaseUtils.InsertHelper |
This class allows users to do multiple inserts into a table using the same statement.
This class is not thread-safe.
Summary
Public constructors | |
---|---|
InsertHelper(db: SQLiteDatabase!, tableName: String!) |
Public methods | |
---|---|
open Unit |
Bind the value to an index. |
open Unit |
Bind the value to an index. |
open Unit |
Bind the value to an index. |
open Unit |
Bind the value to an index. |
open Unit |
Bind the value to an index. |
open Unit |
Bind the value to an index. |
open Unit |
Bind the value to an index. |
open Unit |
Bind null to an index. |
open Unit |
close() Close this object and release any resources associated with it. |
open Long |
execute() Execute the previously prepared insert or replace using the bound values since the last call to prepareForInsert or prepareForReplace. |
open Int |
getColumnIndex(key: String!) Returns the index of the specified column. |
open Long |
insert(values: ContentValues!) Performs an insert, adding a new row with the given values. |
open Unit |
Prepare the InsertHelper for an insert. |
open Unit |
Prepare the InsertHelper for a replace. |
open Long |
replace(values: ContentValues!) Performs an insert, adding a new row with the given values. |
Public constructors
InsertHelper
InsertHelper(
db: SQLiteDatabase!,
tableName: String!)
Parameters | |
---|---|
db |
SQLiteDatabase!: the SQLiteDatabase to insert into |
tableName |
String!: the name of the table to insert into |
Public methods
bind
open funbind(
index: Int,
value: Boolean
): Unit
Deprecated: Deprecated in Java.
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
value |
Boolean: the value to bind |
bind
open funbind(
index: Int,
value: ByteArray!
): Unit
Deprecated: Deprecated in Java.
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
value |
ByteArray!: the value to bind |
bind
open funbind(
index: Int,
value: Double
): Unit
Deprecated: Deprecated in Java.
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
value |
Double: the value to bind |
bind
open funbind(
index: Int,
value: Float
): Unit
Deprecated: Deprecated in Java.
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
value |
Float: the value to bind |
bind
open funbind(
index: Int,
value: Int
): Unit
Deprecated: Deprecated in Java.
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
value |
Int: the value to bind |
bind
open funbind(
index: Int,
value: String!
): Unit
Deprecated: Deprecated in Java.
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
value |
String!: the value to bind |
bind
open funbind(
index: Int,
value: Long
): Unit
Deprecated: Deprecated in Java.
Bind the value to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
value |
Long: the value to bind |
bindNull
open funbindNull(index: Int): Unit
Deprecated: Deprecated in Java.
Bind null to an index. A prepareForInsert() or prepareForReplace() without a matching execute() must have already have been called.
Parameters | |
---|---|
index |
Int: the index of the slot to which to bind |
close
open funclose(): Unit
Deprecated: Deprecated in Java.
Close this object and release any resources associated with it. The behavior of calling insert()
after calling this method is undefined.
execute
open funexecute(): Long
Deprecated: Deprecated in Java.
Execute the previously prepared insert or replace using the bound values since the last call to prepareForInsert or prepareForReplace.
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().
Return | |
---|---|
Long |
the row ID of the newly inserted row, or -1 if an error occurred |
getColumnIndex
open fungetColumnIndex(key: String!): Int
Deprecated: Deprecated in Java.
Returns the index of the specified column. This is index is suitagble for use in calls to bind().
Parameters | |
---|---|
key |
String!: the column name |
Return | |
---|---|
Int |
the index of the column |
insert
open funinsert(values: ContentValues!): Long
Deprecated: Deprecated in Java.
Performs an insert, adding a new row with the given values. If the table contains conflicting rows, an error is returned.
Parameters | |
---|---|
values |
ContentValues!: the set of values with which to populate the new row |
Return | |
---|---|
Long |
the row ID of the newly inserted row, or -1 if an error occurred |
prepareForInsert
open funprepareForInsert(): Unit
Deprecated: Deprecated in Java.
Prepare the InsertHelper for an insert. The pattern for this is:
- prepareForInsert()
- bind(index, value);
- bind(index, value);
- ...
- bind(index, value);
- execute();
prepareForReplace
open funprepareForReplace(): Unit
Deprecated: Deprecated in Java.
Prepare the InsertHelper for a replace. The pattern for this is:
- prepareForReplace()
- bind(index, value);
- bind(index, value);
- ...
- bind(index, value);
- execute();
replace
open funreplace(values: ContentValues!): Long
Deprecated: Deprecated in Java.
Performs an insert, adding a new row with the given values. If the table contains conflicting rows, they are deleted and replaced with the new row.
Parameters | |
---|---|
values |
ContentValues!: the set of values with which to populate the new row |
Return | |
---|---|
Long |
the row ID of the newly inserted row, or -1 if an error occurred |