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


PHP adodb_pr函数代码示例

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


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

示例1: testsql

function testsql()
{
    //define('ADODB_FORCE_NULLS',1);
    include '../adodb.inc.php';
    include '../tohtml.inc.php';
    //==========================
    // This code tests an insert
    $sql = "\r\r\nSELECT * \r\r\nFROM ADOXYZ WHERE id = -1";
    // Select an empty record from the database
    $conn =& ADONewConnection("mysql");
    // create a connection
    //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $conn->debug = 1;
    $conn->PConnect("localhost", "root", "", "test");
    // connect to MySQL, testdb
    $conn->Execute("delete from adoxyz where lastname like 'Smith%'");
    $rs = $conn->Execute($sql);
    // Execute the query and get the empty recordset
    $record = array();
    // Initialize an array to hold the record data to insert
    // Set the values for the fields in the record
    $record["firstname"] = 'null';
    $record["lastname"] = "Smith\$@//";
    $record["created"] = time();
    //$record["id"] = -1;
    // Pass the empty recordset and the array containing the data to insert
    // into the GetInsertSQL function. The function will process the data and return
    // a fully formatted insert sql statement.
    $insertSQL = $conn->GetInsertSQL($rs, $record);
    $conn->Execute($insertSQL);
    // Insert the record into the database
    //==========================
    // This code tests an update
    $sql = "\r\r\nSELECT * \r\r\nFROM ADOXYZ WHERE lastname=" . $conn->qstr($record['lastname']);
    // Select a record to update
    $rs = $conn->Execute($sql);
    // Execute the query and get the existing record to update
    if (!$rs) {
        print "<p>No record found!</p>";
    }
    $record = array();
    // Initialize an array to hold the record data to update
    // Set the values for the fields in the record
    $record["firstName"] = "Caroline" . rand();
    $record["lasTname"] = "Smithy Jones";
    // Update Caroline's lastname from Miranda to Smith
    $record["creAted"] = '2002-12-' . (rand() % 30 + 1);
    $record['num'] = 3921;
    // Pass the single record recordset and the array containing the data to update
    // into the GetUpdateSQL function. The function will process the data and return
    // a fully formatted update sql statement.
    // If the data has not changed, no recordset is returned
    $updateSQL = $conn->GetUpdateSQL($rs, $record);
    $conn->Execute($updateSQL);
    // Update the record in the database
    print "<p>Rows Affected=" . $conn->Affected_Rows() . "</p>";
    $rs = $conn->Execute("select * from adoxyz where lastname like 'Smith%'");
    adodb_pr($rs);
    rs2html($rs);
}
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:60,代码来源:test4.php

