build update clauses correctly

afrisby
Sean Dague 2007-08-09 20:07:58 +00:00
parent 9fb651932e
commit ec0dc208dd
1 changed files with 6 additions and 1 deletions

View File

@ -184,9 +184,14 @@ namespace OpenSim.DataStore.MonoSqliteStorage
private SqliteCommand createUpdateCommand(string table, string pk, Dictionary<string, DbType> defs) private SqliteCommand createUpdateCommand(string table, string pk, Dictionary<string, DbType> defs)
{ {
string sql = "update " + table + " set "; string sql = "update " + table + " set ";
string subsql = "";
foreach (string key in defs.Keys) { foreach (string key in defs.Keys) {
sql += key + "= :" + key + ", "; if (subsql.Length > 0) { //
subsql += ", ";
} }
subsql += key + "= :" + key;
}
sql += subsql;
sql += " where " + pk; sql += " where " + pk;
SqliteCommand cmd = new SqliteCommand(sql); SqliteCommand cmd = new SqliteCommand(sql);