Example #1
0
 public function __construct()
 {
     $this->_primary_key = 'id';
     $this->_table_name = 'sms_sender_log';
     $this->_db_name = XF_Db_Tool::getDBName('web');
     $this->_setFiledValidate();
 }
Example #2
0
 public function __construct()
 {
     $this->_primary_key = 'id';
     $this->_table_name = 'ips';
     $this->_db_name = XF_Db_Tool::getDBName('web');
     $this->_setFieldAssociated('city', 'province_id,city_id', 'Application_Model_Table_City', 'id');
 }
Example #3
0
 public function __construct()
 {
     $this->_primary_key = 'auto_serial_id';
     $this->_table_name = 'auto_serial';
     $this->_db_name = XF_Db_Tool::getDBName('web');
 }
Example #4
0
 /**
  * 设置IN或NOT IN条件
  * @param string $finds 字段 例:id
  * @param array $array 条件值 例:array(1,3,4,23,5)
  * @param string $where_type 条件类别 [ MAND、OR  默认 AND]
  * @param string $type IN或NOT IN
  * @return XF_Db_Table_Select_Mysql
  */
 private function _setWhereInORNotIn($fields, array $array = array(), $where_type = 'AND', $type = 'IN')
 {
     if (!empty($array)) {
         $var = XF_Db_Tool::inFormat($array, $type);
         if (XF_Functions::isEmpty($this->_adv_where) == false) {
             $this->_adv_where .= ' ' . $where_type . ' `' . $fields . '`' . $var;
         } else {
             $this->_adv_where = ' WHERE `' . $fields . '`' . $var;
         }
     }
     return $this;
 }
Example #5
0
 public function __construct()
 {
     $this->_primary_key = 'id';
     $this->_table_name = 'gpj_report_vote';
     $this->_db_name = XF_Db_Tool::getDBName('web');
 }
Example #6
0
 public function __construct()
 {
     $this->_primary_key = 'valuation_id';
     $this->_table_name = 'valuation';
     $this->_db_name = XF_Db_Tool::getDBName('web');
 }
Example #7
0
 /**
  * 使字段的值<b>减少</b>指定的数值[值一般是数字,默认为 1]
  * @access public
  * @param string $fieldName 字段名称 可以是一个数组,例:array('pcount' => 1, 'acount' => 2)
  * @param int $value 减少的值
  * @return mixed
  */
 public function filedAutoLessen($fieldName, $value = 1)
 {
     $this->_checkWhere();
     $this->_allotDatabaseServer('UPDATE');
     $this->_db_drive_connect->showQuery($this->_show_query);
     $sql = '';
     if (is_array($fieldName)) {
         foreach ($fieldName as $key => $val) {
             if ($sql != '') {
                 $sql .= ',';
             }
             $sql .= '`' . $key . '`=`' . $key . '`-' . XF_Db_Tool::escape($val);
         }
         $sql = 'UPDATE `' . $this->_db_name . '`.`' . $this->_db_table->getTableName() . '` SET ' . $sql . ' ' . $this->_adv_where;
     } else {
         $sql = 'UPDATE `' . $this->_db_name . '`.`' . $this->_db_table->getTableName() . '` SET `' . $fieldName . '`=`' . $fieldName . '`-' . XF_Db_Tool::escape($value) . ' ' . $this->_adv_where;
     }
     $result = $this->_db_drive_connect->execute($sql);
     $this->_clearProperty();
     return $result;
 }
Example #8
0
 public function __construct($databaseName)
 {
     $this->_primary_key = 'xf_role_id';
     $this->_table_name = 'xf_roles';
     $this->_db_name = XF_Db_Tool::getDBName($databaseName);
 }
Example #9
0
 public function __construct()
 {
     $this->_primary_key = 'event_id';
     $this->_table_name = 'mail_sms_event';
     $this->_db_name = XF_Db_Tool::getDBName('web');
 }
Example #10
0
 /**
  * 更新数据
  * @param string $table 数据表名称
  * @param array $data 数据组
  * @param string $where 条件
  * @return mixed
  */
 public function update($table, array $data, $where)
 {
     $set = array();
     foreach ($data as $key => $val) {
         //过滤非标量
         if (is_scalar($val)) {
             if ($val === '$NULL') {
                 $set[] = '`' . $key . "`= NULL";
             } elseif (strpos($val, '$PK') === 0) {
                 $val = substr($val, 3);
                 $set[] = '`' . $key . "`={$val}";
             } else {
                 $set[] = '`' . $key . "`='" . XF_Db_Tool::escape($val) . "'";
             }
         }
     }
     if (empty($set)) {
         return false;
     }
     $query = 'UPDATE `' . $this->_db_name . '`.`' . $table . '` SET ' . implode(',', $set) . ' ' . $where;
     return $this->execute($query);
 }