当前位置: 首页>>代码示例>>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;未经允许,请勿转载。