Ejemplo n.º 1
0
 public function testAllAttributesCanBePassedInConstructor()
 {
     $db = 'Database';
     $resourceName = 'Resource Name';
     $attributes = array('attribute' => 'type');
     $nullAttributes = array('null', 'attributes');
     $defaultValueAttributes = array('default', 'value', 'attributes');
     $sqlDao = new SqlDaoBase($db, $resourceName, $attributes, $nullAttributes, $defaultValueAttributes);
     $this->assertEquals($db, $sqlDao->getDb());
     $this->assertEquals($attributes, $sqlDao->getAttributes());
     $this->assertEquals($nullAttributes, $sqlDao->getNullAttributes());
     $this->assertEquals($defaultValueAttributes, $sqlDao->getDefaultValueAttributes());
 }
Ejemplo n.º 2
0
 /**
  * Generates the query for insertion, but adds the RETURNING clause, so the id
  * gets returned automatically.
  *
  * @param Record $record
  * @return string
  */
 protected function generateInsertQuery($record)
 {
     $query = parent::generateInsertQuery($record);
     return $query . ' RETURNING id';
 }