Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
3765af4e
Commit
3765af4e
authored
Mar 19, 2015
by
Thomas Müller
Browse files
Merge pull request #14986 from owncloud/fixmapperbackw
Fix backwards compatibility for mapper execute method
parents
73874ca2
f77ae37f
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/public/appframework/db/mapper.php
View file @
3765af4e
...
...
@@ -26,7 +26,8 @@
namespace
OCP\AppFramework\Db
;
use
\
OCP\IDBConnection
;
use
OCP\IDBConnection
;
use
OCP\IDb
;
/**
...
...
@@ -193,7 +194,11 @@ abstract class Mapper {
* @return \PDOStatement the database query result
*/
protected
function
execute
(
$sql
,
array
$params
=
[],
$limit
=
null
,
$offset
=
null
){
$query
=
$this
->
db
->
prepare
(
$sql
,
$limit
,
$offset
);
if
(
$this
->
db
instanceof
IDb
)
{
$query
=
$this
->
db
->
prepareQuery
(
$sql
,
$limit
,
$offset
);
}
else
{
$query
=
$this
->
db
->
prepare
(
$sql
,
$limit
,
$offset
);
}
$index
=
1
;
// bindParam is 1 indexed
foreach
(
$params
as
$param
)
{
...
...
@@ -217,7 +222,16 @@ abstract class Mapper {
$index
++
;
}
$query
->
execute
();
$result
=
$query
->
execute
();
// this is only for backwards compatibility reasons and can be removed
// in owncloud 10. IDb returns a StatementWrapper from execute, PDO,
// Doctrine and IDbConnection don't so this needs to be done in order
// to stay backwards compatible for the things that rely on the
// StatementWrapper being returned
if
(
$result
instanceof
\
OC_DB_StatementWrapper
)
{
return
$result
;
}
return
$query
;
}
...
...
Write
Preview
Supports
Markdown
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