當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Datasource::query方法代碼示例

本文整理匯總了PHP中Datasource::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP Datasource::query方法的具體用法?PHP Datasource::query怎麽用?PHP Datasource::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Datasource的用法示例。


在下文中一共展示了Datasource::query方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _getTables

 /**
  * _getTables
  * @return array
  */
 protected function _getTables()
 {
     $this->tables = array();
     $tables = Set::extract('/TABLE_NAMES/.', $this->_db->query('SHOW TABLES'));
     foreach ($tables as $table) {
         $this->tables = array_merge($this->tables, array_values($table));
     }
     return $this->tables;
 }
開發者ID:shama,項目名稱:oven,代碼行數:13,代碼來源:SchemaBaker.php

示例2: _loadOptions

 /**
  * Loads the options from the DB
  */
 public function _loadOptions()
 {
     $this->_realmOptions = array();
     $rows = Datasource::query("select * from " . $this->_optionRealm . "_options where id=" . $this->_internalID);
     // First build up from defaults
     foreach (array_keys($this->_realmConfig) as $optionKey) {
         $this->_realmOptions[$optionKey] = $this->_realmConfig[$optionKey]["default"];
     }
     foreach ($rows as $row) {
         $this->_realmOptions[$row["optionname"]] = $this->_getOptionValue($row["optionvalue"], $this->realmConfig[$row["optionname"]]["type"]);
     }
 }
開發者ID:almaopen,項目名稱:SwissMVC,代碼行數:15,代碼來源:options.php

示例3: cacheTable

 private function cacheTable($tbName)
 {
     ob_start();
     echo "<?class ModelCache_" . $tbName . " extends ModelCache {\n";
     echo "public function ModelCache_{$tbName}() {\n";
     echo "\t\$this->modelSource = '{$tbName}';\n";
     $rs = Datasource::query("describe " . Datasource::escape($tbName));
     foreach ($rs as $row) {
         echo "\$this->modelStructure['" . $row["Field"] . "'] = array();\n";
         echo "\$this->modelStructure['" . $row["Field"] . "']['is_id'] = " . ($row["Key"] == 'PRI' ? "true" : "false") . ";\n";
         echo "\$this->modelStructure['" . $row["Field"] . "']['type'] = '" . $this->parseType($row["Type"]) . "';\n";
         echo "\$this->modelStructure['" . $row["Field"] . "']['null'] = " . ($row["Null"] == 'NO' ? "false" : "true") . ";\n";
         echo "\$this->modelStructure['" . $row["Field"] . "']['maxlength'] = " . $this->parseLength($row["Type"]) . ";\n";
         echo "\$this->modelStructure['" . $row["Field"] . "']['default'] = " . $this->getDefault($row) . ";\n";
     }
     echo "}\n";
     echo "\n}?>\n";
     $cacheContents = ob_get_contents();
     ob_end_clean();
     $cachePointer = fopen(WEBAPP_ROOT . "/tmp/modelcache/" . md5($tbName) . ".php", "w");
     fwrite($cachePointer, $cacheContents);
     flush($cachePointer);
     fclose($cachePointer);
 }
開發者ID:almaopen,項目名稱:SwissMVC,代碼行數:24,代碼來源:newmodel.php


注:本文中的Datasource::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。