Re: [CDBI] CDBI::Sweet->page() not quite working with mysql?

[prev] [thread] [next] [Date index for 2005/09/23]

From: Matt S Trout
Subject: Re: [CDBI] CDBI::Sweet->page() not quite working with mysql?
Date: 13:11 on 23 Sep 2005
On Fri, Sep 23, 2005 at 12:24:54PM +0200, Rhesa Rozendaal wrote:
>
> <snip thorough debunking of all my guesses />
> 
> So, out of my depth and out of ideas.

What's bugging me is

__PACKAGE__->data_type( # this bit's in Sweet
    __ROWS   => DBI::SQL_INTEGER,
    __OFFSET => DBI::SQL_INTEGER
);

should mean that

sub _bind_param { # this bit's in Class::DBI
        my ($class, $sth, $keys) = @_;
        my $datatype = $class->__data_type or return;
        for my $i (0 .. $#$keys) {
                if (my $type = $datatype->{ $keys->[$i] }) {
                        $sth->bind_param($i + 1, undef, $type);
                }
        }
}

should arrange for the damn thing to be bound correctly, as you pointed
out in your original post.

Try adding the following code somewhere (corrected as required, I'm
pre-coffee and typing straight into the e-mail) -

sub _bind_param { # in one of your classes
  my ($class, $sth, $keys) = @_;
  my $dt = $class->__data_type;
  warn "_bind_param for ${class}, binding for keys ".
    join(', ', @$keys)." against ".
    join(', ', map { "$_ => ".$dt->{$_} } keys %$dt;

  return $class->SUPER::_bind_param($sth, $keys);
}

which will maybe give us a little help. If nothing else, the output from
that plus DBI->trace output should be enough for you to duplicate the
issue in plain DBI if it does turn out to be a driver bug.

> Can I at least make disable_sql_paging default? The synopsis seems to 
> suggest that the following works, but it's not otherwise documented.
> 
> __PACKAGE__->default_search_attributes({ disable_sql_paging => 1 } );

Yeah, that should work fine.

> Thanks for following up, and an even bigger thanks for releasing Sweet. 
> I'm quite anxious to start working with it :)

Thanks for the page and object caching stuff should be directed to
Christian Hansen, the original author of Sweet. My only contribution was
to destroy the order and beauty of his code in the process of hacking join
support into it :)

        -- 
             Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

Re: [CDBI] CDBI::Sweet->page() not quite working with mysql?
Matt S Trout 13:11 on 23 Sep 2005

Generated at 17:55 on 28 Sep 2005 by mariachi v0.52