示例2: testdb

        if ($db->Connect($dsn)) {
            testdb($db, "create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
        } else {
            print "ERROR: DB2 test requires an server setup with odbc data source db2_sample" . '<BR>' . $db->ErrorMsg();
        }
    }
    echo "<hr />";
    flush();
    $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft";
    $db = ADONewConnection('odbtp');
    if ($db->Connect('127.0.0.1', $dsn)) {
        $db->debug = 1;
        $arr = $db->GetArray("||SQLProcedures");
        adodb_pr($arr);
        $arr = $db->GetArray("||SQLProcedureColumns|||GET_ROUTINE_SAR");
        adodb_pr($arr);
        testdb($db, "create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)");
    } else {
        echo "ERROR Connection";
    }
    echo $db->ErrorMsg();
}
$server = 'sherkhan';
ADOLoadCode("mssqlpo");
if (!empty($testmssql)) {
    // MS SQL Server -- the extension is buggy -- probably better to use ODBC
    $db = ADONewConnection("mssqlpo");
    //$db->debug=1;
    print "<h1>Connecting {$db->databaseType}...</h1>";
    $ok = $db->Connect('', 'adodb', 'natsoft', 'northwind');
    if ($ok or $db->PConnect("mangrove", "sa", "natsoft", "ai")) {
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:31,代码来源:testdatabases.inc.php

示例3: printsqla

        $sqla2 = $dict->ChangeTableSQL('adoxyz', $flds);
        if ($sqla2) {
            printsqla($dbType, $sqla2);
        }
    }
    if ($dbType == 'odbc_mssql') {
        $dsn = $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=localhost;Database=northwind;";
        if (@$db->Connect($dsn, "sa", "natsoft", "test")) {
        }
        $dict->SetSchema('');
        $sqla2 = $dict->ChangeTableSQL('adoxyz', $flds);
        if ($sqla2) {
            printsqla($dbType, $sqla2);
        }
    }
    adodb_pr($dict->databaseType);
    printsqla($dbType, $dict->DropColumnSQL('table', array('my col', '`col2_with_Quotes`', 'A_col3', 'col3(10)')));
    printsqla($dbType, $dict->ChangeTableSQL('adoxyz', 'LASTNAME varchar(32)'));
}
function printsqla($dbType, $sqla)
{
    print "<pre>";
    //print_r($dict->MetaTables());
    foreach ($sqla as $s) {
        $s = htmlspecialchars($s);
        print "{$s};\n";
        if ($dbType == 'oci8') {
            print "/\n";
        }
    }
    print "</pre><hr />";
开发者ID:ThYpHo0n,项目名称:torrentflux,代码行数:31,代码来源:test-datadict.php

示例4: rand

        $x = rand() % 10 + 1;
        $db->debug = $i == 1;
        $id = $db->GetOne($sql, array('Z%', 'Z%', $x));
        if ($id != $offset + $x) {
            print "<p>Error at {$x}";
            break;
        }
    }
}
include_once '../adodb.inc.php';
$db = NewADOConnection('postgres7');
$db->PConnect('localhost', 'tester', 'test', 'test') || die("failed connection");
$enc = "GIF89a%01%00%01%00%80%FF%00%C0%C0%C0%00%00%00%21%F9%04%01%00%00%00%00%2C%00%00%00%00%01%00%01%00%00%01%012%00%3Bt_clear.gif%0D";
$val = rawurldecode($enc);
$MAX = 1000;
adodb_pr($db->ServerInfo());
echo "<h4>Testing PREPARE/EXECUTE PLAN</h4>";
$db->_bindInputArray = true;
// requires postgresql 7.3+ and ability to modify database
$t = getmicrotime();
doloop();
echo '<p>', $MAX, ' times, with plan=', getmicrotime() - $t, '</p>';
$db->_bindInputArray = false;
$t = getmicrotime();
doloop();
echo '<p>', $MAX, ' times, no plan=', getmicrotime() - $t, '</p>';
echo "<h4>Testing UPDATEBLOB</h4>";
$db->debug = 1;
### TEST BEGINS
$db->Execute("insert into photos (id,name) values(9999,'dot.gif')");
$db->UpdateBlob('photos', 'photo', $val, 'id=9999');
开发者ID:dasatti,项目名称:dashboard,代码行数:31,代码来源:test-pgblob.php

