> -----Original Message-----
> From: Peter Rabbitson [mailto:[email protected]]
> Sent: Friday, January 22, 2010 3:36 PM
> To: DBIx::Class user and developer list
> Subject: Re: [Dbix-class] fate of mssql_limit_regression branch?
>
> Alan Humphrey wrote:
> > Hi -
> >
> > Can someone confirm the fate of the mssql_limit_regression branch?
> It no
> > longer exists in
> > http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/branches/ so
> I
> > assumed it had been merged back to trunk.
>
> It was merged after some time was allowed for people to test it :)
>
> > However, if I install the latest DBIx::Class I get numerous errors.
> If I
> > install the mssql_limit_regression code I was testing the errors
> disappear.
>
> You mean you install the latest cpan DBIC ? The trunk has not yet been
> released, and most likely will not be for another week. What kind of
> errors are you getting?
Ah. I'm just ahead. I thought the latest cpan code had the changes merged.
The errors all come from bad SQL being generated. For example this code (from
a Catalyst app)
$items = $c->model('BirdWebDB::SurveyorsSurveySites')->search(
{survey_site_id => $parms->{id} },
{order_by => [{'-'. $sort_order => $sort_column},
{'-asc' => 'name'}],
prefetch => ['surveyor', 'site'],
page => $page,
rows => $limit}
);
Results in this error/sql under version 0.08115:
[error] DBI Exception: DBD::Sybase::st execute failed: Server message
number=8156 severity=16 state=1 line=1 server=SQLB29 text=The column 'id' was
specified multiple times for 'me'.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.id" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.name" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.email" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.phone" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.login" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.password" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.is_active" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.is_verifier" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.arm_length" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.eye_height" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "surveyor.year_joined" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.id" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.site_code" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.site_name" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.county" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.location" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.position" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.elevation" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.comments" could not be bound.
Server message number=4104 severity=16 state=1 line=1 server=SQLB29 text=The
multi-part identifier "site.active" could not be bound.
Server message number=8156 severity=16 state=1 line=1 server=SQLB29 text=The
column 'id' was specified multiple times for 'orig_query'.
Server message number=8156 severity=16 state=1 line=1 server=SQLB29 text=The
column 'id' was specified multiple times for 'rno_subq'.
[for Statement " SELECT * FROM ( SELECT orig_query.*, ROW_NUMBER() OVER( ORDER
BY (SELECT(1)) ) AS rno__row__index FROM (SELECT me.id, me.surveyor_id,
me.survey_site_id, me.year, surveyor.id, surveyor.name, surveyor.email,
surveyor.phone, surveyor.login, surveyor.password, surveyor.is_active,
surveyor.is_verifier, surveyor.arm_length, surveyor.eye_height,
surveyor.year_joined, site.id, site.site_code, site.site_name, site.county,
site.location, site.position, site.elevation, site.comments, site.active FROM
(SELECT TOP 100 PERCENT me.id, me.surveyor_id, me.survey_site_id, me.year,
surveyor.id, surveyor.name, surveyor.email, surveyor.phone, surveyor.login,
surveyor.password, surveyor.is_active, surveyor.is_verifier,
surveyor.arm_length, surveyor.eye_height, surveyor.year_joined, site.id,
site.site_code, site.site_name, site.county, site.location, site.position,
site.elevation, site.comments, site.active FROM surveyors_survey_sites me JOIN
surveyors surveyor ON surveyor.id = me.surveyor_id JOIN survey_sites site ON
site.id = me.survey_site_id WHERE ( survey_site_id = '2' ) ORDER BY year DESC,
name ASC) me) orig_query ) rno_subq WHERE rno__row__index BETWEEN 1 AND 5 "] at
/usr/local/share/perl/5.10.0/DBIx/Class/Schema.pm line 1026
Under the mssql_limit_regression branch we get this (which works):
SELECT me.id, me.surveyor_id, me.survey_site_id, me.year, surveyor.id,
surveyor.name, surveyor.email, surveyor.phone, surveyor.login,
surveyor.password, surveyor.is_active, surveyor.is_verifier,
surveyor.arm_length, surveyor.eye_height, surveyor.year_joined, site.id,
site.site_code, site.site_name, site.county, site.location, site.position,
site.elevation, site.comments, site.active FROM ( SELECT * FROM ( SELECT me.*,
ROW_NUMBER() OVER( ORDER BY (SELECT(1)) ) AS rno__row__index FROM (SELECT
me.id, me.surveyor_id, me.survey_site_id, me.year FROM (SELECT TOP 4294967296
me.id, me.surveyor_id, me.survey_site_id, me.year FROM surveyors_survey_sites
me JOIN surveyors surveyor ON surveyor.id = me.surveyor_id JOIN survey_sites
site ON site.id = me.survey_site_id WHERE ( survey_site_id = '2' ) ORDER BY
year DESC, name ASC) me) me ) rno_subq WHERE rno__row__index BETWEEN 1 AND 5 )
me JOIN surveyors surveyor ON surveyor.id = me.surveyor_id JOIN survey_sites
site ON site.id = me.survey_site_id WHERE ( survey_site_id = '2' ) ORDER BY
year DESC, name ASC:
I'll be patient.
- Alan
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]