Esempio n. 1
0
 /**
  * add a new Condition and connect it to the other conditions via "OR"
  *
  * @param base_database_Column $column
  * @param base_database_interface_Term $value
  * @param string $op
  */
 public function addOr(base_database_Column $column, base_database_interface_Term $value, $op = self::EQUAL)
 {
     $this->_validateOperator($op);
     $condition = $column->getName() . " $op " . $value->toString();
     $this->conditionString .= ' OR ' . $condition;
     $this->_conditions['or'][] = $condition;
 }
Esempio n. 2
0
 public function setColumnValue(base_database_Column $column, base_database_interface_Term $term)
 {
     if ($this->table->existsColumn($column->getName()) === false) {
         throw new base_database_Exception(base_database_Exception::TABLE_COLUMN_NOT_EXISTS);
     }
     $this->columnValues[] = $column->getName() . ' = ' . $term->toString();
 }
Esempio n. 3
0
    /**
     * transform DB result to base_database_Column format
     *
     * @param $result
     * @return array
     */
    private function transformDBResultToColumns($result)
    {
        $colList = [];
        foreach ($result as $colEntry) {
            $col = new base_database_Column();
            $col->setName($colEntry['Field']);
            if (strpos($colEntry['Type'], '(') === false) {
                $col->setType($colEntry['Type']);
            } else {
                list($type, $length) = explode('(', $colEntry['Type']);
                $col->setType($type);
                $col->setLength(str_ireplace(')', '', $length));
            }
            if ($colEntry['Null'] != base_database_Column::NOT_NULL) {
                $col->setNull();
            }
            if ($colEntry['Key'] === base_database_Column::PRIMARY_KEY) {
                $col->setPrimary();
            }
            if (empty($colEntry['Default']) === false) {
                $col->setDefault($colEntry['Default']);
            }
            if ($colEntry['Extra'] === base_database_Column::AUTO_INCREMENT) {
                $col->setAutoIncrement();
            }
            $colList[$colEntry['Field']] = $col;

        }
        return $colList;
    }
Esempio n. 4
0
 public function __construct(base_database_Column $column, $direction = self::DESC)
 {
     $this->_validateDirection($direction);
     $this->orderString = $column->getName() . " $direction";
 }