Skip to content

Commit 7c34766

Browse files
committed
Fix SQL conversion issues
1 parent cf269dc commit 7c34766

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

static/js/mpg.database.query.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,28 @@ MPG.helpers.doAjaxRequest = function(method, url, successCallback, body) {
144144
*/
145145
MPG.helpers.convertSQLToMongoDBQuery = function(sql, successCallback) {
146146

147+
if ( /GROUP BY/i.test(sql) ) {
148+
MPG.codeMirror.setValue(sql);
149+
return window.alert('SQL GROUP BY clause is not supported.');
150+
}
151+
152+
if ( /ORDER BY/i.test(sql) ) {
153+
MPG.codeMirror.setValue(sql);
154+
return window.alert('SQL ORDER BY clause is not supported.');
155+
}
156+
157+
if ( /LIMIT/i.test(sql) ) {
158+
MPG.codeMirror.setValue(sql);
159+
return window.alert('SQL LIMIT clause is not supported.');
160+
}
161+
147162
MPG.helpers.doAjaxRequest(
148163
'POST',
149164
MPG_BASE_URL + '/ajaxSQLConvertToMongoDBQuery',
150165
successCallback,
151166
JSON.stringify({ "sql": sql })
152167
);
153168

154-
return;
155-
156169
};
157170

158171
/**

0 commit comments

Comments
 (0)