Skip to Content.
Sympa Menu

freetds - [freetds] Perl MSSQL DBI blob problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Maciej Grzywocz <emgie AT netinfo.pl>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Perl MSSQL DBI blob problem
  • Date: Tue, 5 Jul 2005 18:19:30 +0200

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/



  • [freetds] Perl MSSQL DBI blob problem, Maciej Grzywocz, 07/05/2005

Archive powered by MHonArc 2.6.24.

Top of Page