/[drupal]/contributions/sandbox/crell/pdo/database.oci.inc
ViewVC logotype

Contents of /contributions/sandbox/crell/pdo/database.oci.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sun Dec 9 06:54:57 2007 UTC (23 months, 2 weeks ago) by crell
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
- Factor code out into separate files in a more logical fashion.
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 }

  ViewVC Help
Powered by ViewVC 1.1.2