Re: Error thrown when trying to update a 'text' field
Michael Peppler <[email protected]> Fri, 28 Aug 2009 20:36:09 +0200
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase,gmane.comp.lang.perl.modules.dbix-class |
|---|---|
| Message-ID | <[email protected]> |
Hi, Sybase definitely treats a TEXT column as a "blob", and as the DBD::Sybase docs mention it is not possible to pass such a column as a placeholder. You must pass the values directly as raw SQL text, or use the text/ 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=2782 severity=16 state=1 line=1 server=CRBIPTEST > procedure=DBD2 text=An 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 = ? WHERE ( > CODE_PRODUIT_CRBIP = ? )"] 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 = ? WHERE ( CODE_PRODUIT_CRBIP = ? ): > '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 > > -- > ------------------------- > 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 undreamed of by its author." -- S. C. Johnson