2017-12-14 20:38:56 -05:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const sql = require('../../services/sql');
|
|
|
|
|
2018-03-30 17:07:41 -04:00
|
|
|
async function execute(req) {
|
2017-12-14 20:38:56 -05:00
|
|
|
const query = req.body.query;
|
|
|
|
|
2017-12-19 22:33:44 -05:00
|
|
|
try {
|
2018-03-30 17:07:41 -04:00
|
|
|
return {
|
2017-12-19 22:33:44 -05:00
|
|
|
success: true,
|
2018-01-29 17:41:59 -05:00
|
|
|
rows: await sql.getRows(query)
|
2018-03-30 17:07:41 -04:00
|
|
|
};
|
2017-12-19 22:33:44 -05:00
|
|
|
}
|
|
|
|
catch (e) {
|
2018-03-30 17:07:41 -04:00
|
|
|
return {
|
2017-12-19 22:33:44 -05:00
|
|
|
success: false,
|
|
|
|
error: e.message
|
2018-03-30 17:07:41 -04:00
|
|
|
};
|
2017-12-19 22:33:44 -05:00
|
|
|
}
|
2018-03-30 17:07:41 -04:00
|
|
|
}
|
2017-12-14 20:38:56 -05:00
|
|
|
|
2018-03-30 17:07:41 -04:00
|
|
|
module.exports = {
|
|
|
|
execute
|
|
|
|
};
|