address review comments
This commit is contained in:
parent
529c5aa77b
commit
0c74a27186
|
@ -18,7 +18,7 @@ try {
|
||||||
if (stristr($info, "PDO support => enabled") === false) {
|
if (stristr($info, "PDO support => enabled") === false) {
|
||||||
printf("PDO is not enabled\n");
|
printf("PDO is not enabled\n");
|
||||||
} elseif (stristr($info, "pdo_sqlsrv support => enabled") === false) {
|
} elseif (stristr($info, "pdo_sqlsrv support => enabled") === false) {
|
||||||
printf("Cannot find PDO driver line in phpinfo() output\n");
|
printf("Cannot find PDO_SQLSRV driver in phpinfo() output\n");
|
||||||
} else {
|
} else {
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ PHPT_EXEC=true
|
||||||
require_once("MsCommon_mid-refactor.inc");
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
try {
|
try {
|
||||||
$conn1 = connect();
|
$conn1 = connect();
|
||||||
checkError(1, $conn1, '00000');
|
checkError(1, $conn1);
|
||||||
|
|
||||||
// Prepare test table
|
// Prepare test table
|
||||||
$table1 = "Table1";
|
$table1 = "Table1";
|
||||||
|
@ -37,10 +37,11 @@ try {
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkError($offset, &$obj, $expected = '00000')
|
function checkError($offset, &$obj)
|
||||||
{
|
{
|
||||||
$code = $obj->errorCode();
|
$code = $obj->errorCode();
|
||||||
if (($code != $expected) && (($expected != '00000') || ($code !=''))) {
|
$expected = '00000';
|
||||||
|
if ($code != $expected && !empty($code)) {
|
||||||
printf("[%03d] Expecting error code '%s' got code '%s'\n", $offset, $expected, $code);
|
printf("[%03d] Expecting error code '%s' got code '%s'\n", $offset, $expected, $code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ try {
|
||||||
$stmt1->closeCursor();
|
$stmt1->closeCursor();
|
||||||
|
|
||||||
dropTable($conn1, $table1);
|
dropTable($conn1, $table1);
|
||||||
$stmt1->execute();
|
@$stmt1->execute();
|
||||||
checkError(5, $conn1);
|
checkError(5, $conn1);
|
||||||
checkError(6, $stmt1, '42S02');
|
checkError(6, $stmt1, '42S02');
|
||||||
checkError(7, $stmt2, '42S02');
|
checkError(7, $stmt2, '42S02');
|
||||||
|
@ -76,7 +76,7 @@ function checkError($offset, &$obj, $expected = '00000')
|
||||||
printf("[%03d] Driver-specific error code not set\n", $offset);
|
printf("[%03d] Driver-specific error code not set\n", $offset);
|
||||||
}
|
}
|
||||||
if (!isset($info[2]) || ($info[2] == '')) {
|
if (!isset($info[2]) || ($info[2] == '')) {
|
||||||
printf("[%03d] Driver-specific error message.not set\n", $offset);
|
printf("[%03d] Driver-specific error message not set\n", $offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,38 +14,39 @@ $tableName2 = "test_connres2";
|
||||||
// from AppVeyor does not have AdventureWorks.
|
// from AppVeyor does not have AdventureWorks.
|
||||||
function generateTables($server, $uid, $pwd, $dbName, $tableName1, $tableName2)
|
function generateTables($server, $uid, $pwd, $dbName, $tableName1, $tableName2)
|
||||||
{
|
{
|
||||||
$conn = new PDO("sqlsrv:server = $server ; Database = $dbName ;", $uid, $pwd);
|
try {
|
||||||
if ($conn === false) {
|
$conn = new PDO("sqlsrv:server = $server ; Database = $dbName ;", $uid, $pwd);
|
||||||
die(print_r(sqlsrv_errors()));
|
|
||||||
|
// Create table
|
||||||
|
$sql = "CREATE TABLE $tableName1 (c1 INT, c2 VARCHAR(40))";
|
||||||
|
$stmt = $conn->query($sql);
|
||||||
|
|
||||||
|
// Insert data
|
||||||
|
$sql = "INSERT INTO $tableName1 VALUES ( ?, ? )";
|
||||||
|
for ($t = 100; $t < 116; $t++) {
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
$ts = substr(sha1($t), 0, 5);
|
||||||
|
$params = array( $t,$ts );
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create table
|
||||||
|
$sql = "CREATE TABLE $tableName2 ( c1 INT, c2 VARCHAR(40) )";
|
||||||
|
$stmt = $conn->query($sql);
|
||||||
|
|
||||||
|
// Insert data
|
||||||
|
$sql = "INSERT INTO $tableName2 VALUES ( ?, ? )";
|
||||||
|
for ($t = 200; $t < 209; $t++) {
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
$ts = substr(sha1($t), 0, 5);
|
||||||
|
$params = array( $t,$ts );
|
||||||
|
$stmt->execute($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($conn);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
var_dump($e->errorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create table
|
|
||||||
$sql = "CREATE TABLE $tableName1 ( c1 INT, c2 VARCHAR(40) )";
|
|
||||||
$stmt = $conn->query($sql);
|
|
||||||
|
|
||||||
// Insert data
|
|
||||||
$sql = "INSERT INTO $tableName1 VALUES ( ?, ? )";
|
|
||||||
for ($t = 100; $t < 116; $t++) {
|
|
||||||
$stmt = $conn->prepare($sql);
|
|
||||||
$ts = substr(sha1($t), 0, 5);
|
|
||||||
$params = array( $t,$ts );
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create table
|
|
||||||
$sql = "CREATE TABLE $tableName2 ( c1 INT, c2 VARCHAR(40) )";
|
|
||||||
$stmt = $conn->query($sql);
|
|
||||||
|
|
||||||
// Insert data
|
|
||||||
$sql = "INSERT INTO $tableName2 VALUES ( ?, ? )";
|
|
||||||
for ($t = 200; $t < 209; $t++) {
|
|
||||||
$stmt = $conn->prepare($sql);
|
|
||||||
$ts = substr(sha1($t), 0, 5);
|
|
||||||
$params = array( $t,$ts );
|
|
||||||
$stmt->execute($params);
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Break connection by getting the session ID and killing it.
|
// Break connection by getting the session ID and killing it.
|
||||||
|
|
|
@ -31,6 +31,8 @@ $conn_break = connect();
|
||||||
$connectionInfo = "ConnectRetryCount = 10; ConnectRetryInterval = 10;";
|
$connectionInfo = "ConnectRetryCount = 10; ConnectRetryInterval = 10;";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// TODO: Idle connection resiliency does not work with Column Encryption at this point
|
||||||
|
// Do not connect with ColumnEncryption for now
|
||||||
$conn = connect($connectionInfo, array(), PDO::ERRMODE_EXCEPTION, true);
|
$conn = connect($connectionInfo, array(), PDO::ERRMODE_EXCEPTION, true);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
echo "Could not connect.\n";
|
echo "Could not connect.\n";
|
||||||
|
|
|
@ -12,7 +12,7 @@ try {
|
||||||
$tbname = "PDO_MainTypes";
|
$tbname = "PDO_MainTypes";
|
||||||
createTableMainTypes($db, $tbname);
|
createTableMainTypes($db, $tbname);
|
||||||
// query with a wrong column name.
|
// query with a wrong column name.
|
||||||
$db->query("Select * from " . $tbname . " where IntColX = 1");
|
$db->query("SELECT * FROM $tbname WHERE IntColX = 1");
|
||||||
|
|
||||||
dropTable($db, $tbname);
|
dropTable($db, $tbname);
|
||||||
unset($conn);
|
unset($conn);
|
||||||
|
|
Loading…
Reference in a new issue