MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mdatabaseexception.class
Ir para a documentação deste ficheiro.
1<?php
2
31class MDatabaseException extends Exception
32{
38 private $sqlError;
39
41 const KNOWN_ERROR_CODE = 1; // Error code for treated messages
42
49 public function generateMessage($svnInfo = '')
50 {
52 switch ( $this->code )
53 {
55
56 $message = ucfirst($this->getMessage());
57
58 // exibe o trace de codigo
59 if ( MUtil::getBooleanValue($MIOLO->getConf('options.backtrace')) )
60 {
61 $trace = $this->getTrace();
62 $query = $trace[3]['args'][0];
63
64 $message .= '<br /><br />' . _M('Query') . ": $query" . '<br /><br />';
65// $message .= str_replace("\n", '<br />', $svnInfo);
66
67 if ( strlen($this->getSqlError()) > 0 )
68 {
69 $message .= $this->getSqlError() . '<br /><br />';
70 }
71
72 $message .= MForm::expansibleText(_M('Exibir trace'), _M('Ocultar trace'), $this->getTraceAsString());
73 }
74
75 break;
76
77
79 default:
80
81 $message = _M('Database error occurred') . '<br /><br />';
82 $message .= str_replace("\n", '<br />', ucfirst($this->getMessage()));
83
84 if ( MUtil::getBooleanValue($MIOLO->getConf('options.backtrace')) )
85 {
86 $trace = $this->getTrace();
87 $query = $trace[3]['args'][0];
88
89 $message .= '<br /><br />' . _M('Query') . ": $query" . '<br /><br />';
90 $message .= str_replace("\n", '<br />', $this->getTraceAsString()) . '<br /><br />';
91 $message .= str_replace("\n", '<br />', $svnInfo);
92 }
93 }
94
95 return $message;
96 }
97
103 public function __toString()
104 {
106
107 $trace = $this->getTrace();
108 $query = $trace[3]['args'][0];
109
110 $message = ucfirst($this->getMessage());
111 $message .= "\n\n" . _M('Query') . ": $query";
112
113 if ( MUtil::getBooleanValue($MIOLO->getConf('options.backtrace')) )
114 {
115 $message .= "\n\n" . $this->getTraceAsString();
116 }
117
118 return $message;
119 }
120
121 public function getSqlError() {
122 return $this->sqlError;
123 }
124
125 public function setSqlError($sqlError) {
126 $this->sqlError = $sqlError;
127 }
128}
129?>
static expansibleText($labelExpand, $labelCollapse, $text)
Definição mform.class:3003
static getInstance()
Definição miolo.class:134
static getBooleanValue($value)
Definição mutil.class:100