mergerd pdo_construct_dsn_format_incorrect and pdo_construct_no_server and renamed to pdo_construct_dsn_error
This commit is contained in:
parent
910e337a16
commit
9d136d541e
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
Test PDO::__Construct by passing connection options
|
||||
Test PDO::__Construct by passing different connection attributes
|
||||
--SKIPIF--
|
||||
|
||||
--FILE--
|
||||
|
@ -18,7 +18,7 @@ try
|
|||
PDO::SQLSRV_ATTR_DIRECT_QUERY => true,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
||||
PDO::SQLSRV_ATTR_CLIENT_BUFFER_MAX_KB_SIZE => -1,
|
||||
PDO::SQLSRV_ATTR_CLIENT_BUFFER_MAX_KB_SIZE => 10240,
|
||||
PDO::SQLSRV_ATTR_DIRECT_QUERY => true
|
||||
);
|
||||
|
||||
|
@ -30,6 +30,9 @@ try
|
|||
$stmt = $conn->prepare("SELECT 1");
|
||||
$stmt->execute();
|
||||
|
||||
// fetch result, which should be stringified since ATTR_STRINGIFY_FETCHES is on
|
||||
var_dump(($stmt->fetch(PDO::FETCH_ASSOC)));
|
||||
|
||||
$stmt = NULL;
|
||||
$conn = NULL;
|
||||
|
||||
|
@ -44,4 +47,8 @@ catch( PDOException $e ) {
|
|||
|
||||
--EXPECT--
|
||||
|
||||
array(1) {
|
||||
[""]=>
|
||||
string(1) "1"
|
||||
}
|
||||
Test Successful
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
Test PDO::__Construct without specifying the Server
|
||||
Test PDO::__Construct with incorrectly formatted DSN or no Server specified in DSN
|
||||
--SKIPIF--
|
||||
|
||||
--FILE--
|
||||
|
@ -9,7 +9,6 @@ require_once("autonomous_setup.php");
|
|||
|
||||
/*----------Connection option cases that raises errors----------*/
|
||||
//dsn with 2 consecutive semicolons
|
||||
|
||||
try
|
||||
{
|
||||
$conn = new PDO( "sqlsrv:Server = $serverName;;", $username, $password );
|
||||
|
@ -69,6 +68,16 @@ catch( PDOException $e ) {
|
|||
print_r( ($e->errorInfo)[2] );
|
||||
echo "\n";
|
||||
}
|
||||
// Try to connect with no server specified
|
||||
try
|
||||
{
|
||||
$database = "tempdb";
|
||||
@$conn = new PDO( "sqlsrv:Database = $database", $username, $password );
|
||||
}
|
||||
catch( PDOException $e ) {
|
||||
print_r( ($e->errorInfo)[2] );
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
/*----------Connection option cases that is OK----------*/
|
||||
|
@ -106,6 +115,7 @@ An expected right brace \(\}\) was not found in the DSN string for the value of
|
|||
An invalid value was specified for the keyword 'Database' in the DSN string\.
|
||||
The DSN string ended unexpectedly\.
|
||||
An invalid DSN string was specified\.
|
||||
Server keyword was not specified in the DSN string\.
|
||||
|
||||
value in curly braces OK
|
||||
value in curly braces followed by a semicolon OK
|
|
@ -1,22 +0,0 @@
|
|||
--TEST--
|
||||
Test PDO::__Construct without specifying the Server
|
||||
--SKIPIF--
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
require_once("autonomous_setup.php");
|
||||
try
|
||||
{
|
||||
$database = "tempdb";
|
||||
// Try to connect with no server specific
|
||||
@$conn = new PDO( "sqlsrv:Database = $database", $username, $password );
|
||||
}
|
||||
catch( PDOException $e ) {
|
||||
print_r( ($e->errorInfo)[2] );
|
||||
}
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
|
||||
Server keyword was not specified in the DSN string.
|
Loading…
Reference in a new issue