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.44: 001ed561c1cd


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.monotone-0.44: 001ed561c1cd1e7e3944d345eb8969b99671032b
Date: Sat, 20 Nov 2010 06:03:55 GMT

revision:            001ed561c1cd1e7e3944d345eb8969b99671032b
date:                2010-11-20T05:57:41
author:              Timothy Brownawell  <address@hidden>
branch:              net.venge.monotone.monotone-0.44
changelog:
Backport sqlite-blob-null fix, and fix configure.ac.

manifest:
format_version "1"

new_manifest [9089ff12b69cc8420fc45c5f111be7c3f5875ac6]

old_revision [7a4832143b3146ca89f5cb91e0e571d05e29d4b9]

patch "configure.ac"
 from [06ab94a035ebe557bf2c5e423f0d7b29714bf210]
   to [d141a8cb0d98d487e3b3d24fe32524747422d3b2]

patch "database.cc"
 from [1cd8904da0236db3a8c5b7d49ed29e3d651ba3df]
   to [5160c86b8e20ed5b4669a2bd3fad66aec0b9bd69]
============================================================
--- configure.ac	06ab94a035ebe557bf2c5e423f0d7b29714bf210
+++ configure.ac	d141a8cb0d98d487e3b3d24fe32524747422d3b2
@@ -21,12 +21,9 @@ dnl but not properly implemented.
 dnl No, AC_PROG_MKDIR_P does not AC_SUBST its result variable, at least
 dnl not in 2.61.  Comments in programs.m4 suggest that it was meant to
 dnl but not properly implemented.
-if test x"$MKDIR_P" = x; then
-  if test x"$mkdir_p" != x; then
-    MKDIR_P="$mkdir_p"
-  else
-    AC_PROG_MKDIR_P
-  fi
+AC_PROG_MKDIR_P
+if test x"$MKDIR_P" = x && test x"$mkdir_p" != x; then
+  MKDIR_P="$mkdir_p"
 fi
 AC_SUBST([MKDIR_P])
 
============================================================
--- database.cc	1cd8904da0236db3a8c5b7d49ed29e3d651ba3df
+++ database.cc	5160c86b8e20ed5b4669a2bd3fad66aec0b9bd69
@@ -1317,12 +1317,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]