<commit_before>var systemModel= function() {
  var self= this;

  self.prompt= ko.observable('\\U:\\d mysql>');
  self.cmd= ko.observable('');

  self.user= ko.observable('');
  self.password= ko.observable('');
  self.database= ko.observable('');
  self.host= ko.observable('localhost');

  self.results= ko.observableArray();

  self.displayprompt= ko.computed(function() {
    var prompt= self.prompt().replace(/\\h/g, self.host())
                             .replace(/\\u/g, self.user() || '(none)')
                             .replace(/\\d/g, self.database() || '(none)')
                             .replace(/\\U/g,
                                      self.user() + '@' + self.host());
    return prompt;
  }, this);

  self.run= function(form) {
    var cmd= this.cmd();
    var space= cmd.indexOf(' ');
    if (space < 0)
      space= cmd.length;

    switch (cmd.substring(0, space)) {
    case 'connect':
      var space2= cmd.indexOf(' ', space + 1);
      if (space2 < 0) space2= cmd.length;
      this.user(cmd.substring(space + 1, space2));
      if (space != space2)
        this.password(cmd.substring(space2 + 1));
      break;

    case 'prompt':
      var prompt= cmd.substring(space + 1);
      if (!prompt) prompt= "mysql>";
      this.prompt(prompt);
      break;

    case 'use':
      var database= cmd.substring(space + 1);
      if (!database) break;
      this.database(database);
      break;

    default:
      $.getJSON("db.php?callback=?",
                { user: this.user(),
                  password: this.password(),
                  database: this.database(),
                  cmd: this.cmd() },
                self.addResult);
    }
  };

  self.addResult= function(data) {
    self.results.push(data);
    $("html, body").animate({
      scrollTop: $(document).height() - $(window).height()<commit_msg>Allow specifying no current database<commit_after>var systemModel= function() {
  var self= this;

  self.prompt= ko.observable('\\U:\\d mysql>');
  self.cmd= ko.observable('');

  self.user= ko.observable('');
  self.password= ko.observable('');
  self.database= ko.observable('');
  self.host= ko.observable('localhost');

  self.results= ko.observableArray();

  self.displayprompt= ko.computed(function() {
    var prompt= self.prompt().replace(/\\h/g, self.host())
                             .replace(/\\u/g, self.user() || '(none)')
                             .replace(/\\d/g, self.database() || '(none)')
                             .replace(/\\U/g,
                                      self.user() + '@' + self.host());
    return prompt;
  }, this);

  self.run= function(form) {
    var cmd= this.cmd();
    var space= cmd.indexOf(' ');
    if (space < 0)
      space= cmd.length;

    switch (cmd.substring(0, space)) {
    case 'connect':
      var space2= cmd.indexOf(' ', space + 1);
      if (space2 < 0) space2= cmd.length;
      this.user(cmd.substring(space + 1, space2));
      if (space != space2)
        this.password(cmd.substring(space2 + 1));
      break;

    case 'prompt':
      var prompt= cmd.substring(space + 1);
      if (!prompt) prompt= "mysql>";
      this.prompt(prompt);
      break;

    case 'use':
      var database= cmd.substring(space + 1);
      this.database(database);
      break;

    default:
      $.getJSON("db.php?callback=?",
                { user: this.user(),
                  password: <PASSWORD>(),
                  database: this.database(),
                  cmd: this.cmd() },
                self.addResult);
    }
  };

  self.addResult= function(data) {
    self.results.push(data);
    $("html, body").animate({
      scrollTop: $(document).height() - $(window).height()
{'fraction_non_alphanumeric': 0.17884199134199133, 'fraction_numerical': 0.007575757575757576, 'mean_word_length': 1.988682295877122, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3649557', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1121, 'n_words': 236}