Esempio n. 1
0
 public static function createInstance($instance_name = '_master', $server, $user, $pass, $db, $engine = 'mysql', $options = array(\PDO::ATTR_EMULATE_PREPARES => FALSE))
 {
     $class = get_called_class();
     $obj = new $class($server, $user, $pass, $db, $engine, $options);
     $obj->instance_name = $instance_name;
     if (!isset(self::$instances[$class][$instance_name])) {
         self::$instances[$class][$instance_name] = $obj;
         if ($instance_name == '_master') {
             self::$master_instance = $obj;
         }
     }
     return $obj;
 }
Esempio n. 2
0
<?php

require 'pdov.php';
$memcache = new Memcache();
$memcache->connect('localhost', 11211) or die("Could not connect");
$db = new PDOV('', 'viper7', '***', 'goliath:1521/v7dev', 'oci');
$db->useMemcache($memcache);
$id = isset($_GET['id']) ? $_GET['id'] : 1;
$stmt = $db->preparedQuery('
	SELECT
		test_id,
		title,
		dbms_lob.substr(body,4000) body
	FROM
		test_table
	WHERE
		test_id = i:id:
	', $id);
$records = $stmt->fetchObjs();
if (!empty($records)) {
    echo "Title: {$records[0]->TITLE}<br/>";
    echo "Body: {$records[0]->BODY}";
} else {
    echo "Sorry, I couldn't find that title";
}