Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
e30e4ea1
Commit
e30e4ea1
authored
11 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
php 5.3 compatibility regarding OC\DB\Connection fixed
parent
408e0022
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/private/db/connection.php
+1
-1
1 addition, 1 deletion
lib/private/db/connection.php
lib/private/db/connectionwrapper.php
+93
-0
93 additions, 0 deletions
lib/private/db/connectionwrapper.php
lib/private/server.php
+2
-1
2 additions, 1 deletion
lib/private/server.php
with
96 additions
and
2 deletions
lib/private/db/connection.php
+
1
−
1
View file @
e30e4ea1
...
...
@@ -12,7 +12,7 @@ use Doctrine\DBAL\Configuration;
use
Doctrine\DBAL\Cache\QueryCacheProfile
;
use
Doctrine\Common\EventManager
;
class
Connection
extends
\Doctrine\DBAL\Connection
implements
\OCP\IDBConnection
{
class
Connection
extends
\Doctrine\DBAL\Connection
{
/**
* @var string $tablePrefix
*/
...
...
This diff is collapsed.
Click to expand it.
lib/private/db/connectionwrapper.php
0 → 100644
+
93
−
0
View file @
e30e4ea1
<?php
namespace
OC\DB
;
class
ConnectionWrapper
implements
\OCP\IDBConnection
{
private
$connection
;
public
function
__construct
(
Connection
$conn
)
{
$this
->
connection
=
$conn
;
}
/**
* Used to the owncloud database access away
* @param string $sql the sql query with ? placeholder for params
* @param int $limit the maximum number of rows
* @param int $offset from which row we want to start
* @return \Doctrine\DBAL\Driver\Statement The prepared statement.
*/
public
function
prepare
(
$sql
,
$limit
=
null
,
$offset
=
null
)
{
return
$this
->
connection
->
prepare
(
$sql
,
$limit
,
$offset
);
}
/**
* Used to get the id of the just inserted element
* @param string $tableName the name of the table where we inserted the item
* @return int the id of the inserted element
*/
public
function
lastInsertId
(
$table
=
null
)
{
return
$this
->
connection
->
lastInsertId
(
$table
);
}
/**
* Insert a row if a matching row doesn't exists.
* @param string The table name (will replace *PREFIX*) to perform the replace on.
* @param array
*
* The input array if in the form:
*
* array ( 'id' => array ( 'value' => 6,
* 'key' => true
* ),
* 'name' => array ('value' => 'Stoyan'),
* 'family' => array ('value' => 'Stefanov'),
* 'birth_date' => array ('value' => '1975-06-20')
* );
* @return bool
*
*/
public
function
insertIfNotExist
(
$table
,
$input
)
{
return
$this
->
connection
->
insertIfNotExist
(
$table
,
$input
);
}
/**
* Start a transaction
* @return bool TRUE on success or FALSE on failure
*/
public
function
beginTransaction
()
{
return
$this
->
connection
->
beginTransaction
();
}
/**
* Commit the database changes done during a transaction that is in progress
* @return bool TRUE on success or FALSE on failure
*/
public
function
commit
()
{
return
$this
->
connection
->
commit
();
}
/**
* Rollback the database changes done during a transaction that is in progress
* @return bool TRUE on success or FALSE on failure
*/
public
function
rollBack
()
{
return
$this
->
connection
->
rollBack
();
}
/**
* Gets the error code and message as a string for logging
* @return string
*/
public
function
getError
()
{
return
$this
->
connection
->
getError
();
}
}
This diff is collapsed.
Click to expand it.
lib/private/server.php
+
2
−
1
View file @
e30e4ea1
...
...
@@ -5,6 +5,7 @@ namespace OC;
use
OC\AppFramework\Http\Request
;
use
OC\AppFramework\Utility\SimpleContainer
;
use
OC\Cache\UserCache
;
use
OC\DB\ConnectionWrapper
;
use
OC\Files\Node\Root
;
use
OC\Files\View
;
use
OCP\IServerContainer
;
...
...
@@ -289,7 +290,7 @@ class Server extends SimpleContainer implements IServerContainer {
* @return \OCP\IDBConnection
*/
function
getDatabaseConnection
()
{
return
\OC_DB
::
getConnection
();
return
new
ConnectionWrapper
(
\OC_DB
::
getConnection
()
)
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment