oracleconnection.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OC\DB;
  9. class OracleConnection extends Connection {
  10. /**
  11. * Quote the keys of the array
  12. */
  13. private function quoteKeys(array $data) {
  14. $return = array();
  15. foreach($data as $key => $value) {
  16. $return[$this->quoteIdentifier($key)] = $value;
  17. }
  18. return $return;
  19. }
  20. /*
  21. * {@inheritDoc}
  22. */
  23. public function insert($tableName, array $data, array $types = array()) {
  24. $tableName = $this->quoteIdentifier($tableName);
  25. $data = $this->quoteKeys($data);
  26. return parent::insert($tableName, $data, $types);
  27. }
  28. /*
  29. * {@inheritDoc}
  30. */
  31. public function update($tableName, array $data, array $identifier, array $types = array()) {
  32. $tableName = $this->quoteIdentifier($tableName);
  33. $data = $this->quoteKeys($data);
  34. $identifier = $this->quoteKeys($identifier);
  35. return parent::update($tableName, $data, $identifier, $types);
  36. }
  37. /*
  38. * {@inheritDoc}
  39. */
  40. public function delete($tableName, array $identifier) {
  41. $tableName = $this->quoteIdentifier($tableName);
  42. $identifier = $this->quoteKeys($identifier);
  43. return parent::delete($tableName, $identifier);
  44. }
  45. }