Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
8bb4d38e
Commit
8bb4d38e
authored
Mar 18, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
0040261f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Mssql.php
lib/Doctrine/Connection/Mssql.php
+8
-8
No files found.
lib/Doctrine/Connection/Mssql.php
View file @
8bb4d38e
...
@@ -104,26 +104,26 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
...
@@ -104,26 +104,26 @@ class Doctrine_Connection_Mssql extends Doctrine_Connection
throw
new
Zend_Db_Adapter_Exception
(
"LIMIT argument offset=
$offset
is not valid"
);
throw
new
Zend_Db_Adapter_Exception
(
"LIMIT argument offset=
$offset
is not valid"
);
}
}
$orderby
=
stristr
(
$
sql
,
'ORDER BY'
);
$orderby
=
stristr
(
$
query
,
'ORDER BY'
);
if
(
$orderby
!==
false
)
{
if
(
$orderby
!==
false
)
{
$sort
=
(
stripos
(
$orderby
,
'desc'
)
!==
false
)
?
'desc'
:
'asc'
;
$sort
=
(
stripos
(
$orderby
,
'desc'
)
!==
false
)
?
'desc'
:
'asc'
;
$order
=
str_ireplace
(
'ORDER BY'
,
''
,
$orderby
);
$order
=
str_ireplace
(
'ORDER BY'
,
''
,
$orderby
);
$order
=
trim
(
preg_replace
(
'/ASC|DESC/i'
,
''
,
$order
));
$order
=
trim
(
preg_replace
(
'/ASC|DESC/i'
,
''
,
$order
));
}
}
$
sql
=
preg_replace
(
'/^SELECT\s/i'
,
'SELECT TOP '
.
(
$count
+
$offset
)
.
' '
,
$sql
);
$
query
=
preg_replace
(
'/^SELECT\s/i'
,
'SELECT TOP '
.
(
$count
+
$offset
)
.
' '
,
$query
);
$
sql
=
'SELECT * FROM (SELECT TOP '
.
$count
.
' * FROM ('
.
$sql
.
') AS inner_tbl'
;
$
query
=
'SELECT * FROM (SELECT TOP '
.
$count
.
' * FROM ('
.
$query
.
') AS inner_tbl'
;
if
(
$orderby
!==
false
)
{
if
(
$orderby
!==
false
)
{
$
sql
.=
' ORDER BY '
.
$order
.
' '
;
$
query
.=
' ORDER BY '
.
$order
.
' '
;
$
sql
.=
(
stripos
(
$sort
,
'asc'
)
!==
false
)
?
'DESC'
:
'ASC'
;
$
query
.=
(
stripos
(
$sort
,
'asc'
)
!==
false
)
?
'DESC'
:
'ASC'
;
}
}
$
sql
.=
') AS outer_tbl'
;
$
query
.=
') AS outer_tbl'
;
if
(
$orderby
!==
false
)
{
if
(
$orderby
!==
false
)
{
$
sql
.=
' ORDER BY '
.
$order
.
' '
.
$sort
;
$
query
.=
' ORDER BY '
.
$order
.
' '
.
$sort
;
}
}
return
$
sql
;
return
$
query
;
}
}
...
...
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