I need re write this sqlite Statements from java to c++, BEcouse of low performance: I red this arcticle:
Improve INSERT-per-second performance of SQLite?
But Iam totaly confused, becouse I cant find any sqlstatemenst of Insert or Update
public synchronized void saveMatchValue(int photoRecOwner, int[] photoRecAssign, float[] value) {
SQLiteDatabase database = databaseHelper.getWritableDatabase();
database.beginTransaction();
IN Java:
String sql = " INSERT OR REPLACE INTO " + TypeContract.CTablePhotoMatch.TABLE_NAME + "("
+ TypeContract.CTablePhotoMatch.FK_OWNER + "," + TypeContract.CTablePhotoMatch.FK_ASSIGN + ","
+ TypeContract.CTablePhotoMatch.VALUE + ") VALUES (?, ?, ?) ;";
// THis can be same in the c++? like
string sqlstatement = "INSERT INTO abe_account ("...........
ANd rest is the clear for me plus minus // it
SQLiteStatement stmt = database.compileStatement(sql);
// stmt.bindDouble(index, value);
// database.compileStatement(sql)
try {
String[] whereArgs = new String[2];
int rows = 0;
for (int i = 0; i < photoRecAssign.length; i++) {
if (photoRecOwner > photoRecAssign[i]) {
stmt.bindDouble(1, photoRecOwner);
stmt.bindDouble(2, photoRecAssign[i]);
} else {
stmt.bindDouble(1, photoRecAssign[i]);
stmt.bindDouble(2, photoRecOwner);
}
stmt.bindDouble(3, value[i]);
try {
long entryID = stmt.executeInsert();
} catch (Exception e) {
// updtStmt.executeUpdateDelete();
} finally {
stmt.clearBindings();
}
// ContentValues contentValues = crossTableContentValues(
// photoRecOwner, photoRecAssign[i], value[i]);
// database.insert(TypeContract.CTablePhotoMatch.TABLE_NAME,
// null,
// contentValues);
}
database.setTransactionSuccessful();
} finally {
stmt.close();
database.endTransaction();
// database.close();
}
}