fix indentations and comments

This commit is contained in:
v-kaywon 2017-04-12 12:25:40 -07:00
parent caec680535
commit 6f84d3642d
2 changed files with 12 additions and 16 deletions

View file

@ -8,17 +8,17 @@ require_once("autonomous_setup.php");
try
{
$conn = new PDO( "sqlsrv:Server=$serverName; Database = tempdb ", $username, $password);
$conn = new PDO( "sqlsrv:Server=$serverName; Database = tempdb ", $username, $password);
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$conn->exec("IF OBJECT_ID('temptb', 'U') IS NOT NULL DROP TABLE temptb");
$conn->exec("CREATE TABLE temptb(IntCol INT, CharCol NVARCHAR(20)) ");
$conn->exec("INSERT INTO temptb (IntCol, CharCol) VALUES (10, 'ten')");
$conn->exec("IF OBJECT_ID('table1', 'U') IS NOT NULL DROP TABLE table1");
$conn->exec("CREATE TABLE table1(IntCol INT, CharCol NVARCHAR(20)) ");
$conn->exec("INSERT INTO table1 (IntCol, CharCol) VALUES (10, 'ten')");
$stmt = $conn->prepare("SELECT IntCol FROM temptb");
$stmt->execute();
$stmt = $conn->prepare("SELECT IntCol FROM table1");
$stmt->execute();
// PARAM_NULL returns null
$stmt->bindColumn('IntCol', $intCol, PDO::PARAM_NULL);
$stmt->bindColumn('IntCol', $intCol, PDO::PARAM_NULL);
$row = $stmt->fetch(PDO::FETCH_BOUND);
if ($intCol == NULL) {
echo "intCol is NULL\n";
@ -26,18 +26,18 @@ try
echo "intCol should have been NULL\n";
}
$stmt = $conn->prepare("SELECT CharCol FROM temptb");
$stmt->execute();
$stmt = $conn->prepare("SELECT CharCol FROM table1");
$stmt->execute();
// PARAM_STMT is not support and should throw an exception
$stmt->bindColumn('CharCol', $charCol, PDO::PARAM_STMT);
// PARAM_STMT is not supported and should throw an exception
$stmt->bindColumn('CharCol', $charCol, PDO::PARAM_STMT);
$row = $stmt->fetch(PDO::FETCH_BOUND);
echo "PARAM_STMT should have thrown an exception\n";
}
catch (PDOException $e)
{
print_r($e->errorInfo[2]);
print_r($e->errorInfo[2]);
echo "\n";
}

View file

@ -116,10 +116,6 @@ require_once("autonomous_setup.php");
echo "Test6 - Set stmt option: SQLSRV_ATTR_ENCODING \n";
set_stmt_option($conn, array(PDO::SQLSRV_ATTR_ENCODING => 3));
$attr = "PDO::ATTR_CURSOR";
$stmt = set_stmt_attr($conn, $attr, 1);
get_stmt_attr($stmt, $attr);
$attr = "PDO::SQLSRV_ATTR_QUERY_TIMEOUT";
$stmt = set_stmt_attr($conn, $attr, 45);
get_stmt_attr($stmt, $attr);