Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 782 → Rev 783

/trunk/dev/test_database_plugins
3,7 → 3,7
 
/*
* OIDplus 2.0
* Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
* Copyright 2019 - 2022 Daniel Marschall, ViaThinkSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
195,7 → 195,7
$db->query("SELECT * from ABCDEF");
echo "Exception for DirectQuery: ".redtext('FAILED').", no Exception thrown\n";
} catch (Exception $e) {
if (strpos($e->getMessage(), 'ABCDEF') !== false) {
if ((strpos($e->getMessage(), 'ABCDEF') !== false) || is_known_errormsg($e->getMessage())) {
echo "Exception for DirectQuery: ".greentext('PASSED')."\n";
} else {
echo "Exception for DirectQuery: ".redtext('FAILED').", does probably not contain DBMS error string\n";
203,7 → 203,7
}
 
$msg = $db->error();
if (strpos($msg, 'ABCDEF') !== false) {
if ((strpos($msg, 'ABCDEF') !== false) || is_known_errormsg($msg)) {
echo "Error-Function after failed direct query: ".greentext('PASSED')."\n";
} else {
echo "Error-Function after failed direct query: ".redtext('FAILED').", does probably not contain DBMS error string ($msg)\n";
213,7 → 213,7
$db->query("SELECT * from FEDCBA", array(''));
echo "Exception for PreparedQuery: ".redtext('FAILED').", no Exception thrown\n";
} catch (Exception $e) {
if (strpos($e->getMessage(), 'FEDCBA') !== false) {
if ((strpos($e->getMessage(), 'FEDCBA') !== false) || is_known_errormsg($e->getMessage())) {
echo "Exception for PreparedQuery: ".greentext('PASSED')."\n";
} else {
echo "Exception for PreparedQuery: ".redtext('FAILED').", does probably not contain DBMS error string\n";
221,7 → 221,7
}
 
$msg = $db->error();
if (strpos($msg, 'FEDCBA') !== false) {
if ((strpos($msg, 'FEDCBA') !== false) || is_known_errormsg($msg)) {
echo "Error-Function after failed prepared query: ".greentext('PASSED')."\n";
} else {
echo "Error-Function after failed prepared query: ".redtext('FAILED').", does probably not contain DBMS error string ($msg)\n";
354,3 → 354,14
$num_succ++;
return PHP_SAPI == 'cli' ? "\033[32m$str\033[0m" : '<font color="green">'.$str.'</font>';
}
 
function is_known_errormsg($msg) {
// Oracle:
//Error-Function after failed direct query:
// ==> OCIStmtExecute: ORA-00942: table or view does not exist (ext\pdo_oci\oci_statement.c:155)
//Error-Function after failed prepared query:
// ==> OCIBindByPos: ORA-01036: illegal variable name/number (ext\pdo_oci\oci_statement.c:346)
if (strpos($msg,': ORA-') !== false) return true;
 
return false;
}