cvs: pear /DB/tests/sqlite connect.inc mktable.inc setup.inc skipif.inc

From: Date: Mon, 23 Jun 2003 20:41:22 +0000
Subject: cvs: pear /DB/tests/sqlite connect.inc mktable.inc setup.inc skipif.inc
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-11142@lists.php.net to get a copy of this message
urs Mon Jun 23 16:41:22 2003 EDT Added files: /pear/DB/tests/sqlite connect.inc mktable.inc setup.inc skipif.inc Log: * initial commit Index: pear/DB/tests/sqlite/connect.inc +++ pear/DB/tests/sqlite/connect.inc <?php require './setup.inc'; error_reporting(E_ALL); require_once "DB.php"; $dbh = DB::connect(DRIVER_DSN, array('optimize' => 'portability')); if (DB::isError($dbh)) { die("connect.inc: ".$dbh->toString()); } function debug_die($o){ die($o->toString()); } $table = "phptest_" . md5(uniqid(rand())); $table = substr($table, 0, 15); $table = "phptest"; ?> Index: pear/DB/tests/sqlite/mktable.inc +++ pear/DB/tests/sqlite/mktable.inc <?php require_once "./connect.inc"; //$dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'debug_die'); $test_mktable_query = "CREATE TABLE $table (a INTEGER, b VARCHAR(40), c VARCHAR(255), d VARCHAR(20));"; $dbh->query($test_mktable_query); $dbh->query("INSERT INTO $table VALUES(42, 'bing', 'This is a test', '1999-11-21');"); $dbh->setErrorHandling(PEAR_ERROR_RETURN); ?> Index: pear/DB/tests/sqlite/setup.inc +++ pear/DB/tests/sqlite/setup.inc <?php define('SEPARATOR', (stristr(PHP_OS, "WIN") ? ';.;' : ':.:' ) ); ini_set('include_path', realpath(dirname(__FILE__) . "/../..") . SEPARATOR . ini_get('include_path')); define('DRIVER_DSN', 'sqlite://dummy:@localhost/' . getcwd() . DIRECTORY_SEPARATOR . 'test.db' ); //define('DRIVER_DSN', 'pgsql://postgres@localhost/test'); //define('DRIVER_DSN', 'mysql://root@localhost/test'); //define('DRIVER_DSN', 'oci8://system:manager@'); //define('DRIVER_DSN', 'ibase(firebird)://SYSDBA:masterkey@//opt/interbase/examples/employee.gdb?dialect=3'); //define('DRIVER_DSN', 'mssql://sa@somehost/pubs'); ?> Index: pear/DB/tests/sqlite/skipif.inc +++ pear/DB/tests/sqlite/skipif.inc <?php // This script prints "skip" unless: // * the mysql extension is built-in or loadable, AND // * there is a database called "test" accessible // with no username/password, AND // * we have create/drop privileges on the entire "test" // database include './setup.inc'; require_once 'DB.php'; if (!defined('DRIVER_DSN') || DRIVER_DSN == '') { die("skip\n"); } $db = DB::connect(DRIVER_DSN); if (DB::isError($db)) { die("skip\n"); } ?>

« previous php.pear.cvs (#11142) next »