sqlite3批量插入数据c接口

	sqlite3_stmt *stmt;
	int ret = 0;

	const char* sql = "insert into tbl_test values(?, ?);";

	ret = sqlite3_prepare_v2(m_db, sql, strlen(sql), &stmt, 0);
	ASSERT(ret == SQLITE_OK);

	for(int i=0; i<3; ++i)
	{
		ret = sqlite3_bind_int(stmt, 1, 5);
		ASSERT(ret == SQLITE_OK);
		
		ret = sqlite3_bind_int(stmt, 2, 5);
		ASSERT(ret == SQLITE_OK);

		sqlite3_step(stmt);    // 执行
		sqlite3_reset(stmt);   // 重置
	}

	ret = sqlite3_finalize(stmt);
	ASSERT(ret == SQLITE_OK);

你可能感兴趣的:(数据库,sqlite,c语言,数据库)