本文整理汇总了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;
}
示例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;
}
示例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) {