本文整理汇总了PHP中Query::generateDeleteStm方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::generateDeleteStm方法的具体用法?PHP Query::generateDeleteStm怎么用?PHP Query::generateDeleteStm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::generateDeleteStm方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($comm)
{
parent::delete($comm, self::OBJECT_CLASS);
$rs = $this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::COMMENT_ID), Operator::EQUAL, $comm->getID()))), $this->table->getName(), $comm);
if ($this->db->affected_rows() != 1) {
throw new Exception("Errore durante l'eliminazione dell'oggetto.");
}
return $comm;
}
示例2: delete
function delete($report)
{
parent::delete($report, self::OBJECT_CLASS);
$rs = $this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::REPORT_ID), Operator::EQUAL, intval($report->getID())))), $this->table->getName(), $report);
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $report;
}
示例3: delete
function delete($author, $post)
{
parent::delete($author, "User");
parent::delete($author, "Post");
$rs = $this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::VOTE_AUTHOR), Operator::EQUAL, intval($author->getID())), new WhereConstraint($this->table->getColumn(DB::VOTE_POST), Operator::EQUAL, intval($post->getID())))), $this->table->getName(), array("Vote", intval($author->getID()), intval($post->getID())));
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando l'oggetto. Riprovare.");
}
return true;
}
示例4: delete
function delete($contact)
{
parent::delete($contact, self::OBJECT_CLASS);
$this->db->execute(Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::CONTACT_ID), Operator::EQUAL, $contact->getID()))), $this->table->getName(), $contact);
//salvo la risorsa nella storia.
$this->saveHistory($contact, "DELETED");
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $contact;
}
示例5: delete
function delete($user)
{
parent::delete($user, self::OBJECT_CLASS);
//carico la risorsa, completa dei suoi derivati (che andrebbero persi).
$loadR = $this->loadReports;
$this->loadReports = true;
$loadD = $this->loadDependences;
$this->loadDependences = true;
$u_complete = null;
try {
$u_complete = $this->load($user->getID());
$this->loadReports = $loadR;
$this->loadDependences = $loadD;
} catch (Exception $e) {
$this->loadReports = $loadR;
$this->loadDependences = $loadD;
throw $e;
}
$this->db->execute(Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::USER_ID), Operator::EQUAL, $user->getID()))), $this->table->getName(), $user);
//salvo la risorsa nella storia.
$this->saveHistory($u_complete, "DELETED");
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $user;
}
示例6: delete
function delete($post)
{
parent::delete($post, self::OBJECT_CLASS);
//carico il post, completo dei suoi derivati (che andrebbero persi) esclusi i voti.
$loadC = $this->loadComments;
$this->loadComments = true;
$loadR = $this->loadReports;
$this->loadReports = true;
$p_complete = null;
try {
$p_complete = $this->load($post->getID());
$this->loadComments = $loadC;
$this->loadReports = $loadR;
} catch (Exception $e) {
$this->loadComments = $loadC;
$this->loadReports = $loadR;
throw $e;
}
$this->db->execute($s = Query::generateDeleteStm($this->table, array(new WhereConstraint($this->table->getColumn(DB::POST_ID), Operator::EQUAL, $post->getID()))), $this->table->getName(), $post);
//salvo il post nella storia.
$this->saveHistory($p_complete, "DELETED");
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando il dato. Riprovare.");
}
return $post;
}
示例7: delete
function delete()
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
$table = Query::getDBSchema()->getTable(TABLE_RESOURCE);
$rs = $db->execute($s = Query::generateDeleteStm($table, array(new WhereConstraint($table->getColumn(RESOURCE_ID), Operator::EQUAL, $this->getID()))), $table->getName(), $this);
//echo "<br />" . $s; //DEBUG
if ($db->affected_rows() == 1) {
return $this;
} else {
$db->display_error("Resource::delete()");
}
} else {
$db->display_connect_error("Resource::delete()");
}
return false;
}
示例8: unsubscribePost
function unsubscribePost($post, $contest)
{
parent::delete($contest, self::OBJECT_CLASS);
if (!is_subclass_of($post, "Post")) {
throw new Exception("Attenzione! Il parametro di ricerca non è un post.");
}
if (time() > $contest->getEnd()) {
throw new Exception("Questo contest è chiuso, non puoi cancellare la tua iscrizione.");
}
$this->db->execute($s = Query::generateDeleteStm($this->table_cs, array(new WhereConstraint($this->table_cs->getColumn(DB::CONTEST_SUBSCRIBER_POST), Operator::EQUAL, $post->getID()), new WhereConstraint($this->table_cs->getColumn(DB::CONTEST_SUBSCRIBER_CONTEST), Operator::EQUAL, $this->getID()))), $this->table_cs->getName(), $contest);
if ($this->db->affected_rows() != 1) {
throw new Exception("Si è verificato un errore eliminando l'oggetto. Riprovare.");
}
//$this->loadSubscribers($contest); //FIXME vale la pena ricaricare il contest?
return $contest;
}
示例9: delete
function delete()
{
if ($this->getName() == MAILBOX) {
return false;
}
//la mailbox non si può eliminare.
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineMailDirColumns();
$table = Query::getDBSchema()->getTable(TABLE_MAIL_DIRECTORY);
//cerco la Mailbox dell'utente e sposto tutte le mail lì.
$db->execute($s = Query::generateSelectStm(array($table), array(), array(new WhereConstraint($table->getColumn(MAIL_DIRECTORY_OWNER), Operator::EQUAL, $this->owner), new WhereConstraint($table->getColumn(MAIL_DIRECTORY_NAME), Operator::EQUAL, MAILBOX)), array()), $table->getName(), $this);
if ($db->num_rows() == 1) {
$row = $db->fetch_result();
$mailboxid = intval($row[MAIL_DIRECTORY_ID]);
$table1 = Query::getDBSchema()->getTable(TABLE_MAIL_IN_DIRECTORY);
$db->execute($s = Query::generateUpdateStm($table1, array(MAIL_IN_DIRECTORY_DIRECTORY => intval($mailboxid)), array(new WhereConstraint($table1->getColumn(MAIL_IN_DIRECTORY_DIRECTORY), Operator::EQUAL, $this->getID()))), $table1->getName(), $this);
if ($db->affected_rows() == count($this->getMails())) {
$rs = $db->execute($s = Query::generateDeleteStm($table, array(new WhereConstraint($table->getColumn(MAIL_DIRECTORY_ID), Operator::EQUAL, $this->getID()))), $table->getName(), $this);
//echo "<br />" . $db->affected_rows() . $s; //DEBUG
if ($db->affected_rows() == 1) {
return $this;
} else {
$db->display_error("MailDirectory::delete()");
}
} else {
$db->display_error("MailDirectory::delete()");
}
} else {
$db->display_error("MailDirectory::delete()");
}
} else {
$db->display_connect_error("MailDirectory::delete()");
}
return false;
}
示例10: removeFollower
function removeFollower($user)
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineFollowColumns();
$table = Query::getDBSchema()->getTable(TABLE_FOLLOW);
$db->execute($s = Query::generateDeleteStm($table, array(new WhereConstraint($table->getColumn(FOLLOW_FOLLOWER), Operator::EQUAL, $user->getID()), new WhereConstraint($table->getColumn(FOLLOW_SUBJECT), Operator::EQUAL, $this->getID()))), $table->getName(), $this);
if ($db->affected_rows() > 1) {
$db->display_error("User::removeFollower()");
}
//Genera un errore ma ritorna comunque $this
} else {
$db->display_connect_error("User::removeFollower()");
}
return $this->loadFollowers();
}
示例11: delete
function delete()
{
require_once "query.php";
$db = new DBManager();
if (!$db->connect_errno()) {
define_tables();
defineVoteColumns();
$table = Query::getDBSchema()->getTable(TABLE_VOTE);
$rs = $db->execute($s = Query::generateDeleteStm($table, array(new WhereConstraint($table->getColumn(VOTE_AUTHOR), Operator::EQUAL, $this->getAuthor()), new WhereConstraint($table->getColumn(VOTE_POST), Operator::EQUAL, $this->getPost()))), $table->getName(), $this);
//echo "<br />" . $s; //DEBUG
if ($db->affected_rows() == 1) {
return $this;
} else {
$db->display_error("Vote::delete()");
}
} else {
$db->display_connect_error("Vote::delete()");
}
return false;
}