Skip to content

Commit

Permalink
Changed the EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
yitam committed Jun 27, 2018
1 parent 4c51ca5 commit 40b2266
Showing 1 changed file with 76 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
--TEST--
PDO - Large Unicode Column Name Test
--DESCRIPTION--
Verifies that long column names in Unicode are supported (up to 128 chars).
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
--TEST--
PDO - Large Unicode Column Name Test
--DESCRIPTION--
Verifies that long column names in Unicode are supported (up to 128 chars).
--ENV--
PHPT_EXEC=true
--SKIPIF--
<?php require('skipif.inc'); ?>
--FILE--
<?php
require_once('MsCommon.inc');

function largeColumnNameTest($columnName)
{
include 'MsSetup.inc';

Setup();

$conn = connect();

$tableName = "largeColumnNameTest";

dropTable($conn, $tableName);

$conn->query("CREATE TABLE [$tableName] ([$columnName] int)");

$conn->query("INSERT INTO [$tableName] ([$columnName]) VALUES (5)");

$stmt = $conn->query("SELECT * from [$tableName]");

dropTable($conn, $tableName);
}


//--------------------------------------------------------------------
// repro
//
//--------------------------------------------------------------------
function repro()
{
$testName = "PDO - Large Column Name Test";

startTest($testName);

// The maximum size of a column name is 128 characters
$maxlen = 128;
$columnName = str_repeat('', $maxlen);

try {
largeColumnNameTest($columnName);
} catch (Exception $e) {
echo "Possible regression: Unable to retrieve inserted value\n";
print_r($e->getMessage());
echo "\n";
}

// Now add another character to the name
$columnName .= '';
try {
largeColumnNameTest($columnName);
} catch (Exception $e) {
// Expects to fail
$expected = 'is too long. Maximum length is 128.';
if (strpos($e->getMessage(), $expected) === false) {
print_r($e->getMessage());
echo "\n";
}
}

endTest($testName);
}

repro();

?>
--EXPECT--
Test "PDO - Large Column Name Test" completed successfully.
require_once('MsCommon.inc');

function largeColumnNameTest($columnName)
{
include 'MsSetup.inc';

Setup();

$conn = connect();

$tableName = "largeColumnNameTest";

dropTable($conn, $tableName);

$conn->query("CREATE TABLE [$tableName] ([$columnName] int)");

$conn->query("INSERT INTO [$tableName] ([$columnName]) VALUES (5)");

$stmt = $conn->query("SELECT * from [$tableName]");

dropTable($conn, $tableName);
}


//--------------------------------------------------------------------
// repro
//
//--------------------------------------------------------------------
function repro()
{
$testName = "PDO - Large Column Name Test";

startTest($testName);

// The maximum size of a column name is 128 characters
$maxlen = 128;
$columnName = str_repeat('', $maxlen);

try {
largeColumnNameTest($columnName);
} catch (Exception $e) {
echo "Possible regression: Unable to retrieve inserted value\n";
print_r($e->getMessage());
echo "\n";
}

// Now add another character to the name
$columnName .= '';
try {
largeColumnNameTest($columnName);
} catch (Exception $e) {
// Expects to fail
$expected = 'is too long. Maximum length is 128.';
if (strpos($e->getMessage(), $expected) === false) {
print_r($e->getMessage());
echo "\n";
}
}

endTest($testName);
}

repro();

?>
--EXPECT--
Test "PDO - Large Column Name Test" completed successfully.

0 comments on commit 40b2266

Please sign in to comment.