class_mcPDOLogger.inc.php
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of class_mcPDOLogger
*
* @author Frederick <frederick at mensch.coop>
*/
class mcPDOLogger {
private static $Messages = array();
public static function add($param_order, array $param_bindValueArray=null, $param_count_result=false, $param_optional='') {
mcPDOLogger::$Messages[] = array(
'order' => $param_order,
'bindValue' => $param_bindValueArray,
'optional' => $param_optional,
'count_result' => $param_count_result,
);
}
public static function getMessagesAsText() {
$MessageAsText = '';
foreach(mcPDOLogger::$Messages as $index => $message) {
arsort($message['bindValue']);
foreach($message['bindValue'] as $string => $value) {
if(is_string($value)) {
$value = "'".$value."'";
}
$message['order'] = str_replace($string, $value, $message['order']);
}
$MessageAsText .= "\n".$index.":\t".trim($message['order'])."\n\t\tcount:\t".$message['count_result']."\n";
}
mcPDOLogger::$Messages = array();
return $MessageAsText;
}
}
?>