Exemplo n.º 1
0
 public function testHaveAutoIncrement()
 {
     $tableDesc = new TableDesc('authors');
     $this->assertTrue($tableDesc->hasAutoIncrement());
 }
Exemplo n.º 2
0
Arquivo: Morm.php Projeto: anicet/morm
 /**
  * getTableDesc 
  *
  * returns the TableDesc of the model's table
  * 
  * @return TableDesc
  */
 public function getTableDesc()
 {
     return TableDesc::getTable($this->_table);
 }
Exemplo n.º 3
0
 static function singleWhere($table, $condition)
 {
     $field = array_keys($condition);
     $field = $field[0];
     $operator = '=';
     if (is_array($condition[$field]) && isset($condition[$field]['operator'])) {
         $operator = $condition[$field]['operator'];
         $condition[$field] = $condition[$field][0];
     }
     $table_desc = TableDesc::getTable($table);
     if (is_array($condition[$field])) {
         foreach ($condition[$field] as $key => $value) {
             settype($condition[$field][$key], $table_desc->{$field}->php_type);
         }
         $operator = 'IN';
         return '`' . $table . '`.`' . $field . '` ' . $operator . ' (' . SqlTools::formatSqlValue($condition[$field]) . ')';
     }
     settype($condition[$field], $table_desc->{$field}->php_type);
     return '`' . $table . '`.`' . $field . '` ' . $operator . ' ' . SqlTools::formatSqlValue($condition[$field]);
 }