<commit_before>const dbCtrl = require('./dbCtrl');

const userCtrl = {};

userCtrl.sendTableList = (req, res) => {
  dbCtrl.showTables(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}

userCtrl.sendTable = (req, res) => {
  dbCtrl.getTable(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}

userCtrl.createTable = (req, res) => {
  dbCtrl.createTable(req.body)
    .then((result) => {
      console.log(result);
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}

userCtrl.insertEntry = (req, res) => {
  dbCtrl.insertRow(req.body)
  .then( (result) => {
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}

userCtrl.updateEntry = (req, res) => {
  dbCtrl.updateRow(req.body)
  .then( (result) => {
    console.log(result);
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}

userCtrl.deleteEntry = (req, res) => {
  dbCtrl.deleteRow(req.body)
  .then( (result) => {
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}

userCtrl.rawQuery = (req, res) => {
  dbCtrl.commandLine(req.body)
  .then( (result) => {
    console.log(result);
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}
userCtrl.dropTable = (req, res) => {
  dbCtrl.dropTable(req.body)
  .then( (result) => {
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}
userCtrl.count = (req, res) => {
  dbCtrl.count(req.body)
  .then(result => {
    console.log('user controller', result);
    res.json(result);
  })
  .catch(err => {
    console.log(err)
    res.end('error')
  })
}
userCtrl.sum = (req, res) => {
  dbCtrl.sum(req.body)
  .then(result => {
    res.json(result);
  })
  .catch(err => {
    res.end('error')
  })
}
userCtrl.average = (req, res) => {
  dbCtrl.average(req.body)
  .then(result => {
    res.json(result);
  })
  .catch(err => {
    res.end('error')
  })
}

userCtrl.searchTable = (req, res) => {
  dbCtrl.searchTable(req.body)
    .then((result) => {
      console.log(result);
      res.json(result);
    }).catch((err) => {
      console.log(err);
      res.end('error')
    })
}

///////////////////////////////////
// New Join Table Middleware
userCtrl.sendJoinTable = (req, res) => {
  dbCtrl.getJoinTable(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error');
    });
}
///////////////////////////////////

///////////////////////////////////
// New Request Field Middleware
userCtrl.sendTableFields = (req, res) => {
  dbCtrl.getTableFields(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}
///////////////////////////////////

userCtrl.renderChart = (req, res) => {
      res.json(dbCtrl.renderChart(req.body));
}

module.exports = userCtrl;<commit_msg>not trying to overwrite feature<commit_after>const dbCtrl = require('./dbCtrl');

const userCtrl = {};

userCtrl.sendTableList = (req, res) => {
  dbCtrl.showTables(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}

userCtrl.sendTable = (req, res) => {
  dbCtrl.getTable(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}

userCtrl.createTable = (req, res) => {
  dbCtrl.createTable(req.body)
    .then((result) => {
      console.log(result);
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}

userCtrl.insertEntry = (req, res) => {
  dbCtrl.insertRow(req.body)
  .then( (result) => {
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}

userCtrl.updateEntry = (req, res) => {
  dbCtrl.updateRow(req.body)
  .then( (result) => {
    console.log(result);
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}

userCtrl.deleteEntry = (req, res) => {
  dbCtrl.deleteRow(req.body)
  .then( (result) => {
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}

userCtrl.rawQuery = (req, res) => {
  dbCtrl.commandLine(req.body)
  .then( (result) => {
    console.log(result);
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}
userCtrl.dropTable = (req, res) => {
  dbCtrl.dropTable(req.body)
  .then( (result) => {
    res.json(result);
  })
  .catch( (err) => {
    console.log(err);
    res.end('error')
  });
}
userCtrl.count = (req, res) => {
  dbCtrl.count(req.body)
  .then(result => {
    console.log('user controller', result);
    res.json(result);
  })
  .catch(err => {
    console.log(err)
    res.end('error')
  })
}
userCtrl.sum = (req, res) => {
  dbCtrl.sum(req.body)
  .then(result => {
    res.json(result);
  })
  .catch(err => {
    res.end('error')
  })
}
userCtrl.average = (req, res) => {
  dbCtrl.average(req.body)
  .then(result => {
    res.json(result);
  })
  .catch(err => {
    res.end('error')
  })
}

userCtrl.searchTable = (req, res) => {
  dbCtrl.searchTable(req.body)
    .then((result) => {
      console.log(result);
      res.json(result);
    }).catch((err) => {
      console.log(err);
      res.end('error')
    })
}

///////////////////////////////////
// New Join Table Middleware
userCtrl.sendJoinTable = (req, res) => {
  dbCtrl.getJoinTable(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error');
    });
}
///////////////////////////////////

///////////////////////////////////
// New Request Field Middleware
userCtrl.sendTableFields = (req, res) => {
  dbCtrl.getTableFields(req.body)
    .then((result) => {
      res.json(result);
    })
    .catch((err) => {
      console.log(err);
      res.end('error')
    });
}
///////////////////////////////////

userCtrl.renderChart = (req, res) => {
  res.json(dbCtrl.renderChart(req.body));
}

module.exports = userCtrl;
{'fraction_non_alphanumeric': 0.2512437810945274, 'fraction_numerical': 0.0, 'mean_word_length': 2.2116824762855716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 89, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3706142', 'n_tokens_mistral': 2388, 'n_tokens_neox': 2381, 'n_words': 323}