示例5: flush

        }
        flush();
    }
    $rs = new ADORecordSet_empty();
    foreach ($rs as $v) {
        echo "<p>empty ";
        var_dump($v);
    }
    if ($i != $cnt) {
        die("actual cnt is {$i}, cnt should be {$cnt}\n");
    } else {
        echo "Count {$i} is correct<br>";
    }
    $rs = $db->Execute("select bad from badder");
} catch (exception $e) {
    adodb_pr($e);
    echo "<h3>adodb_backtrace:</h3>\n";
    $e = adodb_backtrace($e->gettrace());
}
$rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order by id");
echo "Result=\n", $rs, "</p>";
echo "<h3>Active Record</h3>";
include_once "../adodb-active-record.inc.php";
ADOdb_Active_Record::SetDatabaseAdapter($db);
try {
    class City extends ADOdb_Active_Record
    {
    }
    $a = new City();
} catch (exception $e) {
    echo $e->getMessage();
开发者ID:GLUD,项目名称:EcoHack,代码行数:31,代码来源:test-php5.php

示例6: emp

    print $db->Affected_Rows() . '<BR>';
    $stmt = $db->Prepare('insert into emp (empno, ename) values (:empno, :ename)');
    $rs = $db->Execute($stmt, array('empno' => 4321, 'ename' => 'John'));
    // prepare not quite ready for prime time
    //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John'));
    if (!$rs) {
        die("Empty RS");
    }
    $db->setfetchmode(ADODB_FETCH_NUM);
    $vv = 'A%';
    $stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;", true);
    $db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR);
    $db->OutParameter($stmt, $vv, 'tt');
    $rs = $db->Execute($stmt);
    while (!$rs->EOF) {
        adodb_pr($rs->fields);
        $rs->MoveNext();
    }
    echo " val = {$vv}";
}
if (0) {
    $db = ADONewConnection('odbc_oracle');
    if (!$db->PConnect('local_oracle', 'scott', 'tiger')) {
        die('fail connect');
    }
    $db->debug = true;
    $rs = $db->Execute('select * from adoxyz where firstname=? and trim(lastname)=?', array('first' => 'Caroline', 'last' => 'Miranda'));
    if (!$rs) {
        die("Empty RS");
    }
    if ($rs->EOF) {
开发者ID:nabusas,项目名称:Nabu,代码行数:31,代码来源:testoci8.php

示例7: testdb


//.........这里部分代码省略.........
        if ($a === false) {
            print "<b>MetaTables not supported</b></p>";
        } else {
            print "Array of tables: ";
            foreach ($a as $v) {
                print " ({$v}) ";
            }
            print '</p>';
        }
        $db->debug = 0;
        $rez = $db->MetaColumns("NOSUCHTABLEHERE");
        if ($rez !== false) {
            Err("MetaColumns error handling failed");
            var_dump($rez);
        }
        $db->debug = 1;
        $a = $db->MetaColumns('ADOXYZ');
        if ($a === false) {
            print "<b>MetaColumns not supported</b></p>";
        } else {
            print "<p>Columns of ADOXYZ: <font size=1><br>";
            foreach ($a as $v) {
                print_r($v);
                echo "<br>";
            }
            echo "</font>";
        }
        print "<p>Testing MetaIndexes</p>";
        $a = $db->MetaIndexes('ADOXYZ', true);
        if ($a === false) {
            print "<b>MetaIndexes not supported</b></p>";
        } else {
            print "<p>Indexes of ADOXYZ: <font size=1><br>";
            adodb_pr($a);
            echo "</font>";
        }
        print "<p>Testing MetaPrimaryKeys</p>";
        $a = $db->MetaPrimaryKeys('ADOXYZ');
        var_dump($a);
    }
    $rs = $db->Execute('delete from ADOXYZ');
    if ($rs) {
        $rs->Close();
    }
    $db->debug = false;
    switch ($db->databaseType) {
        case 'vfp':
            if (0) {
                // memo test
                $rs = $db->Execute("select data from memo");
                rs2html($rs);
            }
            break;
        case 'postgres7':
        case 'postgres64':
        case 'postgres':
        case 'ibase':
            print "<p>Encode=" . $db->BlobEncode("abcd\"'\nef") . "</p>";
            //'
            print "<p>Testing Foreign Keys</p>";
            $arr = $db->MetaForeignKeys('ADOXYZ', false, true);
            print_r($arr);
            if (!$arr) {
                Err("No MetaForeignKeys");
            }
            break;
开发者ID:mvpphet,项目名称:IntranetPaper,代码行数:67,代码来源:test.php

示例8: adodb_pr

    }
}
$arr = $db->ServerInfo();
echo "<h3>{$db->dataProvider}: {$arr['description']}</h3>";
$arr = $db->GetActiveRecords('products', ' productid<10');
adodb_pr($arr);
ADOdb_Active_Record::SetDatabaseAdapter($db);
if (!$db) {
    die('failed');
}
$rec = new ADODB_Active_Record('photos');
$rec = new ADODB_Active_Record('products');
adodb_pr($rec->getAttributeNames());
echo "<hr>";
$rec->load('productid=2');
adodb_pr($rec);
$db->debug = 1;
$rec->productname = 'Changie Chan' . rand();
$rec->insert();
$rec->update();
$rec->productname = 'Changie Chan 99';
$rec->replace();
$rec2 = new ADODB_Active_Record('products');
$rec->load('productid=3');
$rec->save();
$rec = new ADODB_Active_record('products');
$rec->productname = 'John ActiveRec';
$rec->notes = 22;
#$rec->productid=0;
$rec->discontinued = 1;
$rec->Save();
开发者ID:jnugh,项目名称:Paradise-Bird-Project,代码行数:31,代码来源:test-active-recs2.php

示例9: testsql

