@@ -34,6 +34,7 @@ abstract class SQLCollector extends Collector
3434 protected $ oDB ;
3535 protected $ oStatement ;
3636 protected $ idx ;
37+ protected $ sQuery ;
3738
3839 /**
3940 * Initalization
@@ -63,31 +64,31 @@ public function Prepare()
6364 }
6465
6566 // Read the SQL query from the configuration
66- $ sQuery = Utils::GetConfigurationValue (get_class ($ this )."_query " , '' );
67- if ($ sQuery == '' ) {
67+ $ this -> sQuery = Utils::GetConfigurationValue (get_class ($ this )."_query " , '' );
68+ if ($ this -> sQuery == '' ) {
6869 // Try all lowercase
69- $ sQuery = Utils::GetConfigurationValue (strtolower (get_class ($ this ))."_query " , '' );
70+ $ this -> sQuery = Utils::GetConfigurationValue (strtolower (get_class ($ this ))."_query " , '' );
7071 }
71- if ($ sQuery == '' ) {
72+ if ($ this -> sQuery == '' ) {
7273 // No query at all !!
7374 Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] no SQL query configured! Cannot collect data. The query was expected to be configured as ' " .strtolower (get_class ($ this ))."_query' in the configuration file. " );
7475
7576 return false ;
7677 }
7778
7879
79- $ this ->oStatement = $ this ->oDB ->prepare ($ sQuery );
80+ $ this ->oStatement = $ this ->oDB ->prepare ($ this -> sQuery );
8081 if ($ this ->oStatement === false ) {
8182 $ aInfo = $ this ->oDB ->errorInfo ();
82- Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to prepare the query: ' $ sQuery'. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
83+ Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to prepare the query: ' $ this -> sQuery '. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
8384
8485 return false ;
8586 }
8687
8788 $ this ->oStatement ->execute ();
8889 if ($ this ->oStatement ->errorCode () !== '00000 ' ) {
8990 $ aInfo = $ this ->oStatement ->errorInfo ();
90- Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to execute the query: ' $ sQuery'. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
91+ Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to execute the query: ' $ this -> sQuery '. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
9192
9293 return false ;
9394 }
@@ -223,15 +224,15 @@ protected function Connect()
223224 $ this ->oStatement = $ this ->oDB ->prepare ("SET NAMES 'utf8' " );
224225 if ($ this ->oStatement === false ) {
225226 $ aInfo = $ this ->oDB ->errorInfo ();
226- Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to prepare the query: ' $ sQuery'. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
227+ Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to prepare the query: ' $ this -> sQuery '. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
227228
228229 return false ;
229230 }
230231
231232 $ bRet = $ this ->oStatement ->execute ();
232233 if ($ this ->oStatement ->errorCode () !== '00000 ' ) {
233234 $ aInfo = $ this ->oStatement ->errorInfo ();
234- Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to execute the query: ' $ sQuery'. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
235+ Utils::Log (LOG_ERR , "[ " .get_class ($ this )."] Failed to execute the query: ' $ this -> sQuery '. Reason: " .$ aInfo [0 ].', ' .$ aInfo [2 ]);
235236
236237 return false ;
237238 }
0 commit comments