/** * Check if table is present in database * @param String tablename to check */ static function CheckTable($tablename) { global $adb; $old_dieOnError = $adb->dieOnError; $adb->dieOnError = false; $tablename = Vtiger_Utils::SQLEscape($tablename); $tablecheck = $adb->pquery("SHOW TABLES LIKE ?", array($tablename)); $tablePresent = true; if(empty($tablecheck) || $adb->num_rows($tablecheck) === 0) $tablePresent = false; $adb->dieOnError = $old_dieOnError; return $tablePresent; }
/** * Check if table is present in database * @param String tablename to check */ static function CheckTable($tablename) { global $adb; $old_dieOnError = $adb->dieOnError; $adb->dieOnError = false; $tablename = Vtiger_Utils::SQLEscape($tablename); $tablecheck = $adb->pquery("SELECT 1 FROM {$tablename} LIMIT 1", array()); $tablePresent = true; if (empty($tablecheck)) { $tablePresent = false; } $adb->dieOnError = $old_dieOnError; return $tablePresent; }