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


PHP XDB::rawIterator方法代碼示例

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


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

示例1: substr

    $string = substr($string, 1, strlen($string) - 2);
    if ($string == $data['lastname_main']) {
        return true;
    }
    if ($string != $data['pseudonym']) {
        if ($has_ordinary) {
            $update[] = XDB::format('pseudonym = {?}', $string);
        } else {
            $update[] = XDB::format('lastname_main = {?}', $string);
        }
        return true;
    }
    return false;
}
$res = XDB::rawIterator('SELECT  pd.pid, pd.private_name, pn.lastname_main, pn.lastname_marital, pn.lastname_ordinary,
                                 pn.firstname_main, pn.firstname_ordinary, pn.pseudonym
                           FROM  profile_display      AS pd
                     INNER JOIN  profile_public_names AS pn ON (pd.pid = pn.pid)');
$pattern = '/^([^\\(\\)]+)(?: (\\([^\\(\\)]+\\)))?(?: (\\([^\\(\\)]+\\)))?(?: (\\([^\\(\\)]+\\)))?$/';
while ($data = $res->next()) {
    preg_match($pattern, $data['private_name'], $matches);
    $has_ordinary = false;
    $count = count($matches);
    $update = array();
    $has_ordinary = update_main($data, $matches[1], $update);
    for ($i = 2; $i < $count; ++$i) {
        if (preg_match('/^\\((?:M|Mme) (.+)\\)$/', $matches[$i], $pieces)) {
            update_marital($data, $pieces[1], $update);
        } elseif (preg_match('/^\\((?:alias|autres prénoms :|autres noms :) .+\\)$/', $matches[$i], $pieces)) {
            update_private($data, $matches[$i], $data['pid'], $aliases, $perform_updates);
        } else {
            $has_ordinary = update_plain($data, $matches[$i], $update, $has_ordinary);
開發者ID:Ekleog,項目名稱:platal,代碼行數:32,代碼來源:names.php

示例2: printf

            ++$skipped;
        }
    }
    ++$i;
    printf("\r%u / %u", $i, $total);
}
printf("\r%u / %u", $i, $total);
if ($skipped != 0) {
    printf("\n%u addresses skipped.\n", $skipped);
}
if ($fixed != 0) {
    printf("\n%u addresses fixed.\n", $fixed);
}
print "\nAddress formating done.\n\n";
print "Formats non formated phones. (3/4)\n";
$it = XDB::rawIterator("SELECT  search_tel AS search, display_tel AS display, comment, link_id,\n                                tel_type AS type, link_type, tel_id AS id, pid, pub\n                          FROM  profile_phones\n                         WHERE  search_tel = '' OR search_tel IS NULL\n                      ORDER BY  pid, link_id, tel_id");
$total = $it->total();
$i = 0;
$j = 0;
while ($item = $it->next()) {
    $phone = new Phone($item);
    $phone->delete();
    $phone->save();
    ++$i;
    ++$j;
    if ($j == 100) {
        $j = 0;
        printf("\r%u / %u", $i, $total);
    }
}
printf("\r%u / %u", $i, $total);
開發者ID:Ekleog,項目名稱:platal,代碼行數:31,代碼來源:merge_issues.php

示例3: handler_corps

 function handler_corps($page)
 {
     $page->changeTpl('fusionax/corps.tpl');
     $missingCorps = XDB::rawIterator('SELECT  DISTINCT(f.corps_sortie) AS name
                                         FROM  fusionax_anciens AS f
                                        WHERE  NOT EXISTS (SELECT  *
                                                             FROM  profile_corps_enum AS c
                                                            WHERE  f.corps_sortie = c.abbreviation)');
     $missingGrade = XDB::rawIterator('SELECT  DISTINCT(f.grade) AS name
                                         FROM  fusionax_anciens AS f
                                        WHERE  NOT EXISTS (SELECT  *
                                                             FROM  profile_corps_rank_enum AS c
                                                            WHERE  f.grade = c.name)');
     $page->assign('missingCorps', $missingCorps);
     $page->assign('missingGrade', $missingGrade);
     $page->assign('missingCorpsCount', $missingCorps->total());
     $page->assign('missingGradeCount', $missingGrade->total());
 }
開發者ID:Ekleog,項目名稱:platal,代碼行數:18,代碼來源:fusionax.php

示例4: imagecreatefromstring

#!/usr/bin/php5
<?php 
require_once 'connect.db.inc.php';
$globals->debug = 0;
// Do not store backtraces.
$MAX_X = 200;
$MAX_Y = 100;
$it = XDB::rawIterator('SELECT  id, diminutif, logo, logo_mime
                          FROM  groups
                         WHERE  logo IS NOT NULL AND logo != ""');
while ($row = $it->next()) {
    $group_id = $row['id'];
    $group_name = $row['diminutif'];
    $logo = $row['logo'];
    $mime = $row['mime'];
    $img = imagecreatefromstring($logo);
    if ($img === false) {
        print "\n\nError reading image for:\n     {$group_name}\n\n";
        continue;
    }
    $x = imagesx($img);
    $y = imagesy($img);
    $nx = $x;
    $ny = $y;
    if ($x > $MAX_X || $y > $MAX_Y) {
        if ($x > $MAX_X) {
            $ny = intval($y * $MAX_X / $x);
            $nx = $MAX_X;
        }
        if ($y > $MAX_Y) {
            $nx = intval($x * $MAX_Y / $y);
開發者ID:Ekleog,項目名稱:platal,代碼行數:31,代碼來源:group_logos.php

示例5: ON

// Do not store backtraces.
$it = XDB::iterator('SELECT  gl.language, gc.country, gc.iso_3166_1_a2
                       FROM  geoloc_languages AS gl
                 INNER JOIN  geoloc_countries AS gc ON (gl.iso_3166_1_a2 = gc.iso_3166_1_a2)');
echo $it->total() . " pays à remplir.\n";
while ($item = $it->next()) {
    if ($item['language'] != 'fr') {
        $address = new Address(array('text' => $item['country']));
        $gmapsGeocoder = new GMapsGeocoder();
        $gmapsGeocoder->getGeocodedAddress($address, $item['language'], true);
        $country = $address->country;
    } else {
        $country = $item['country'];
    }
    $countryPlain = mb_strtoupper(replace_accent($country));
    XDB::execute('UPDATE  geoloc_languages
                     SET  country = {?}, countryPlain = {?}
                   WHERE  iso_3166_1_a2 = {?} AND language = {?}', $country, $countryPlain, $item['iso_3166_1_a2'], $item['language']);
    sleep(1);
}
$it = XDB::rawIterator('SELECT  country, iso_3166_1_a2
                          FROM  geoloc_countries');
echo $it->total() . " pays à simplifier.\n";
while ($item = $it->next()) {
    XDB::execute('UPDATE  geoloc_countries
                     SET  countryPlain = {?}
                   WHERE  iso_3166_1_a2 = {?}', mb_strtoupper(replace_accent($item['country'])), $item['iso_3166_1_a2']);
}
// Fixes geocoding errors.
XDB::rawExecute("REPLACE INTO  geoloc_languages (iso_3166_1_a2, language, country, countryPlain)\n                       VALUES  ('FM', 'en', 'Federated States of Micronesia', 'FEDERATED STATES OF MICRONESIA'),\n                               ('MH', 'en', 'Republic of the Marshall Islands', 'REPUBLIC OF THE MARSHALL ISLANDS'),\n                               ('PS', 'ar', 'دولة فلسطين', 'دولة فلسطين'),\n                               ('SB', 'en', 'Solomon Islands', 'SOLOMON ISLANDS'),\n                               ('TW', 'zh-CN', '台灣', '台灣'),\n                               ('TW', 'zh-TW', '台灣', '台灣'),\n                               ('CZ', 'cs', 'Česká Republika', 'CESKA REPUBLIKA'),\n                               ('CZ', 'sk', 'Česká Republika', 'CESKA REPUBLIKA'),\n                               ('DO', 'es', 'República Dominicana', 'REPUBLICA DOMINICANA'),\n                               ('GD', 'en', 'Grenada', 'GRENADA'),\n                               ('MD', 'ro', 'Republica Moldova', 'REPUBLICA MOLDOVA'),\n                               ('RU', 'ru', 'Россия', 'Россия'),\n                               ('SK', 'sk', 'Slovenská Republika', 'SLOVENSKA REPUBLIKA'),\n                               ('TZ', 'en', 'United Republic of Tanzania', 'UNITED REPUBLIC OF TANZANIA')");
/* vim:set et sw=4 sts=4 ts=4: */
開發者ID:Ekleog,項目名稱:platal,代碼行數:31,代碼來源:geocoding.php

示例6: IN

#!/usr/bin/php5
<?php 
require_once 'connect.db.inc.php';
$globals->debug = 0;
// Do not store backtraces.
$it = XDB::rawIterator('SELECT  uid, full_name, email, type
                          FROM  accounts
                         WHERE  type NOT IN (\'x\', \'master\', \'phd\')');
$total = $it->total();
$done = 0;
while ($item = $it->next()) {
    if ($item['type'] == 'virtual') {
        $firstname = '';
        $lastname = $item['full_name'];
    } elseif ($item['full_name'] && strpos(' ', $item['full_name'])) {
        list($firstname, $lastname) = explode(' ', $item['full_name']);
    } else {
        list($local_part, ) = explode('@', strtolower($item['email']));
        $parts = explode('.', $local_part);
        if (count($parts) == 1) {
            $lastname = ucfirst($local_part);
            $firstname = '';
        } else {
            $firstname = ucfirst($parts[0]);
            $lastname = ucwords(implode(' ', array_slice($parts, 1)));
        }
    }
    XDB::execute('UPDATE  accounts
                     SET  firstname = {?}, lastname = {?}
                   WHERE  uid = {?}', $firstname, $lastname, $item['uid']);
    ++$done;
開發者ID:Ekleog,項目名稱:platal,代碼行數:31,代碼來源:accounts.php


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