Exemplo n.º 1
0
 /**
  * 对于 db_single 或 db_split 类型,分别使用下面两种方式调用
  * public function iDeleteByCond($oOption, $vAdmin='')
  * public function iDeleteByCond($vHintId, $oOption, $vAdmin='')
  *
  * @return int
  */
 public function iDeleteByCond()
 {
     $aArgv = func_get_args();
     $splitField = $this->sGetSplitField();
     $isSplit = strlen($splitField);
     if ($isSplit) {
         assert(count($aArgv) >= 2);
         $vHintId = $aArgv[0];
         $oOption = $aArgv[1];
         $vAdmin = isset($aArgv[2]) ? $aArgv[2] : '';
     } else {
         assert(count($aArgv) >= 1);
         $oOption = $aArgv[0];
         $vAdmin = isset($aArgv[1]) ? $aArgv[1] : '';
     }
     assert(!Ko_Tool_Option::BIsWhereEmpty($oOption, $this->vGetAttribute('ismongodb')));
     if ($isSplit) {
         $list = $this->aGetList($vHintId, $oOption);
     } else {
         $list = $this->aGetList($oOption);
     }
     $iRet = 0;
     foreach ($list as $info) {
         $oOptionNew = $oOption->oClone();
         $iRet += $this->iDelete($info, $oOptionNew, $vAdmin);
     }
     return $iRet;
 }
Exemplo n.º 2
0
Arquivo: DB.php Projeto: jinghm318/ko
 /**
  * @param Ko_Tool_SQL|Ko_Tool_MONGO|array $oOption
  * @return int 返回 affectedrows
  */
 public function iDeleteByCond($vHintId, $oOption)
 {
     assert(!Ko_Tool_Option::BIsWhereEmpty($oOption, $this->_bIsMongoDB));
     if (($this->_bUseUO || $this->_iMCacheTime) && count($this->_aKeyField)) {
         $oOption = $this->_vBuildOption($oOption, $vHintId, array());
         $oOption = $this->_oWriteOption2ReadOption($oOption);
         $aInfo = $this->_oGetSqlAgent()->aSelect($this->_sTable, $this->iGetHintId($vHintId), $oOption, 0, true);
         $iRet = 0;
         foreach ($aInfo as $key) {
             $oOptionNew = $oOption->oClone();
             $iRet += $this->_iDelete($vHintId, $key, $oOptionNew, false);
         }
         return $iRet;
     }
     return $this->_iDelete($vHintId, array(), $oOption, true);
 }
Exemplo n.º 3
0
Arquivo: SQL.php Projeto: jinghm318/ko
 /**
  * @return Ko_Tool_SQL 返回 $this
  */
 public function oHaving()
 {
     $this->_sHaving = Ko_Tool_Option::SEscapeWhere(func_get_args());
     return $this;
 }