[Dbix-class] Branch for supporting column attributes checked in

John Napiorkowski jjn1056 at yahoo.com
Mon Nov 20 05:19:20 GMT 2006


{snip}
> > The biggest change I've introduced is that
> > SQL::Abstract is initialised with
> > "bindtype=>'columns'", which means that the array
> of
> > binds returned will be an arrayref of the column
> name
> > and the value instead of just an array of values. 
> So
> > if you are using the SQL::Abstract inside of
> > ..Storage::DBI then this change will affect you. 
> I
> > think I got all the places but I might have missed
> > something.
> > 
> > In order to get the actual bind attributes into
> the
> > storage object I had to mess with
> ..ResultSet->update
> > and ..Row->update|insert.
> 
> That's horrific. When we were discussing this I said
> I thought that the 
> $source object was passed and that if it wasn't, it
> should be. Turns out it 
> isn't, so the solution is that it should be - i.e.
> in Row->update
> 
>    my $rows = $self->result_source->storage->update(
>                 $self->result_source->from,
> \%to_update, $ident_cond);
> 
> would become
> 
>    my $rows = $self->result_source->storage->update(
>                 $self->result_source, \%to_update,
> $ident_cond);
> 

Cool I got this working and checked in. 
Update|Insert|Delete were currently sending
$self->result_source->from as their first param, I
made that as suggested above.  However I left select
alone, since it builds up it's own structure.

> Also, I see absolutely no reason to pollute the
> column_info with DB-specific 
> crud - why can't Storage::DBI::Pg detect 
> $source->column_info($col)->{data_type} being
> 'bytea' and DWIM?

$source->column_info($col)->{data_type} would have to
return the expected data type number, not the string
it currently returns.  If someone with Oracle could
experiment with this and let me know what it currently
returns so I can find out a way to map it to
DBD::Oracle::ORA_[type] that would help out.

Since this is really only needed for a handful of
columns I'm only going to map the troublesome ones,
unless someone out there knows how to get the expected
type number for a column in a reasonably cross
database way.  I seem to recall something in the DBI
docs about that, but not sure how well it's
implemented in different databases.

Still looking for someone using Oracle BLOB types that
needs this to join in the testing fun ;)

--john


 
____________________________________________________________________________________
Sponsored Link

$200,000 mortgage for $660/ mo - 
30/15 yr fixed, reduce debt - 
http://yahoo.ratemarketplace.com



More information about the Dbix-class mailing list