ssb Sun Jan 14 17:10:14 2001 EDT
Added files:
/php4/pear/DB/tests/odbc .cvsignore 002.phpt 003.phpt 004.phpt
006.phpt 007.phpt 010.phpt connect.inc
dsn.inc mktable.inc
Modified files:
/php4/pear/DB/tests/odbc 001.phpt skipif.inc
Log:
* defined a bunch of ODBC tests
# unfortunately MyODBC 2.50.36 crashes on me as soon as I do a query
# so these tests need to be run in another environment :-P
Index: php4/pear/DB/tests/odbc/001.phpt
diff -u php4/pear/DB/tests/odbc/001.phpt:1.1 php4/pear/DB/tests/odbc/001.phpt:1.2
--- php4/pear/DB/tests/odbc/001.phpt:1.1 Tue Dec 5 18:53:15 2000
+++ php4/pear/DB/tests/odbc/001.phpt Sun Jan 14 17:10:14 2001
@@ -5,15 +5,7 @@
--FILE--
<?php
require_once "DB.php";
-switch (ODBC_TYPE) {
- case "solid":
- $dsn = "tcp+localhost+1313";
- break;
- default:
- $dsn = "localhost/test";
- break;
-}
-$dbh = DB::connect("odbc://test:test@$dsn");
+require "connect.inc";
if (is_object($dbh)) {
print "\$dbh is an object\n";
}
Index: php4/pear/DB/tests/odbc/skipif.inc
diff -u php4/pear/DB/tests/odbc/skipif.inc:1.1 php4/pear/DB/tests/odbc/skipif.inc:1.2
--- php4/pear/DB/tests/odbc/skipif.inc:1.1 Tue Dec 5 18:53:15 2000
+++ php4/pear/DB/tests/odbc/skipif.inc Sun Jan 14 17:10:14 2001
@@ -5,7 +5,6 @@
// with no username/password, AND
// * we have create/drop privileges on the entire "test"
// database
-die("skip\n");
if (!extension_loaded("odbc")) {
$dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
@dl("odbc$dlext");
@@ -13,16 +12,11 @@
if (!extension_loaded("odbc")) {
die("skip\n");
}
-switch (ODBC_TYPE) {
- case "solid":
- $dsn = "tcp localhost 1313";
- $user = $pass = "test";
- break;
- default:
- die("skip\n");
- break;
+require "dsn.inc";
+if (!$nativedsn) {
+ die("skip\n");
}
-$conn = @odbc_connect($dsn, $user, $pass);
+$conn = @odbc_connect($nativedsn, $user, $pass);
if (!is_resource($conn)) {
die("skip\n");
}
Index: php4/pear/DB/tests/odbc/.cvsignore
+++ php4/pear/DB/tests/odbc/.cvsignore
*.exp
*.out
*.php
phpt.*
Index: php4/pear/DB/tests/odbc/002.phpt
+++ php4/pear/DB/tests/odbc/002.phpt
--TEST--
DB_odbc fetch modes test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
require_once "DB.php";
include("mktable.inc");
include("../fetchmodes.inc");
?>
--EXPECT--
testing fetchrow default default
0 1 2 3
testing fetchinto default default
0 1 2 3
testing fetchrow ordered default
0 1 2 3
testing fetchrow assoc default
a b c d
testing fetchrow ordered default with assoc specified
a b c d
testing fetchrow assoc default with ordered specified
0 1 2 3
testing fetchinto ordered default
0 1 2 3
testing fetchinto assoc default
a b c d
testing fetchinto ordered default with assoc specified
a b c d
testing fetchinto assoc default with ordered specified
0 1 2 3
Index: php4/pear/DB/tests/odbc/003.phpt
+++ php4/pear/DB/tests/odbc/003.phpt
--TEST--
DB_odbc::simpleQuery test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
require_once "DB.php";
include("mktable.inc");
include("../simplequery.inc");
?>
--EXPECT--
resource
Index: php4/pear/DB/tests/odbc/004.phpt
+++ php4/pear/DB/tests/odbc/004.phpt
--TEST--
DB_odbc::numCols test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
require_once "DB.php";
include("mktable.inc");
include("../numcols.inc");
?>
--EXPECT--
1
2
3
4
Index: php4/pear/DB/tests/odbc/006.phpt
+++ php4/pear/DB/tests/odbc/006.phpt
--TEST--
DB_odbc::prepare/execute test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
require_once "DB.php";
include("mktable.inc");
include("../prepexe.inc");
?>
--EXPECT--
sth1,sth2,sth3 created
sth1 executed
sth2 executed
sth3 executed
results:
72 - - -
72 - bing - -
72 - gazonk - opaque
placeholder
test -
Index: php4/pear/DB/tests/odbc/007.phpt
+++ php4/pear/DB/tests/odbc/007.phpt
--TEST--
DB_odbc::errorNative test
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
require_once "DB.php";
include("mktable.inc");
$dbh->query("syntax error please");
print "error code " . $dbh->errorNative() . "\n";
?>
--EXPECT--
error code 1064
Index: php4/pear/DB/tests/odbc/010.phpt
+++ php4/pear/DB/tests/odbc/010.phpt
--TEST--
DB_mysql error mapping
--SKIPIF--
<?php require "skipif.inc"; ?>
--FILE--
<?php
require "connect.inc";
require "mktable.inc";
require "../errors.inc";
?>
--EXPECT--
Trying to provoke DB_ERROR_NOSUCHTABLE
DB Error: no such table
Trying to provoke DB_ERROR_ALREADY_EXISTS
DB Error: already exists
Trying to provoke DB_ERROR_NOSUCHTABLE
DB Error: no such table
Trying to provoke DB_ERROR_CONSTRAINT
Trying to provoke DB_ERROR_DIVZERO
Trying to provoke DB_ERROR_INVALID_NUMBER
Trying to provoke DB_ERROR_NOSUCHFIELD
DB Error: no such field
Trying to provoke DB_ERROR_SYNTAX
DB Error: syntax error
Index: php4/pear/DB/tests/odbc/connect.inc
+++ php4/pear/DB/tests/odbc/connect.inc
<?php
require_once "DB.php";
require "dsn.inc";
if (!$dsn) {
die("tests not configure for this environment");
}
$dbh = DB::connect($dsn);
if (DB::isError($dbh)) {
die("connect.inc: ".$dbh->getMessage());
}
?>
Index: php4/pear/DB/tests/odbc/dsn.inc
+++ php4/pear/DB/tests/odbc/dsn.inc
<?php
switch (ODBC_TYPE) {
case "solid":
$nativedsn = "tcp localhost 1313";
$dsn = "odbc://tcp+localhost+1313";
$user = $pass = "test";
break;
case "iodbc":
$nativedsn = "test";
$dsn = "odbc://test";
$user = $pass = "";
break;
default:
$nativedsn = $dsn = $user = $pass = "";
break;
}
?>
Index: php4/pear/DB/tests/odbc/mktable.inc
+++ php4/pear/DB/tests/odbc/mktable.inc
<?php
require "connect.inc";
$dbh->setErrorHandling(PEAR_ERROR_RETURN);
$dbh->query("DROP TABLE phptest");
$dbh->setErrorHandling(PEAR_ERROR_TRIGGER);
$dbh->query("CREATE TABLE phptest (a INTEGER, b VARCHAR(40), c TEXT, d DATE)");
$dbh->query("INSERT INTO phptest VALUES(42, 'bing', 'This is a test', '1999-11-21')");
$dbh->setErrorHandling(PEAR_ERROR_RETURN);
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]