1<?php 2 3/* 4 * This file is part of pgFouine. 5 * 6 * pgFouine - a PostgreSQL log analyzer 7 * Copyright (c) 2005-2008 Guillaume Smet 8 * 9 * pgFouine is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or (at 12 * your option) any later version. 13 * 14 * pgFouine is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with pgFouine; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 22 */ 23 24class PostgreSQLContextLine extends PostgreSQLLogLine { 25 var $ignore = false; 26 var $recognized = true; 27 28 function PostgreSQLContextLine($text) { 29 global $postgreSQLRegexps; 30 31 $statementMatch =& $postgreSQLRegexps['ContextSqlStatement']->match($text); 32 if($statementMatch) { 33 $this->PostgreSQLLogLine(substr($statementMatch->getPostMatch(), -1, 1)); 34 } else { 35 $functionMatch =& $postgreSQLRegexps['ContextSqlFunction']->match($text); 36 if($functionMatch) { 37 $this->PostgreSQLLogLine($functionMatch->getMatch(2)); 38 } else { 39 $this->recognized = false; 40 $this->PostgreSQLLogLine($text); 41 } 42 } 43 } 44 45 function appendTo(& $logObject) { 46 if(is_a($logObject, 'ErrorLogObject')) { 47 $logObject->appendContext($this->text); 48 } else { 49 if(DEBUG && !$this->recognized) stderr('Unrecognized context or context for an error', true); 50 $logObject->appendContext($this->text); 51 } 52 return false; 53 } 54 55 function isContextual() { 56 return true; 57 } 58} 59 60?>