Permalink
Browse files

Merged from MOODLE_15_STABLE: Fix for Secunia Advisory SA18267 and te…

…st file cleanup
  • Loading branch information...
martinlanghoff
martinlanghoff committed Jan 3, 2006
1 parent 11d6d23 commit ff8ed9e11863df18a2ca571195e8c9b0e660a9bf
@@ -1,84 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <title>ADODB Benchmarks</title>
-</head>
-
-<body>
-<?php
-/*
-V4.51 29 July 2004 (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.
- Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
-
- Benchmark code to test the speed to the ADODB library with different databases.
- This is a simplistic benchmark to be used as the basis for further testing.
- It should not be used as proof of the superiority of one database over the other.
-*/
-
-$testmssql = true;
-//$testvfp = true;
-$testoracle = true;
-$testado = true;
-$testibase = true;
-$testaccess = true;
-$testmysql = true;
-$testsqlite = true;;
-
-set_time_limit(240); // increase timeout
-
-include("../tohtml.inc.php");
-include("../adodb.inc.php");
-
-function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
-{
-GLOBAL $ADODB_version,$ADODB_FETCH_MODE;
-
- adodb_backtrace();
-
- $max = 100;
- $sql = 'select * from ADOXYZ';
- $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-
- //print "<h3>ADODB Version: $ADODB_version Host: <i>$db->host</i> &nbsp; Database: <i>$db->database</i></h3>";
-
- // perform query once to cache results so we are only testing throughput
- $rs = $db->Execute($sql);
- if (!$rs){
- print "Error in recordset<p>";
- return;
- }
- $arr = $rs->GetArray();
- //$db->debug = true;
- global $ADODB_COUNTRECS;
- $ADODB_COUNTRECS = false;
- $start = microtime();
- for ($i=0; $i < $max; $i++) {
- $rs =& $db->Execute($sql);
- $arr =& $rs->GetArray();
- // print $arr[0][1];
- }
- $end = microtime();
- $start = explode(' ',$start);
- $end = explode(' ',$end);
-
- //print_r($start);
- //print_r($end);
-
- // print_r($arr);
- $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]);
- printf ("<p>seconds = %8.2f for %d iterations each with %d records</p>",$total,$max, sizeof($arr));
- flush();
-
-
- //$db->Close();
-}
-include("testdatabases.inc.php");
-
-?>
-
-
-</body>
-</html>
View
@@ -1,194 +0,0 @@
-<html>
-<body bgcolor=white>
-<?php
-/**
- * V4.50 6 July 2004 (c) 2001-2002 John Lim (jlim@natsoft.com.my). All rights reserved.
- * Released under both BSD license and Lesser GPL library license.
- Whenever there is any discrepancy between the two licenses,
- the BSD license will take precedence.
- *
- * set tabs to 8
- */
-
- // documentation on usage is at http://php.weblogs.com/adodb_csv
-
-include('../adodb.inc.php');
-include('../tohtml.inc.php');
-
- function &send2server($url,$sql)
- {
- $url .= '?sql='.urlencode($sql);
- print "<p>$url</p>";
- $rs = csv2rs($url,$err);
- if ($err) print $err;
- return $rs;
- }
-
- function print_pre($s)
- {
- print "<pre>";print_r($s);print "</pre>";
- }
-
-
-$serverURL = 'http://localhost/php/phplens/adodb/server.php';
-$testhttp = false;
-
-$sql1 = "insertz into products (productname) values ('testprod 1')";
-$sql2 = "insert into products (productname) values ('testprod 1')";
-$sql3 = "insert into products (productname) values ('testprod 2')";
-$sql4 = "delete from products where productid>80";
-$sql5 = 'select * from products';
-
-if ($testhttp) {
- print "<a href=#c>Client Driver Tests</a><p>";
- print "<h3>Test Error</h3>";
- $rs = send2server($serverURL,$sql1);
- print_pre($rs);
- print "<hr>";
-
- print "<h3>Test Insert</h3>";
-
- $rs = send2server($serverURL,$sql2);
- print_pre($rs);
- print "<hr>";
-
- print "<h3>Test Insert2</h3>";
-
- $rs = send2server($serverURL,$sql3);
- print_pre($rs);
- print "<hr>";
-
- print "<h3>Test Delete</h3>";
-
- $rs = send2server($serverURL,$sql4);
- print_pre($rs);
- print "<hr>";
-
-
- print "<h3>Test Select</h3>";
- $rs = send2server($serverURL,$sql5);
- if ($rs) rs2html($rs);
-
- print "<hr>";
-}
-
-
-print "<a name=c><h1>CLIENT Driver Tests</h1>";
-$conn = ADONewConnection('csv');
-$conn->Connect($serverURL);
-$conn->debug = true;
-
-print "<h3>Bad SQL</h3>";
-
-$rs = $conn->Execute($sql1);
-
-print "<h3>Insert SQL 1</h3>";
-$rs = $conn->Execute($sql2);
-
-print "<h3>Insert SQL 2</h3>";
-$rs = $conn->Execute($sql3);
-
-print "<h3>Select SQL</h3>";
-$rs = $conn->Execute($sql5);
-if ($rs) rs2html($rs);
-
-print "<h3>Delete SQL</h3>";
-$rs = $conn->Execute($sql4);
-
-print "<h3>Select SQL</h3>";
-$rs = $conn->Execute($sql5);
-if ($rs) rs2html($rs);
-
-
-/* EXPECTED RESULTS FOR HTTP TEST:
-
-Test Insert
-http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
-
-adorecordset Object
-(
- [dataProvider] => native
- [fields] =>
- [blobSize] => 64
- [canSeek] =>
- [EOF] => 1
- [emptyTimeStamp] =>
- [emptyDate] =>
- [debug] =>
- [timeToLive] => 0
- [bind] =>
- [_numOfRows] => -1
- [_numOfFields] => 0
- [_queryID] => 1
- [_currentRow] => -1
- [_closed] =>
- [_inited] =>
- [sql] => insert into products (productname) values ('testprod')
- [affectedrows] => 1
- [insertid] => 81
-)
-
-
---------------------------------------------------------------------------------
-
-Test Insert2
-http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29
-
-adorecordset Object
-(
- [dataProvider] => native
- [fields] =>
- [blobSize] => 64
- [canSeek] =>
- [EOF] => 1
- [emptyTimeStamp] =>
- [emptyDate] =>
- [debug] =>
- [timeToLive] => 0
- [bind] =>
- [_numOfRows] => -1
- [_numOfFields] => 0
- [_queryID] => 1
- [_currentRow] => -1
- [_closed] =>
- [_inited] =>
- [sql] => insert into products (productname) values ('testprod')
- [affectedrows] => 1
- [insertid] => 82
-)
-
-
---------------------------------------------------------------------------------
-
-Test Delete
-http://localhost/php/adodb/server.php?sql=delete+from+products+where+productid%3E80
-
-adorecordset Object
-(
- [dataProvider] => native
- [fields] =>
- [blobSize] => 64
- [canSeek] =>
- [EOF] => 1
- [emptyTimeStamp] =>
- [emptyDate] =>
- [debug] =>
- [timeToLive] => 0
- [bind] =>
- [_numOfRows] => -1
- [_numOfFields] => 0
- [_queryID] => 1
- [_currentRow] => -1
- [_closed] =>
- [_inited] =>
- [sql] => delete from products where productid>80
- [affectedrows] => 2
- [insertid] => 0
-)
-
-[more stuff deleted]
- .
- .
- .
-*/
-?>
View
@@ -1,42 +0,0 @@
-<?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");
-
-?>
Oops, something went wrong.

0 comments on commit ff8ed9e

Please sign in to comment.