Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myQuery = function(query, callback) {
- connection.connect();
- var queryString = "SELECT * FROM `__table` WHERE `_id` = '"+id+"'";
- var query = connection.query(queryString);
- query.on('error', function(err) {
- throw err;
- });
- query.on('fields', function(fields) {
- // sub.lg('Query fields :\n');
- // sub.ld(fields);
- });
- query.on('result', function(row) {
- // sub.lg('Query result :\n');
- // sub.ld(row);
- if (row!=={}) {
- row.Value = 'exists';
- row.Result = 'OK';
- row.Error = '';
- row.Pending = 'Done';
- result = row;
- callback(JSON.stringify(result));
- } else {
- callback(JSON.stringify(result));
- }
- });
- }
- myquery("xxxx", function(result)){
- console.log(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement