
win95, vb4 pro 32bit, sybase 10, intersolv odbc, addchunk (image blobs)
I'm trying to read an image from a file on the PC into a
sybase image blob.
I'm using Win95, vb4 pro 32bit, sybase system 10, and the
intersolv odbc driver.
I would like to hear from anyone who has been able to write
blobs to Sybase in this environment!
I can't seem to get addchunk to work. I think my configuration
is OK, because I can read large blobs from Sybase using
getchunk.
When I try to write blobs to the database (using code
very similar to the addchunk examples in the manual) my code
executes without causing any VB errors, but only a small
blob is written to the database. When I send around 59000
bytes, sybase receives only 250 bytes.
The differences between my code and the addchunk example
are as follows:
Instead of using a string buffer (which doesn't work in
32bit VB4), I'm using a dynamically allocated array of bytes:
Dim buffer() as byte
appears at the beginning of the routine,
redim buffer(chunkSize)
before the first use, and
redim buffer(remainingSize)
is done for the last buffer. This works well for getchunk.
Instead of reading the existing blob into an array of strings,
I do
myBlob.getchunk buffer (***)
myRecordset.Edit
while remainingSize > 0
get buffer from file
myBlob.addchunk buffer
wend
myRecordset.Update
myRecordset.Close
The getchunk at (***) seems to be necessary, even though
I don't use the data. If it isn't done, the Update
fails (perhaps because the lower level software did
not get a valid textptr?)
Perhaps addchunk calculates the size incorrectly because
the byte() buffer is used instead of a string?
I tried using a string variable, and the same problem
occurs.
To me, this seems to be a bug in the Intersolv ODBC driver.
Is this is a known bug? Are fixes available?