當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。