ensureCapacity
Jan-Henrik Haukeland
hauk at tildeslash.com
Sat Apr 26 00:38:45 CEST 2008
Thanks Paul, I'll look into this over the weekend.
On 25. april. 2008, at 11.56, Paul J Stevens wrote:
> Jan-Henrik,
>
> Found some time today to do more testing on a problem I was still
> having with
> the mysql driver (the postgres driver is kicking ass).
>
> I suspect there is still a problem in ensureCapacity (or it's
> consumers). I'm
> attaching a small program that will reliably reproduce this.
>
> Looks like strings from the /first/ row (and only the first row)
> retrieved from
> a resultset are still being truncated at 256 char length.
>
> tested against yesterdays svn-rev.
>
> thanks,
>
>
> --
> ________________________________________________________________
> Paul Stevens paul at nfg.nl
> NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
> The Netherlands________________________________http://www.nfg.nl
> #include <stdio.h>
> #include <string.h>
> #include <assert.h>
>
> #include <URL.h>
> #include <ResultSet.h>
> #include <PreparedStatement.h>
> #include <Connection.h>
> #include <ConnectionPool.h>
> #include <SQLException.h>
>
>
> /*
>
> CREATE TABLE `test` (
> `id` int(11) NOT NULL auto_increment,
> `data` longblob NOT NULL,
> PRIMARY KEY (`id`)
> ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1
>
> */
>
> const char *blob1 = "From nobody at pacific.net.sg Tue Dec 04 19:52:17
> 2007\n"
> "X-Envelope-From: <nobody at pacific.net.sg>\n"
> "Received: from [127.0.0.1] (port=49353 helo=test11)\n"
> " by centos.nowhere.com with smtp (Exim 4.63)\n"
> " (envelope-from <nobody at pacific.net.sg>)\n"
> " id 1IzWJv-0000Ep-5f\n"
> " for wallace at nowhere.com; Tue, 04 Dec 2007 19:52:17
> +0800\n"
> "From: \"Wallace\" <nobody at pacific.net.sg>\n"
> "To: wallace <wallace at nowhere.com>\n"
> "Subject: Test 11\n"
> "Message-Id: <E1IzWJv-0000Ep-5f at centos.nowhere.com>\n"
> "Date: Tue, 04 Dec 2007 19:52:16 +0800\n"
> "\n"
> "\n"
> "This line works, however,\n"
> "From what I know, this line gets truncated\n"
> "This line gets truncated\n"
> "This other line get truncated too\n";
>
> const char *blob2 = "(\"Tue, 06 Aug 2002 19:54:41 +0200\"
> \"[dovecot] mbox support\" ((\"Marcus Rueckert\" NIL \"rueckert\"
> \"informatik.uni-rostock.de\")) ((NIL NIL \"dovecot-bounce\"
> \"procontrol.fi\")) ((\"Marcus Rueckert\" NIL \"rueckert\"
> \"informatik.uni-rostock.de\")) ((\"dovecot mailing list\" NIL
> \"dovecot\" \"procontrol.fi\")) NIL NIL NIL \"<0000420020806175441.GA7148 at linux.taugt.net
> >\")";
>
>
> //#define DMTEST
> #define BUFSIZE 8192
> int main(void)
> {
> char *in = blob1;
> int ZBDEBUG=1, i = 0;
> ResultSet_T res;
> PreparedStatement_T s;
> URL_T url = URL_new("mysql://test:test@localhost:3306/test");
> assert(url);
> ConnectionPool_T pool = ConnectionPool_new(url);
> assert(pool);
> ConnectionPool_start(pool);
> Connection_T con = ConnectionPool_getConnection(pool);
> assert(con);
>
>
> TRY
> Connection_execute(con, "DELETE FROM test");
>
> s = Connection_prepareStatement(con, "INSERT INTO test (data)
> values ( ? )");
> PreparedStatement_setString(s,1,in);
> for (i=0; i<20; i++)
> PreparedStatement_execute(s);
>
> res = Connection_executeQuery(con, "SELECT id,data FROM test LIMIT
> 10");
> while(ResultSet_next(res)) {
> const char *out = ResultSet_getString(res,2);
> if (strcmp(in, out) != 0) {
> printf("Error mismatch\n[%s]\n[%s]\n", in, out);
> } else {
> printf("Row matches\n");
> }
> }
>
> CATCH(SQLException)
> printf("SQLException: %s\n", Connection_getLastError(con));
> FINALLY
> Connection_close(con);
> END_TRY;
>
> return 0;
> }
>
>
> --
> To unsubscribe:
> http://www.tildeslash.com/mailman/listinfo/libzdb-general
More information about the libzdb-general
mailing list