当前位置: 首页>>代码示例>>PHP>>正文


PHP adodb_movenext函数代码示例

本文整理汇总了PHP中adodb_movenext函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_movenext函数的具体用法?PHP adodb_movenext怎么用?PHP adodb_movenext使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了adodb_movenext函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MetaForeignKeys

 function MetaForeignKeys($table, $owner = false, $upper = false)
 {
     $sql = "\n\t  SELECT fum.ftblname AS lookup_table, split_part(fum.rf, ')'::text, 1) AS lookup_field,\n\t     fum.ltable AS dep_table, split_part(fum.lf, ')'::text, 1) AS dep_field\n\t  FROM (\n\t  SELECT fee.ltable, fee.ftblname, fee.consrc, split_part(fee.consrc,'('::text, 2) AS lf, \n\t    split_part(fee.consrc, '('::text, 3) AS rf\n\t  FROM (\n\t      SELECT foo.relname AS ltable, foo.ftblname,\n\t          pg_get_constraintdef(foo.oid) AS consrc\n\t      FROM (\n\t          SELECT c.oid, c.conname AS name, t.relname, ft.relname AS ftblname\n\t          FROM pg_constraint c \n\t          JOIN pg_class t ON (t.oid = c.conrelid) \n\t          JOIN pg_class ft ON (ft.oid = c.confrelid)\n\t          JOIN pg_namespace nft ON (nft.oid = ft.relnamespace)\n\t          LEFT JOIN pg_description ds ON (ds.objoid = c.oid)\n\t          JOIN pg_namespace n ON (n.oid = t.relnamespace)\n\t          WHERE c.contype = 'f'::\"char\"\n\t          ORDER BY t.relname, n.nspname, c.conname, c.oid\n\t          ) foo\n\t      ) fee) fum\n\t  WHERE fum.ltable='" . strtolower($table) . "'\n\t  ORDER BY fum.ftblname, fum.ltable, split_part(fum.lf, ')'::text, 1)\n\t  ";
     $rs = $this->Execute($sql);
     if (!$rs || $rs->EOF) {
         return false;
     }
     $a = array();
     while (!$rs->EOF) {
         if ($upper) {
             $a[strtoupper($rs->Fields('lookup_table'))][] = strtoupper(ereg_replace('"', '', $rs->Fields('dep_field') . '=' . $rs->Fields('lookup_field')));
         } else {
             $a[$rs->Fields('lookup_table')][] = ereg_replace('"', '', $rs->Fields('dep_field') . '=' . $rs->Fields('lookup_field'));
         }
         adodb_movenext($rs);
     }
     return $a;
 }
开发者ID:ssolano,项目名称:cafe_sigesp,代码行数:18,代码来源:adodb-postgres7.inc.php

示例2: Move

 /**
  * Random access to a specific row in the recordset. Some databases do not support
  * access to previous rows in the databases (no scrolling backwards).
  *
  * @param rowNumber is the row to move to (0-based)
  *
  * @return true if there still rows available, or false if there are no more rows (EOF).
  */
 function Move($rowNumber = 0)
 {
     $this->EOF = false;
     if ($rowNumber == $this->_currentRow) {
         return true;
     }
     if ($rowNumber >= $this->_numOfRows) {
         if ($this->_numOfRows != -1) {
             $rowNumber = $this->_numOfRows - 2;
         }
     }
     if ($this->canSeek) {
         if ($this->_seek($rowNumber)) {
             $this->_currentRow = $rowNumber;
             if ($this->_fetch()) {
                 return true;
             }
         } else {
             $this->EOF = true;
             return false;
         }
     } else {
         if ($rowNumber < $this->_currentRow) {
             return false;
         }
         global $ADODB_EXTENSION;
         if ($ADODB_EXTENSION) {
             while (!$this->EOF && $this->_currentRow < $rowNumber) {
                 adodb_movenext($this);
             }
         } else {
             while (!$this->EOF && $this->_currentRow < $rowNumber) {
                 $this->_currentRow++;
                 if (!$this->_fetch()) {
                     $this->EOF = true;
                 }
             }
         }
         return !$this->EOF;
     }
     $this->fields = false;
     $this->EOF = true;
     return false;
 }
开发者ID:dasatti,项目名称:dashboard,代码行数:52,代码来源:adodb.inc.php

示例3: _adodb_getcount

