<commit_before>#!/usr/bin/env node
/*
Copyright (C) 2010, <NAME> <<EMAIL>>

See license text in LICENSE file
*/

// Load configuration
var cfg = require("./config").cfg;

// Require modules
var
  sys = require("sys"),
  mysql_libmysqlclient = require("../mysql-libmysqlclient");


var conn = mysql_libmysqlclient.createConnectionSync(cfg.host, cfg.user, cfg.password, cfg.database),
  res,
  random_number,
  random_boolean,
  last_insert_id,
  i;
  
res = conn.querySync("DROP TABLE IF EXISTS " + cfg.test_table + ";");
res = conn.querySync("CREATE TABLE " + cfg.test_table +
  " (autoincrement_id BIGINT NOT NULL AUTO_INCREMENT," +
  " random_number INT(8) NOT NULL, random_boolean BOOLEAN NOT NULL," +
  " PRIMARY KEY (autoincrement_id)) TYPE=MEMORY;");

if (!res) {
  sys.puts("conn.query('DELETE FROM cfg.test_table')");
  process.exit(1);
}

sys.puts("Start");

for (i = 0; i < cfg.insert_rows_count; i += 1)
{
  random_number = Math.round(Math.random() * 1000000);
  random_boolean = (Math.random() > 0.5) ? 1 : 0;
  sys.puts("\u001B[1ABefore queryAsync #" + (i + 1));
  
  (function () {
    var j = i;
    conn.query("INSERT INTO " + cfg.test_table +
      " (random_number, random_boolean) VALUES ('" + random_number +
      "', '" + random_boolean + "');", function (result) {
        sys.puts("\u001B[1ACallback #" + (j + 1));
        if (result !== null) {
          result.freeSync();
        }
      });<commit_msg>Indentation fix<commit_after>#!/usr/bin/env node
/*
Copyright (C) 2010, <NAME> <<EMAIL>>

See license text in LICENSE file
*/

// Load configuration
var cfg = require("./config").cfg;

// Require modules
var
  sys = require("sys"),
  mysql_libmysqlclient = require("../mysql-libmysqlclient");


var conn = mysql_libmysqlclient.createConnectionSync(cfg.host, cfg.user, cfg.password, cfg.database),
  res,
  random_number,
  random_boolean,
  last_insert_id,
  i;
  
res = conn.querySync("DROP TABLE IF EXISTS " + cfg.test_table + ";");
res = conn.querySync("CREATE TABLE " + cfg.test_table +
  " (autoincrement_id BIGINT NOT NULL AUTO_INCREMENT," +
  " random_number INT(8) NOT NULL, random_boolean BOOLEAN NOT NULL," +
  " PRIMARY KEY (autoincrement_id)) TYPE=MEMORY;");

if (!res) {
  sys.puts("conn.query('DELETE FROM cfg.test_table')");
  process.exit(1);
}

sys.puts("Start");

for (i = 0; i < cfg.insert_rows_count; i += 1)
{
  random_number = Math.round(Math.random() * 1000000);
  random_boolean = (Math.random() > 0.5) ? 1 : 0;
  sys.puts("\u001B[1ABefore queryAsync #" + (i + 1));
  
  (function () {
    var j = i;
    conn.query("INSERT INTO " + cfg.test_table +
      " (random_number, random_boolean) VALUES ('" + random_number +
      "', '" + random_boolean + "');", function (result) {
      sys.puts("\u001B[1ACallback #" + (j + 1));
      if (result !== null) {
        result.freeSync();
      }
    });
{'fraction_non_alphanumeric': 0.17110799438990182, 'fraction_numerical': 0.020336605890603085, 'mean_word_length': 3.5575079872204474, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5424152', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1005, 'n_words': 221}