From 1a9e34f15790a4e57b2e653684a299112b57368f Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 16 Sep 2010 00:01:56 +0000 Subject: Rewrite the whole of parameter and column binding almost from scratch No more template rubbish, no more messy partial specialisation Add copyless rebind of column to parameter Changes in project2 to suit --- project2/sendmailTask.cpp | 1 - project2/tablepatch.cpp | 13 ++++--------- project2/tablepatch.h | 2 -- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/project2/sendmailTask.cpp b/project2/sendmailTask.cpp index fdc298d..dc04f49 100644 --- a/project2/sendmailTask.cpp +++ b/project2/sendmailTask.cpp @@ -2,7 +2,6 @@ #include #include #include "xmlObjectLoader.h" -#include "modifycommand.h" #include "appEngine.h" #include "rdbmsDataSource.h" #include "presenter.h" diff --git a/project2/tablepatch.cpp b/project2/tablepatch.cpp index 3f057df..0decc1e 100644 --- a/project2/tablepatch.cpp +++ b/project2/tablepatch.cpp @@ -41,12 +41,6 @@ TablePatch::patch(const char * where, const char * order) doInserts(order); } -void -TablePatch::copyBind(const SelectCommand * src, ModifyCommand * dest, int cola, int colb) -{ - (*src)[cola].rebind(dest, colb); -} - void TablePatch::doDeletes(const char * where, const char * order) { @@ -200,10 +194,11 @@ TablePatch::doUpdates(const char * where, const char * order) SelectCommand toUpd(db, toUpdSel.c_str()); ModifyCommand upd(db, updSql.c_str()); int cs = cols.size(); + toUpd.execute(); + for (int c = 0; c < cs; c += 1) { + toUpd[c].rebind(&upd, c); + } while (toUpd.fetch()) { - for (int c = 0; c < cs; c += 1) { - copyBind(&toUpd, &upd, c, c); - } upd.execute(false); } } diff --git a/project2/tablepatch.h b/project2/tablepatch.h index 533ee16..f317fd2 100644 --- a/project2/tablepatch.h +++ b/project2/tablepatch.h @@ -29,8 +29,6 @@ class TablePatch { void addKey(const Column & col); void patch(const char * where, const char * order); - static void copyBind(const SelectCommand * src, ModifyCommand * dest, int cola, int colb); - private: void doDeletes(const char * where, const char * order); void doUpdates(const char * where, const char * order); -- cgit v1.2.3