summaryrefslogtreecommitdiff
path: root/project2/tablepatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/tablepatch.cpp')
-rw-r--r--project2/tablepatch.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/project2/tablepatch.cpp b/project2/tablepatch.cpp
index ddf7e03..8acc8da 100644
--- a/project2/tablepatch.cpp
+++ b/project2/tablepatch.cpp
@@ -95,8 +95,9 @@ TablePatch::doDeletes(const char * where, const char * order)
toDelSql.appendf(" ORDER BY %s", order);
}
toDelSql.append(")");
- ModifyCommand del(db, toDelSql);
- del.execute();
+ ModifyCommand * del = db.newModifyCommand(toDelSql);
+ del->execute();
+ delete del;
}
void
@@ -186,16 +187,18 @@ TablePatch::doUpdates(const char * where, const char * order)
// -----------------------------------------------------------------
// Iterator over update list make changes --------------------------
// -----------------------------------------------------------------
- SelectCommand toUpd(db, toUpdSel);
- ModifyCommand upd(db, updSql);
+ SelectCommand * toUpd = db.newSelectCommand(toUpdSel);
+ ModifyCommand * upd = db.newModifyCommand(updSql);
int cs = cols.size();
- toUpd.execute();
+ toUpd->execute();
for (int c = 0; c < cs; c += 1) {
- toUpd[c].rebind(&upd, c);
+ (*toUpd)[c].rebind(upd, c);
}
- while (toUpd.fetch()) {
- upd.execute(false);
+ while (toUpd->fetch()) {
+ upd->execute(false);
}
+ delete toUpd;
+ delete upd;
}
void
@@ -250,7 +253,9 @@ TablePatch::doInserts(const char * order)
if (order && *order) {
toInsSql.appendf(" ORDER BY %s", order);
}
- ModifyCommand(db, toInsSql).execute();
+ ModifyCommand * ins = db.newModifyCommand(toInsSql);
+ ins->execute();
+ delete ins;
}
const char *