2014-11-05 12:01:01 +01:00
|
|
|
|
|
|
|
|
2014-12-15 13:19:12 +01:00
|
|
|
var HyriseSQLConnector = function(endpointUrl) {
|
|
|
|
this._endpointUrl = endpointUrl;
|
2014-11-05 12:01:01 +01:00
|
|
|
}
|
|
|
|
|
2014-12-15 13:19:12 +01:00
|
|
|
HyriseSQLConnector.prototype.executeSQLQuery = function(query, callback, error_callback) {
|
|
|
|
var url = encodeURI(this._endpointUrl);
|
2014-11-05 12:01:01 +01:00
|
|
|
|
|
|
|
jQuery.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: url,
|
|
|
|
dataType: 'json',
|
|
|
|
data: {
|
|
|
|
performance: true,
|
|
|
|
sql: query
|
|
|
|
},
|
|
|
|
success: function(result) {
|
2014-11-13 02:40:43 +01:00
|
|
|
if (typeof result.real_size === "undefined") {
|
|
|
|
result.real_size = 0;
|
|
|
|
result.rows = [];
|
|
|
|
result.header = [];
|
|
|
|
}
|
2014-11-05 12:01:01 +01:00
|
|
|
callback(result);
|
2014-11-05 16:09:56 +01:00
|
|
|
},
|
|
|
|
error: error_callback
|
2014-11-05 12:01:01 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
return this;
|
|
|
|
};
|