[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 --TEST-- 2 DB_driver::connect 3 --INI-- 4 error_reporting = 2047 5 --SKIPIF-- 6 <?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?> 7 --FILE-- 8 <?php 9 require_once './connect.inc'; 10 11 if (is_object($dbh)) { 12 print "\$dbh is an object\n"; 13 } 14 switch ($dbh->phptype) { 15 case 'mysqli': 16 if (is_a($dbh->connection, 'mysqli')) { 17 print "\$dbh is connected\n"; 18 } else { 19 print "\$dbh NOT connected\n"; 20 } 21 break; 22 default: 23 if (gettype($dbh->connection) == 'resource') { 24 print "\$dbh is connected\n"; 25 } else { 26 print "\$dbh NOT connected\n"; 27 } 28 } 29 30 31 $test_array_dsn = DB::parseDSN(DRIVER_DSN); 32 33 foreach ($test_array_dsn as $key => $value) { 34 if ($value === false) { 35 unset($test_array_dsn[$key]); 36 } 37 } 38 39 $dbha =& DB::connect($test_array_dsn, $options); 40 if (DB::isError($dbha)) { 41 die("connect.inc: ".$dbha->toString()); 42 } 43 if (is_object($dbha)) { 44 print "\$dbha is an object\n"; 45 } 46 switch ($dbh->phptype) { 47 case 'mysqli': 48 if (is_a($dbha->connection, 'mysqli')) { 49 print "\$dbha is connected\n"; 50 } else { 51 print "\$dbha NOT connected\n"; 52 } 53 break; 54 default: 55 if (gettype($dbha->connection) == 'resource') { 56 print "\$dbha is connected\n"; 57 } else { 58 print "\$dbha NOT connected\n"; 59 } 60 } 61 62 ?> 63 --EXPECT-- 64 $dbh is an object 65 $dbh is connected 66 $dbha is an object 67 $dbha is connected
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |