예제 #1
0
 public function updateData($insert = false)
 {
     $queryData = new mySQLQueryData();
     foreach ($this->mySQLRowDataChanges as $column => $value) {
         if ($value != null) {
             $queryData->addSetter($this->mySQLTable->fetchColumn($column), $value);
         }
     }
     if ($this->isNewRow) {
         $mySQLQuery = new mySQLQueryInsert();
         $mySQLQuery->setTable($this->mySQLTable)->setData($queryData);
     } else {
         $primaryKey = $this->mySQLTable->getPrimaryKey();
         $mySQLQuery = new mySQLQueryUpdate();
         $mySQLQuery->setTable($this->mySQLTable)->setData($queryData)->setWhere(new mySQLClause($primaryKey, new mySQLOperatorIsEqualTo(), $this->mySQLRowData[$primaryKey->Field]));
     }
     $mySQL = new mySQL($mySQLQuery, $this->mySQLConnection);
     $return = $mySQL->executeQuery();
     if ($return) {
         $this->mySQLRowDataChanges = array();
         return true;
     } else {
         return $return;
     }
 }