added execution of selected text to frontend
This commit is contained in:
parent
2f110b8168
commit
e7764eae7a
|
@ -32,12 +32,14 @@ PREPARE select_test: SELECT * FROM students WHERE grade = ?;
|
|||
# EXECUTE 1
|
||||
EXECUTE select_test(2.0);
|
||||
# PREPARE 2
|
||||
PREPARE insert_test:
|
||||
PREPARE insert_test {
|
||||
INSERT INTO test VALUES (?, 0, 0);
|
||||
INSERT INTO test VALUES (?, 0, 0);
|
||||
INSERT INTO test VALUES (?, 0, 0);
|
||||
INSERT INTO test VALUES (?, 0, 0);
|
||||
INSERT INTO test VALUES (?, 0, 0);
|
||||
};
|
||||
EXECUTE insert_test(1, 2, 3, 4 ,5);
|
||||
SELECT * FROM test;
|
||||
# EXECUTE 2
|
||||
EXECUTE insert_test(1, 2, 3, 4, 5);
|
||||
|
|
|
@ -12,6 +12,13 @@ $(function() {
|
|||
|
||||
var endpointUrl = $('#endpointInput').val();
|
||||
var query = $('#queryInput').val();
|
||||
|
||||
// Check whether a part of the query has been selected
|
||||
var selectedText = getSelectedText();
|
||||
if (query.indexOf(selectedText) >= 0) {
|
||||
query = selectedText;
|
||||
}
|
||||
|
||||
var hyrise = new HyriseSQLConnector(endpointUrl);
|
||||
|
||||
hyrise.executeSQLQuery(query, function(result) {
|
||||
|
@ -43,6 +50,16 @@ $(function() {
|
|||
});
|
||||
|
||||
|
||||
function getSelectedText() {
|
||||
var text = "";
|
||||
if (window.getSelection) {
|
||||
text = window.getSelection().toString();
|
||||
} else if (document.selection && document.selection.type != "Control") {
|
||||
text = document.selection.createRange().text;
|
||||
}
|
||||
return (text === "") ? null : text;
|
||||
}
|
||||
|
||||
|
||||
function loadSampleQueries(url) {
|
||||
$.get(url, function(data) {
|
||||
|
|
Loading…
Reference in New Issue