Re: Error thrown when trying to update a 'text' field
Emmanuel Quevillon <[email protected]> Tue, 1 Sep 2009 08:23:32 +0200
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase,gmane.comp.lang.perl.modules.dbix-class |
|---|---|
| Message-ID | <[email protected]> |
Hi Mickael, As you adviced me i used raw SQL with $dbh->do() method and it did the =20 trick. Thanks for you help. Regards Emmanuel Le 28 ao=C3=BBt 2009 =C3=A0 20:36, Michael Peppler <[email protected]>= a =20 =C3=A9crit : > Hi, > > Sybase definitely treats a TEXT column as a "blob", and as the =20 > DBD::Sybase docs mention it is not possible to pass such a column as =20 > a placeholder. > > You must pass the values directly as raw SQL text, or use the text/=20 > image API provided by DBD::Sybase. > > Michael > > > On Aug 28, 2009, at 4:16 PM, Emmanuel Quevillon wrote: > >> Hi, >> >> I didn't know to which mailing list I should send this message, so >> I'm cc'ing to DBIx::Class as it uses this framework. However, the DB >> is Sybase 12.5.3. >> >> The thing is that I want to do a large update of a certain amount of >> rows. What I've to do is replace some kind of a date string into a >> text field. If I send the query generated by DBIx::Class by hand to >> the server, it works perfectly and to the update. >> However, if I let the perl code (DBIC) doing it itself, I get the >> following error thrown by Sybase: >> >> DBI Exception: DBD::Sybase::db prepare failed: Server message >> number=3D2782 severity=3D16 state=3D1 line=3D1 server=3DCRBIPTEST >> procedure=3DDBD2 text=3DAn untyped variable in the PREPARE statement >> 'DBD2' is being resolved to a TEXT or IMAGE type. This is illegal in >> a dynamic PREPARE statement. >> >> [for Statement "UPDATE produit SET HISTORIQUE =3D ? WHERE ( >> CODE_PRODUIT_CRBIP =3D ? )"] at >> /usr/local/lib/perl5/site_perl/5.8.8/DBIx/Class/Schema.pm line 1025 >> >> >> Here is the request generated: >> >> UPDATE produit SET HISTORIQUE =3D ? WHERE ( CODE_PRODUIT_CRBIP =3D ? )= : >> '1993 R. Landen >> 1993 - 1998 M.M. Lecadet IP >> 1998 - 2001 B. Papierok IP >> 2001 - 2008 J.F. Charles IP >> 2009 C. Bizet IP', 'CRBIPbIEBC1048' >> >> So I though the problem could come from the fact that the text field >> contains some carriage return and causes Sybase not to understand >> correctly the request? >> On colleague also told me it could come from the fact that DBI >> treats text field as BLOB????? Never head of this. >> >> If someone could light my lantern..... >> Thanks in advance >> >> Regards >> >> --=20 >> ------------------------- >> Emmanuel Quevillon >> Biological Software and Databases Group >> Institut Pasteur >> +33 1 44 38 95 98 >> tuco at_ pasteur dot fr >> ------------------------- >> > > Michael Peppler > Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html > > "A successful [software] tool is one that was used to do something =20 > undreamed of by its author." -- S. C. Johnson > > > > >