Several code-cleanups:
[mailer.git] / inc / db / lib-mysql3.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/29/2004 *
4  * ===================                          Last change: 08/29/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : lib-mysql3.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : Database layer for MySQL 3/4/5 server            *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Datenbankschicht fuer MySQL 3/4/5 Server         *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
20  * For more information visit: http://www.mxchange.org                  *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // SQL queries
44 function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) {
45         // Do we have cache?
46         if (!isset($GLOBALS[__FUNCTION__][$sqlString])) {
47                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called: ' . $sqlString);
48
49                 // Trim SQL string
50                 $sqlStringModified = trim($sqlString);
51
52                 // Empty query string or link is not up?
53                 if (empty($sqlStringModified)) {
54                         // Empty SQL string!
55                         debug_report_bug(__FUNCTION__, __LINE__, sprintf("SQL string is empty. Please fix this. file=%s, line=%s",
56                                 basename($F),
57                                 $L
58                         ));
59                 } elseif (!SQL_IS_LINK_UP()) {
60                         // We should not quietly ignore this
61                         debug_report_bug(__FUNCTION__, __LINE__, sprintf("Cannot query database: sqlString=%s,file=%s,line=%s",
62                                 $sqlStringModified,
63                                 basename($F),
64                                 $L
65                         ));
66                 }
67
68                 // Remove \t, \n and \r from queries they may confuse some MySQL versions
69                 $sqlStringModified = str_replace("\t", ' ', str_replace("\n", ' ', str_replace("\r", ' ', $sqlStringModified)));
70
71                 // Compile config entries out
72                 $sqlStringModified = SQL_PREPARE_SQL_STRING($sqlStringModified, $enableCodes);
73
74                 // Cache it and remember as last SQL query
75                 $GLOBALS[__FUNCTION__][$sqlString] = $sqlStringModified;
76                 $GLOBALS['last_sql'] = $sqlStringModified;
77                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Stored cache: ' . $sqlStringModified);
78         }  else {
79                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used: ' . $sqlString);
80
81                 // Use cache (to save a lot function calls
82                 $GLOBALS['last_sql'] = $GLOBALS[__FUNCTION__][$sqlString];
83
84                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache is: ' . $sqlString);
85         }
86
87         // Starting time
88         $querytimeBefore = microtime(true);
89
90         // Run SQL command
91         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'F=' . basename($F) . ',L=' . $L . ',sql=' . $GLOBALS['last_sql']);
92         $result = mysql_query($GLOBALS['last_sql'], SQL_GET_LINK())
93                 or debug_report_bug($F, $L, 'file='. basename($F) . ',line=' . $L . ':mysql_error()=' . mysql_error() . "\n".
94 'Query string:' . $GLOBALS['last_sql']);
95         //* DEBUG: */ logDebugMessage($F, $L, 'sql=' . $GLOBALS['last_sql'] . ',affected=' . SQL_AFFECTEDROWS() . ',numRows='.(is_resource($result) ? SQL_NUMROWS($result) : gettype($result)));
96
97         // Calculate query time
98         $queryTime = microtime(true) - $querytimeBefore;
99
100         // Add this query to array including timing
101         addSqlToDebug($result, $GLOBALS['last_sql'], $queryTime, $F, $L);
102
103         // Save last successfull query
104         setConfigEntry('db_last_query', $GLOBALS['last_sql']);
105
106         // Count all query times
107         incrementConfigEntry('sql_time', $queryTime);
108
109         // Count this query
110         incrementConfigEntry('sql_count');
111
112         // Debug output
113         if ((!isCssOutputMode()) && (isDebugModeEnabled()) && (isSqlDebuggingEnabled())) {
114                 // Is this the first call?
115                 if (!isset($GLOBALS['sql_first_entry'])) {
116                         // Write first entry
117                         appendLineToFile(getCachePath() . 'mysql.log', 'Module=' . getModule());
118                         $GLOBALS['sql_first_entry'] = true;
119                 } // END - if
120
121                 // Append debug line
122                 appendLineToFile(getCachePath() . 'mysql.log', $F . '(LINE=' . $L . '|NUM=' . SQL_NUMROWS($result) . '|AFFECTED=' . SQL_AFFECTEDROWS() . '|QUERYTIME:' . $queryTime . '): ' . str_replace("\r", '', str_replace("\n", ' ', $GLOBALS['last_sql'])));
123         } // END - if
124
125         // Count DB hits
126         if (!isStatsEntrySet('db_hits')) {
127                 // Count in dummy variable
128                 setStatsEntry('db_hits', 1);
129         } else {
130                 // Count to config array
131                 incrementStatsEntry('db_hits');
132         }
133
134         // Return the result
135         return $result;
136 }
137
138 // SQL num rows
139 function SQL_NUMROWS ($resource) {
140         // Valid link resource?
141         if (!SQL_IS_LINK_UP()) return false;
142
143         // Link is not up, no rows by default
144         $lines = false;
145
146         // Is the result a valid resource?
147         if (isset($GLOBALS['sql_numrows'][$resource])) {
148                 // Use cache
149                 $lines = $GLOBALS['sql_numrows'][intval($resource)];
150         } elseif (is_resource($resource)) {
151                 // Get the count of rows from database
152                 $lines = mysql_num_rows($resource);
153
154                 // Remember it in cache
155                 $GLOBALS['sql_numrows'][intval($resource)] = $lines;
156         } else {
157                 // No resource given, please fix this
158                 debug_report_bug(__FUNCTION__, __LINE__, 'No resource given! result[]=' . gettype($resource) . ',last_sql=' .  $GLOBALS['last_sql']);
159         }
160
161         // Return lines
162         return $lines;
163 }
164
165 // SQL affected rows
166 function SQL_AFFECTEDROWS() {
167         // Valid link resource?
168         if (!SQL_IS_LINK_UP()) return false;
169
170         // Get affected rows
171         $lines = mysql_affected_rows(SQL_GET_LINK());
172
173         // Return it
174         return $lines;
175 }
176
177 // SQL fetch row
178 function SQL_FETCHROW ($resource) {
179         // Is a result resource set?
180         if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) return false;
181
182         // Fetch the data and return it
183         return mysql_fetch_row($resource);
184 }
185
186 // SQL fetch array
187 function SQL_FETCHARRAY ($res) {
188         // Is a result resource set?
189         if ((!is_resource($res)) || (!SQL_IS_LINK_UP())) return false;
190
191         // Load row from database
192         $row = mysql_fetch_assoc($res);
193
194         // Return only arrays here
195         if (is_array($row)) {
196                 // Return row
197                 return $row;
198         } else {
199                 // Return a false, else some loops would go endless...
200                 return false;
201         }
202 }
203
204 // SQL result
205 function SQL_RESULT ($resource, $row, $field = '0') {
206         // Is $resource valid?
207         if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) return false;
208
209         // Run the result command
210         $result = mysql_result($resource, $row, $field);
211
212         // ... and return the result
213         return $result;
214 }
215
216 // SQL connect
217 function SQL_CONNECT ($host, $login, $password, $F, $L) {
218         // Try to connect
219         $linkResource = mysql_connect($host, $login, $password) or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error());
220
221         // Set the link resource
222         SQL_SET_LINK($linkResource);
223
224         // Destroy cache
225         unset($GLOBALS['is_sql_link_up']);
226 }
227
228 // SQL select database
229 function SQL_SELECT_DB ($dbName, $F, $L) {
230         // Is there still a valid link? If not, skip it.
231         if (!SQL_IS_LINK_UP()) return false;
232
233         // Return the result
234         return mysql_select_db($dbName, SQL_GET_LINK()) or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):' . mysql_error());
235 }
236
237 // SQL close link
238 function SQL_CLOSE ($F, $L) {
239         if (!SQL_IS_LINK_UP()) {
240                 // Skip double close
241                 return false;
242         } // END - if
243
244         // Close database link and forget the link
245         $close = mysql_close(SQL_GET_LINK())
246                 or addFatalMessage(__FUNCTION__, __LINE__, $F . ' (' . $L . '):'.mysql_error());
247
248         // Close link
249         SQL_SET_LINK(null);
250
251         // Destroy cache
252         unset($GLOBALS['is_sql_link_up']);
253
254         // Return the result
255         return $close;
256 }
257
258 // SQL free result
259 function SQL_FREERESULT ($resource) {
260         if ((!is_resource($resource)) || (!SQL_IS_LINK_UP())) {
261                 // Abort here
262                 return false;
263         } // END - if
264
265         // Free result
266         $res = mysql_free_result($resource);
267
268         // And return that result of freeing it...
269         return $res;
270 }
271
272 // SQL string escaping
273 function SQL_QUERY_ESC ($sqlString, $data, $F, $L, $run = true, $strip = true, $secure = true) {
274         // Link is there?
275         if ((!SQL_IS_LINK_UP()) || (!is_array($data))) return false;
276
277         // Escape all data
278         $dataSecured['__sql_string'] = $sqlString;
279         foreach ($data as $key => $value) {
280                 $dataSecured[$key] = SQL_ESCAPE($value, $secure, $strip);
281         } // END - foreach
282
283         // Generate query
284         $query = call_user_func_array('sprintf', $dataSecured);
285
286         if ($run === true) {
287                 // Run SQL query (default)
288                 return SQL_QUERY($query, $F, $L);
289         } else {
290                 // Return secured string
291                 return $query;
292         }
293 }
294
295 // Get id from last INSERT command
296 function SQL_INSERTID () {
297         if (!SQL_IS_LINK_UP()) return false;
298         return mysql_insert_id();
299 }
300
301 // Escape a string for the database
302 function SQL_ESCAPE ($str, $secureString = true, $strip = true) {
303         // Do we have cache?
304         if (!isset($GLOBALS['sql_escapes'][''.$str.''])) {
305                 // Secure string first? (which is the default behaviour!)
306                 if ($secureString === true) {
307                         // Then do it here
308                         $str = secureString($str, $strip);
309                 } // END - if
310
311                 if (!SQL_IS_LINK_UP()) {
312                         // Fall-back to escapeQuotes() when there is no link
313                         $ret = escapeQuotes($str);
314                 } elseif (function_exists('mysql_real_escape_string')) {
315                         // The new and improved version
316                         $ret = mysql_real_escape_string($str, SQL_GET_LINK());
317                 } elseif (function_exists('mysql_escape_string')) {
318                         // The obsolete function
319                         $ret = mysql_escape_string($str, SQL_GET_LINK());
320                 } else {
321                         // If nothing else works, fall back to escapeQuotes() again
322                         $ret = escapeQuotes($str);
323                 }
324
325                 // Cache result
326                 $GLOBALS['sql_escapes'][''.$str.''] = $ret;
327         } // END - if
328
329         // Return it
330         return $GLOBALS['sql_escapes'][''.$str.''];
331 }
332
333 // SELECT query string from table, columns and so on... ;-)
334 function SQL_RESULT_FROM_ARRAY ($table, $columns, $idRow, $id, $F, $L) {
335         // Is columns an array?
336         if (!is_array($columns)) {
337                 // No array
338                 debug_report_bug(__FUNCTION__, __LINE__, sprintf("columns is not an array. %s != array, file=%s, line=%s",
339                         gettype($columns),
340                         basename($F),
341                         $L
342                 ));
343
344                 // Abort here with 'false'
345                 return false;
346         } // END  - if
347
348         // Prepare the SQL statement
349         $sql = "SELECT `".implode("`,`", $columns)."` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s' LIMIT 1";
350
351         // Return the result
352         return SQL_QUERY_ESC($sql,
353                 array(
354                         $table,
355                         $idRow,
356                         bigintval($id),
357                 ), $F, $L
358         );
359 }
360
361 // ALTER TABLE wrapper function
362 function SQL_ALTER_TABLE ($sql, $F, $L, $enableCodes = true) {
363         // Abort if link is down
364         if (!SQL_IS_LINK_UP()) return false;
365
366         // This is the default result...
367         $result = false;
368
369         // Determine index/fulltext/unique word
370         $noIndex = (
371         (
372                 strpos($sql, 'INDEX') === false
373         ) && (
374                 strpos($sql, 'KEY') === false
375         ) && (
376                 strpos($sql, 'FULLTEXT') === false
377         ) && (
378                 strpos($sql, 'UNIQUE') === false
379         )
380         );
381
382         // Extract table name
383         $tableArray = explode(' ', $sql);
384         $tableName = str_replace('`', '', $tableArray[2]);
385
386         // Debug log
387         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sql . ',tableName=' . $tableName);
388
389         // Shall we add/drop?
390         if (((strpos($sql, 'ADD') !== false) || (strpos($sql, 'DROP') !== false) || (strpos($sql, 'CHANGE') !== false)) && ($noIndex === true)) {
391                 // Try two columns, one should fix
392                 foreach (array(4,5) as $idx) {
393                         // If an entry is not set, abort here
394                         if (!isset($tableArray[$idx])) {
395                                 // Debug log this
396                                 logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',idx=' . $idx . ',sql=' . $sql . ' is missing!');
397                                 break;
398                         } // END - if
399
400                         // And column name as well
401                         $columnName = str_replace('`', '', $tableArray[$idx]);
402
403                         // Get column information
404                         $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
405                                 array($tableName, $columnName), __FUNCTION__, __LINE__);
406
407                         // Debug log
408                         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',idx=' . $idx . ',sql=' . $sql . ',hasZeroNums=' . intval(SQL_HASZERONUMS($result)));
409
410                         // Do we have no entry on ADD or an entry on DROP/CHANGE?
411                         // 123               4       43    3      4           4          32    23           4       4     3    3      4            4          32    23                4       43    3      4              4          3    3         321
412                         if (((SQL_HASZERONUMS($result)) && (strpos($sql, 'ADD') !== false)) || ((!SQL_HASZERONUMS($result)) && (strpos($sql, 'DROP') !== false)) || ((!SQL_HASZERONUMS($result)) && (strpos($sql, 'CHANGE') !== false) && ($idx == 4))) {
413                                 // Do the query
414                                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
415                                 $result = SQL_QUERY($sql, $F, $L, false);
416
417                                 // Skip further attempt(s)
418                                 break;
419                         //       1234                5       54    4      5           5          43    34                5       54    4      5            5          43    3      4              4          32    2                    21
420                         } elseif ((((!SQL_HASZERONUMS($result)) && (strpos($sql, 'ADD') !== false)) || ((!SQL_HASZERONUMS($result)) && (strpos($sql, 'DROP') !== false)) || (strpos($sql, 'CHANGE') !== false)) && ($columnName != 'KEY')) {
421                                 // Abort here because it is alreay there
422                                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: sql=' . $sql . ',columnName=' . $columnName . ',idx=' . $idx);
423                                 break;
424                         } elseif ((SQL_HASZERONUMS($result)) && (strpos($sql, 'DROP') !== false)) {
425                                 // Abort here because we tried to drop a column which is not there (never created maybe)
426                                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'No drop: ' . $sql);
427                                 break;
428                         } elseif ($columnName != 'KEY') {
429                                 // Something didn't fit, we better log it
430                                 logDebugMessage(__FUNCTION__, __LINE__, 'Possible problem: ' . $sql . ',hasZeroNums=' . intval(SQL_HASZERONUMS($result)) . '');
431                         }
432                 } // END - foreach
433         } elseif ((getConfig('_TABLE_TYPE') == 'InnoDB') && (strpos($sql, 'FULLTEXT') !== false)) {
434                 // Skip this query silently
435                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Skipped FULLTEXT: sql=%s,tableName=%s,hasZeroNums=%d,file=%s,line=%s", $sql, $tableName, intval((is_bool($result)) ? 0 : SQL_HASZERONUMS($result)), $F, $L));
436         } elseif ($noIndex === false) {
437                 // And column name as well
438                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableArray=<pre>' . print_r($tableArray, true) . '</pre>');
439                 $keyName = str_replace('`', '', $tableArray[5]);
440
441                 // Is this "UNIQUE" or so? FULLTEXT has been handled the elseif() block above
442                 if (in_array(strtoupper($keyName), array('INDEX', 'UNIQUE', 'KEY', 'FULLTEXT'))) {
443                         // Init loop
444                         $begin = 1; $keyName = ',';
445                         while (strpos($keyName, ',') !== false) {
446                                 // Use last
447                                 $keyName = str_replace('`', '', $tableArray[count($tableArray) - $begin]);
448                                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $keyName . '----------------' . $begin);
449
450                                 // Remove brackes
451                                 $keyName = str_replace('(', '', str_replace(')', '', $keyName));
452                                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $keyName . '----------------' . $begin);
453
454                                 // Continue
455                                 $begin++;
456                         } // END while
457                 } // END - if
458
459                 // Show indexes
460                 $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__);
461
462                 // Non-skipping is default for ADD
463                 $skip = false;
464
465                 // But should we DROP?
466                 if ($tableArray[3] == 'DROP') {
467                         // Then skip if nothing found
468                         $skip = true;
469                         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Going to drop key ' . $keyName);
470                 } // END - if
471
472                 // Walk through all
473                 while ($content = SQL_FETCHARRAY($result)) {
474                         // Is it found?
475                         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName='.$keyName.',content=<pre>' . print_r($content, true) . '</pre>');
476                         if (($content['Key_name'] == $keyName) && ($tableArray[3] == 'ADD')) {
477                                 // Skip this query!
478                                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("ADD: Skiped: %s", $sql));
479                                 $skip = true;
480                                 break;
481                         } elseif (($content['Key_name'] == $keyName) && ($tableArray[3] == 'DROP')) {
482                                 // Don't skip this!
483                                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, sprintf("DROP: Not skiped: %s", $sql));
484                                 $skip = false;
485                                 break;
486                         }
487                 } // END - while
488
489                 // Free result
490                 SQL_FREERESULT($result);
491
492                 // Shall we run it?
493                 if ($skip === false) {
494                         // Send it to the SQL_QUERY() function
495                         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
496                         $result = SQL_QUERY($sql, $F, $L, $enableCodes);
497                 } else {
498                         // Not executed
499                         //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not executed: ' . $sql);
500                 }
501         } else {
502                 // Other ALTER TABLE query
503                 //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $sql);
504                 $result = SQL_QUERY($sql, $F, $L, $enableCodes);
505         }
506
507         // Return result
508         return $result;
509 }
510
511 // Getter for SQL link
512 function SQL_GET_LINK () {
513         // Init link
514         $link = null;
515
516         // Is it in the globals?
517         if (isset($GLOBALS['sql_link'])) {
518                 // Then take it
519                 $link = $GLOBALS['sql_link'];
520         } // END - if
521
522         // Return it
523         return $link;
524 }
525
526 // Setter for link
527 function SQL_SET_LINK ($link) {
528         // Is this a resource or null?
529         if ((ifFatalErrorsDetected()) && (isInstallationPhase())) {
530                 // This may happen in installation phase
531                 return;
532         } elseif ((!is_resource($link)) && (!is_null($link))) {
533                 // This should never happen!
534                 debug_report_bug(__FUNCTION__, __LINE__, sprintf("link is not resource or null. Type: %s", gettype($link)));
535         } // END - if
536
537         // Set it
538         $GLOBALS['sql_link'] = $link;
539 }
540
541 // Checks if the link is up
542 function SQL_IS_LINK_UP () {
543         // Default is not up
544         $linkUp = false;
545
546         // Do we have cached this?
547         if (isset($GLOBALS['is_sql_link_up'])) {
548                 // Then use this
549                 $linkUp = $GLOBALS['is_sql_link_up'];
550         } else {
551                 // Get it
552                 $linkUp = is_resource(SQL_GET_LINK());
553
554                 // And cache it
555                 $GLOBALS['is_sql_link_up'] = $linkUp;
556         }
557
558         // Return the result
559         return $linkUp;
560 }
561
562 // Wrapper function to make code more readable
563 function SQL_HASZERONUMS ($result) {
564         // Just pass it through
565         return (SQL_NUMROWS($result) === 0);
566 }
567
568 // Wrapper function to make code more readable
569 function SQL_HASZEROAFFECTED () {
570         // Just pass it through
571         return (SQL_AFFECTEDROWS() === 0);
572 }
573
574 // Private function to prepare the SQL query string
575 function SQL_PREPARE_SQL_STRING ($sqlString, $enableCodes = true) {
576         // Is it already cached?
577         if (!isset($GLOBALS['sql_strings'][$sqlString])) {
578                 // Compile config+expression code
579                 $sqlString2 = FILTER_COMPILE_EXPRESSION_CODE(FILTER_COMPILE_CONFIG($sqlString));
580
581                 // Do final compilation
582                 $GLOBALS['sql_strings'][$sqlString] = doFinalCompilation($sqlString2, false, $enableCodes);
583                 //die($sqlString.'<br />'.$sqlString2.'<br />'.$GLOBALS['sql_strings'][$sqlString]);
584         } // END - if
585
586         // Return it
587         return $GLOBALS['sql_strings'][$sqlString];
588 }
589
590 // [EOF]
591 ?>