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