Best code examples for SQLiteDatabase insert method (android.database.sqlite.SQLiteDatabase.insert)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SQLiteDatabase insert method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

SQLiteDatabase insert examples from Open Source projects
This code example shows how to use the following methods: execSQL, insert
69:	userDao.save(sqLiteDatabase, account.getUser()); 
-
76:	clearDeletedAccount(sqLiteDatabase, account); // 确保一个帐号在数据库中只有一条记录,一个状态 
-
78:	long rowId = sqLiteDatabase.insert(TABLE, null, values); 
-
94:	sqLiteDatabase.execSQL(sql.toString()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: close, delete, insert, query
100:	db.delete(TABLE_PLAYLIST, "PlaylistName = ?", whereArgs); 
-
102:	db.close(); 
-
311:	Cursor query = db.query(TABLE_PLAYLIST, columns, "PlaylistName = ?", selectionArgs, null, null, null); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: execSQL, insert
84:	db.execSQL( 
-
95:	db.execSQL("CREATE INDEX lookup_identity ON identity(" + 
-
98:	db.execSQL( 
-
106:	db.execSQL("CREATE INDEX lookup_feature ON feature(" + 
-
114:	db.insert("identity", "_id", values); 
-
120:	db.insert("feature", "_id", values); 
-
122:	db.insert("feature", "_id", values); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: execSQL, insert, query
95:	Cursor c = 
-
136:	db.execSQL(DBVERSION_CREATE); 
-
139:	db.insert(TABLE_DBVERSION, null, args); 
-
141:	db.execSQL(TABLE_CREATE); 
-
158:	db.insert(TABLE_DBVERSION, null, args); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: execSQL, insert
84:	db.execSQL( 
-
95:	db.execSQL("CREATE INDEX lookup_identity ON identity(" + 
-
98:	db.execSQL( 
-
106:	db.execSQL("CREATE INDEX lookup_feature ON feature(" + 
-
114:	db.insert("identity", "_id", values); 
-
120:	db.insert("feature", "_id", values); 
-
122:	db.insert("feature", "_id", values); 
-
137:	db.execSQL("DROP TABLE feature"); 
138:	db.execSQL("DROP TABLE identity"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: insert
118:	mDb.insert(table, null, cv); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: delete, insert, query
345:	int deleted = database.delete("table_name", "1", null); 
-
619:	return database.insert("table_name", null, values); 
-
645:	Cursor cursor = database.query("table_name", new String[]{"id", "name"}, null, null, null, null, null); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: beginTransaction, insert
233:	db.beginTransaction(); 
-
237:	final long id = db.insert(getTableName(), null, getContent()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert
55:	db.execSQL("DROP TABLE IF EXISTS " + SYNC_STATE_TABLE); 
56:	db.execSQL("CREATE TABLE " + SYNC_STATE_TABLE + " (" 
-
64:	db.execSQL("DROP TABLE IF EXISTS " + SYNC_STATE_META_TABLE); 
65:	db.execSQL("CREATE TABLE " + SYNC_STATE_META_TABLE + " (" 
-
69:	db.insert(SYNC_STATE_META_TABLE, SYNC_STATE_META_VERSION_COLUMN, values); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: put, insert
46:	ContentValues cv=new ContentValues(); 
-
48:	cv.put("name", name); 
49:	cv.put("address", address); 
50:	cv.put("type", type); 
51:	cv.put("notes", notes); 
-
53:	getWritableDatabase().insert("restaurants", "name", cv); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: execSQL, insert, query
114:	Cursor c = 
-
160:	db.execSQL(DBVERSION_CREATE); 
-
163:	db.insert(TABLE_DBVERSION, null, args); 
-
165:	db.execSQL(TABLE_LOG_CREATE); 
166:	db.execSQL(TABLE_CELL_CREATE); 
167:	db.execSQL(TABLE_TAGS_CREATE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert
37:	database.execSQL(table1); 
-
56:	database.insert(usersTable, null, entry); 
-
61:	database.execSQL("DROP TABLE IF EXISTS " + usersTable); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: close, beginTransaction, endTransaction, insert
70:	mDB.beginTransaction();//开始事务 
-
77:	mDB.insert(TABLE_NAME, "_id", values); 
-
82:	mDB.endTransaction();//由事务的标志决定是提交事务,还是回滚事务. 
83:	mDB.close(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: insert, rawQuery, update
137:	db.update("styles", cvs, "_id = ?", new String[] { id.toString() }); 
-
139:	id = db.insert("styles", null, cvs); 
-
141:	Cursor cursor = db.rawQuery("SELECT * FROM styles WHERE _id = ?", 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: insert
94:	long rowID = mDb.insert(TABLE_NAME, null, values); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: insert, replace
177:	long res = db.insert(CERTIFICATE_TABLE, null, value); 
-
179:	db.replace(CERTIFICATE_TABLE, null, value); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: insert
41:	return mDb.insert(tableName, null, values); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: close, delete, insert, rawQuery
54:	c=sqdb.rawQuery("select count(*) from loginstat",null); 
-
60:	c=sqdb.rawQuery("Select time from loginstat order by time",null); 
-
64:	sqdb.delete("loginstat","time" + "=?",new String[] {temp} ); 
-
66:	sqdb.insert("loginstat",null,workhorse); 
-
69:	sqdb.close();///added on err 
-
78:	long temp3=sqdb.insert("loginstat",null,workhorse); 
-
80:	sqdb.close();///added on err 
-
87:	sqdb.close();///added on err 
-
94:	sqdb.close();///added on err 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert, ContentValues.put
122:	ContentValues content = new ContentValues(); 
-
124:	content.put(Field.title.toString(), title ); 
125:	content.put(Field.a_first_name.toString(), authorFirstName ); 
126:	content.put(Field.a_last_name.toString(), authorLastName ); 
127:	content.put(Field.cover_image.toString(), coverImage ); 
128:	content.put(Field.description.toString(), description ); 
-
131:	content.put(Field.date_last_read.toString(), new Date().getTime() ); 
-
134:	content.put(Field.file_name.toString(), fileName ); 
135:	content.put(Field.date_added.toString(), new Date().getTime() ); 
-
137:	getDataBase().insert(LIB_BOOKS_TABLE, null, content); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: execSQL, insert
71:	db.execSQL( 
-
91:	db.execSQL(sql); 
-
112:	db.execSQL(sql); 
-
122:	long id = db.insert(GamesSQLiteOpenHelper.GAME_USER_TABLE, null, values); 
-
134:	db.insert(GamesSQLiteOpenHelper.GAME_USER_SETTINGS_TABLE, null, values); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert
23:	db.execSQL("CREATE TABLE IF NOT EXISTS people" 
-
32:	db.insert("people", null, values); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert, query
122:	Cursor cur = mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_FACE}, 
-
127:	mDb.execSQL(sql); 
-
129:	Long ret = mDb.insert(DATABASE_TABLE, null, initialValues); 
-
132:	cur = mDb.query(DATABASE_TABLE, new String[] { KEY_ROWID}, 
-
143:	mDb.execSQL(sql); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert
30:	ContentValues cv = new ContentValues(); 
-
32:	cv.put("name", name); 
33:	cv.put("address", address); 
34:	cv.put("type", type); 
35:	cv.put("notes", notes); 
-
37:	getWritableDatabase().insert("restaurants", "name", cv); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: beginTransaction, endTransaction, insert, setTransactionSuccessful
179:	db.beginTransaction(); 
-
181:	long rowId = db.insert(getTableName(uri), BaseColumns._ID, initialValues); 
-
183:	db.setTransactionSuccessful(); 
184:	db.endTransaction(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert
42:	db.execSQL(SCHEDULE_QUERY_STRING); 
43:	db.execSQL(LISTING_DEFINITION_QUERY_STRING); 
44:	db.execSQL(TYPE_QUERY_STRING); 
45:	db.execSQL(LISTINGS_QUERY_STRING); 
-
91:	db.insert("schedule", "duration", cv); 
-
95:	db.insert("schedule", "duration", cv); 
-
100:	db.insert("schedule", "duration", cv); 
-
105:	db.insert("schedule", "duration", cv); 
-
110:	db.insert("schedule", "duration", cv); 
-
115:	db.insert("schedule", "duration", cv); 
-
120:	db.insert("schedule", "duration", cv); 
-
125:	db.insert("schedule", "duration", cv); 
-
131:	db.insert("auction_type", "description", cv); 
-
135:	db.insert("auction_type", "description", cv); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert
77:	db.execSQL("CREATE TABLE data (" + 
-
87:	db.insert("data", null, values); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert
54:	ContentValues cv = new ContentValues(); 
55:	cv.put(CREATED_AT, created_at); 
56:	cv.put(TEXT, text); 
57:	getWritableDatabase().insert("twitter", null, cv); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: delete, insert, query, update
271:	Long rowid = db.insert(getTableHistory(), null, values); 
-
354:	int deleted = db.delete(getTableHistory(), COLUMN_HISTORY_ID + " = '" + _id 
-
431:	return db.query(getTableSpieler(), columns, 
-
465:	Cursor c = db.query(getTableSpieler(), columns, getColumnSpielerId() + " = '" 
-
566:	db.update(getTableHistory(), cv2, COLUMN_HISTORY_SPIELER 
-
580:	db.update(getTableSpieler(), values, getColumnSpielerId() + " = " 
-
587:	return db.update(getTableSpieler(), cv, getColumnSpielerId() + " = '" 
-
602:	return db.update(getTableSpieler(), cv, getColumnSpielerId() + " = '" 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: execSQL, insert
64:	db.execSQL("drop table if exists " + GAME_TABLE + ";"); 
65:	db.execSQL("Drop table if exists " + GAME_USER_TABLE + ";"); 
66:	db.execSQL("Drop table if exists " + GAME_USER_SETTINGS_TABLE + ";"); 
-
71:	db.execSQL( 
-
91:	db.execSQL(sql); 
-
112:	db.execSQL(sql); 
-
122:	long id = db.insert(GamesSQLiteOpenHelper.GAME_USER_TABLE, null, values); 
-
134:	db.insert(GamesSQLiteOpenHelper.GAME_USER_SETTINGS_TABLE, null, values); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert
118:	ContentValues contentValues = new ContentValues(); 
119:	contentValues.put(LOCATION_TIMESTAMP_COLUMN, location.getTime()); 
120:	contentValues.put(PROVIDER_COLUMN, location.getProvider()); 
121:	contentValues.put(UPDATE_ID_COLUMN, updateId); 
122:	getWritableDatabase().insert(LOCATION_TABLE, null, contentValues); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: insert, isOpen
16:	if (db.isOpen()) { 
-
21:	db.insert("folders", null, cv); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: delete, insert, rawQuery, update
83:	mDatabase.update(TABLE_PLAKATE, cv, PLAKATE_ID + "=?", 
-
87:	mDatabase.delete(TABLE_CHANGES, CHANGES_ID + "=?", new String[] { String.valueOf(id) }); 
-
91:	mDatabase.insert(TABLE_CHANGES, null, values); 
-
174:	Cursor dataCount = mDatabase.rawQuery("select " + CHANGES_TYPE 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert
48:	db.execSQL(URLSTORE_TABLE_CREATE); 
49:	db.execSQL(HANDLER_TABLE_CREATE); 
-
56:	db.insert(URLSTORE_TABLE_NAME, "URL", values); 
-
65:	db.execSQL("DROP TABLE IF EXISTS " + URLSTORE_TABLE_NAME); 
66:	db.execSQL("DROP TABLE IF EXISTS " + HANDLER_TABLE_NAME); 
-
79:	db.execSQL("DROP TABLE IF EXISTS " + HANDLER_TABLE_NAME); 
80:	db.execSQL(HANDLER_TABLE_CREATE); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: close, beginTransaction, endTransaction, insert, setTransactionSuccessful
40:	mDB.beginTransaction();//开始事务 
-
42:	mDB.insert(TABLE_NAME, null, values); 
43:	mDB.setTransactionSuccessful(); //执行到endTransaction()提交当前事务,如不调用此方法会回滚事务 . 
-
47:	mDB.endTransaction();//由事务的标志决定是提交事务,还是回滚事务. 
48:	mDB.close(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: insert, insertOrThrow, rawQuery, update
163:	db.insertOrThrow(TASK_TABLE, null, values); 
164:	db.insert(FTS_TABLE, null, ftsVals); 
-
168:	Cursor cursor = db.rawQuery("SELECT version FROM " + TASK_TABLE + 
-
174:	db.update(TASK_TABLE, values, C_ID + " = " + id, null); 
175:	db.update(FTS_TABLE, ftsVals, C_ID + " = " + id, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert
81:	ContentValues c = new ContentValues(); 
82:	c.put("NAME", s.getName()); 
83:	c.put("HOST", s.getHost()); 
84:	c.put("SSL", s.isSSL()); 
85:	c.put("PORT", s.getPort()); 
86:	c.put("USERNAME", s.getUsername()); 
87:	c.put("PASSWORD", s.getPassword()); 
88:	s.setId(getWritableDatabase().insert( "SERVERS", null, c)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert
35:	db.execSQL(sql); 
-
43:	db.execSQL(sql2); 
-
49:	db.insert("game4list", "notagame", values2); 
-
59:	db.insert("game4user", "lastName", values); 
-
68:	db.insert("game4user", "lastName", values); 
-
77:	db.insert("game4user", "lastName", values); 
-
86:	db.insert("game4user", "lastName", values); 
-
95:	db.insert("game4user", "lastName", values); 
-
104:	db.insert("game4user", "lastName", values); 
-
113:	db.insert("game4user", "lastName", values); 
-
119:	db.execSQL("DROP TABLE IF EXISTS game4users"); 
120:	db.execSQL("DROP TABLE IF EXISTS game4list"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert
127:	ContentValues value2 = new ContentValues(); 
128:	value2.put("ID", ID1); 
129:	value2.put("FromMemberId", fromMember); 
130:	value2.put("ToMemberId", toMember); 
131:	value2.put("Amount",amount); 
132:	getDB().insert(CashTable,null,value2); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert
33:	ContentValues cv=new ContentValues(); 
34:	cv.put("name", query); 
-
36:	getWritableDatabase().insert("restaurants", "name", cv); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: execSQL, insert, rawQuery
58:	Cursor c = db.rawQuery(DB_CHECK, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: put, insert
28:	ContentValues cv = new ContentValues(); 
29:	cv.put("text", text); 
30:	getWritableDatabase().insert("vokabeln", null, cv); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: close, insert, rawQuery
40:	db.rawQuery("DELETE FROM BayesianTables", null); 
-
43:	db.insert("BayesianTables", null, val); 
44:	db.close(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: put, insert
113:	ContentValues vals = new ContentValues(); 
114:	vals.put("action_id", actionId); 
115:	vals.put("name", name); 
116:	vals.put("type", type); 
117:	vals.put("handles", handles); 
118:	vals.put("script", script); 
119:	vals.put("icon", icon); 
-
122:	getWritableDatabase().insert("actions", null, vals); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: insert, query
47:	Cursor cursor = db.query("userinfo",null, "username = ? and password = ?", new String[]{username,password}, null, null, null); 
-
49:	db.insert("userinfo", null, cv); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: put, insert
439:	ContentValues values = new ContentValues(); 
440:	values.put("msisdn", msisdn); 
441:	getWritableDatabase().insert(TABLE_NAME, "timestamp", values); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: execSQL, insert, rawQuery
184:	mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data REAL);"); 
-
187:	long id = mDatabase.insert("test", "data", values); 
-
189:	Cursor c = mDatabase.rawQuery("SELECT data FROM test", null); 
Full Snippet Info
5
CodeRank
Related SQLiteDatabase insert Questions & Answers:
Other SQLiteDatabase insert Examples
68:			if (!isSiteExists(db, site.getRSSLink())) {
69:				// site not existed, create a new row
70:				db.insert(TABLE_RSS, null, values);
71:				db.close();
72:			} else {

Read More

62:	
63:			// Inserting Row
64:			db.insert(TABLE_CONTACTS, null, values);
65:			db.close(); // Closing database connection
66:		}

Read More

7:	
8:			// Inserting Row
9:			db.insert(TABLE_CONTACTS, null, values);
10:			db.close(); // Closing database connection
11:		}

Read More

insert Method Overview
Convenience method for inserting a row into the database.
See Also