X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fsql-functions.php;h=267dcb4fb8be6e4f4fb43a12a1e47c2dc0070bba;hp=5686a79ff5a863403646bf92f7521b268b27410b;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=1e5953f6bfcadb2cbdaead2e516c4401078e620d diff --git a/inc/sql-functions.php b/inc/sql-functions.php index 5686a79ff5..267dcb4fb8 100644 --- a/inc/sql-functions.php +++ b/inc/sql-functions.php @@ -10,13 +10,8 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : SQL-Funktionen fuer Queries * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -529,7 +524,7 @@ function isSqlLinkUp () { } // Wrapper function to make code more readable -function ifSqlHasZeroNums ($result) { +function ifSqlHasZeroNumRows ($result) { // Just pass it through return (sqlNumRows($result) === 0); } @@ -648,7 +643,7 @@ function ifSqlTableColumnExists ($tableName, $columnName, $forceFound = FALSE) { } // END - if // Determine it - $doesExist = (!ifSqlHasZeroNums($result)); + $doesExist = (!ifSqlHasZeroNumRows($result)); // Free result sqlFreeResult($result); @@ -730,7 +725,7 @@ function getArrayFromSupportedSqlEngines ($requestedEngine = 'ALL') { $result = sqlQuery('SHOW ENGINES', __FUNCTION__, __LINE__); // Are there entries? (Bad if not) - if (!ifSqlHasZeroNums($result)) { + if (!ifSqlHasZeroNumRows($result)) { // Load all and check for active entries while ($content = sqlFetchArray($result)) { // Debug message @@ -782,5 +777,41 @@ WHERE ); } +// Log SQL errors to debug.log in installation phase or call reportBug() +function logSqlError ($file, $line, $message) { + // Remember plain error in last_sql_error + setSqlError($file, $line, $message); + + // Is login set? + if (!empty($GLOBALS['mysql']['login'])) { + // Secure login name in message + $message = str_replace($GLOBALS['mysql']['login'], '***', $message); + } // END - if + + // Is database password set? + if (!empty($GLOBALS['mysql']['password'])) { + // Secure password in message + $message = str_replace($GLOBALS['mysql']['password'], '***', $message); + } // END - if + + // Is database name set? + if (!empty($GLOBALS['mysql']['dbase'])) { + // Secure database name in message + $message = str_replace($GLOBALS['mysql']['dbase'], '***', $message); + } // END - if + + // Is there installation phase? + if (isInstaller()) { + /* + * In installation phase, we don't want SQL errors abort e.g. connection + * tests, so just log it away. + */ + logDebugMessage($file, $line, $message); + } else { + // Regular mode, then call reportBug() + reportBug($file, $line, $message); + } +} + // [EOF] ?>