Beispiel #1
0
 public function testSettings()
 {
     Configure::write('Cache.disable', true);
     $this->Dbo = ConnectionManager::getDataSource('test');
     $this->skipIf(!$this->Dbo instanceof Postgres);
     $config2 = $this->Dbo->config;
     $config2['settings']['datestyle'] = 'sql, dmy';
     ConnectionManager::create('test2', $config2);
     $dbo2 = new Postgres($config2, true);
     $expected = array(array('r' => date('d/m/Y')));
     $r = $dbo2->fetchRow('SELECT now()::date AS "r"');
     $this->assertEquals($expected, $r);
     $dbo2->execute('SET DATESTYLE TO ISO');
     $dbo2->disconnect();
 }
 /**
  * _fixSequence
  *
  * @param Postgres $db
  */
 protected function _fixSequence($db)
 {
     $sql = sprintf("\n\t\t\tSELECT setval(pg_get_serial_sequence('%s', 'id'), (SELECT MAX(id) FROM %s))", $this->table, $this->table);
     $db->execute($sql);
 }