freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] dbilib - dbwritetext and big buffers
- From: Frediano Ziglio <freddy77 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] dbilib - dbwritetext and big buffers
- Date: Wed, 14 Oct 2009 20:41:52 +0200
2009/10/14 miscmail <miscmail AT fingerpost.co.uk>:
> Hi all
>
> I am trying to upgrade from freetds 0.62 to 0.82 and have a small
> problem with dbwritetext
>
> In my program, if the data length < system_max then the program does a :
>
> - dbwritetext with a data buffer set to NULL and the length set to
> the actual size.
> - then a loop with dbmoretext to upload the chunks
>
> But in 0.82 it just hangs ... with an error .....
>
> In dblib/unittest/t0013.c there is some code which is similar to mine
> BUT it is wasted with a ''ifndef"
>
> When I tried a file around 400k - it worked fine even though the 'set
> textsize' is 64512
>
> So then I set the flag (and added missing variables numtowrite and
> numwritten) :
> #define DBWRITE_OK_FOR_OVER_4K
>
> .. recompiled and got the same hang as my code does
>
> The actual code in t0013 is :
>
> if (dbwritetext(dbproc, objname, textPtr, DBTXPLEN,
> timeStamp, FALSE, isiz, NULL) != SUCCEED)
> return 15;
> dbsqlok(dbproc);
> dbresults(dbproc);
>
> numtowrite = 0;
> /* Send the update value in chunks. */
> for (numwritten = 0; numwritten < isiz; numwritten +=
> numtowrite) {
> numtowrite = (isiz - numwritten);
> if (numtowrite > BLOB_BLOCK_SIZE)
> numtowrite = BLOB_BLOCK_SIZE;
> dbmoretext(dbproc, (DBINT) numtowrite, blob +
> numwritten);
> }
> dbsqlok(dbproc);
> while (dbresults(dbproc) != NO_MORE_RESULTS);
>
> I checked the src/dblib/dblib.c an found there is a check-exit-if-null
> on the 'text' buffer parameter
> - around line 6261 in dblib.c 0.82 there is a
> CHECK_NULP(text, "dbwritetext", 8, FAIL);
> which looks like it is doing the damage.
>
> which means a call with a NULL text buffer never gets to do anything !
>
> There is a snippet of code a few lines further down which catches
> NULLs (below) so I wonder if that CHECK is superfluous :
>
> if (!text) {
> dbproc->text_size = size;
> dbproc->text_sent = 0;
> return SUCCEED;
> }
>
> Is there something new in how dbwritetext works - or should I just
> comment out the offending CHECK_NULP line (BTW it aint in freetds
> 0.62)?
>
> Waddatink
>
> chris
>
I think you are right. I don't understand #if statements in test, I'll
have a look.
freddy77
-
[freetds] dbilib - dbwritetext and big buffers,
miscmail, 10/14/2009
- Re: [freetds] dbilib - dbwritetext and big buffers, Frediano Ziglio, 10/14/2009
- Re: [freetds] dbilib - dbwritetext and big buffers, Frediano Ziglio, 10/16/2009
Archive powered by MHonArc 2.6.24.