From 77713513a5214d2f5918aae4a28d8f2d4eac23fa Mon Sep 17 00:00:00 2001 From: randomdan Date: Tue, 30 Nov 2010 21:03:08 +0000 Subject: Support binding null to an SQL command parameter Bind null for missing values for SQL merge data --- project2/sqlMergeTask.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/project2/sqlMergeTask.cpp b/project2/sqlMergeTask.cpp index 318ab4f..3abf4ee 100644 --- a/project2/sqlMergeTask.cpp +++ b/project2/sqlMergeTask.cpp @@ -216,7 +216,12 @@ class _Populate : public _NoOutputExecute { } unsigned int cols = iter->columnCount(); for (unsigned int c = 0; c < cols; c += 1) { - cmd->bindParamS(idxs[c], iter->getCurrentValue(c)); + try { + cmd->bindParamS(idxs[c], iter->getCurrentValue(c)); + } + catch (const PerRowValues::FieldDoesNotExist &) { + cmd->bindNull(idxs[c]); + } } cmd->execute(); } -- cgit v1.2.3