Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBD::Sybase and TDS for SQL 2000 1

Status
Not open for further replies.

CherylD

Programmer
May 1, 2001
107
CA
I've been using this combination of things for sometime with no problems until now. The problem now is that I've started to work with BLOB type data (images). I've found examples of this working and have replicated only to get a syntax error. Here is my error, which occurs at:

$sth->func($buff, $bytesread, 'ct_send_data') || print $sth->errstr, "\n";

Server message number=170 severity=15 state=1 line=1 server=mydbserver text=Line 1: Incorrect syntax near '0x00000000000000000000000000000000'.

If I look at tds error log, an operation that its performing is:
tds_put_string converting 82 bytes of "writetext bulk 0x00000000000000000000000000000000 timestamp = 0x0000000000000000 "
15:04:40.849776 tds_put_string wrote 164 bytes

Does anyone know where this writetext bulk comes in or have any ideas whats going wrong here? Any info or links to other references would be great.

Thanks.
 
Cheryl,

in the interim, might be an idea to use real identifiable tags for the images (as in files), until you can get this one sorted out

--Paul

Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Well storing the filenames was not something I could do as another system was storing blobs and I hadt o be able to tie into that one.

Good news though, a solution was found. And it didn't even involve using the functions as described anywhere else.

A simple insert statement was inserting the images/files, first it had to be unpacked. For anyone's future reference here is what worked:
$heximg=unpack('H*',$image);
$q = "INSERT INTO IMAGES (image) VALUES (0x$heximg)";

That was it!
 
Good to know
* for posting back a pertinent answer
--Paul

Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top