add exception handling for pdo_transaction.phpt

This commit is contained in:
v-kaywon 2017-11-03 17:10:45 -07:00
parent a60992f8a5
commit e09dd9163d

View file

@ -10,17 +10,21 @@ require_once("MsCommon_mid-refactor.inc");
function deleteRows($conn, $tbname) function deleteRows($conn, $tbname)
{ {
if (!isColEncrypted()) { try {
$rows = $conn->exec("DELETE FROM $tbname WHERE col1 = 'a'"); if (!isColEncrypted()) {
} else { $rows = $conn->exec("DELETE FROM $tbname WHERE col1 = 'a'");
// needs to find parameter for encrypted columns } else {
$sql = "DELETE FROM $tbname WHERE col1 = ?"; // needs to find parameter for encrypted columns
$stmt = $conn->prepare($sql); $sql = "DELETE FROM $tbname WHERE col1 = ?";
$col1 = "a"; $stmt = $conn->prepare($sql);
$stmt->execute(array($col1)); $col1 = "a";
$rows = $stmt->rowCount(); $stmt->execute(array($col1));
$rows = $stmt->rowCount();
}
return $rows;
} catch (PDOException $e) {
var_dump($e->errorInfo);
} }
return $rows;
} }
try { try {