[freetds] Perl MSSQL DBI blob problem
Maciej Grzywocz
emgie at netinfo.pl
Tue Jul 5 12:19:30 EDT 2005
Hi,
Thanks for the latest answer to my blob update problem -- it worked.
However, now I'm facing another problem, because I must put a blob into
the database, it will be a file, inserted into 'image' field.
Configuration: FreeTDS-0.62.1, recent Perl, MSSQL 2000, DBD::Sybase
driver.
I'm having problem with this code:
$data = "BINARY\x00DATA";
$sth = $dbh->prepare("insert into images (id, dta) values (1,
'$data'");
$sth->execute();
After executing, the DB says:
DBD::Sybase::st execute failed: Server message number=105 severity=15
state=1 line=1 server=KEZLOK\SRV1 text=Unclosed quotation mark before
the character string 'BINARY'.Server message number=170 severity=15
state=1 line=1 server=KEZLOK\SRV1 text=Line 1: Incorrect syntax near
'BINARY'. at blob.pl line 17.
Obviously, the error is caused by the NULL (0x00) character in data.
My question is: any possibility to put such data into database? Maybe
using another drivers? Maybe a function to convert hex stream (from
the form that comes from DB with SELECT statement, like AB01CD02)?
If no, maybe it will work from PHP? And what function to use?
--
Maciej Grzywocz <maciek at netinfo.pl>
Netinfo: Dział Rozwoju Produktów
tel: 32.3460490 fax: 32.3460492
http://www.netinfo.pl/
More information about the FreeTDS
mailing list