fixed connection resiliency tests
This commit is contained in:
parent
e535e85d1f
commit
44dbd78c92
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
require_once("MsSetup.inc");
|
||||
|
||||
// Using the tempdb database for two tables specifically constructed
|
||||
// Using the test database for two tables specifically constructed
|
||||
// for the connection resiliency tests
|
||||
$dbName = "tempdb";
|
||||
$dbName = $databaseName;
|
||||
|
||||
$tableName1 = "test_connres1";
|
||||
$tableName2 = "test_connres2";
|
||||
|
@ -65,18 +65,18 @@ function BreakConnection( $conn, $conn_break )
|
|||
}
|
||||
|
||||
// Remove any databases previously created by GenerateDatabase
|
||||
function DropTables( $server, $uid, $pwd, $tableName1, $tableName2 )
|
||||
function DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 )
|
||||
{
|
||||
$conn = new PDO( "sqlsrv:server = $server ; ", $uid, $pwd );
|
||||
$conn = new PDO( "sqlsrv:server = $server ; Database = $dbName ;", $uid, $pwd );
|
||||
|
||||
$query="IF OBJECT_ID('tempdb.dbo.$tableName1', 'U') IS NOT NULL DROP TABLE tempdb.dbo.$tableName1";
|
||||
$query="IF OBJECT_ID('$tableName1', 'U') IS NOT NULL DROP TABLE $tableName1";
|
||||
$stmt=$conn->query( $query );
|
||||
|
||||
$query="IF OBJECT_ID('tempdb.dbo.$tableName2', 'U') IS NOT NULL DROP TABLE tempdb.dbo.$tableName2";
|
||||
$query="IF OBJECT_ID('$tableName2', 'U') IS NOT NULL DROP TABLE $tableName2";
|
||||
$stmt=$conn->query( $query );
|
||||
}
|
||||
|
||||
DropTables( $server, $uid, $pwd, $tableName1, $tableName2 );
|
||||
DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 );
|
||||
GenerateTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 );
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
require_once("MsSetup.inc");
|
||||
|
||||
// Using the tempdb database for two tables specifically constructed
|
||||
// Using the test database for two tables specifically constructed
|
||||
// for the connection resiliency tests
|
||||
$dbName = "tempdb";
|
||||
$dbName = $databaseName;
|
||||
|
||||
$tableName1 = "test_connres1";
|
||||
$tableName2 = "test_connres2";
|
||||
|
@ -70,19 +70,19 @@ function BreakConnection( $conn, $conn_break )
|
|||
}
|
||||
|
||||
// Remove the tables generated by GenerateTables
|
||||
function DropTables( $server, $uid, $pwd, $tableName1, $tableName2 )
|
||||
function DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 )
|
||||
{
|
||||
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd );
|
||||
$connectionInfo = array( "Database"=>$dbName, "UID"=>$uid, "PWD"=>$pwd );
|
||||
$conn = sqlsrv_connect( $server, $connectionInfo );
|
||||
|
||||
$query="IF OBJECT_ID('tempdb.dbo.$tableName1', 'U') IS NOT NULL DROP TABLE tempdb.dbo.$tableName1";
|
||||
$query="IF OBJECT_ID('$tableName1', 'U') IS NOT NULL DROP TABLE $tableName1";
|
||||
$stmt=sqlsrv_query( $conn, $query );
|
||||
|
||||
$query="IF OBJECT_ID('tempdb.dbo.$tableName2', 'U') IS NOT NULL DROP TABLE tempdb.dbo.$tableName2";
|
||||
$query="IF OBJECT_ID('$tableName2', 'U') IS NOT NULL DROP TABLE $tableName2";
|
||||
$stmt=sqlsrv_query( $conn, $query );
|
||||
}
|
||||
|
||||
DropTables( $server, $uid, $pwd, $tableName1, $tableName2 );
|
||||
DropTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 );
|
||||
GenerateTables( $server, $uid, $pwd, $dbName, $tableName1, $tableName2 );
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue