Re: dbilib - dbwritetext and big buffers

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
2009/10/14 miscmail <[email protected]>:
> 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 mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.