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


PHP JDatabaseDriver::query方法代码示例

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


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

示例1: createTable

 protected function createTable()
 {
     $this->debug('createTable: Check if plugin table exists.');
     // Create plugin table if doesn't exist
     $query = "SHOW TABLES LIKE '{$this->db->getPrefix()}kunenadiscuss'";
     $this->db->setQuery($query);
     if (!$this->db->loadResult()) {
         KunenaError::checkDatabaseError();
         $query = "CREATE TABLE IF NOT EXISTS `#__kunenadiscuss`\n\t\t\t\t\t(`content_id` int(11) NOT NULL default '0',\n\t\t\t\t\t `thread_id` int(11) NOT NULL default '0',\n\t\t\t\t\t PRIMARY KEY  (`content_id`)\n\t\t\t\t\t )";
         $this->db->setQuery($query);
         $this->db->query();
         KunenaError::checkDatabaseError();
         $this->debug("Created #__kunenadiscuss cross reference table.");
         // Migrate data from old FireBoard discussbot if it exists
         $query = "SHOW TABLES LIKE '{$this->db->getPrefix()}fb_discussbot'";
         $this->db->setQuery($query);
         if ($this->db->loadResult()) {
             $query = "REPLACE INTO `#__kunenadiscuss`\n\t\t\t\t\tSELECT `content_id` , `thread_id`\n\t\t\t\t\tFROM `#__fb_discussbot`";
             $this->db->setQuery($query);
             $this->db->query();
             KunenaError::checkDatabaseError();
             $this->debug("Migrated old data.");
         }
     }
 }
开发者ID:810,项目名称:Kunena-Addons,代码行数:25,代码来源:kunenadiscuss.php

示例2: deleteByAttributes

 /**
  * Delete all rows by attributes
  *
  * @param array $conditions
  *
  * @return mixed
  */
 public function deleteByAttributes(array $conditions)
 {
     $query = $this->db->getQuery(true);
     $where = array();
     foreach ($conditions as $ckey => $cvalue) {
         $where[] = $this->quoteName($ckey) . ' = ' . (is_numeric($cvalue) ? intval($cvalue) : $this->quote($cvalue));
     }
     $query->delete($this->quoteName($this->tableName));
     $query->where($where);
     $this->db->setQuery($query);
     return $this->db->query();
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:19,代码来源:db.php

示例3: toggle

 public function toggle($id, $property)
 {
     $this->db->setQuery('SELECT `' . $property . '` FROM #__acctexp_' . $this->table . ' WHERE `id` = ' . $id);
     $newstate = $this->db->loadResult() ? 0 : 1;
     if ($property == 'default') {
         if (!$newstate) {
             echo !$newstate;
             return;
         }
         // Reset all other items
         $this->db->setQuery('UPDATE #__acctexp_' . $this->table . ' SET `' . $property . '` = ' . ($newstate ? 0 : 1) . ' WHERE `id` != ' . $id);
         $this->db->query();
     }
     $this->db->setQuery('UPDATE #__acctexp_' . $this->table . ' SET `' . $property . '` = ' . $newstate . ' WHERE `id` = ' . $id);
     $this->db->query();
     echo $newstate;
 }
开发者ID:Ibrahim1,项目名称:aec,代码行数:17,代码来源:admin.acctexp.php

示例4: query

 /**
  * Execute the query
  * 
  * @param  string  the query (optional, it will use the setQuery one otherwise)
  * @return mixed A database resource if successful, FALSE if not.
  */
 function query($sql = null)
 {
     if ($sql !== null) {
         $this->setQuery($sql);
     }
     return $this->_db->query();
 }
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:13,代码来源:cb.database.php


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