| 1 |
<?php
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Not yet functional demo of how one would implement an Oracle or similar driver.
|
| 5 |
*
|
| 6 |
*/
|
| 7 |
class Database_oci extends Database {
|
| 8 |
|
| 9 |
function __construct($url) {
|
| 10 |
parent::__construct('oci:dbname=' . substr($url['path'], 1), $url['user'], $url['pass'], array());
|
| 11 |
}
|
| 12 |
|
| 13 |
function insert($table, $fields, $delay = FALSE) {
|
| 14 |
$insert_fields = array_keys($fields);
|
| 15 |
$insert_values = array_values($fields);
|
| 16 |
|
| 17 |
$schema = schema_get_schema($table);
|
| 18 |
|
| 19 |
$i = 1;
|
| 20 |
foreach ($fields as $field => $value) {
|
| 21 |
$type = in_array($schema['fields'][$field]['type'], array('text' , 'blob')) ? PDO::PARAM_LOB : NULL;
|
| 22 |
$placeholders[] = in_array($schema['fields'][$field]['type'], array('text' , 'blob')) ? 'EMPTY_BLOB()' : '?';
|
| 23 |
$statement->bindParam($i++, $value, $type);
|
| 24 |
}
|
| 25 |
|
| 26 |
$sql = $this->prefixTables('INSERT INTO {' . $table . '} (' . implode(',', $insert_fields) . ') VALUES (' . implode(',', $placeholders) . ')');
|
| 27 |
$statement = $this->prepare($sql);
|
| 28 |
|
| 29 |
$statement->beginTransaction();
|
| 30 |
$statement->execute();
|
| 31 |
$statement->commit();
|
| 32 |
|
| 33 |
return $statement;
|
| 34 |
}
|
| 35 |
|
| 36 |
function queryRange($query, Array $args, $from, $count, Array $options) {
|
| 37 |
|
| 38 |
}
|
| 39 |
|
| 40 |
function queryTemporary($query, Array $args, $tablename) {
|
| 41 |
|
| 42 |
}
|
| 43 |
}
|