Example #1
0
 /**
  * 通过主键,查询一条记录
  * @param integer $regionId
  * @return array
  */
 public function findByPk($regionId)
 {
     if (($regionId = (int) $regionId) <= 0) {
         return false;
     }
     $tableName = $this->getTblprefix() . TableNames::getRegions();
     $sql = 'SELECT `region_id`, `region_pid`, `region_name`, `region_type` FROM `' . $tableName . '` WHERE `region_id` = ?';
     return $this->fetchAssoc($sql, $regionId);
 }
Example #2
0
 /**
  * 通过键名,删除一条记录
  * @param string $optKey
  * @return integer
  */
 public function removeByKey($optKey)
 {
     if (($optKey = trim($optKey)) === '') {
         return false;
     }
     $tableName = $this->getTblprefix() . TableNames::getOptions();
     $sql = $this->getCommandBuilder()->createDelete($tableName, '`option_key` = ?');
     $rowCount = $this->delete($sql, $optKey);
     return $rowCount;
 }