Merge branch 'QA_4_5' into QA_4_6
This commit is contained in:
commit
fbf756c7d6
@ -83,6 +83,7 @@ phpMyAdmin - ChangeLog
|
||||
- issue #11967 Fix PHP error on loading invalid XML or ODS file
|
||||
- issue #11969 Missing confirmation while dropping a view in view_operations.php
|
||||
- issue #11968 Fix export of index comments in SQL
|
||||
- issue #11979 DECLARE not accepted as valid SQL
|
||||
|
||||
4.5.4.1 (2016-01-29)
|
||||
- issue #11892 Error with PMA 4.4.15.3
|
||||
|
||||
3
js/codemirror/addon/lint/sql-lint.js
vendored
3
js/codemirror/addon/lint/sql-lint.js
vendored
@ -31,7 +31,8 @@ CodeMirror.sqlLint = function(text, updateLinting, options, cm) {
|
||||
data: {
|
||||
sql_query: text,
|
||||
token: PMA_commonParams.get('token'),
|
||||
server: PMA_commonParams.get('server')
|
||||
server: PMA_commonParams.get('server'),
|
||||
options: options.lintOptions,
|
||||
},
|
||||
success: handleResponse
|
||||
});
|
||||
|
||||
@ -213,11 +213,12 @@ function PMA_handleRedirectAndReload(data) {
|
||||
/**
|
||||
* Creates an SQL editor which supports auto completing etc.
|
||||
*
|
||||
* @param $textarea jQuery object wrapping the textarea to be made the editor
|
||||
* @param options optional options for CodeMirror
|
||||
* @param resize optional resizing ('vertical', 'horizontal', 'both')
|
||||
* @param $textarea jQuery object wrapping the textarea to be made the editor
|
||||
* @param options optional options for CodeMirror
|
||||
* @param resize optional resizing ('vertical', 'horizontal', 'both')
|
||||
* @param lintOptions additional options for lint
|
||||
*/
|
||||
function PMA_getSQLEditor($textarea, options, resize) {
|
||||
function PMA_getSQLEditor($textarea, options, resize, lintOptions) {
|
||||
if ($textarea.length > 0 && typeof CodeMirror !== 'undefined') {
|
||||
|
||||
// merge options for CodeMirror
|
||||
@ -237,6 +238,7 @@ function PMA_getSQLEditor($textarea, options, resize) {
|
||||
lint: {
|
||||
"getAnnotations": CodeMirror.sqlLint,
|
||||
"async": true,
|
||||
"lintOptions": lintOptions
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
10
js/rte.js
10
js/rte.js
@ -15,6 +15,8 @@ var RTE = {
|
||||
*/
|
||||
object: function (type) {
|
||||
$.extend(this, RTE.COMMON);
|
||||
this.editorType = type;
|
||||
|
||||
switch (type) {
|
||||
case 'routine':
|
||||
$.extend(this, RTE.ROUTINE);
|
||||
@ -58,6 +60,10 @@ RTE.COMMON = {
|
||||
* the jQueryUI dialog buttons
|
||||
*/
|
||||
buttonOptions: {},
|
||||
/**
|
||||
* @var editorType Type of the editor
|
||||
*/
|
||||
editorType: null,
|
||||
/**
|
||||
* Validate editor form fields.
|
||||
*/
|
||||
@ -360,7 +366,9 @@ RTE.COMMON = {
|
||||
* the Definition textarea.
|
||||
*/
|
||||
var $elm = $('textarea[name=item_definition]').last();
|
||||
that.syntaxHiglighter = PMA_getSQLEditor($elm);
|
||||
var linterOptions = {};
|
||||
linterOptions[that.editorType + '_editor'] = true;
|
||||
that.syntaxHiglighter = PMA_getSQLEditor($elm, {}, null, linterOptions);
|
||||
|
||||
// Execute item-specific code
|
||||
that.postDialogShow(data);
|
||||
|
||||
12
lint.php
12
lint.php
@ -31,4 +31,16 @@ PMA\libraries\Response::getInstance()->disable();
|
||||
|
||||
PMA_headerJSON();
|
||||
|
||||
if (! empty($_POST['options'])) {
|
||||
$options = $_POST['options'];
|
||||
|
||||
if (! empty($options['routine_editor'])) {
|
||||
$sql_query = 'CREATE PROCEDURE `a`() ' . $sql_query;
|
||||
} elseif (! empty($options['trigger_editor'])) {
|
||||
$sql_query = 'CREATE TRIGGER `a` AFTER INSERT ON `b` FOR EACH ROW ' . $sql_query;
|
||||
} elseif (! empty($options['event_editor'])) {
|
||||
$sql_query = 'CREATE EVENT `a` ON SCHEDULE EVERY MINUTE DO ' . $sql_query;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(Linter::lint($sql_query));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user