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


PHP rcube_db::fetch_assoc方法代码示例

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


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

示例1: read_record

 /**
  * Reads cache entry.
  *
  * @param string  $key     Cache key name
  * @param boolean $nostore Enable to skip in-memory store
  *
  * @return mixed Cached value
  */
 private function read_record($key, $nostore = false)
 {
     if (!$this->db) {
         return null;
     }
     if ($this->type != 'db') {
         $this->load_index();
         // Consistency check (#1490390)
         if (!in_array($key, $this->index)) {
             // we always check if the key exist in the index
             // to have data in consistent state. Keeping the index consistent
             // is needed for keys delete operation when we delete all keys or by prefix.
         } else {
             $ckey = $this->ckey($key);
             if ($this->type == 'memcache') {
                 $data = $this->db->get($ckey);
             } else {
                 if ($this->type == 'apc') {
                     $data = apc_fetch($ckey);
                 }
             }
             if ($this->debug) {
                 $this->debug('get', $ckey, $data);
             }
         }
         if ($data !== false) {
             $md5sum = md5($data);
             $data = $this->unserialize($data);
             if ($nostore) {
                 return $data;
             }
             $this->cache_sums[$key] = $md5sum;
             $this->cache[$key] = $data;
         } else {
             $this->cache[$key] = null;
         }
     } else {
         $sql_result = $this->db->query("SELECT `data`, `cache_key` FROM {$this->table}" . " WHERE `cache_key` = ?", $this->prefix . '.' . $key);
         if ($sql_arr = $this->db->fetch_assoc($sql_result)) {
             if (strlen($sql_arr['data']) > 0) {
                 $md5sum = md5($sql_arr['data']);
                 $data = $this->unserialize($sql_arr['data']);
             }
             $this->db->reset();
             if ($nostore) {
                 return $data;
             }
             $this->cache[$key] = $data;
             $this->cache_sums[$key] = $md5sum;
         } else {
             $this->cache[$key] = null;
         }
     }
     return $this->cache[$key];
 }
开发者ID:jimjag,项目名称:roundcubemail,代码行数:63,代码来源:rcube_cache_shared.php

示例2: array

 /**
  * Return saved search data.
  *
  * @param int  $id  Row identifier
  *
  * @return array Data
  */
 function get_search($id)
 {
     $plugin = $this->rc->plugins->exec_hook('saved_search_get', array('id' => $id));
     if ($plugin['abort']) {
         return $plugin['result'];
     }
     $sql_result = $this->db->query("SELECT " . $this->db->quote_identifier('name') . ", " . $this->db->quote_identifier('data') . ", " . $this->db->quote_identifier('type') . " FROM " . $this->db->table_name('searches') . " WHERE user_id = ?" . " AND search_id = ?", (int) $this->ID, (int) $id);
     while ($sql_arr = $this->db->fetch_assoc($sql_result)) {
         return array('id' => $id, 'name' => $sql_arr['name'], 'type' => $sql_arr['type'], 'data' => unserialize($sql_arr['data']));
     }
     return null;
 }
开发者ID:alecchisi,项目名称:roundcubemail,代码行数:19,代码来源:rcube_user.php

示例3: read_record

 /**
  * Reads cache entry.
  *
  * @param string  $key     Cache key name
  * @param boolean $nostore Enable to skip in-memory store
  *
  * @return mixed Cached value
  */
 private function read_record($key, $nostore = false)
 {
     if (!$this->db) {
         return null;
     }
     if ($this->type != 'db') {
         $this->load_index();
         // Consistency check (#1490390)
         if (!in_array($key, $this->index)) {
             // we always check if the key exist in the index
             // to have data in consistent state. Keeping the index consistent
             // is needed for keys delete operation when we delete all keys or by prefix.
         } else {
             if ($this->type == 'memcache') {
                 $data = $this->db->get($this->ckey($key));
             } else {
                 if ($this->type == 'apc') {
                     $data = apc_fetch($this->ckey($key));
                 }
             }
         }
         if ($data) {
             $md5sum = md5($data);
             $data = $this->unserialize($data);
             if ($nostore) {
                 return $data;
             }
             $this->cache_sums[$key] = $md5sum;
             $this->cache[$key] = $data;
         } else {
             $this->cache[$key] = null;
         }
     } else {
         $sql_result = $this->db->limitquery("SELECT `data`, `cache_key`" . " FROM {$this->table}" . " WHERE `user_id` = ? AND `cache_key` = ?" . " ORDER BY `created` DESC", 0, 1, $this->userid, $this->prefix . '.' . $key);
         if ($sql_arr = $this->db->fetch_assoc($sql_result)) {
             $key = substr($sql_arr['cache_key'], strlen($this->prefix) + 1);
             $md5sum = $sql_arr['data'] ? md5($sql_arr['data']) : null;
             if ($sql_arr['data']) {
                 $data = $this->unserialize($sql_arr['data']);
             }
             if ($nostore) {
                 return $data;
             }
             $this->cache[$key] = $data;
             $this->cache_sums[$key] = $md5sum;
         } else {
             $this->cache[$key] = null;
         }
     }
     return $this->cache[$key];
 }
