-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pdo_oci: Add client identifier and module attrs
Add tests for the new attributes, and check the setAttribute return value.
- Loading branch information
Showing
8 changed files
with
206 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--TEST-- | ||
PDO_OCI: Attribute: Setting session client identifier | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded'); | ||
require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc'); | ||
PDOTest::skip(); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc'); | ||
|
||
$query = 'select client_identifier from v$session where sid = sys_context(\'USERENV\', \'SID\')'; | ||
|
||
$dbh = PDOTest::factory(); | ||
|
||
$stmt = $dbh->query($query); | ||
$row = $stmt->fetch(); | ||
echo 'CLIENT_IDENTIFIER NOT SET: '; | ||
var_dump($row['client_identifier']); | ||
|
||
var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_IDENTIFIER, "some client identifier")); | ||
|
||
$stmt = $dbh->query($query); | ||
$row = $stmt->fetch(); | ||
echo 'CLIENT_IDENTIFIER SET: '; | ||
var_dump($row['client_identifier']); | ||
|
||
var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_IDENTIFIER, "something else!")); | ||
|
||
$stmt = $dbh->query($query); | ||
$row = $stmt->fetch(); | ||
echo 'CLIENT_IDENTIFIER RESET: '; | ||
var_dump($row['client_identifier']); | ||
|
||
var_dump($dbh->setAttribute(PDO::OCI_ATTR_CLIENT_IDENTIFIER, null)); | ||
|
||
$stmt = $dbh->query($query); | ||
$row = $stmt->fetch(); | ||
echo 'CLIENT_IDENTIFIER NULLED: '; | ||
var_dump($row['client_identifier']); | ||
|
||
echo "Done\n"; | ||
|
||
?> | ||
--EXPECT-- | ||
CLIENT_IDENTIFIER NOT SET: NULL | ||
bool(true) | ||
CLIENT_IDENTIFIER SET: string(22) "some client identifier" | ||
bool(true) | ||
CLIENT_IDENTIFIER RESET: string(15) "something else!" | ||
bool(true) | ||
CLIENT_IDENTIFIER NULLED: NULL | ||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--TEST-- | ||
PDO_OCI: Attribute: Setting session module | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded'); | ||
require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc'); | ||
PDOTest::skip(); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc'); | ||
|
||
$query = 'select module from v$session where sid = sys_context(\'USERENV\', \'SID\')'; | ||
|
||
$dbh = PDOTest::factory(); | ||
|
||
var_dump($dbh->setAttribute(PDO::OCI_ATTR_MODULE, "some module")); | ||
|
||
$stmt = $dbh->query($query); | ||
$row = $stmt->fetch(); | ||
echo 'MODULE SET: '; | ||
var_dump($row['module']); | ||
|
||
var_dump($dbh->setAttribute(PDO::OCI_ATTR_MODULE, "something else!")); | ||
|
||
$stmt = $dbh->query($query); | ||
$row = $stmt->fetch(); | ||
echo 'MODULE RESET: '; | ||
var_dump($row['module']); | ||
|
||
var_dump($dbh->setAttribute(PDO::OCI_ATTR_MODULE, null)); | ||
|
||
$stmt = $dbh->query($query); | ||
$row = $stmt->fetch(); | ||
echo 'MODULE NULLED: '; | ||
var_dump($row['module']); | ||
|
||
echo "Done\n"; | ||
|
||
?> | ||
--EXPECT-- | ||
bool(true) | ||
MODULE SET: string(11) "some module" | ||
bool(true) | ||
MODULE RESET: string(15) "something else!" | ||
bool(true) | ||
MODULE NULLED: NULL | ||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters