# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# DatabaseUtils.InsertHelper

`public static class DatabaseUtils.InsertHelper`
`extends Object` ``

java.lang.Object
↳ | android.database.DatabaseUtils.InsertHelper

This class is deprecated.
Use `SQLiteStatement` instead.

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(SQLiteDatabase db, String tableName)`

### Public methods
`void` | `bind(int index, float value)` Bind the value to an index.
`void` | `bind(int index, double value)` Bind the value to an index.
`void` | `bind(int index, int value)` Bind the value to an index.
`void` | `bind(int index, String value)` Bind the value to an index.
`void` | `bind(int index, long value)` Bind the value to an index.
`void` | `bind(int index, byte[] value)` Bind the value to an index.
`void` | `bind(int index, boolean value)` Bind the value to an index.
`void` | `bindNull(int index)` Bind null to an index.
`void` | `close()` Close this object and release any resources associated with it.
`long` | `execute()` Execute the previously prepared insert or replace using the bound values since the last call to prepareForInsert or prepareForReplace.
`int` | `getColumnIndex(String key)` Returns the index of the specified column.
`long` | `insert(ContentValues values)` Performs an insert, adding a new row with the given values.
`void` | `prepareForInsert()` Prepare the InsertHelper for an insert.
`void` | `prepareForReplace()` Prepare the InsertHelper for a replace.
`long` | `replace(ContentValues values)` Performs an insert, adding a new row with the given values.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### InsertHelper

    public InsertHelper (SQLiteDatabase db,
                    String tableName)

Parameters
`db` | `SQLiteDatabase`: the SQLiteDatabase to insert into
`tableName` | `String`: the name of the table to insert into

## Public methods

### bind

    public void bind (int index,
                    float value)

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

    public void bind (int index,
                    double value)

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

    public void bind (int index,
                    int value)

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

    public void bind (int index,
                    String value)

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

    public void bind (int index,
                    long value)

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

### bind

    public void bind (int index,
                    byte[] value)

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` | `byte`: the value to bind

### bind

    public void bind (int index,
                    boolean value)

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

### bindNull

    public void bindNull (int index)

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

    public void close ()

Close this object and release any resources associated with it. The behavior of calling `insert()` after calling this method is undefined.

### execute

    public long execute ()

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().

Returns
`long` | the row ID of the newly inserted row, or -1 if an error occurred

### getColumnIndex

    public int getColumnIndex (String key)

Returns the index of the specified column. This is index is suitagble for use in calls to bind().

Parameters
`key` | `String`: the column name

Returns
`int` | the index of the column

### insert

    public long insert (ContentValues values)

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

Returns
`long` | the row ID of the newly inserted row, or -1 if an error occurred

### prepareForInsert

    public void prepareForInsert ()

Prepare the InsertHelper for an insert. The pattern for this is:

- prepareForInsert()
- bind(index, value);
- bind(index, value);
- ...
- bind(index, value);
- execute();

### prepareForReplace

    public void prepareForReplace ()

Prepare the InsertHelper for a replace. The pattern for this is:

- prepareForReplace()
- bind(index, value);
- bind(index, value);
- ...
- bind(index, value);
- execute();

### replace

    public long replace (ContentValues values)

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

Returns
`long` | the row ID of the newly inserted row, or -1 if an error occurred

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*