PageRenderTime 52ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/rdfapi-php/api/util/adodb/tests/pdo.php

https://github.com/komagata/plnet
PHP | 42 lines | 28 code | 12 blank | 2 comment | 5 complexity | 9e4c3a2ea72980d126c52dd0e2319e48 MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. error_reporting(E_ALL);
  3. include('../adodb.inc.php');
  4. echo "New Connection\n";
  5. $DB = NewADOConnection('pdo');
  6. echo "Connect\n";
  7. $pdo_connection_string = 'odbc:nwind';
  8. $DB->Connect($pdo_connection_string,'','') || die("CONNECT FAILED");
  9. echo "Execute\n";
  10. //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
  11. $rs = $DB->Execute("select * from products where productid<3");
  12. echo "e=".$DB->ErrorNo() . " ".($DB->ErrorMsg())."\n";
  13. //print_r(get_class_methods($DB->_stmt));
  14. if (!$rs) die("NO RS");
  15. echo "FETCH\n";
  16. $cnt = 0;
  17. while (!$rs->EOF) {
  18. print_r($rs->fields);
  19. $rs->MoveNext();
  20. if ($cnt++ > 1000) break;
  21. }
  22. echo "<br>--------------------------------------------------------<br>\n\n\n";
  23. $stmt = $DB->PrepareStmt("select * from products");
  24. $rs = $stmt->Execute();
  25. echo "e=".$stmt->ErrorNo() . " ".($stmt->ErrorMsg())."\n";
  26. while ($arr = $rs->FetchRow()) {
  27. print_r($arr);
  28. }
  29. die("DONE\n");
  30. ?>