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


PHP SqlQuery::returnsResultSet方法代码示例

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


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

示例1: run


//.........这里部分代码省略.........
                    } elseif (isset($_REQUEST[$pages->pageSizeVar])) {
                        $pageSize = $pages->setupPageSize('pageSize', 'schema.table.browse');
                        $offset = 0;
                        $sqlQuery->applyLimit($pageSize, $offset, true);
                    }
                    $this->start = (int) $offset;
                } elseif ($type == "insert" || $type == "update" || $type == "delete") {
                    #predie("insert / update / delete statement");
                    $response->refresh = true;
                } elseif ($type == "show") {
                    // show create table etc.
                } elseif ($type == "explain") {
                } elseif ($type == "analyze" || $type == "optimize" || $type == "repair" || $type == "check") {
                    // Table functions
                } elseif ($type == "use") {
                    $name = $sqlQuery->getDatabase();
                    if ($queryCount == 1 && $name && $this->schema != $name) {
                        $response->redirectUrl = Yii::app()->baseUrl . '/schema/' . $name . '#sql';
                        $response->addNotification('success', Yii::t('core', 'successChangeDatabase', array('{name}' => $name)));
                    }
                } elseif ($type == "create") {
                    $response->reload = true;
                } elseif ($type == "drop") {
                    $response->reload = true;
                }
                $this->executedQueries[] = $sqlQuery->getQuery();
                $this->originalQueries[] = $sqlQuery->getOriginalQuery();
                if ($type == "select") {
                    $pages->postVars = $sort->postVars = array('query' => $sqlQuery->getOriginalQuery());
                }
                // Prepare query for execution
                $cmd = $this->db->createCommand($sqlQuery->getQuery());
                $cmd->prepare();
                if ($this->hasResultSet = $sqlQuery->returnsResultSet() !== false) {
                    try {
                        // Fetch data
                        $start = microtime(true);
                        $data = $cmd->queryAll();
                        $time = round(microtime(true) - $start, 6);
                        SqlUtil::FixTable($data);
                        if ($type == 'select') {
                            $total = (int) $this->db->createCommand('SELECT FOUND_ROWS()')->queryScalar();
                            $pages->setItemCount($total);
                            $this->total = $total;
                            $keyData = array();
                        }
                        $columns = array();
                        // Fetch column headers
                        if (isset($data[0])) {
                            $columns = array_keys($data[0]);
                        }
                        $isSent = true;
                        $this->lastResultSetQuery = $sqlQuery->getOriginalQuery();
                    } catch (CDbException $ex) {
                        $ex = new DbException($cmd);
                        $response->addNotification('error', Yii::t('core', 'errorExecuteQuery'), $ex->getText(), $ex->getSql());
                    }
                } else {
                    try {
                        // Measure time
                        $start = microtime(true);
                        $result = $cmd->execute();
                        $time = round(microtime(true) - $start, 6);
                        $response->addNotification('success', Yii::t('core', 'successExecuteQuery'), Yii::t('core', 'affectedRowsQueryTime', array($result, '{rows}' => $result, '{time}' => $time)), $sqlQuery->getQuery());
                    } catch (CDbException $ex) {
                        $dbException = new DbException($cmd);
开发者ID:cebe,项目名称:chive,代码行数:67,代码来源:BrowsePage.php


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