123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace OC\DB;
- class OracleConnection extends Connection {
-
- private function quoteKeys(array $data) {
- $return = [];
- $c = $this->getDatabasePlatform()->getIdentifierQuoteCharacter();
- foreach ($data as $key => $value) {
- if ($key[0] !== $c) {
- $return[$this->quoteIdentifier($key)] = $value;
- } else {
- $return[$key] = $value;
- }
- }
- return $return;
- }
-
- public function insert($table, array $data, array $types = []) {
- if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
- $table = $this->quoteIdentifier($table);
- }
- $data = $this->quoteKeys($data);
- return parent::insert($table, $data, $types);
- }
-
- public function update($table, array $data, array $criteria, array $types = []) {
- if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
- $table = $this->quoteIdentifier($table);
- }
- $data = $this->quoteKeys($data);
- $criteria = $this->quoteKeys($criteria);
- return parent::update($table, $data, $criteria, $types);
- }
-
- public function delete($table, array $criteria, array $types = []) {
- if ($table[0] !== $this->getDatabasePlatform()->getIdentifierQuoteCharacter()) {
- $table = $this->quoteIdentifier($table);
- }
- $criteria = $this->quoteKeys($criteria);
- return parent::delete($table, $criteria);
- }
-
- public function dropTable($table) {
- $table = $this->tablePrefix . trim($table);
- $table = $this->quoteIdentifier($table);
- $schema = $this->getSchemaManager();
- if ($schema->tablesExist([$table])) {
- $schema->dropTable($table);
- }
- }
-
- public function tableExists($table) {
- $table = $this->tablePrefix . trim($table);
- $table = $this->quoteIdentifier($table);
- $schema = $this->getSchemaManager();
- return $schema->tablesExist([$table]);
- }
- }
|