Example #1
0
 function delete($id = NULL)
 {
     org_glizy_dataAccess_DataAccess::selectDB($this->_connNumber);
     if (is_null($id)) {
         $id = $this->getId();
     }
     if (is_null($id)) {
         // visualizzare errore
     }
     $this->setId($id);
     $sql = 'DELETE ';
     $sql .= ' FROM ' . $this->_tablesName['mainTable'];
     $sql .= ' WHERE ' . $this->_tablePrimaryKey . ' = ?';
     $rs = $this->_execute($sql, array($id));
     $sql = 'DELETE ';
     $sql .= ' FROM ' . $this->_tablesName['detailTable'];
     $sql .= ' WHERE ' . $this->_joinFields['detailTable'] . ' = ?';
     $rs = $this->_execute($sql, array($id));
     $evt = array('type' => GLZ_EVT_AR_DELETE . '@' . $this->getClassName(), 'data' => $this);
     $this->dispatchEvent($evt);
     if ($this->_processRelations) {
         $this->buildAllRelations(false);
         $this->_deleteAllRelations();
     }
     $this->emptyRecord();
     if ($rs) {
         return true;
     } else {
         // TODO
         // visualizzare errore
         //			$e = ADODB_Pear_Error();
         //			echo '<p>',$e->message,'</p>';
         return false;
     }
 }
Example #2
0
 function execSqlByName($queryName, $params = array())
 {
     org_glizy_dataAccess_DataAccess::selectDB($this->_connNumber);
     $sql = $this->_getQuerySqlString($queryName);
     $result = $this->_execute($sql, $params);
     return $result;
 }