From: JINMEI Tatuya Date: Wed, 5 Oct 2011 06:17:41 +0000 (-0700) Subject: [1261] install NULL instead of "" for an empty column for backward X-Git-Tag: perftcpdns_before_epoll~37^2~21^2~13^2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2de8b71f8c0e7d02e25aa7ec6fa13f9933c8b534;p=thirdparty%2Fkea.git [1261] install NULL instead of "" for an empty column for backward compatibility. We need this at least until we completely deprecate the old API. --- diff --git a/src/lib/datasrc/sqlite3_accessor.cc b/src/lib/datasrc/sqlite3_accessor.cc index 69d564951d..3c2a705955 100644 --- a/src/lib/datasrc/sqlite3_accessor.cc +++ b/src/lib/datasrc/sqlite3_accessor.cc @@ -637,8 +637,12 @@ doUpdate(SQLite3Parameters& dbparams, StatementID stmt_id, const size_t column_count = sizeof(update_params) / sizeof(update_params[0]); for (int i = 0; i < column_count; ++i) { - if (sqlite3_bind_text(stmt, ++param_id, update_params[i].c_str(), -1, - SQLITE_TRANSIENT) != SQLITE_OK) { + // The old sqlite3 data source API assumes NULL for an empty column. + // We need to provide compatibility at least for now. + if (sqlite3_bind_text(stmt, ++param_id, + update_params[i].empty() ? NULL : + update_params[i].c_str(), + -1, SQLITE_TRANSIENT) != SQLITE_OK) { isc_throw(DataSourceError, "failed to bind SQLite3 parameter: " << sqlite3_errmsg(dbparams.db_)); }