function testsql()
{
    include '../adodb.inc.php';
    include '../tohtml.inc.php';
    global $ADODB_FORCE_TYPE;
    //==========================
    // This code tests an insert
    $sql = "\r\nSELECT * \r\nFROM ADOXYZ WHERE id = -1";
    // Select an empty record from the database
    $conn =& ADONewConnection("mysql");
    // create a connection
    $conn->PConnect("localhost", "root", "", "test");
    // connect to MySQL, testdb
    //$conn =& ADONewConnection('oci8');
    //$conn->Connect('','scott','natsoft');
    //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    $conn->debug = 1;
    $conn->Execute("delete from adoxyz where lastname like 'Smith%'");
    $rs = $conn->Execute($sql);
    // Execute the query and get the empty recordset
    $record = array();
    // Initialize an array to hold the record data to insert
    // Set the values for the fields in the record
    $record["firstname"] = 'null';
    $record["lastname"] = "Smith\$@//";
    $record["created"] = time();
    if (isset($_GET['f'])) {
        $ADODB_FORCE_TYPE = $_GET['f'];
    }
    //$record["id"] = -1;
    // Pass the empty recordset and the array containing the data to insert
    // into the GetInsertSQL function. The function will process the data and return
    // a fully formatted insert sql statement.
    $insertSQL = $conn->GetInsertSQL($rs, $record);
    $conn->Execute($insertSQL);
    // Insert the record into the database
    $insertSQL2 = $conn->GetInsertSQL($table = 'ADOXYZ', $record);
    if ($insertSQL != $insertSQL2) {
        echo "<p><b>Walt's new stuff failed</b>: {$insertSQL2}</p>";
    }
    //==========================
    // This code tests an update
    $sql = "\r\nSELECT * \r\nFROM ADOXYZ WHERE lastname=" . $conn->qstr($record['lastname']) . " ORDER BY 1";
    // Select a record to update
    $rs = $conn->Execute($sql);
    // Execute the query and get the existing record to update
    if (!$rs) {
        print "<p><b>No record found!</b></p>";
    }
    $record = array();
    // Initialize an array to hold the record data to update
    // Set the values for the fields in the record
    $record["firstName"] = "Caroline" . rand();
    $record["lasTname"] = "";
    // Update Caroline's lastname from Miranda to Smith
    $record["creAted"] = '2002-12-' . (rand() % 30 + 1);
    $record['num'] = '';
    // Pass the single record recordset and the array containing the data to update
    // into the GetUpdateSQL function. The function will process the data and return
    // a fully formatted update sql statement.
    // If the data has not changed, no recordset is returned
    $updateSQL = $conn->GetUpdateSQL($rs, $record);
    $conn->Execute($updateSQL);
    // Update the record in the database
    if ($conn->Affected_Rows() != 1) {
        print "<p><b>Error</b>: Rows Affected=" . $conn->Affected_Rows() . ", should be 1</p>";
    }
    $record["firstName"] = "Caroline" . rand();
    $record["lasTname"] = "Smithy Jones";
    // Update Caroline's lastname from Miranda to Smith
    $record["creAted"] = '2002-12-' . (rand() % 30 + 1);
    $record['num'] = 331;
    $updateSQL = $conn->GetUpdateSQL($rs, $record);
    $conn->Execute($updateSQL);
    // Update the record in the database
    $rs = $conn->Execute("select * from adoxyz where lastname like 'Smith%'");
    adodb_pr($rs);
    rs2html($rs);
}
开发者ID:Artea,项目名称:freebeer,代码行数:79,代码来源:test4.php

示例10: sizeof

    $DB->debug = 1;
    $DB2->debug = 1;
}
#	$rep->SwapDBs();
$cnt = sizeof($tables);
foreach ($tables as $k => $table) {
    $pkey = '';
    if (!ParseTable($table, $pkey)) {
        continue;
    }
    #######################
    $kcnt = $k + 1;
    echo "<h1>({$kcnt}/{$cnt}) {$table} -- {$pkey}</h1>\n";
    flush();
    @ob_flush();
    CreateTable($rep, $table);
    # COPY DATA
    TableStats($rep, $table, $pkey);
    if ($table == 'JohnTest') {
        MergeDataJohnTest($rep, $table, $pkey);
    } else {
        CopyData($rep, $table, $pkey);
    }
}
if (!empty($TARR)) {
    ksort($TARR);
    adodb_pr($TARR);
    asort($TARR);
    adodb_pr($TARR);
}
echo "<hr>", date('H:i:s'), ": Done</hr>";
开发者ID:fgbreel,项目名称:ADOdb,代码行数:31,代码来源:test-tnb.php


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