function _adodb_getcount(&$zthis, $sql, $inputarr = false, $secs2cache = 0)
{
    $qryRecs = 0;
    if (!empty($zthis->_nestedSQL) || preg_match("/^\\s*SELECT\\s+DISTINCT/is", $sql) || preg_match('/\\s+GROUP\\s+BY\\s+/is', $sql) || preg_match('/\\s+UNION\\s+/is', $sql)) {
        $rewritesql = adodb_strip_order_by($sql);
        // ok, has SELECT DISTINCT or GROUP BY so see if we can use a table alias
        // but this is only supported by oracle and postgresql...
        if ($zthis->dataProvider == 'oci8') {
            // Allow Oracle hints to be used for query optimization, Chris Wrye
            if (preg_match('#/\\*+.*?\\*\\/#', $sql, $hint)) {
                $rewritesql = "SELECT " . $hint[0] . " COUNT(*) FROM (" . $rewritesql . ")";
            } else {
                $rewritesql = "SELECT COUNT(*) FROM (" . $rewritesql . ")";
            }
        } else {
            if (strncmp($zthis->databaseType, 'postgres', 8) == 0 || strncmp($zthis->databaseType, 'mysql', 5) == 0) {
                $rewritesql = "SELECT COUNT(*) FROM ({$rewritesql}) _ADODB_ALIAS_";
            } else {
                $rewritesql = "SELECT COUNT(*) FROM ({$rewritesql})";
            }
        }
    } else {
        // now replace SELECT ... FROM with SELECT COUNT(*) FROM
        if (strpos($sql, '_ADODB_COUNT') !== FALSE) {
            $rewritesql = preg_replace('/^\\s*?SELECT\\s+_ADODB_COUNT(.*)_ADODB_COUNT\\s/is', 'SELECT COUNT(*) ', $sql);
        } else {
            $rewritesql = preg_replace('/^\\s*?SELECT\\s.*?\\s+(.*?)\\s+FROM\\s/is', 'SELECT COUNT(*) FROM ', $sql);
        }
        // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails
        // with mssql, access and postgresql. Also a good speedup optimization - skips sorting!
        // also see http://phplens.com/lens/lensforum/msgs.php?id=12752
        $rewritesql = adodb_strip_order_by($rewritesql);
    }
    if (isset($rewritesql) && $rewritesql != $sql) {
        if (preg_match('/\\sLIMIT\\s+[0-9]+/i', $sql, $limitarr)) {
            $rewritesql .= $limitarr[0];
        }
        if ($secs2cache) {
            // we only use half the time of secs2cache because the count can quickly
            // become inaccurate if new records are added
            $qryRecs = $zthis->CacheGetOne($secs2cache / 2, $rewritesql, $inputarr);
        } else {
            $qryRecs = $zthis->GetOne($rewritesql, $inputarr);
        }
        if ($qryRecs !== false) {
            return $qryRecs;
        }
    }
    //--------------------------------------------
    // query rewrite failed - so try slower way...
    // strip off unneeded ORDER BY if no UNION
    if (preg_match('/\\s*UNION\\s*/is', $sql)) {
        $rewritesql = $sql;
    } else {
        $rewritesql = $rewritesql = adodb_strip_order_by($sql);
    }
    if (preg_match('/\\sLIMIT\\s+[0-9]+/i', $sql, $limitarr)) {
        $rewritesql .= $limitarr[0];
    }
    if ($secs2cache) {
        $rstest = $zthis->CacheExecute($secs2cache, $rewritesql, $inputarr);
        if (!$rstest) {
            $rstest = $zthis->CacheExecute($secs2cache, $sql, $inputarr);
        }
    } else {
        $rstest = $zthis->Execute($rewritesql, $inputarr);
        if (!$rstest) {
            $rstest = $zthis->Execute($sql, $inputarr);
        }
    }
    if ($rstest) {
        $qryRecs = $rstest->RecordCount();
        if ($qryRecs == -1) {
            global $ADODB_EXTENSION;
            // some databases will return -1 on MoveLast() - change to MoveNext()
            if ($ADODB_EXTENSION) {
                while (!$rstest->EOF) {
                    adodb_movenext($rstest);
                }
            } else {
                while (!$rstest->EOF) {
                    $rstest->MoveNext();
                }
            }
            $qryRecs = $rstest->_currentRow;
        }
        $rstest->Close();
        if ($qryRecs == -1) {
            return 0;
        }
    }
    return $qryRecs;
}
开发者ID:spring,项目名称:spring-website,代码行数:93,代码来源:adodb-lib.inc.php

