Example #1
0
 /**
  * the constructor
  *
  * @param Doctrine_Manager $manager
  * @param PDO $pdo                          database handle
  */
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     // initialize all driver options
     $this->supported = array('sequences' => true, 'indexes' => true, 'affected_rows' => true, 'summary_functions' => true, 'order_by_text' => true, 'transactions' => true, 'savepoints' => true, 'current_id' => true, 'limit_queries' => true, 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => 'emulated', 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => true, 'identifier_quoting' => true, 'pattern_escaping' => true);
     $this->properties['string_quoting'] = array('start' => "'", 'end' => "'", 'escape' => "'", 'escape_pattern' => '\\');
     $this->properties['identifier_quoting'] = array('start' => '"', 'end' => '"', 'escape' => '"');
     parent::__construct($manager, $adapter);
 }
Example #2
0
 /**
  * initializes database functions missing in sqlite
  *
  * @see Doctrine_Expression
  * @return void
  */
 public function connect()
 {
     parent::connect();
     $this->dbh->sqliteCreateFunction('md5', array('Doctrine_Expression_Sqlite', 'md5Impl'), 1);
     $this->dbh->sqliteCreateFunction('mod', array('Doctrine_Expression_Sqlite', 'modImpl'), 2);
     $this->dbh->sqliteCreateFunction('concat', array('Doctrine_Expression_Sqlite', 'concatImpl'));
     $this->dbh->sqliteCreateFunction('now', 'time', 0);
 }
Example #3
0
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     $this->supported = array('sequences' => true, 'indexes' => true, 'summary_functions' => true, 'order_by_text' => true, 'current_id' => true, 'affected_rows' => true, 'transactions' => true, 'savepoints' => true, 'limit_queries' => true, 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => false, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => true, 'identifier_quoting' => true, 'pattern_escaping' => true);
     $this->properties['sql_file_delimiter'] = "\n/\n";
     $this->properties['varchar2_max_length'] = 4000;
     $this->properties['number_max_precision'] = 38;
     $this->properties['max_identifier_length'] = 30;
     parent::__construct($manager, $adapter);
 }
 /**
  * initializes database functions missing in sqlite
  *
  * @see Doctrine_Expression
  * @return void
  */
 public function connect()
 {
     if ($this->isConnected) {
         return false;
     }
     parent::connect();
     $this->dbh->sqliteCreateFunction('mod', array('Doctrine_Expression_Sqlite', 'modImpl'), 2);
     $this->dbh->sqliteCreateFunction('concat', array('Doctrine_Expression_Sqlite', 'concatImpl'));
     $this->dbh->sqliteCreateFunction('md5', 'md5', 1);
     $this->dbh->sqliteCreateFunction('now', 'time', 0);
 }
Example #5
0
 /**
  * the constructor
  *
  * @param Doctrine_Manager $manager
  * @param PDO|Doctrine_Adapter $adapter     database handler
  */
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
     $this->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE, 'INNODB');
     $this->supported = array('sequences' => 'emulated', 'indexes' => true, 'affected_rows' => true, 'transactions' => true, 'savepoints' => false, 'summary_functions' => true, 'order_by_text' => true, 'current_id' => 'emulated', 'limit_queries' => true, 'LOBs' => true, 'replace' => true, 'sub_selects' => true, 'auto_increment' => true, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => 'emulated', 'identifier_quoting' => true, 'pattern_escaping' => true);
     $this->properties['string_quoting'] = array('start' => "'", 'end' => "'", 'escape' => '\\', 'escape_pattern' => '\\');
     $this->properties['identifier_quoting'] = array('start' => '`', 'end' => '`', 'escape' => '`');
     $this->properties['sql_comments'] = array(array('start' => '-- ', 'end' => "\n", 'escape' => false), array('start' => '#', 'end' => "\n", 'escape' => false), array('start' => '/*', 'end' => '*/', 'escape' => false));
     $this->properties['varchar_max_length'] = 255;
     parent::__construct($manager, $adapter);
 }
Example #6
0
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     $this->supported = array('sequences' => true, 'indexes' => true, 'summary_functions' => true, 'order_by_text' => true, 'current_id' => true, 'affected_rows' => true, 'transactions' => true, 'savepoints' => true, 'limit_queries' => true, 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => false, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => true, 'identifier_quoting' => true, 'pattern_escaping' => true);
     $this->properties['sql_file_delimiter'] = "\n/\n";
     $this->properties['number_max_precision'] = 38;
     $this->properties['max_identifier_length'] = 30;
     parent::__construct($manager, $adapter);
     // moving properties to params to make them changeable by user
     // VARCHAR2 allowed length is 4000 BYTE. For UTF8 strings is better to use 1000 CHAR
     $this->setParam('varchar2_max_length', 4000);
     // Oracle's default unit for char data types is BYTE. For UTF8 string it is better to use CHAR
     $this->setParam('char_unit', null);
 }
Example #7
0
 /**
  * the constructor
  *
  * @param Doctrine_Manager $manager
  * @param PDO $pdo                          database handle
  */
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     $this->supported = array('sequences' => true, 'indexes' => true, 'affected_rows' => true, 'summary_functions' => true, 'order_by_text' => true, 'transactions' => true, 'savepoints' => true, 'current_id' => true, 'limit_queries' => 'emulated', 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => true, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => true, 'identifier_quoting' => false, 'pattern_escaping' => true);
     // initialize all driver options
     /**
     $this->options['DBA_username'] = false;
     $this->options['DBA_password'] = false;
     $this->options['database_path'] = '';
     $this->options['database_extension'] = '.gdb';
     $this->options['server_version'] = '';
     */
     parent::__construct($manager, $adapter);
 }
