Subject: | Oracle - generate query problem |
Date: | Mon, 12 Mar 2012 12:06:57 +0100 |
To: | bug-DBIx-Class [...] rt.cpan.org |
From: | martin spevak <martin.spevak [...] hp.com> |
Hello,
Two different queries are generated while I use search->first or find,
it looks that find doesn't work.
my $user_identificator = '20412542';
my $sessionid = 'session:5f6e8e9d6abb0b7be5d354fdeea1296bff60cca3';
my $last_user_session;
$last_user_session = $c->model('DBIx::Session')->find({
user_identificator => $user_identificator,
id => { '!=' => $sessionid },
expires => {
'=' => $c->model('DBIx::Session')->search({
user_identificator => $user_identificator,
id => { '!=' => $sessionid },
})->get_column('expires')->max_rs->as_query
},
}, {
rows => 1,
});
$last_user_session = $c->model('DBIx::Session')->search({
user_identificator => $user_identificator,
id => { '!=' => $sessionid },
expires => {
'=' => $c->model('DBIx::Session')->search({
user_identificator => $user_identificator,
id => { '!=' => $sessionid },
})->get_column('expires')->max_rs->as_query
},
}, {
rows =>
1,
})->first;
has next queries (using DBIC_TRACE=1)
SELECT id_session, id, session_data, expires, user_identificator FROM (
SELECT id_session, id, session_data, expires, user_identificator,
ROWNUM rownum__index FROM (
SELECT me.id_session, me.id, me.session_data, me.expires,
me.user_identificator FROM user_session me WHERE ( me.id != ? )
) me
) me WHERE rownum__index BETWEEN ? AND ?
: 'session:5f6e8e9d6abb0b7be5d354fdeea1296bff60cca3', '1', '1'
SELECT id_session, id, session_data, expires, user_identificator FROM (
SELECT id_session, id, session_data, expires, user_identificator,
ROWNUM rownum__index FROM (
SELECT me.id_session, me.id, me.session_data, me.expires,
me.user_identificator FROM user_session me WHERE ( ( expires = (SELECT
MAX( me.expires ) FROM user_session me WHERE ( ( id != ? AND
user_identificator = ? ) ) ) AND id != ? AND user_identificator = ? ) )
) me
) me WHERE rownum__index BETWEEN ? AND ?
: 'session:5f6e8e9d6abb0b7be5d354fdeea1296bff60cca3', '20412542',
'session:5f6e8e9d6abb0b7be5d354fdeea1296bff60cca3', '20412542', '1', '1'
isectst:~/web-data/infrasec/infrasec/FILES/bin $ uname -a
Linux isectst.omc.hp.com 2.6.32-220.4.2.el6.x86_64 #1 SMP Mon Feb 6
16:39:28 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
isectst:~/web-data/infrasec/infrasec/FILES/bin $ grep 'VERSION
=' /usr/share/perl5/vendor_perl/DBIx/Class.pm
$VERSION = '0.08196';