开发者ID:tesorogithub,项目名称:tesoroshop,代码行数:59,代码来源:rcube_cache.php

示例4: read_record

 /**
  * Reads cache entry.
  *
  * @param string  $key     Cache key name
  * @param boolean $nostore Enable to skip in-memory store
  *
  * @return mixed Cached value
  */
 private function read_record($key, $nostore = false)
 {
     if (!$this->db) {
         return null;
     }
     if ($this->type != 'db') {
         if ($this->type == 'memcache') {
             $data = $this->db->get($this->ckey($key));
         } else {
             if ($this->type == 'apc') {
                 $data = apc_fetch($this->ckey($key));
             }
         }
         if ($data) {
             $md5sum = md5($data);
             $data = $this->unserialize($data);
             if ($nostore) {
                 return $data;
             }
             $this->cache_sums[$key] = $md5sum;
             $this->cache[$key] = $data;
         } else {
             $this->cache[$key] = null;
         }
     } else {
         $sql_result = $this->db->limitquery("SELECT data, cache_key" . " FROM " . $this->table . " WHERE user_id = ?" . " AND cache_key = ?" . " ORDER BY created DESC", 0, 1, $this->userid, $this->prefix . '.' . $key);
         if ($sql_arr = $this->db->fetch_assoc($sql_result)) {
             $key = substr($sql_arr['cache_key'], strlen($this->prefix) + 1);
             $md5sum = $sql_arr['data'] ? md5($sql_arr['data']) : null;
             if ($sql_arr['data']) {
                 $data = $this->unserialize($sql_arr['data']);
             }
             if ($nostore) {
                 return $data;
             }
             $this->cache[$key] = $data;
             $this->cache_sums[$key] = $md5sum;
         } else {
             $this->cache[$key] = null;
         }
     }
     return $this->cache[$key];
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:51,代码来源:rcube_cache.php

示例5: read_record

 /**
  * Reads cache entry.
  *
  * @param string  $key     Cache key name
  * @param boolean $nostore Enable to skip in-memory store
  *
  * @return mixed Cached value
  */
 private function read_record($key, $nostore = false)
 {
     if (!$this->db) {
         return null;
     }
     if ($this->type != 'db') {
         if ($this->type == 'memcache') {
             $data = $this->db->get($this->ckey($key));
         } else {
             if ($this->type == 'apc') {
                 $data = apc_fetch($this->ckey($key));
             }
         }
         if ($data) {
             $md5sum = md5($data);
             $data = $this->unserialize($data);
             if ($nostore) {
                 return $data;
             }
             $this->cache_sums[$key] = $md5sum;
             $this->cache[$key] = $data;
         } else {
             $this->cache[$key] = null;
         }
     } else {
         $sql_result = $this->db->limitquery("SELECT `data`, `cache_key`" . " FROM {$this->table}" . " WHERE `cache_key` = ?" . " ORDER BY `created` DESC", 0, 1, $this->prefix . '.' . $key);
         if ($sql_arr = $this->db->fetch_assoc($sql_result)) {
             $md5sum = $sql_arr['data'] ? md5($sql_arr['data']) : null;
             if ($sql_arr['data']) {
                 $data = $this->unserialize($sql_arr['data']);
             }
             if ($nostore) {
                 return $data;
             }
             $this->cache[$key] = $data;
             $this->cache_sums[$key] = $md5sum;
         } else {
             $this->cache[$key] = null;
         }
     }
     return $this->cache[$key];
 }
开发者ID:StudsPro,项目名称:islandpeeps.com,代码行数:50,代码来源:rcube_cache_shared.php

示例6: hmail_db_connect

function hmail_db_connect()
{
    $rcmail = rcube::get_instance();
    if ($dsn = $rcmail->config->get('companyaddressbook_db_dsnw')) {
        $db = new rcube_db($dsn, '', FALSE);
        $db->set_debug((bool) $rcmail->config->get('sql_debug'));
        $db->db_connect('w');
        $sql = 'SELECT * FROM hm_dbversion LIMIT 1';
        $result = $db->query($sql);
        if ($db->error) {
            return false;
        }
        $v = $db->fetch_assoc($result);
        if ($v['value'] >= HMAIL_DB_VERSION_MIN && $v['value'] <= HMAIL_DB_VERSION_MAX) {
            return $db;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:22,代码来源:driver.php

示例7: explode

 /**
  * Add the given contact records the a certain group
  *
  * @param string  Group identifier
  * @param array   List of contact identifiers to be added
  * @return int    Number of contacts added 
  */
 function add_to_group($group_id, $ids)
 {
     if (!is_array($ids)) {
         $ids = explode(self::SEPARATOR, $ids);
     }
     $added = 0;
     $exists = array();
     // get existing assignments ...
     $sql_result = $this->db->query("SELECT contact_id FROM " . $this->db->table_name($this->db_groupmembers) . " WHERE contactgroup_id=?" . " AND contact_id IN (" . $this->db->array2list($ids, 'integer') . ")", $group_id);
     while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
         $exists[] = $sql_arr['contact_id'];
     }
     // ... and remove them from the list
     $ids = array_diff($ids, $exists);
     foreach ($ids as $contact_id) {
         $this->db->query("INSERT INTO " . $this->db->table_name($this->db_groupmembers) . " (contactgroup_id, contact_id, created)" . " VALUES (?, ?, " . $this->db->now() . ")", $group_id, $contact_id);
         if ($error = $this->db->is_error()) {
             $this->set_error(self::ERROR_SAVING, $error);
         } else {
             $added++;
         }
     }
     return $added;
 }
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:31,代码来源:rcube_contacts.php

示例8: synchronize

 /**
  * Synchronizes the mailbox.
  *
  * @param string $mailbox Folder name
  */
 function synchronize($mailbox)
 {
     // RFC4549: Synchronization Operations for Disconnected IMAP4 Clients
     // RFC4551: IMAP Extension for Conditional STORE Operation
     //          or Quick Flag Changes Resynchronization
     // RFC5162: IMAP Extensions for Quick Mailbox Resynchronization
     // @TODO: synchronize with other methods?
     $qresync = $this->imap->get_capability('QRESYNC');
     $condstore = $qresync ? true : $this->imap->get_capability('CONDSTORE');
     if (!$qresync && !$condstore) {
         return;
     }
     // Get stored index
     $index = $this->get_index_row($mailbox);
     // database is empty
     if (empty($index)) {
         // set the flag that DB was already queried for index
         // this way we'll be able to skip one SELECT in get_index()
         $this->icache[$mailbox]['index_queried'] = true;
         return;
     }
     $this->icache[$mailbox]['index'] = $index;
     // no last HIGHESTMODSEQ value
     if (empty($index['modseq'])) {
         return;
     }
     if (!$this->imap->check_connection()) {
         return;
     }
     // Enable QRESYNC
     $res = $this->imap->conn->enable($qresync ? 'QRESYNC' : 'CONDSTORE');
     if ($res === false) {
         return;
     }
     // Close mailbox if already selected to get most recent data
     if ($this->imap->conn->selected == $mailbox) {
         $this->imap->conn->close();
     }
     // Get mailbox data (UIDVALIDITY, HIGHESTMODSEQ, counters, etc.)
     $mbox_data = $this->imap->folder_data($mailbox);
     if (empty($mbox_data)) {
         return;
     }
     // Check UIDVALIDITY
     if ($index['validity'] != $mbox_data['UIDVALIDITY']) {
         $this->clear($mailbox);
         return;
     }
     // QRESYNC not supported on specified mailbox
     if (!empty($mbox_data['NOMODSEQ']) || empty($mbox_data['HIGHESTMODSEQ'])) {
         return;
     }
     // Nothing new
     if ($mbox_data['HIGHESTMODSEQ'] == $index['modseq']) {
         return;
     }
     $uids = array();
     $removed = array();
     // Get known UIDs
     if ($this->mode & self::MODE_MESSAGE) {
         $sql_result = $this->db->query("SELECT `uid`" . " FROM {$this->messages_table}" . " WHERE `user_id` = ?" . " AND `mailbox` = ?", $this->userid, $mailbox);
         while ($sql_arr = $this->db->fetch_assoc($sql_result)) {
             $uids[] = $sql_arr['uid'];
         }
     }
     // Synchronize messages data
     if (!empty($uids)) {
         // Get modified flags and vanished messages
         // UID FETCH 1:* (FLAGS) (CHANGEDSINCE 0123456789 VANISHED)
         $result = $this->imap->conn->fetch($mailbox, $uids, true, array('FLAGS'), $index['modseq'], $qresync);
         if (!empty($result)) {
             foreach ($result as $msg) {
                 $uid = $msg->uid;
                 // Remove deleted message
                 if ($this->skip_deleted && !empty($msg->flags['DELETED'])) {
                     $removed[] = $uid;
                     // Invalidate index
                     $index['valid'] = false;
                     continue;
                 }
                 $flags = 0;
                 if (!empty($msg->flags)) {
                     foreach ($this->flags as $idx => $flag) {
                         if (!empty($msg->flags[$flag])) {
                             $flags += $idx;
                         }
                     }
                 }
                 $this->db->query("UPDATE {$this->messages_table}" . " SET `flags` = ?, `expires` = " . ($this->ttl ? $this->db->now($this->ttl) : 'NULL') . " WHERE `user_id` = ?" . " AND `mailbox` = ?" . " AND `uid` = ?" . " AND `flags` <> ?", $flags, $this->userid, $mailbox, $uid, $flags);
             }
         }
         // VANISHED found?
         if ($qresync) {
             $mbox_data = $this->imap->folder_data($mailbox);
             // Removed messages found
//.........这里部分代码省略.........
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:101,代码来源:rcube_imap_cache.php


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