Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7748b83a6b |
@@ -53,6 +53,18 @@ if (($dbh = $db->dbGetDbh()) instanceof \PgSql\Connection) {
|
|||||||
print "NO DB HANDLER<br>";
|
print "NO DB HANDLER<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undocumented function
|
||||||
|
*
|
||||||
|
* @param \CoreLibs\DB\IO $dbc
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testDBS(\CoreLibs\DB\IO $dbc): void
|
||||||
|
{
|
||||||
|
echo "Int call<br>";
|
||||||
|
$dbc->dbReturnRow("SELECT test FROM test_foo LIMIT 1");
|
||||||
|
}
|
||||||
|
|
||||||
$uniqid = \CoreLibs\Create\Uids::uniqIdShort();
|
$uniqid = \CoreLibs\Create\Uids::uniqIdShort();
|
||||||
$binary_data = $db->dbEscapeBytea(file_get_contents('class_test.db.php') ?: '');
|
$binary_data = $db->dbEscapeBytea(file_get_contents('class_test.db.php') ?: '');
|
||||||
$query_params = [
|
$query_params = [
|
||||||
@@ -110,6 +122,8 @@ if (is_array($res)) {
|
|||||||
var_dump($res);
|
var_dump($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testDBS($db);
|
||||||
|
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
||||||
// __END__
|
// __END__
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
|||||||
// get it at the end, cause now we can be more sure of no double IDs, etc
|
// get it at the end, cause now we can be more sure of no double IDs, etc
|
||||||
reset($this->table_array);
|
reset($this->table_array);
|
||||||
// create select part & addition FK part
|
// create select part & addition FK part
|
||||||
foreach ($this->table_array as $column => $data_array) {
|
foreach (array_keys($this->table_array) as $column) {
|
||||||
// check FK ...
|
// check FK ...
|
||||||
if (
|
if (
|
||||||
isset($this->table_array[$column]['fk']) &&
|
isset($this->table_array[$column]['fk']) &&
|
||||||
|
|||||||
@@ -792,19 +792,45 @@ class IO
|
|||||||
. \CoreLibs\Debug\Support::prAr($error_data)
|
. \CoreLibs\Debug\Support::prAr($error_data)
|
||||||
. ']';
|
. ']';
|
||||||
}
|
}
|
||||||
|
// we need to trace back where the first non class call was done
|
||||||
|
// add this stack trace to the context
|
||||||
|
$call_stack = [];
|
||||||
|
foreach (array_reverse(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)) as $call_trace) {
|
||||||
|
if (
|
||||||
|
!empty($call_trace['file']) &&
|
||||||
|
str_ends_with($call_trace['file'], '/DB/IO.php')
|
||||||
|
) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$call_stack[] =
|
||||||
|
($call_trace['file'] ?? 'n/f') . ':'
|
||||||
|
. ($call_trace['line'] ?? '-') . ':'
|
||||||
|
. (!empty($call_trace['class']) ? $call_trace['class'] . '->' : '')
|
||||||
|
. $call_trace['function'];
|
||||||
|
}
|
||||||
|
$context = [
|
||||||
|
'call_trace' => array_reverse($call_stack)
|
||||||
|
];
|
||||||
switch ($id) {
|
switch ($id) {
|
||||||
case 'DB_ERROR':
|
case 'DB_ERROR':
|
||||||
$this->log->error($debug_id . ' :' . $prefix . $error_string);
|
$this->log->error(
|
||||||
|
$debug_id . ' :' . $prefix . $error_string,
|
||||||
|
$context
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'DB_WARNING':
|
case 'DB_WARNING':
|
||||||
$this->log->warning($debug_id . ' :' . $prefix . $error_string);
|
$this->log->warning(
|
||||||
|
$debug_id . ' :' . $prefix . $error_string,
|
||||||
|
$context
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// used named arguments so we can easy change the order of debug
|
// used named arguments so we can easy change the order of debug
|
||||||
$this->log->debug(
|
$this->log->debug(
|
||||||
group_id: $debug_id,
|
group_id: $debug_id,
|
||||||
message: $error_string,
|
message: $error_string,
|
||||||
prefix: $prefix
|
prefix: $prefix,
|
||||||
|
context: $context
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -567,7 +567,7 @@ class Logging
|
|||||||
$context_str = '';
|
$context_str = '';
|
||||||
if ($context != []) {
|
if ($context != []) {
|
||||||
// TODO this here has to be changed to something better
|
// TODO this here has to be changed to something better
|
||||||
$context_str = ' ' . print_r($context, true);
|
$context_str = ' :' . print_r($context, true);
|
||||||
}
|
}
|
||||||
// build log string
|
// build log string
|
||||||
return '[' . $timestamp . '] '
|
return '[' . $timestamp . '] '
|
||||||
|
|||||||
Reference in New Issue
Block a user