Skip to content

Commit

Permalink
apply review commnets
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiwongky committed Nov 8, 2017
1 parent bedfd46 commit 12f5e72
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class ColumnMeta
public function isEncryptableType()
{
$unsupportedTypes = array("money", "smallmoney", "image", "ntext", "text", "xml", "sql_variant");
if (in_array(strtolower($this->dataType), $unsupportedTypes) && !$this->forceEncrypt) {
if (!$this->forceEncrypt && in_array(strtolower($this->dataType), $unsupportedTypes)) {
return false;
} else {
return true;
Expand Down
1 change: 1 addition & 0 deletions test/functional/pdo_sqlsrv/pdo_ae_insert_money.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require_once("MsCommon_mid-refactor.inc");
require_once("AEData.inc");
$dataTypes = array("smallmoney", "money");
try {
//set to ERRMODE_SILENT to compare actual error and expected unsupport money types in encrypted columns error
$conn = connect('', array(), PDO::ERRMODE_SILENT);
foreach ($dataTypes as $dataType) {
echo "\nTesting $dataType:\n";
Expand Down
3 changes: 2 additions & 1 deletion test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_money.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require_once("MsCommon_mid-refactor.inc");
require_once("AEData.inc");
$dataTypes = array( "smallmoney", "money" );
try {
//set to ERRMODE_SILENT to compare actual error and expected unsupport money types in encrypted columns error
$conn = connect('', array(), PDO::ERRMODE_SILENT);
foreach ($dataTypes as $dataType) {
echo "\nTesting $dataType:\n";
Expand Down Expand Up @@ -60,7 +61,7 @@ try {
if ($success) {
echo "Test successfully done.\n";
}
DropTable($conn, $tbname);
dropTable($conn, $tbname);
}
unset($stmt);
unset($conn);
Expand Down
10 changes: 5 additions & 5 deletions test/functional/pdo_sqlsrv/pdo_ae_insert_retrieve.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ try {
$conn = connect();
// Create the table
$tbname = 'Patients';
$colMetaArr = array( new columnMeta("int", "PatientId", "IDENTITY(1,1)"),
new columnMeta("char(11)", "SSN"),
new columnMeta("nvarchar(50)", "FirstName", "NULL"),
new columnMeta("nvarchar(50)", "LastName", "NULL"),
new columnMeta("date", "BirthDate", null, "randomized"));
$colMetaArr = array( new ColumnMeta("int", "PatientId", "IDENTITY(1,1)"),
new ColumnMeta("char(11)", "SSN"),
new ColumnMeta("nvarchar(50)", "FirstName", "NULL"),
new ColumnMeta("nvarchar(50)", "LastName", "NULL"),
new ColumnMeta("date", "BirthDate", null, "randomized"));
createTable($conn, $tbname, $colMetaArr);

// insert a row
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (isColEncrypted()) {
$conn1 = connect('', array(), PDO::ERRMODE_EXCEPTION, true);
$stmt = $conn1->query($selectSql);
while ($decrypted_row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($decrypted_row[ 'CharCount' ] == strlen($decrypted_row[getDefaultColName("nvarchar(1000)")])) {
if ($decrypted_row['CharCount'] == strlen($decrypted_row[getDefaultColName("nvarchar(1000)")])) {
$rowInd = $decrypted_row[ 'CharCount' ] + 1;
echo "Failed to encrypted at row $rowInd\n";
$testPass = false;
Expand Down
2 changes: 1 addition & 1 deletion test/functional/pdo_sqlsrv/pdo_ae_insert_string.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ try {

// create table
$tbname = getTableName();
$colMetaArr = array( new columnMeta($dataType, "c_det"), new columnMeta($dataType, "c_rand", null, "randomized"));
$colMetaArr = array(new ColumnMeta($dataType, "c_det"), new ColumnMeta($dataType, "c_rand", null, "randomized"));
createTable($conn, $tbname, $colMetaArr);

// insert a row
Expand Down

0 comments on commit 12f5e72

Please sign in to comment.