Databases

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • problem with blobs (perl code)

    2 answers - 1156 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    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?
  • No.1 | | 575 bytes | |

    5 Dec 2005, at 13:23, drh (AT) hwaci (DOT) com wrote:

    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?

    Not yet. Let me write a test case and see if there's really a bug or
    not.

    Matt.

    This email has been scanned by the MessageLabs Email Security System.
    For more information please visit
  • No.2 | | 754 bytes | |

    Mon, Dec 05, 2005 at 08:23:19AM -0500, drh (AT) hwaci (DOT) com wrote:
    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 );

    I'm the original reporter of that bug, and I can confirm that while it
    did not work in DBD::SQLite 1.09, it works without problem in 1.11.

    sqlite3_result_text() appears to deal fine with embedded NUL's.
    Attached is a tiny C program I just used to confirm this to myself.

    Large thanks to Matt and Richard for so quickly ending up with a great
    solution that just transparently works!

Re: problem with blobs (perl code)


max 4000 letters.
Your nickname that display:
In order to stop the spam: 0 + 9 =
QUESTION ON "Databases"

EMSDN.COM