File: pdo.php

package info (click to toggle)
ipplan 4.92a-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,256 kB
  • ctags: 11,121
  • sloc: php: 44,277; sh: 387; perl: 257; xml: 97; makefile: 57; sql: 32
file content (42 lines) | stat: -rw-r--r-- 936 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
error_reporting(E_ALL);
include('../adodb.inc.php');



echo "New Connection\n";
$DB = NewADOConnection('pdo');
echo "Connect\n";
$pdo_connection_string = 'odbc:nwind';
$DB->Connect($pdo_connection_string,'','') || die("CONNECT FAILED");
echo "Execute\n";



//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$rs = $DB->Execute("select * from products where productid<3");
echo "e=".$DB->ErrorNo() . " ".($DB->ErrorMsg())."\n";


//print_r(get_class_methods($DB->_stmt));

if (!$rs) die("NO RS");
echo "FETCH\n";
$cnt = 0;
while (!$rs->EOF) {
	print_r($rs->fields);
	$rs->MoveNext();
	if ($cnt++ > 1000) break;
}

echo "<br>--------------------------------------------------------<br>\n\n\n";

$stmt = $DB->PrepareStmt("select * from products");
$rs = $stmt->Execute();
echo "e=".$stmt->ErrorNo() . " ".($stmt->ErrorMsg())."\n";
while ($arr = $rs->FetchRow()) {
	print_r($arr);
}
die("DONE\n");

?>