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


PHP JString::startsWith方法代码示例

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


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

示例1: query

 /**
  * Execute the SQL statement.
  *
  * @return  mixed  A database cursor resource on success, boolean false on failure.
  *
  * @since   11.1
  * @throws  DatabaseException
  */
 public function query()
 {
     if (!is_resource($this->connection)) {
         // Legacy error handling switch based on the JError::$legacy switch.
         // @deprecated  11.3
         if (JError::$legacy) {
             if ($this->debug) {
                 JError::raiseError(500, 'JDatabaseDriverSQLAzure::query: ' . $this->errorNum . ' - ' . $this->errorMsg);
             }
             return false;
         } else {
             JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database');
             throw new DatabaseException();
         }
     }
     // Take a local copy so that we don't modify the original query and cause issues later
     $sql = $this->replacePrefix((string) $this->sql);
     if ($this->limit > 0 || $this->offset > 0) {
         $sql = $this->_limit($sql, $this->limit, $this->offset);
     }
     // If debugging is enabled then let's log the query.
     if ($this->debug) {
         // Increment the query counter and add the query to the object queue.
         $this->count++;
         $this->log[] = $sql;
         JLog::add($sql, JLog::DEBUG, 'databasequery');
     }
     // Reset the error values.
     $this->errorNum = 0;
     $this->errorMsg = '';
     // sqlsrv_num_rows requires a static or keyset cursor.
     if (JString::startsWith(ltrim(strtoupper($sql)), 'SELECT')) {
         $array = array('Scrollable' => SQLSRV_CURSOR_KEYSET);
     } else {
         $array = array();
     }
     // Execute the query.
     $this->cursor = sqlsrv_query($this->connection, $sql, array(), $array);
     // If an error occurred handle it.
     if (!$this->cursor) {
         // Populate the errors.
         $errors = sqlsrv_errors();
         $this->errorNum = $errors[0]['SQLSTATE'];
         $this->errorMsg = $errors[0]['message'] . 'SQL=' . $sql;
         // Legacy error handling switch based on the JError::$legacy switch.
         // @deprecated  11.3
         if (JError::$legacy) {
             if ($this->debug) {
                 JError::raiseError(500, 'JDatabaseDriverSQLAzure::query: ' . $this->errorNum . ' - ' . $this->errorMsg);
             }
             return false;
         } else {
             JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery');
             throw new DatabaseException();
         }
     }
     return $this->cursor;
 }
开发者ID:ramdesh,项目名称:joomla-platform,代码行数:66,代码来源:sqlazure.php


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