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


PHP _adodb_getcount函数代码示例

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


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

示例1: _adodb_pageexecute_all_rows

function _adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, $inputarr = false, $secs2cache = 0)
{
    $atfirstpage = false;
    $atlastpage = false;
    $lastpageno = 1;
    // If an invalid nrows is supplied,
    // we assume a default value of 10 rows per page
    if (!isset($nrows) || $nrows <= 0) {
        $nrows = 10;
    }
    $qryRecs = false;
    //count records for no offset
    $qryRecs = _adodb_getcount($zthis, $sql, $inputarr, $secs2cache);
    $lastpageno = (int) ceil($qryRecs / $nrows);
    $zthis->_maxRecordCount = $qryRecs;
    // ***** Here we check whether $page is the last page or
    // whether we are trying to retrieve
    // a page number greater than the last page number.
    if ($page >= $lastpageno) {
        $page = $lastpageno;
        $atlastpage = true;
    }
    // If page number <= 1, then we are at the first page
    if (empty($page) || $page <= 1) {
        $page = 1;
        $atfirstpage = true;
    }
    // We get the data we want
    $offset = $nrows * ($page - 1);
    if ($secs2cache > 0) {
        $rsreturn = $zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr);
    } else {
        $rsreturn = $zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache);
    }
    // Before returning the RecordSet, we set the pagination properties we need
    if ($rsreturn) {
        $rsreturn->_maxRecordCount = $qryRecs;
        $rsreturn->rowsPerPage = $nrows;
        $rsreturn->AbsolutePage($page);
        $rsreturn->AtFirstPage($atfirstpage);
        $rsreturn->AtLastPage($atlastpage);
        $rsreturn->LastPageNo($lastpageno);
    }
    return $rsreturn;
}
开发者ID:spring,项目名称:spring-website,代码行数:45,代码来源:adodb-lib.inc.php

示例2: testdb


//.........这里部分代码省略.........
        if ($rez !== false) {
            if (is_null($rez)) {
                Err("Error: _transOK not modified");
            } else {
                Err("Error: CompleteTrans (1) should have failed");
            }
        } else {
            $name = $db->GetOne("Select firstname from ADOXYZ where id=1");
            if ($name == "Carolx") {
                Err("Error: CompleteTrans (2) should have failed");
            } else {
                echo "<p> -- Passed StartTrans test1 - rolling back</p>";
            }
        }
        $db->StartTrans();
        $db->BeginTrans();
        $db->Execute("update ADOXYZ set firstname='Carolx' where id=1");
        $db->RollbackTrans();
        $rez = $db->CompleteTrans();
        if ($rez !== true) {
            Err("Error: CompleteTrans (1) should have succeeded");
        } else {
            $name = $db->GetOne("Select firstname from ADOXYZ where id=1");
            if (trim($name) != "Carolx") {
                Err("Error: CompleteTrans (2) should have succeeded, returned name={$name}");
            } else {
                echo "<p> -- Passed StartTrans test2 - commiting</p>";
            }
        }
    }
    flush();
    $saved = $db->debug;
    $db->debug = 1;
    $cnt = _adodb_getcount($db, 'select * from ADOXYZ where firstname in (select firstname from ADOXYZ)');
    echo "<b>Count=</b> {$cnt}";
    $db->debug = $saved;
    global $TESTERRS;
    $debugerr = true;
    global $ADODB_LANG;
    $ADODB_LANG = 'fr';
    $db->debug = false;
    $TESTERRS = 0;
    $db->raiseErrorFn = 'adodb_test_err';
    global $ERRNO;
    // from adodb_test_err
    $db->Execute('select * from nowhere');
    $metae = $db->MetaError($ERRNO);
    if ($metae !== DB_ERROR_NOSUCHTABLE) {
        print "<p><b>MetaError=" . $metae . " wrong</b>, should be " . DB_ERROR_NOSUCHTABLE . "</p>";
    } else {
        print "<p>MetaError ok (" . DB_ERROR_NOSUCHTABLE . "): " . $db->MetaErrorMsg($metae) . "</p>";
    }
    if ($TESTERRS != 1) {
        print "<b>raiseErrorFn select nowhere failed</b><br>";
    }
    $rs = $db->Execute('select * from ADOXYZ');
    if ($debugerr) {
        print " Move";
    }
    $rs->Move(100);
    $rs->_queryID = false;
    if ($debugerr) {
        print " MoveNext";
    }
    $rs->MoveNext();
    if ($debugerr) {
开发者ID:mvpphet,项目名称:IntranetPaper,代码行数:67,代码来源:test.php


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