示例4: MoveNext

	function MoveNext()
	{
		return adodb_movenext($this);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:4,代码来源:adodb-oci8.old.inc.php

示例5: _adodb_getcount

function _adodb_getcount(&$zthis, $sql, $inputarr = false, $secs2cache = 0)
{
    $qryRecs = 0;
    if (preg_match("/^\\s*SELECT\\s+DISTINCT/is", $sql) || preg_match('/\\s+GROUP\\s+BY\\s+/is', $sql)) {
        // ok, has SELECT DISTINCT or GROUP BY so see if we can use a table alias
        // but this is only supported by oracle and postgresql...
        if ($zthis->dataProvider == 'oci8') {
            $rewritesql = preg_replace('/(\\sORDER\\s+BY\\s.*)/is', '', $sql);
            $rewritesql = "SELECT COUNT(*) FROM ({$rewritesql})";
        } else {
            if ($zthis->databaseType == 'postgres' || $zthis->databaseType == 'postgres7') {
                $info = $zthis->ServerInfo();
                if (substr($info['version'], 0, 3) >= 7.1) {
                    // good till version 999
                    $rewritesql = preg_replace('/(\\sORDER\\s+BY\\s.*)/is', '', $sql);
                    $rewritesql = "SELECT COUNT(*) FROM ({$rewritesql}) _ADODB_ALIAS_";
                }
            }
        }
    } else {
        // now replace SELECT ... FROM with SELECT COUNT(*) FROM
        $rewritesql = preg_replace('/^\\s*SELECT\\s.*\\s+FROM\\s/Uis', 'SELECT COUNT(*) FROM ', $sql);
        // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails
        // with mssql, access and postgresql. Also a good speedup optimization - skips sorting!
        $rewritesql = preg_replace('/(\\sORDER\\s+BY\\s.*)/is', '', $rewritesql);
    }
    if (isset($rewritesql) && $rewritesql != $sql) {
        if ($secs2cache) {
            // we only use half the time of secs2cache because the count can quickly
            // become inaccurate if new records are added
            $qryRecs = $zthis->CacheGetOne($secs2cache / 2, $rewritesql, $inputarr);
        } else {
            $qryRecs = $zthis->GetOne($rewritesql, $inputarr);
        }
        if ($qryRecs !== false) {
            return $qryRecs;
        }
    }
    //--------------------------------------------
    // query rewrite failed - so try slower way...
    // strip off unneeded ORDER BY if no UNION
    if (preg_match('/\\s*UNION\\s*/is', $sql)) {
        $rewritesql = $sql;
    } else {
        $rewritesql = preg_replace('/(\\sORDER\\s+BY\\s.*)/is', '', $sql);
    }
    $rstest =& $zthis->Execute($rewritesql, $inputarr);
    if ($rstest) {
        $qryRecs = $rstest->RecordCount();
        if ($qryRecs == -1) {
            global $ADODB_EXTENSION;
            // some databases will return -1 on MoveLast() - change to MoveNext()
            if ($ADODB_EXTENSION) {
                while (!$rstest->EOF) {
                    adodb_movenext($rstest);
                }
            } else {
                while (!$rstest->EOF) {
                    $rstest->MoveNext();
                }
            }
            $qryRecs = $rstest->_currentRow;
        }
        $rstest->Close();
        if ($qryRecs == -1) {
            return 0;
        }
    }
    return $qryRecs;
}
开发者ID:hetznerZA,项目名称:ipplan,代码行数:70,代码来源:adodb-lib.inc.php

示例6: dl

<?php

dl('adodb.so');
include_once 'phplens/adodb/adodb.inc.php';
$db = ADONewConnection('mysql');
$server = 'jaguar';
$user = 'mobydick';
$password = $_GET['pwd'];
$database = 'northwind';
$db->Connect($server, $user, $pwd, $database);
$rs = $db->Execute('select productname,unitsinstock from products');
while (!$rs->EOF) {
    print_r($rs->fields);
    print HTML_BR;
    adodb_movenext($rs);
    ## ADODB extension function
}
$rs->Close();
echo '<hr/>';
$rs = $db->Execute("select productname, unitsinstock from products where productid < 5");
$arr = adodb_getall($rs);
## ADOdb extension function
echo '<pre>';
print_r($arr);
echo '</pre>';
开发者ID:BackupTheBerlios,项目名称:ol-commerce-svn,代码行数:25,代码来源:test-adodb.php

示例7: MoveNext

 public function MoveNext()
 {
     return @adodb_movenext($this);
 }
开发者ID:bermi,项目名称:akelos,代码行数:4,代码来源:adodb-mysql.inc.php


注:本文中的adodb_movenext函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。