Udostępnij za pośrednictwem


SQLiteDatabase.InsertWithOnConflict Method

Definition

General method for inserting a row into the database.

[Android.Runtime.Register("insertWithOnConflict", "(Ljava/lang/String;Ljava/lang/String;Landroid/content/ContentValues;I)J", "GetInsertWithOnConflict_Ljava_lang_String_Ljava_lang_String_Landroid_content_ContentValues_IHandler")]
public virtual long InsertWithOnConflict (string? table, string? nullColumnHack, Android.Content.ContentValues? initialValues, Android.Database.Sqlite.Conflict conflictAlgorithm);
[<Android.Runtime.Register("insertWithOnConflict", "(Ljava/lang/String;Ljava/lang/String;Landroid/content/ContentValues;I)J", "GetInsertWithOnConflict_Ljava_lang_String_Ljava_lang_String_Landroid_content_ContentValues_IHandler")>]
abstract member InsertWithOnConflict : string * string * Android.Content.ContentValues * Android.Database.Sqlite.Conflict -> int64
override this.InsertWithOnConflict : string * string * Android.Content.ContentValues * Android.Database.Sqlite.Conflict -> int64

Parameters

table
String

the table to insert the row into

nullColumnHack
String

optional; may be null. SQL doesn't allow inserting a completely empty row without naming at least one column name. If your provided initialValues is empty, no column names are known and an empty row can't be inserted. If not set to null, the nullColumnHack parameter provides the name of nullable column name to explicitly insert a NULL into in the case where your initialValues is empty.

initialValues
ContentValues

this map contains the initial column values for the row. The keys should be the column names and the values the column values

conflictAlgorithm
Conflict

for insert conflict resolver

Returns

the row ID of the newly inserted row OR -1 if either the input parameter conflictAlgorithm = #CONFLICT_IGNORE or an error occurred.

Attributes

Remarks

General method for inserting a row into the database.

Java documentation for android.database.sqlite.SQLiteDatabase.insertWithOnConflict(java.lang.String, java.lang.String, android.content.ContentValues, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to