[Dbix-class] MSSQL notes
Alan Humphrey
alan.humphrey at comcast.net
Fri Feb 17 23:55:05 CET 2006
Additional notes for anyone using MSSQL:
1) using the ODBC driver on Windows I had to use the software_limit
attribute:
$it = MSSQLTest::Artist->search( { },
{ rows => 3,
software_limit => 1
}
);
Failure to use the attribute results in
SQL::Abstract::Limit: Unsupported data struct HASH for ORDER BY at
/usr/lib/perl5/site_perl/5.8/DBIx/Class/Storage/DBI.pm line 332
This is caused by this piece of code in _select (in DBI.pm)
if (exists $attrs->{group_by}) {
$order = { group_by => $attrs->{group_by},
($order ? (order_by => $order) : ()) };
}
In my testing $attrs->{group_by} exists, but is undefined.
2) Using the DBD::Sybase driver on a BSD box I also have to set
limit_dialect:
$obj = $prod->resultset('Urls')->search({},
{rows=>4,
software_limit=>1
});
$obj->result_source->storage->sql_maker->limit_dialect('Top');
Failure to set limit_dialect results in this error:
(in cleanup) Can't call method "FETCH" on an undefined value at
/usr/pkg/lib/perl5/site_perl/5.8.0/DBIx/Class/Storage/DBI/Cursor.pm line 66
during global destruction.
3) If the offset attribute is used then I do not have to set limit_dialect:
$obj = $prod->resultset('Urls')->search({},
{rows=>4,
offset=>2,
software_limit=>1
});
I'm reasonably confident that the behavior seen in 2) and 3) is a result of
different code paths taken in SQL::Abstract::Limit based on the driver.
Use this info with caution. It's what worked for me, in my limited tests.
Also, both software_limit and limit_dialect are "public" methods (no leading
underscore), but they're undocumented. I don't know what Matt has in mind
for them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20060217/9ee20c7b/attachment-0001.htm
More information about the Dbix-class
mailing list