// SQL queries
function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$sqlString])) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called: ' . $sqlString);
// Escape a string for the database
function SQL_ESCAPE ($str, $secureString = true, $strip = true) {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS['sql_escapes']['' . $str . ''])) {
// Prepare the string here
$str = SQL_PREPARE_SQL_STRING($str);
// Debug log
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'columnName=' . $columnName . ',idx=' . $idx . ',sql=' . $sql . ',hasZeroNums=' . intval(ifSqlColumnExists($tableName, $columnName)));
- // Do we have no entry on ADD or an entry on DROP/CHANGE?
+ // Is there no entry on ADD or an entry on DROP/CHANGE?
if (((!ifSqlColumnExists($tableName, $columnName)) && (isInString('ADD', $sql))) || ((ifSqlColumnExists($tableName, $columnName)) && ((isInString('DROP', $sql)) || ((isInString('CHANGE', $sql)) && ($idx == 4) && ((!ifSqlColumnExists($tableName, $tableArray[5])) || ($columnName == $tableArray[5])))))) {
// Do the query
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Executing: ' . $sql);
// Checks if the link is up
function SQL_IS_LINK_UP () {
- // Do we have cached this?
+ // Is there cached this?
if (!isset($GLOBALS['is_sql_link_up'])) {
// Determine it
$GLOBALS['is_sql_link_up'] = is_resource(SQL_GET_LINK());
// Remember plain error in last_sql_error
$GLOBALS['last_sql_error'] = mysql_error();
- // Do we have installation phase?
+ // Is there installation phase?
if (isInstallationPhase()) {
/*
* In installation phase, we don't want SQL errors abort e.g. connection
// Check if there is a SQL table created
function ifSqlTableExists ($tableName) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ' - ENTERED!');
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$tableName])) {
// Check if the table is there
$result = SQL_QUERY_ESC("SHOW TABLES FROM `{?__DB_NAME?}` WHERE `Tables_in_{?__DB_NAME?}`='{?_MYSQL_PREFIX?}_%s'",
// Is a table column there?
function ifSqlColumnExists ($tableName, $columnName) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',columnName=' . $columnName . ' - ENTERED!');
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$tableName][$columnName])) {
// And column name as well
$columnName = str_replace('`', '', $columnName);
// Checks depending on the mode if the index is there
function isSqlTableIndexFound ($tableName, $keyName) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'tableName=' . $tableName . ',columnName=' . $keyName . ' - ENTERED!');
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$tableName][$keyName])) {
// Show indexes
$result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__);
// This also worked, now we need to check if the selected database type is supported
$result = SQL_QUERY('SHOW ENGINES', __FUNCTION__, __LINE__);
- // Do we have entries? (Bad if not)
+ // Are there entries? (Bad if not)
if (SQL_NUMROWS($result) > 0) {
// Load all and check for active entries
while ($content = SQL_FETCHARRAY($result)) {