Exemplo n.º 1
0
 /**
  * set existing actual revision of the object to self::HISTORIC
  *
  * @param $table
  * @param $historicValue
  * @return base_database_statement_Update
  * @throws base_database_Exception
  */
 private function _setHistoricData(base_database_Table $table, $historicValue)
 {
     $statement = new base_database_statement_Update();
     $where = DB::where($table->getColumn('histtop'), DB::term(self::ACTUAL));
     $where->addAnd($table->getColumn('LK'), DB::intTerm((int) $this['LK']));
     $statement->setTable($table);
     $statement->setWhere($where);
     $statement->setColumnValue($table->getColumn('histtop'), DB::term($historicValue));
     $statement->insertDatabase();
 }
Exemplo n.º 2
0
Arquivo: User.php Projeto: kafruhs/fws
    /**
     * update the user login data like ip, sessionid and last login timestamp
     *
     * @param base_database_Table $table
     * @param base_database_Where $where
     * @param array               $fieldsWithValues
     * @throws base_database_Exception
     */
    private static function _updateUserLoginData(base_database_Table $table, base_database_Where $where, array $fieldsWithValues)
    {
        $updateStatement = new base_database_statement_Update();
        $updateStatement->setTable($table);

        foreach ($fieldsWithValues as $field => $value) {
            $updateStatement->setColumnValue($table->getColumn($field), $value);
        }
        $updateStatement->setWhere($where);

        DB::beginTransaction();
        $updateStatement->insertDatabase();
        DB::endTransaction();
    }
Exemplo n.º 3
0
Arquivo: CSV.php Projeto: kafruhs/fws
 /**
  * @param $result
  * @return base_database_statement_Insert|base_database_statement_Update
  * @throws base_database_Exception
  */
 protected function getStatementForImport($result)
 {
     if (empty($result)) {
         $statement = new base_database_statement_Insert();
         return $statement;
     } else {
         $statement = new base_database_statement_Update();
         $colPK = $this->table->getColumn('PK');
         $statement->setWhere(DB::where($colPK, DB::intTerm($result)));
         return $statement;
     }
 }
Exemplo n.º 4
0
 private function _updateExistingSequence()
 {
     $table = DB::table('sequence');
     $statement = new base_database_statement_Update();
     $statement->setTable($table);
     $statement->setColumnValue($table->getColumn('num'), DB::term($this->nextSeq));
     $where = DB::where($table->getColumn('class'), DB::term($this->class));
     $statement->setWhere($where);
     $statement->insertDatabase();
 }