SQLite API の軽いラッパーを書いています。
基本的に、SQLite プリコンパイル済みステートメントがいつどのように実行されるかについて興味があります...
私が行くと:
char buffer[] = "INSERT INTO example VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)";
sqlite3_stmt* stmt;
sqlite3_prepare_v2(mDb, buffer, strlen(buffer), &stmt, NULL);
for (unsigned i = 0; i < mVal; i++)
{
std::string id = getID();
sqlite3_bind_text(stmt, 1, id.c_str(), id.size(), SQLITE_STATIC);
sqlite3_bind_double(stmt, 2, getDouble());
sqlite3_bind_double(stmt, 3, getDouble());
sqlite3_bind_double(stmt, 4, getDouble());
sqlite3_bind_int(stmt, 5, getInt());
sqlite3_bind_int(stmt, 6, getInt());
sqlite3_bind_int(stmt, 7, getInt());
if (sqlite3_step(stmt) != SQLITE_DONE)
{
printf("Commit Failed!\n");
}
sqlite3_reset(stmt);
}
sqlite3_finalize(stmt);
実際のSQLはどの時点で実行されますか? への呼び出し中ですかsqlite3_prepare_v2
、それとも最初の 中sqlite3_step
ですか?
明快さは大歓迎です:)
乾杯
ジャレット