Example #1
0
 /**
  */
 protected function getWhereForExistingData(array $data)
 {
     $columnClass     = $this->table->getColumn('class');
     $columnFieldName = $this->table->getColumn('fieldName');
     $where = DB::where($columnClass, DB::stringTerm($data['class']));
     $where->addAnd($columnFieldName, DB::stringTerm($data['fieldName']));
     return $where;
 }
Example #2
0
 /**
  * @param $identifier
  * @throws base_exception_SelectionList
  */
 public function load($identifier)
 {
     $table = DB::table($this->table);
     $where = DB::where($table->getColumn('identifier'), DB::stringTerm($identifier));
     $select = new base_database_statement_Select();
     $select->setTable($table);
     $select->setWhere($where);
     $result = $select->fetchDatabase();
     if (count($result) > 1) {
         throw new base_exception_SelectionList(TMS(base_exception_SelectionList::DUPLICATED_IDENTIFIER));
     }
     if (!empty($result)) {
         foreach ($result[0] as $propName => $value) {
             $this->$propName = $value;
         }
         $this->_loadEntries();
     }
 }
Example #3
0
    /**
     * load the data for the object to load
     *
     * @param $key
     * @param $keyField
     * @param $historic
     *
     * @throws BaseException
     * @throws base_database_Exception
     * @return array
     */
    private function _loadData($key, $keyField, $historic)
    {
        $table = DB::table($this->getTable());
        $where = DB::where($table->getColumn($keyField), DB::intTerm($key));
        if (!empty($historic)) {
            $where->addAnd($table->getColumn('histtop'), DB::stringTerm($historic));
        }
        $selectStatement = new base_database_statement_Select();
        $selectStatement->setTable($table);
        $selectStatement->setWhere($where);
        $result = $selectStatement->fetchDatabase();
        if (count($result) > 1) {
            throw new BaseException('Einf├╝gen Zeile 160 BaseObject');
        }

        if (empty($result)) {
            return null;
        }
        return $result[0];
    }
Example #4
0
File: TMS.php Project: kafruhs/fws
    /**
     * set the select statement for the db fetch
     *
     * @return base_database_statement_Select
     * @throws base_database_Exception
     */
    private function _setSelectStatement()
    {
        $table = DB::table('tms');
        $colName = $table->getColumn('name');
        $colValue = $table->getColumn(Language::get()->getSelectedLanguage());
        $where = DB::where($colName, DB::stringTerm($this->module));

        $select = new base_database_statement_Select();
        $select->setTable($table);
        $select->setColumns(array($colValue));
        $select->setWhere($where);
        return $select;
    }
Example #5
0
File: User.php Project: kafruhs/fws
    public static function logout()
    {
        if (!self::isLoggedIn()) {
            return self::LOGOUT_SUCCESS;
        }

        $table = DB::table('user');
        $where = DB::where($table->getColumn('LK'), DB::intTerm(Flat::user()->getLogicalKey()));
        $updateData = array(
            'ip' => DB::stringTerm(''),
            'sessionid' => DB::stringTerm(''),
        );
        try {
            self::_updateUserLoginData($table, $where, $updateData);
            session_destroy();
            return self::LOGOUT_SUCCESS;
        } catch (Exception $e) {
            return self::LOGOUT_FAILURE;
        }
    }
Example #6
0
 /**
  * get all fieldNames for the given class
  *
  * @return array
  * @throws base_database_Exception
  */
 public function getAllFieldNames()
 {
     $table = DB::table($this->table);
     $colClass = $table->getColumn('class');
     $where = DB::where($colClass, DB::stringTerm($this->class));
     $sqlStatement = new base_database_statement_Select();
     $sqlStatement->setTable($table);
     $sqlStatement->setWhere($where);
     $sqlStatement->setColumns(array($table->getColumn('fieldName')));
     $result = $sqlStatement->fetchDatabase();
     $fieldNames = [];
     foreach ($result as $row) {
         $fieldNames[] = $row['fieldName'];
     }
     return $fieldNames;
 }
Example #7
0
 /**
  */
 protected function getWhereForExistingData(array $data)
 {
     $columnPK     = $this->table->getColumn('name');
     $where = DB::where($columnPK, DB::stringTerm($data['name']));
     return $where;
 }