problem with blobs (perl code)
2 answers - 1156 bytes -

Matt Sergeant <msergeant (AT) messagelabs (DOT) comwrote:
K, so 1.11 is on CPAN which fixes this. However I have another bug
report about this not working for user defined functions, where I do
this:
s = SvPV(result, len);
sqlite3_result_text( context, s, len, SQLITE_TRANSIENT );
(SvPV is a macro that retrieves a char* from result, and as a side
effect sets len to the length of the string in bytes, even if it
contains nuls).
Is this maybe a bug in sqlite3_result_text()? I could patch it to do:
if (memchr(s, 0, len)) {
/* if the result contains NUL(s) treat it as a blob */
sqlite3_result_blob(context, s, len, SQLITE_TRANSIENT );
}
else {
sqlite3_result_text( context, s, len, SQLITE_TRANSIENT );
}
But that seems a waste of resources if it's a bug in
sqlite3_result_text().
I added a test case (check-in [2798]) that checks to make sure
that sqlite3_result_text is able to deal with embedded '\000'
characters in a string. I appears to work fine. I cannot
reproduce the problem
Can you suggest other ways of producing the problem?