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


PHP DibiConnection::fetchAll方法代碼示例

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


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

示例1: createDuplicates

 public function createDuplicates($newPageId, $oldPageId)
 {
     //unset($pageIdsToDelete[$pageIdToUpdate]);
     $data = $this->connection->fetchAll("SELECT * FROM [:vd:pages_files] WHERE [page_id]=%i", $oldPageId);
     if ($data) {
         $inserts = array();
         foreach ($data as $insert) {
             $insert->toArray();
             $insert['page_id'] = $newPageId;
             $inserts[] = $insert;
         }
         $this->connection->query("INSERT INTO [:vd:pages_files] %ex", $inserts);
     }
     // $this->connection->query("DELETE FROM [:vd:pages_files] WHERE [page_id] IN %l",(array) $pageIdsToDelete);
     return true;
 }
開發者ID:jurasm2,項目名稱:bubo,代碼行數:16,代碼來源:DriveModel.php

示例2: createInformationForEntity

 /**
  * @param \obo\Carriers\EntityInformationCarrier $entityInformation
  * @return array
  */
 protected function createInformationForEntity(\obo\Carriers\EntityInformationCarrier $entityInformation)
 {
     $information = ["table" => $entityInformation->repositoryName, "columns" => [], "autoIncrementProperty" => null, "toPropertyName" => [], "toColumnName" => []];
     foreach ($this->dibiConnection->fetchAll("SHOW COLUMNS FROM [{$information["table"]}];") as $row) {
         $information["columns"][$row->Field] = ["field" => $row->Field, "type" => $type = preg_replace("#[^a-z]+.*\$#", '', $row->Type), "placeholder" => $this->placeholderForColumnType($type), "null" => $row->Null, "key" => $row->Key, "default" => $row->Default, "extra" => $row->Extra];
     }
     foreach ($entityInformation->persistablePropertiesNames as $persitablePropertyName) {
         $propertyInformation = $entityInformation->informationForPropertyWithName($persitablePropertyName);
         if (!isset($information["columns"][$propertyInformation->columnName])) {
             throw new \obo\Exceptions\Exception("Column '{$propertyInformation->columnName}' does not exist for persistable property '{$persitablePropertyName}' in table '{$information["table"]}'");
         }
         $information["columns"][$propertyInformation->columnName]["propertyName"] = $propertyInformation->name;
         $information["columns"][$propertyInformation->columnName]["nullable"] = $propertyInformation->nullable;
         if ($information["columns"][$propertyInformation->columnName]["autoIncrement"] = $propertyInformation->autoIncrement) {
             $information["autoIncrementProperty"] = $persitablePropertyName;
         }
         $information["columns"][$propertyInformation->columnName]["exportFilter"] = $this->dataConverter->convertFilterForCombinationCode("D" . $information["columns"][$propertyInformation->columnName]["type"] . "->O" . $propertyInformation->dataType->name());
         $information["columns"][$propertyInformation->columnName]["importFilter"] = $this->dataConverter->convertFilterForCombinationCode("O" . $propertyInformation->dataType->name() . "->D" . $information["columns"][$propertyInformation->columnName]["type"]);
         $information["toPropertyName"][$propertyInformation->columnName] = $propertyInformation->name;
         $information["toColumnName"][$propertyInformation->name] = $propertyInformation->columnName;
     }
     return $this->informations[$entityInformation->className] = $information;
 }
開發者ID:lordjim666,項目名稱:data-storage-mysql,代碼行數:27,代碼來源:MySQL.php

示例3: DibiConnection

<?php

require_once 'vendor/autoload.php';
require_once 'config.php';
require_once 'libs/WikinewsReport.php';
use Dibi\Dibi;
$db = new DibiConnection($database_configuration);
$language = isset($_GET['lang']) ? $_GET['lang'] : '';
$rows = $db->fetchAll('SELECT url FROM Texts WHERE language="' . $language . '"');
$publishedUrls = array();
foreach ($rows as $row) {
    array_push($publishedUrls, $row['url']);
}
switch ($language) {
    case "en":
        $reports = simplexml_load_file("https://en.wikinews.org/wiki/Special:NewsFeed");
        foreach ($reports->url as $report_url) {
            $link = $report_url->loc;
            $report = new WikinewsReport($link, $publishedUrls);
            $extracted_report = $report->getTitleTextLevel();
            if (!$extracted_report['published']) {
                $db->query("INSERT INTO Texts (language,title,text,level,source,url,public) VALUES ('" . $language . "','" . $extracted_report['title'] . "','" . $extracted_report['text'] . "','" . $extracted_report['level'] . "','Wikinews','" . $link . "','1')");
            }
        }
        break;
    case "de":
        $reports = simplexml_load_file("https://de.wikinews.org/w/api.php?format=xml&action=query&prop=extracts&exchars=99999999&explaintext&exsectionformat=wiki&titles=Kategorie:Ver%C3%B6ffentlicht");
        $titles = $reports->query->pages->page->extract;
        $titles = trim($titles, " \n\t\r\v…");
        $links = preg_split("/[\n\r]+/", $titles);
        foreach ($links as &$link) {
開發者ID:WesleyYep,項目名稱:text2test,代碼行數:31,代碼來源:get-wikinews.php


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