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

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

[Monotone-commits-diffs] net.venge.monotone.monotone-0.46: 10d471105eeb


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.monotone-0.46: 10d471105eeb58e07eeba578680208e526f5dea7
Date: Sat, 20 Nov 2010 06:01:33 GMT

revision:            10d471105eeb58e07eeba578680208e526f5dea7
date:                2010-11-20T05:27:31
author:              Timothy Brownawell  <address@hidden>
branch:              net.venge.monotone.monotone-0.46
changelog:
Backport sqlite-blob-null fix.

manifest:
format_version "1"

new_manifest [943e992312ac1d5b5ff53234c902003ae7fef198]

old_revision [e282b2cf8b86caf828930b3b1ec67f41153084e4]

patch "database.cc"
 from [9e4afbdbfa43b40b5b61090574f548647c5bd916]
   to [0b4ddc48d932842fb23eb63078676b46b31172e5]
============================================================
--- database.cc	9e4afbdbfa43b40b5b61090574f548647c5bd916
+++ database.cc	0b4ddc48d932842fb23eb63078676b46b31172e5
@@ -1452,12 +1452,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);
     }

reply via email to

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