Warn the user if the definition of a stored function does not contain a return statement.

This commit is contained in:
Rouslan Placella 2011-06-14 15:45:39 +01:00
parent 48681dfd81
commit 279ef37298
2 changed files with 10 additions and 0 deletions

View File

@ -80,6 +80,13 @@ function validateRoutineEditor(syntaxHiglighter) {
isError = true;
}
}
if (! isError && $('select[name=routine_type]').find(':selected').val() == 'FUNCTION') {
if ($('.rte_table').find('textarea[name=routine_definition]').val().toLowerCase().indexOf('return') < 0) {
syntaxHiglighter.focus();
alert(PMA_messages['MissingReturn']);
return false;
}
}
if (! isError) {
return true;
} else {

View File

@ -86,6 +86,9 @@ $js_messages['strShowSearchResults'] = __('Show search results');
$js_messages['strBrowsing'] = __('Browsing');
$js_messages['strDeleting'] = __('Deleting');
/* For db_routines.js */
$js_messages['MissingReturn'] = __('The definition of a stored function must contain a RETURN statement!');
/* For import.js */
$js_messages['strImportCSV'] = __('Note: If the file contains multiple tables, they will be combined into one');