data_type => 'integer',
is_nullable => 1,
},
+ 'short desc' => {
+ data_type => 'text',
+ is_nullable => 1,
+ },
);
my $native_limit_dialect = $schema->storage->sql_maker->{limit_dialect};
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
LIMIT ?
)",
[
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
LIMIT ?
OFFSET ?
)",
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT `me`.`name`, `me`.`id`
FROM `owners` `me`
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
LIMIT ?, ?
)",
[
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT `me`.`name`, `me`.`id`
FROM `owners` `me`
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
)",
[
[ { sqlt_datatype => 'integer' } => 3 ],
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT SKIP ? FIRST ? `me`.`name`, `me`.`id`
FROM `owners` `me`
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
)",
[
[ { sqlt_datatype => 'integer' } => 4 ],
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT FIRST ? SKIP ? `me`.`name`, `me`.`id`
FROM `owners` `me`
my $ordered_sql = "(
SELECT `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`
FROM (
- SELECT `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`, ROW_NUMBER() OVER( ORDER BY `ORDER__BY__001`, `ORDER__BY__002` ) AS `rno__row__index`
+ SELECT `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`, ROW_NUMBER() OVER( ORDER BY `ORDER__BY__001`, `ORDER__BY__002`, `ORDER__BY__003` ) AS `rno__row__index`
FROM (
SELECT `me`.`id`, `owner`.`id` AS `owner__id`, `owner`.`name` AS `owner__name`, ? * ? AS `bar`, ? AS `baz`,
- ? / ? AS `ORDER__BY__001`, ? AS `ORDER__BY__002`
+ ? / ? AS `ORDER__BY__001`, ? AS `ORDER__BY__002`, `me`.`short desc` AS `ORDER__BY__003`
FROM `books` `me`
JOIN `owners` `owner`
ON `owner`.`id` = `me`.`owner`
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT `me`.`name`, `me`.`id`
FROM (
[ { sqlt_datatype => 'integer' } => 7 ],
],
],
- ordered_limit => [ $limit_sql->('ORDER BY ? / ?, ?'),
+ ordered_limit => [ $limit_sql->('ORDER BY ? / ?, ?, `me`.`short desc`'),
[
@select_bind,
@where_bind,
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
) `me`
WHERE ROWNUM <= ?
) `me`
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT `me`.`name`, `me`.`id`
FROM (
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
FETCH FIRST 4 ROWS ONLY
)",
[
"(
SELECT `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`
FROM (
- SELECT `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`, `ORDER__BY__001`, `ORDER__BY__002`
+ SELECT `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`, `ORDER__BY__001`, `ORDER__BY__002`, `ORDER__BY__003`
FROM (
- SELECT `me`.`id`, `owner`.`id` AS `owner__id`, `owner`.`name` AS `owner__name`, ? * ? AS `bar`, ? AS `baz`, ? / ? AS `ORDER__BY__001`, ? AS `ORDER__BY__002`
+ SELECT `me`.`id`, `owner`.`id` AS `owner__id`, `owner`.`name` AS `owner__name`, ? * ? AS `bar`, ? AS `baz`, ? / ? AS `ORDER__BY__001`, ? AS `ORDER__BY__002`, `me`.`short desc` AS `ORDER__BY__003`
FROM `books` `me`
JOIN `owners` `owner`
ON `owner`.`id` = `me`.`owner`
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
FETCH FIRST 7 ROWS ONLY
) `me`
- ORDER BY `ORDER__BY__001` DESC, `ORDER__BY__002` DESC
+ ORDER BY `ORDER__BY__001` DESC, `ORDER__BY__002` DESC, `ORDER__BY__003` DESC
FETCH FIRST 4 ROWS ONLY
) `me`
- ORDER BY `ORDER__BY__001`, `ORDER__BY__002`
+ ORDER BY `ORDER__BY__001`, `ORDER__BY__002`, `ORDER__BY__003`
)",
[
@select_bind,
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT `me`.`name`, `me`.`id`
FROM (
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
)",
[
@select_bind,
"(
SELECT `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`
FROM (
- SELECT TOP 4 `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`, `ORDER__BY__001`, `ORDER__BY__002`
+ SELECT TOP 4 `me`.`id`, `owner__id`, `owner__name`, `bar`, `baz`, `ORDER__BY__001`, `ORDER__BY__002`, `ORDER__BY__003`
FROM (
- SELECT TOP 7 `me`.`id`, `owner`.`id` AS `owner__id`, `owner`.`name` AS `owner__name`, ? * ? AS `bar`, ? AS `baz`, ? / ? AS `ORDER__BY__001`, ? AS `ORDER__BY__002`
+ SELECT TOP 7 `me`.`id`, `owner`.`id` AS `owner__id`, `owner`.`name` AS `owner__name`, ? * ? AS `bar`, ? AS `baz`, ? / ? AS `ORDER__BY__001`, ? AS `ORDER__BY__002`, `me`.`short desc` AS `ORDER__BY__003`
FROM `books` `me`
JOIN `owners` `owner`
ON `owner`.`id` = `me`.`owner`
WHERE $where_string
GROUP BY (`me`.`id` / ?), `owner`.`id`
HAVING ?
- ORDER BY ? / ?, ?
+ ORDER BY ? / ?, ?, `me`.`short desc`
) `me`
- ORDER BY `ORDER__BY__001` DESC, `ORDER__BY__002` DESC
+ ORDER BY `ORDER__BY__001` DESC, `ORDER__BY__002` DESC, `ORDER__BY__003` DESC
) `me`
- ORDER BY `ORDER__BY__001`, `ORDER__BY__002`
+ ORDER BY `ORDER__BY__001`, `ORDER__BY__002`, `ORDER__BY__003`
)",
[
@select_bind,
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT TOP 3 `me`.`name`, `me`.`id`
FROM (
],
limit_offset_prefetch => [
"(
- SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`
+ SELECT `me`.`name`, `books`.`id`, `books`.`source`, `books`.`owner`, `books`.`title`, `books`.`price (#)`, `books`.`short desc`
FROM (
SELECT `me`.`name`, `me`.`id`
FROM (
# order + limit, no offset
$rs = $rs->search(undef, {
order_by => ( $limtype =~ /GenericSubQ/
- ? [ { -desc => 'price (#)' }, 'me.id', \[ '`owner`.`name` + ?', 'bah' ] ] # needs a same-table stable order to be happy
- : [ \['? / ?', [ \ 'int' => 1 ], [ name => 2 ]], \[ '?', 3 ] ]
+ ? [ { -desc => 'price (#)' }, 'me.id', \[ '`owner`.`name` + ?', 'bah' ], \'`me`.`short desc`' ] # needs a same-table stable order to be happy
+ : [ \['? / ?', [ \ 'int' => 1 ], [ name => 2 ]], \[ '?', 3 ], \'`me`.`short desc`' ]
),
});