当前位置: 首页>>代码示例>>PHP>>正文


PHP Sql::delete方法代码示例

本文整理汇总了PHP中Zend\Db\Sql\Sql::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::delete方法的具体用法?PHP Sql::delete怎么用?PHP Sql::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Db\Sql\Sql的用法示例。


在下文中一共展示了Sql::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDelete

 /**
  * @covers Zend\Db\Sql\Sql::delete
  */
 public function testDelete()
 {
     $delete = $this->sql->delete();
     $this->assertInstanceOf('Zend\\Db\\Sql\\Delete', $delete);
     $this->assertSame('foo', $delete->getRawState('table'));
     $this->setExpectedException('Zend\\Db\\Sql\\Exception\\InvalidArgumentException', 'This Sql object is intended to work with only the table "foo" provided at construction time.');
     $this->sql->delete('bar');
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:11,代码来源:SqlTest.php

示例2: archive

 /**
  * @return $successfulArchive
  */
 public function archive() : bool
 {
     if ($this->isArchivedTable()) {
         // @todo: Replace pseudo code
         $archived = !$this->sql->create($this->getArchivedTablename());
         if ($archived) {
             $archived = $archived && $this->delete();
             if ($archived) {
                 $duplicate = false;
             } else {
                 $duplicate = !$this->sql->delete($this->getArchivedTablename());
             }
         }
     } else {
         $archived = false;
     }
     if ($success) {
         $this->record('arc_suc', RecordService::INFO, 'Archived entity successfully.', $this->data);
     } elseif ($duplicate) {
         $this->record('arc_err', RecordService::ERROR, 'Archiving ended up with duplicate data sets. ', $this->data);
     } else {
         $this->record('arc_fai', RecordService::ERROR, 'Archiving failed.', $this->data);
     }
     return (bool) $success;
 }
开发者ID:geolysis,项目名称:gz3-base,代码行数:28,代码来源:AbstractManager.php

示例3: deleteBy

 /**
  * Delete a record by predicate
  *
  * @param  Where|\Closure|string|array|Predicate\PredicateInterface $predicate
  * @param  string $combination One of the OP_* constants from Predicate\PredicateSet
  *
  * @return integer the number of affected rows (can be be influenced by triggers or cascade)
  */
 public function deleteBy($predicate, $combination = Predicate\PredicateSet::OP_AND)
 {
     $delete = $this->sql->delete($this->prefixed_table)->where($predicate, $combination);
     $statement = $this->sql->prepareStatementForSqlObject($delete);
     $result = $statement->execute();
     return $result->getAffectedRows();
 }
开发者ID:robocoder,项目名称:solublecomponents,代码行数:15,代码来源:Table.php

示例4: indexAction

 public function indexAction()
 {
     date_default_timezone_set('Asia/Dubai');
     $auth = new AuthenticationService();
     $container = new Container('username');
     $sm = $this->getServiceLocator();
     $dba = $sm->get($container->adapter);
     $secsql = "SELECT * FROM section";
     $secstatement = $dba->query($secsql, array(5));
     $section = new ResultSet();
     $section->initialize($secstatement);
     $teasql = "SELECT * FROM teacher";
     $teastatement = $dba->query($teasql, array(5));
     $teacher = new ResultSet();
     $teacher->initialize($teastatement);
     if ($auth->hasIdentity() && $container->type == 0) {
         if ($this->getRequest()->getPost('submit-update')) {
             $count = (int) $this->getRequest()->getPost('rcount');
             for ($i = 1; $i <= $count; $i++) {
                 $id = $this->getRequest()->getPost('rid' . $i);
                 $att = $this->getRequest()->getPost('rattendance' . $i);
                 $com = $this->getRequest()->getPost('rcomment' . $i);
                 $stup = $this->getRequest()->getPost('status-update' . $i);
                 if ($stup != 0) {
                     $data = array('counted' => $att, 'comment' => $com, 'Abs_value' => $stup);
                     $sql = new Sql($dba);
                     $update = $sql->update();
                     $update->table('attendance');
                     $update->set($data);
                     $update->where(array('Att_id' => $id));
                     $statement = $sql->prepareStatementForSqlObject($update);
                     $statement->execute();
                 } else {
                     $id = $this->getRequest()->getPost('rid' . $i);
                     $sql = new Sql($dba);
                     $delete = $sql->delete('attendance')->where(array('Att_id' => $id));
                     $statement = $sql->prepareStatementForSqlObject($delete);
                     $statement->execute();
                 }
             }
             $sday = $this->getRequest()->getPost('sdate-filter');
             $eday = $this->getRequest()->getPost('edate-filter');
             $syour_date = date("Y-m-d", strtotime($sday));
             $eyour_date = date("Y-m-d", strtotime($eday));
             return new ViewModel(array('attendance' => $this->getRepport($syour_date, $eyour_date, $this->getRequest()->getPost('stid-filter'), $this->getRequest()->getPost('tea-filter'), $this->getRequest()->getPost('sec-filter'), $this->getRequest()->getPost('p-filter'), $this->getRequest()->getPost('status-filter')), 'sections' => $section, 'teachers' => $teacher, 'message' => "Attendance report updated", 'sday' => $sday, 'eday' => $eday, 'stid' => $this->getRequest()->getPost('stid-filter'), 'tid' => $this->getRequest()->getPost('tea-filter'), 'secid' => $this->getRequest()->getPost('sec-filter'), 'pid' => $this->getRequest()->getPost('p-filter'), 'status' => $this->getRequest()->getPost('status-filter'), 'filter' => "Attendance report for " . $this->getRequest()->getPost('stid-filter') . " from " . date("l jS \\of F Y ", strtotime($sday)) . " to " . date("l jS \\of F Y ", strtotime($eday))));
         } else {
             if ($this->getRequest()->getPost('submit-date')) {
                 $sday = $this->getRequest()->getPost('sdate-filter');
                 $eday = $this->getRequest()->getPost('edate-filter');
                 $syour_date = date("Y-m-d", strtotime($sday));
                 $eyour_date = date("Y-m-d", strtotime($eday));
                 return new ViewModel(array('attendance' => $this->getRepport($syour_date, $eyour_date, $this->getRequest()->getPost('stid-filter'), $this->getRequest()->getPost('tea-filter'), $this->getRequest()->getPost('sec-filter'), $this->getRequest()->getPost('p-filter'), $this->getRequest()->getPost('status-filter')), 'sections' => $section, 'teachers' => $teacher, 'message' => "", 'sday' => $sday, 'eday' => $eday, 'stid' => $this->getRequest()->getPost('stid-filter'), 'tid' => $this->getRequest()->getPost('tea-filter'), 'secid' => $this->getRequest()->getPost('sec-filter'), 'pid' => $this->getRequest()->getPost('p-filter'), 'status' => $this->getRequest()->getPost('status-filter'), 'filter' => "Attendance report for " . $this->getRequest()->getPost('stid-filter') . " from " . date("l jS \\of F Y ", strtotime($sday)) . " to " . date("l jS \\of F Y ", strtotime($eday))));
             } else {
                 return new ViewModel(array('attendance' => $this->getRepport(date('Y-m-d'), date('Y-m-d'), "", 0, 0, 0, 0), 'sections' => $section, 'teachers' => $teacher, 'message' => "", 'sday' => date('m/d/Y'), 'eday' => date('m/d/Y'), 'stid' => "", 'tid' => 0, 'secid' => 0, 'pid' => 0, 'status' => 0, 'filter' => "Attendance report for " . date("l jS \\of F Y ", strtotime(date('m/d/Y')))));
             }
         }
     } else {
         return $this->redirect()->toRoute('login', array('controller' => 'index', 'action' => 'login'));
     }
 }
开发者ID:krystouf,项目名称:injazfuj,代码行数:60,代码来源:IndexController.php

示例5: delete

 /**
  * Removes this record from the database
  */
 protected function delete()
 {
     if ($this->getId()) {
         $sql = new Sql(Database::getConnection(), $this->tablename);
         $delete = $sql->delete()->where(['id' => $this->getId()]);
         $sql->prepareStatementForSqlObject($delete)->execute();
     }
 }
开发者ID:City-of-Bloomington,项目名称:myCity,代码行数:11,代码来源:ActiveRecord.php

示例6: cleanPriorForgotRequests

 public function cleanPriorForgotRequests($userId)
 {
     $sql = new Sql($this->getDbAdapter(), $this->tableName);
     $delete = $sql->delete();
     $delete->where->equalTo($this->userField, $userId);
     $statement = $sql->prepareStatementForSqlObject($delete);
     $statement->execute();
     return true;
 }
开发者ID:dnconcept,项目名称:GoalioForgotPassword,代码行数:9,代码来源:Password.php

示例7: delete

 /**
  * Delete
  *
  * @param Entity $entity Entity
  *
  * @return void
  */
 public function delete(Entity $entity)
 {
     $delete = $this->_sql->delete();
     $delete->from($entity->getTableName());
     if ($entity->getPrimaryKey() && $entity->getId()) {
         $delete->where([$entity->getPrimaryKey() => $entity->getId()]);
     }
     $this->_executeSql($this->_sql, $delete);
 }
开发者ID:VaD1ke,项目名称:redmine_telegram_notifier,代码行数:16,代码来源:Collection.php

示例8: delete

 public function delete($where)
 {
     $delete = $this->sql->delete($this->_table);
     $delete->where($where);
     $result = $this->_execute($delete);
     if ($result) {
         return true;
     }
     return false;
 }
开发者ID:biialaborg,项目名称:budocu.com,代码行数:10,代码来源:AbstractRepository.php

示例9: delete

 /**
  * Deletes a record.
  * @param $id
  * @throws Exception if no records are deleted
  * @return $this
  */
 public function delete($id)
 {
     $adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $sql = new Sql($adapter);
     $delete = $sql->delete('room')->where(array('id' => $id));
     $res = $sql->prepareStatementForSqlObject($delete)->execute();
     if ($res->getAffectedRows() < 1) {
         throw new \Exeption('Room not deleted: DB affected rows count=0.');
     }
 }
开发者ID:rav990,项目名称:AplikacjaRestPhp,代码行数:16,代码来源:Rooms.php

示例10: deleteById

 public function deleteById($cartItemId)
 {
     $sql = new Sql($this->getDbAdapter(), $this->tableName);
     $where = new Where();
     $where->equalTo($this->itemIdField, $cartItemId);
     $delete = $sql->delete();
     $delete->where($where);
     $statement = $sql->prepareStatementForSqlObject($delete);
     $result = $statement->execute();
     return $result->getAffectedRows();
 }
开发者ID:nclundsten,项目名称:SpeckCart,代码行数:11,代码来源:CartItemMapperZendDb.php

示例11: delete

 /**
  * Delete
  * 
  * @param  Closure $where
  * @return int
  */
 public function delete($where)
 {
     $delete = $this->sql->delete();
     if ($where instanceof \Closure) {
         $where($delete);
     } else {
         $delete->where($where);
     }
     $statement = $this->sql->prepareStatementForSqlObject($delete);
     $result = $statement->execute();
     return $result->getAffectedRows();
 }
开发者ID:rikaix,项目名称:zf2,代码行数:18,代码来源:TableGateway.php

示例12: cancelMatch

 /**
  * Delete current Match for cancelation
  * @param Integer $id
  * @return array
  */
 public function cancelMatch($id)
 {
     $sql = new Sql($this->dbAdapter);
     $delete = $sql->delete('tblmatch');
     $delete->where(array('matchID = ?' => $id));
     $stmt = $sql->prepareStatementForSqlObject($delete);
     $result = $stmt->execute();
     if ($result instanceof ResultInterface) {
         return array('canceled' => true);
     }
     return array('canceled' => false);
 }
开发者ID:DieDreiTechGetiere,项目名称:LNSU-backend,代码行数:17,代码来源:GameTable.php

示例13: delete

 /**
  * Delete
  *
  * @param  Where|\Closure|string|array $where
  * @return int
  */
 public function delete($where)
 {
     if (!$this->isInitialized) {
         $this->initialize();
     }
     $delete = $this->sql->delete();
     if ($where instanceof \Closure) {
         $where($delete);
     } else {
         $delete->where($where);
     }
     return $this->executeDelete($delete);
 }
开发者ID:artpoplsh,项目名称:learningZf2,代码行数:19,代码来源:AbstractTableGateway.php

示例14: expireAction

 public function expireAction()
 {
     $verbose = $this->params()->fromRoute('verbose');
     $db = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $sql = new Sql($db);
     $delete = $sql->delete();
     $delete->from('sessions')->where('expires < NOW()');
     $statement = $sql->prepareStatementForSqlObject($delete);
     $result = $statement->execute();
     if ($result && $verbose) {
         echo "Deleted " . number_format($result->count()) . " session(s)\n";
     }
     exit;
 }
开发者ID:zealproject,项目名称:zeal-session,代码行数:14,代码来源:CliController.php

示例15: delete

 public function delete($id)
 {
     $adapter = $this->adapter;
     $sql = new Sql($this->adapter);
     $delete = $sql->delete('user_address');
     $delete->from('user_address');
     $delete->where(array('addr_id' => $id));
     $statement = $sql->prepareStatementForSqlObject($delete);
     try {
         $affectedRows = $statement->execute()->getAffectedRows();
     } catch (\Exception $e) {
         die('Error: ' . $e->getMessage());
     }
     return true;
 }
开发者ID:ankuradhey,项目名称:laundry,代码行数:15,代码来源:UsertrackMapper.php


注:本文中的Zend\Db\Sql\Sql::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。