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


PHP moodle_database::get_record_sql方法代码示例

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


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

示例1: release_lock

 /**
  * Release a lock that was previously obtained with @lock.
  * @param lock $lock - a lock obtained from this factory.
  * @return boolean - true if the lock is no longer held (including if it was never held).
  */
 public function release_lock(lock $lock)
 {
     $params = array('locktype' => $this->dblockid, 'token' => $lock->get_key());
     $result = $this->db->get_record_sql('SELECT pg_advisory_unlock(:locktype, :token) AS unlocked', $params);
     $result = $result->unlocked === 't';
     if ($result) {
         unset($this->openlocks[$lock->get_key()]);
     }
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:postgres_lock_factory.php

示例2: get_record_sql

 /**
  * Get a single database record as an object using a SQL statement.
  *
  * The SQL statement should normally only return one record.
  * It is recommended to use get_records_sql() if more matches possible!
  *
  * @param string $sql The SQL string you wish to be executed, should normally only return one record.
  * @param array $params array of sql parameters
  * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
  *                        IGNORE_MULTIPLE means return first, ignore multiple records found(not recommended);
  *                        MUST_EXIST means throw exception if no record or multiple records found
  * @return mixed a fieldset object containing the first matching record, false or exception if error not found depending on mode
  * @throws dml_exception A DML specific exception is thrown for any errors.
  */
 public function get_record_sql($sql, array $params = null, $strictness = IGNORE_MISSING)
 {
     $strictness = (int) $strictness;
     if ($strictness == IGNORE_MULTIPLE) {
         // do not limit here - ORA does not like that
         $rs = $this->get_recordset_sql($sql, $params);
         $result = false;
         foreach ($rs as $rec) {
             $result = $rec;
             break;
         }
         $rs->close();
         return $result;
     }
     return parent::get_record_sql($sql, $params, $strictness);
 }
开发者ID:nmicha,项目名称:moodle,代码行数:30,代码来源:oci_native_moodle_database.php


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