[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone.monotone-0.45: 5b64142ee90f
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone.monotone-0.45: 5b64142ee90f2296bc596fe6cacd5c499976f305 |
Date: |
Sat, 20 Nov 2010 22:11:37 GMT |
revision: 5b64142ee90f2296bc596fe6cacd5c499976f305
date: 2010-11-20T17:04:18
author: Timothy Brownawell <address@hidden>
branch: net.venge.monotone.monotone-0.45
changelog:
Backport sqlite-blob-null fix.
manifest:
format_version "1"
new_manifest [f1b90f8a226dd5cac7949bfcfeb9faaa62ded673]
old_revision [a19f8b2017c81c3c6c8b2bb3247f865f6ed4e5a9]
patch "database.cc"
from [8d092cff405c1f08af7289dccf224037ada9dd53]
to [b6cccea72fbba9023702d4d0e1ae65086d77f9c3]
============================================================
--- database.cc 8d092cff405c1f08af7289dccf224037ada9dd53
+++ database.cc b6cccea72fbba9023702d4d0e1ae65086d77f9c3
@@ -1449,12 +1449,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);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone.monotone-0.45: 5b64142ee90f2296bc596fe6cacd5c499976f305,
code <=