Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
6920da4a
Commit
6920da4a
authored
Nov 24, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed limit/offset for sqlite,mysql and cubrid
tests for this are on elasticsearch branch (due to huge refactoring there) and will come later by merge
parent
e4e376ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
0 deletions
+59
-0
QueryBuilder.php
framework/yii/db/cubrid/QueryBuilder.php
+20
-0
QueryBuilder.php
framework/yii/db/mysql/QueryBuilder.php
+20
-0
QueryBuilder.php
framework/yii/db/sqlite/QueryBuilder.php
+19
-0
No files found.
framework/yii/db/cubrid/QueryBuilder.php
View file @
6920da4a
...
...
@@ -67,4 +67,24 @@ class QueryBuilder extends \yii\db\QueryBuilder
throw
new
InvalidParamException
(
"There is not sequence associated with table '
$tableName
'."
);
}
}
/**
* @inheritDocs
*/
public
function
buildLimit
(
$limit
,
$offset
)
{
$sql
=
''
;
// limit is not optional in CUBRID
// http://www.cubrid.org/manual/90/en/LIMIT%20Clause
// "You can specify a very big integer for row_count to display to the last row, starting from a specific row."
if
(
$limit
!==
null
&&
$limit
>=
0
)
{
$sql
=
'LIMIT '
.
(
int
)
$limit
;
if
(
$offset
>
0
)
{
$sql
.=
' OFFSET '
.
(
int
)
$offset
;
}
}
elseif
(
$offset
>
0
)
{
$sql
=
'LIMIT '
.
(
int
)
$offset
.
', 18446744073709551615'
;
// 2^64-1
}
return
$sql
;
}
}
framework/yii/db/mysql/QueryBuilder.php
View file @
6920da4a
...
...
@@ -140,4 +140,24 @@ class QueryBuilder extends \yii\db\QueryBuilder
{
return
'SET FOREIGN_KEY_CHECKS = '
.
(
$check
?
1
:
0
);
}
/**
* @inheritDocs
*/
public
function
buildLimit
(
$limit
,
$offset
)
{
$sql
=
''
;
// limit is not optional in MySQL
// http://stackoverflow.com/a/271650/1106908
// http://dev.mysql.com/doc/refman/5.0/en/select.html#idm47619502796240
if
(
$limit
!==
null
&&
$limit
>=
0
)
{
$sql
=
'LIMIT '
.
(
int
)
$limit
;
if
(
$offset
>
0
)
{
$sql
.=
' OFFSET '
.
(
int
)
$offset
;
}
}
elseif
(
$offset
>
0
)
{
$sql
=
'LIMIT '
.
(
int
)
$offset
.
', 18446744073709551615'
;
// 2^64-1
}
return
$sql
;
}
}
framework/yii/db/sqlite/QueryBuilder.php
View file @
6920da4a
...
...
@@ -206,4 +206,23 @@ class QueryBuilder extends \yii\db\QueryBuilder
{
throw
new
NotSupportedException
(
__METHOD__
.
' is not supported by SQLite.'
);
}
/**
* @inheritDocs
*/
public
function
buildLimit
(
$limit
,
$offset
)
{
$sql
=
''
;
// limit is not optional in SQLite
// http://www.sqlite.org/syntaxdiagrams.html#select-stmt
if
(
$limit
!==
null
&&
$limit
>=
0
)
{
$sql
=
'LIMIT '
.
(
int
)
$limit
;
if
(
$offset
>
0
)
{
$sql
.=
' OFFSET '
.
(
int
)
$offset
;
}
}
elseif
(
$offset
>
0
)
{
$sql
=
'LIMIT 9223372036854775807 OFFSET '
.
(
int
)
$offset
;
// 2^63-1
}
return
$sql
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment