From 55efe1e56ced021ae99d7af6d6331882fd8244ba Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Sun, 1 Sep 2013 12:35:20 +0200 Subject: Fix insert/update/delete helper functions for oracle --- lib/db/oracleconnection.php | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lib/db/oracleconnection.php (limited to 'lib/db') diff --git a/lib/db/oracleconnection.php b/lib/db/oracleconnection.php new file mode 100644 index 00000000000..3da3d91dbfa --- /dev/null +++ b/lib/db/oracleconnection.php @@ -0,0 +1,50 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\DB; + +class OracleConnection extends Connection { + /** + * Quote the keys of the array + */ + private function quoteKeys(array $data) { + $return = array(); + foreach($data as $key => $value) { + $return[$this->quoteIdentifier($key)] = $value; + } + return $return; + } + + /* + * (inherit docs) + */ + public function insert($tableName, array $data, array $types = array()) { + $tableName = $this->quoteIdentifier($tableName); + $data = $this->quoteKeys($data); + return parent::insert($tableName, $data, $types); + } + + /* + * (inherit docs) + */ + public function update($tableName, array $data, array $identifier, array $types = array()) { + $tableName = $this->quoteIdentifier($tableName); + $data = $this->quoteKeys($data); + $identifier = $this->quoteKeys($identifier); + return parent::update($tableName, $data, $identifier, $types); + } + + /* + * (inherit docs) + */ + public function delete($tableName, array $identifier) { + $tableName = $this->quoteIdentifier($tableName); + $identifier = $this->quoteKeys($identifier); + return parent::delete($tableName, $identifier); + } +} -- cgit v1.2.3