After browsing through the
DBIx::Class source code, it seems to me that DBIx::Class is less flexible that I hoped it to be... maybe it is not possible / very difficult to do what I originally intended.
Concretely,
DBIx::Class::Storage::DBI handles
insert/update statements, using
sub _execute {
...
my ($sql, @bind) = $self->sql_maker->$op($ident, @args);
...
my $sth = $self->sth($sql,$op);
...
$rv = $sth->execute(@bind)
...
}
In particular, this means that because the bind parameters are passed to
execute as array, no bind attributes can be specified!
In this case, according to the documentation of
DBI:
If any arguments are given, then execute will effectively call "bind_param" for each value before executing the statement. Values bound in this way are usually treated as SQL_VARCHAR types unless the driver can determine the correct type (which is rare), or unless bind_param (or bind_param_inout) has already been used to specify the type.
It would be possible to define the data type prior to executing the statement, because according to the documentation of
DBI::bind_param(..., \%attr),
the whole \%attr parameter is 'sticky' in the sense that a driver only needs to consider the \%attr parameter for the first call, for a given $sth and parameter.
However, even when using
bind_param, this would still would still require changes to DBIx::Class in some form.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.