Print error messages for fatal errors
This commit is contained in:
parent
c55ad3ed9f
commit
63d7a99c91
|
@ -409,7 +409,7 @@ function callFunc($conn, $funcName, $funcArgs, $funcValues)
|
|||
sqlsrv_free_stmt($stmt);
|
||||
}
|
||||
|
||||
function fatalError($errorMsg, $print = false)
|
||||
function fatalError($errorMsg, $print = true)
|
||||
{
|
||||
SetUTF8Data(false);
|
||||
if ($print) {
|
||||
|
@ -425,7 +425,6 @@ function printErrors($message = "")
|
|||
if (strlen($message) > 0) {
|
||||
echo $message . "\n";
|
||||
}
|
||||
|
||||
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
if (count($errors) == 0) {
|
||||
$errors = sqlsrv_errors(SQLSRV_ERR_ALL);
|
||||
|
|
|
@ -481,12 +481,12 @@ function executeQuery($conn, $sql, $conds = null, $values = null)
|
|||
if ($stmt) {
|
||||
$r = sqlsrv_execute($stmt);
|
||||
if (!$r) {
|
||||
fatalError("executeQuery: failed to execute \'$sql\'!", true);
|
||||
fatalError("executeQuery: failed to execute \'$sql\'!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$stmt) {
|
||||
fatalError("executeQuery: failed to run query \'$sql\'!", true);
|
||||
fatalError("executeQuery: failed to run query \'$sql\'!");
|
||||
}
|
||||
|
||||
return $stmt;
|
||||
|
@ -506,12 +506,12 @@ function executeQueryEx($conn, $sql, $options)
|
|||
if ($stmt) {
|
||||
$r = sqlsrv_execute($stmt);
|
||||
if (!$r) {
|
||||
fatalError("executeQueryEx: failed to execute \'$sql\'!", true);
|
||||
fatalError("executeQueryEx: failed to execute \'$sql\'!");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$stmt) {
|
||||
fatalError("executeQueryEx: failed to run query \'$sql\'!", true);
|
||||
fatalError("executeQueryEx: failed to run query \'$sql\'!");
|
||||
}
|
||||
|
||||
return $stmt;
|
||||
|
@ -683,7 +683,7 @@ function insertTestRow($conn, $tbname, $index)
|
|||
$stmt = sqlsrv_query($conn, $insertSql);
|
||||
}
|
||||
if (!$stmt || $result === false) {
|
||||
fatalError("insertTestRow: failed to insert row $index!\n", true);
|
||||
fatalError("insertTestRow: failed to insert row $index!\n");
|
||||
}
|
||||
return $stmt;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue