monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] org.debian.monotone: 71931c9a5c8d377bfb143bd4f2


From: code
Subject: [Monotone-commits-diffs] org.debian.monotone: 71931c9a5c8d377bfb143bd4f20fabd0ec30ada0
Date: Mon, 11 Mar 2013 21:54:09 +0100 (CET)

revision:            71931c9a5c8d377bfb143bd4f20fabd0ec30ada0
date:                2010-10-26T16:57:03
author:              Richard Levitte <address@hidden>
branch:              org.debian.monotone
changelog:
SQLite 3.7.3 and later does consistently return a NULL pointer for empty or 
NULL blobs, just as documented. We've just been lucky enough in the past to 
always get back an empty string before...

manifest:
format_version "1"

new_manifest [770ba56eaef6eca1ff0f825099c8f49a0b293591]

old_revision [b6ecd6153dbd8658f621e9a20d47859194ccd252]

add_file "patches/01-database.cc.diff"
 content [665f7d49b645df16a5b38298bc887504a49c04a5]

patch "patches/series"
 from [8bec750bce1e1dc66bb0b390532a900f9ba11e8f]
   to [46b089f38bf947773523743d6cd387a59946f42d]
============================================================
--- /dev/null	
+++ patches/01-database.cc.diff	665f7d49b645df16a5b38298bc887504a49c04a5
@@ -0,0 +1,37 @@
+#
+# SQLite 3.7.3 and later does consistently return a NULL pointer
+# for empty or NULL blobs, just as documented. We've just been
+# lucky enough in the past to always get back an empty string
+# before...
+#
+# patch "database.cc"
+#  from [0afa3ff4bd9c9ee3bc62b10bcf6295a9f5388d64]
+#    to [8bfff559a0894259fe3668294bd3906ae837129b]
+#
+============================================================
+--- monotone-0.48.orig/database.cc	0afa3ff4bd9c9ee3bc62b10bcf6295a9f5388d64
++++ monotone-0.48/database.cc	8bfff559a0894259fe3668294bd3906ae837129b
+@@ -1489,12 +1489,19 @@ database_impl::fetch(results & res,
+       vector<string> row;
+       for (int col = 0; col < ncol; col++)
+         {
++          // We never store NULLs, so we should never see one.
++          int const datatype = sqlite3_column_type(i->second.stmt(), col);
++          E(datatype != SQLITE_NULL, origin::database,
++            F("null result in query: %s") % query.sql_cmd);
+           const char * value = (const char*)sqlite3_column_blob(i->second.stmt(), col);
+           int bytes = sqlite3_column_bytes(i->second.stmt(), col);
+-          E(value, origin::database,
+-            F("null result in query: %s") % query.sql_cmd);
+-          row.push_back(string(value, value + bytes));
+-          //L(FL("row %d col %d value='%s'") % nrow % col % value);
++          if (value) {
++            row.push_back(string(value, value + bytes));
++          } else {
++            // sqlite3_column_blob() returns null for zero-length
++            I(bytes == 0);
++            row.push_back(string());
++          }
+         }
+       res.push_back(row);
+     }
============================================================
--- patches/series	8bec750bce1e1dc66bb0b390532a900f9ba11e8f
+++ patches/series	46b089f38bf947773523743d6cd387a59946f42d
@@ -1,2 +1,3 @@ 00-fail_cleanly_on_unreadable_db.diff
 00-fail_cleanly_on_unreadable_db.diff
+01-database.cc.diff 
 90-stacktrace-on-crash.diff

reply via email to

[Prev in Thread] Current Thread [Next in Thread]