Пример #1
0
 public function getSqlStatement()
 {
     $statement = new \Maestro\Database\MSQL();
     $statement->setDb($this->getClassMap()->getDb());
     $statement->setTables($this->classMap->getUpdateSql());
     if (count($this->columnAttributes)) {
         $i = 0;
         $columns = '';
         foreach ($this->columnAttributes as $column) {
             if ($i++) {
                 $columns .= ',';
             }
             $columns .= $this->getOperand($column)->getSql();
         }
         $statement->setColumns($columns);
     }
     // Add 'WHERE' clause to update statement
     if (($whereCondition = $this->whereCondition->getSql()) != '') {
         $statement->setWhere($whereCondition);
     }
     return $statement;
 }
Пример #2
0
 public function executeCommand($command, $parameters = null)
 {
     $msql = new MSQL();
     $msql->setDb($this);
     $msql->setCommand($command);
     $this->execute($msql, $parameters);
 }
Пример #3
0
 public function getUpdateStatementId($object, $id, $value = NULL)
 {
     // $id = array com PK dos objetos associados
     $statement = new \Maestro\Database\MSQL();
     $statement->setDb($this->fromClassMap->getDb());
     $statement->setTables($this->toClassMap->getTableName());
     $a = new OperandArray($id);
     $statement->setColumns($this->toAttributeMap->getName());
     $whereCondition = $this->toClassMap->getKeyAttributeName() . ' IN ' . $a->getSql();
     $statement->setWhere($whereCondition);
     //$statement->setParameters($object->getOIDValue());
     $statement->setParameters($value);
     return $statement->update();
 }