From 19994085dadd8879b58a61b1e5eb0fedf5b48508 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 5 Nov 2014 12:01:01 +0100 Subject: [PATCH] added frontend to execute queries on hyrise and display result table #2 --- frontend-hyrise/hyrise-sql-connector.js | 35 +++++++++++ frontend-hyrise/index.html | 78 +++++++++++++++++++++++++ frontend-hyrise/style.css | 20 +++++++ 3 files changed, 133 insertions(+) create mode 100644 frontend-hyrise/hyrise-sql-connector.js create mode 100644 frontend-hyrise/index.html create mode 100644 frontend-hyrise/style.css diff --git a/frontend-hyrise/hyrise-sql-connector.js b/frontend-hyrise/hyrise-sql-connector.js new file mode 100644 index 0000000..35f6ea8 --- /dev/null +++ b/frontend-hyrise/hyrise-sql-connector.js @@ -0,0 +1,35 @@ + + + +var HyriseSqlConnector = function(host, port) { + + this.setConnectionDetails(host, port); + +} + + +HyriseSqlConnector.prototype.setConnectionDetails = function(host, port) { + this._host = host; + this._port = port; + return this; +}; + +HyriseSqlConnector.prototype.executeQuery = function(query, callback) { + var endpoint = 'http://' + this._host + ':' + this._port + '/query'; + var url = encodeURI(endpoint); + + jQuery.ajax({ + type: "POST", + url: url, + dataType: 'json', + data: { + performance: true, + sql: query + }, + success: function(result) { + callback(result); + } + }); + + return this; +}; \ No newline at end of file diff --git a/frontend-hyrise/index.html b/frontend-hyrise/index.html new file mode 100644 index 0000000..1bc3fdf --- /dev/null +++ b/frontend-hyrise/index.html @@ -0,0 +1,78 @@ + + + + + + + + + + +
+
+
+ +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/frontend-hyrise/style.css b/frontend-hyrise/style.css new file mode 100644 index 0000000..1c94a5d --- /dev/null +++ b/frontend-hyrise/style.css @@ -0,0 +1,20 @@ + +body { + text-align: center; +} + +div { + margin: auto; +} + +.content { + width: 90%; + margin: auto; + margin-top: 10px; +} + +/* +#resultTable td { + border: 1px solid #333; + padding: 10px; +}*/ \ No newline at end of file