[Dbix-class] How to insert multiline fields

Brandon Black blblack at gmail.com
Wed Oct 4 21:28:01 CEST 2006


On 10/4/06, Hartmaier Alexander <Alexander.Hartmaier at t-systems.at> wrote:
>
> > First of - did you try it like you would with any normal parameter?
> >
> > $row->$colname($value);
>
> Works for me with varchar2 fields.


The issue here is quoting/escaping stuff in Oracle varchar fields.  The
parameter binding in raw DBI mentioned earlier takes care of this.  This is
something we probably need to fix in the general case in DBIC at some point,
but its something not many people run into in practice.

Right now in the Storage::DBI driver stuff, we just plug in ? placeholders
then call ->execute(@args) on the generated statement handle.  The DBI docs
basically say that when you do this, the values are quoted/treated like
SQL_VARCHAR by default, except in the probably rare case that the DBD driver
is smart enough to know the types of your ?'s, or if you've done a
bind_param on this sth before.

I would propose we could go this route in the future to improve our code in
this area:

1) Support a column_info parameter called "bind_attrs", which affects
Storage::DBI's parameter type binding.  This would allow the user to do
this:

__PACKAGE__->add_columns( funky_col => { bind_attrs => { ora_type =>
'ORA_CLOB', ora_field => 'funky_col' } }, other_col => ... );

and have the case in this email thread handled correctly at execute time.
This way users can always plug in whatever funky thing they need until we
figure out how to support it correctly in a future release.

2) Support automatic default "bind_attrs" for certain vendor and
column_info->{data_type} combinations (like, automatically generating the
above when the storage type is Storage::DBI::Oracle for columns with
data_type set to 'varchar').

-- Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20061004/a2446a14/attachment-0001.htm 


More information about the Dbix-class mailing list