Example #8
0
 /**
  * Set the charset on the current connection
  *
  * @param string    charset
  *
  * @return void
  */
 public function setCharset($charset)
 {
     $query = 'SET NAMES ' . $this->quote($charset);
     $this->exec($query);
     parent::setCharset($charset);
 }
Example #9
0
 /**
  * the constructor
  *
  * @param Doctrine_Manager $manager
  * @param PDO $pdo                          database handle
  */
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     parent::__construct($manager, $adapter);
 }
Example #10
0
 /**
  * Inserts a table row with specified data.
  *
  * @param Doctrine_Table $table     The table to insert data into.
  * @param array $values             An associative array containing column-value pairs.
  *                                  Values can be strings or Doctrine_Expression instances.
  * @return integer                  the number of affected rows. Boolean false if empty value array was given,
  */
 public function insert(Doctrine_Table $table, array $fields)
 {
     $identifiers = $table->getIdentifierColumnNames();
     $settingNullIdentifier = false;
     $fields = array_change_key_case($fields);
     foreach ($identifiers as $identifier) {
         $lcIdentifier = strtolower($identifier);
         if (array_key_exists($lcIdentifier, $fields)) {
             if (is_null($fields[$lcIdentifier])) {
                 $settingNullIdentifier = true;
                 unset($fields[$lcIdentifier]);
             }
         }
     }
     // MSSQL won't allow the setting of identifier columns to null, so insert a default record and then update it
     if ($settingNullIdentifier) {
         $count = $this->exec('INSERT INTO ' . $this->quoteIdentifier($table->getTableName()) . ' DEFAULT VALUES');
         if (!$count) {
             return $count;
         }
         $id = $this->lastInsertId($table->getTableName());
         return $this->update($table, $fields, array($id));
     }
     return parent::insert($table, $fields);
 }
Example #11
0
 /**
  * the constructor
  *
  * @param Doctrine_Manager $manager
  * @param PDO $pdo                          database handle
  */
 public function __construct(Doctrine_Manager $manager, $adapter)
 {
     // initialize all driver options
     $this->supported = array('sequences' => 'emulated', 'indexes' => true, 'affected_rows' => true, 'transactions' => true, 'summary_functions' => true, 'order_by_text' => true, 'current_id' => 'emulated', 'limit_queries' => 'emulated', 'LOBs' => true, 'replace' => 'emulated', 'sub_selects' => true, 'auto_increment' => true, 'primary_key' => true, 'result_introspection' => true, 'prepared_statements' => 'emulated');
     parent::__construct($manager, $adapter);
 }
Example #12
0
File: Oracle.php Project: hunde/bsc
 /**
  * Override quote behaviour for boolean to fix issues with quoting of
  * boolean values.
  */
 public function quote($input, $type = null)
 {
     if ($type === 'boolean') {
         if ($input === null) {
             return null;
         } else {
             return $input ? 1 : 0;
         }
     } else {
         return parent::quote($input, $type);
     }
 }
Example #13
0
 /**
  * Overrides connect Method, to add specific attributes
  * PDO emulate prepares is required to avoid bugs on mysql < 5.1
  * when trying to prepare DROP DATABASE or CREATE DATABASE statements
  *
  * @see Doctrine_Connection :: connect();
  * @return boolean connected
  */
 public function connect()
 {
     $connected = parent::connect();
     $this->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
     return $connected;
 }
Example #14
0
 /**
  * Set connection record listeners
  *
  * @param   Doctrine_Connection_Common $conn
  * @param   array $options
  * @return  void
  * @throws  Zend_Application_Resource_Exception
  */
 protected function _setConnectionRecordListeners(Doctrine_Connection_Common $conn, array $options)
 {
     foreach ($options as $alias => $class) {
         if (!class_exists($class)) {
             throw new Zend_Application_Resource_Exception("{$class} does not exist.");
         }
         $conn->addRecordListener(new $class(), $alias);
     }
 }
Example #15
0
 /**
  *
  * @param Doctrine_Connection_Common $conn
  * @param array $options
  */
 protected function _setConnectionRecordListeners(Doctrine_Connection_Common $conn, array $options)
 {
     foreach ($options as $alias => $class) {
         $listener = $this->_getListenerInstance($class);
         $conn->addRecordListener($listener, $alias);
     }
 }
Example #16
0
 /**
  * dropDatabase
  *
  * Issue drop database command for this instance of Doctrine_Connection
  *
  * @return string       success string. Doctrine_Exception if operation failed
  */
 public function dropDatabase()
 {
     // it is not necessary to create temporary command when using oracle
     if (!$this->dbh instanceof Doctrine_Adapter_Oracle) {
         parent::dropDatabase();
     }
     try {
         $this->export->dropDatabase($this->dbh->getUserName());
     } catch (Exception $e) {
         $e->getMessage();
     }
     if (isset($e)) {
         return $e;
     } else {
         return 'Successfully dropped database for connection "' . $this->getName() . '" named "' . $this->dbh->getUserName() . '"';
     }
 }