<commit_before>// websql example adapted from  http://html5demos.com/database-rollback
// original code (c) 

var sys = require('sys');
var webdb = require('../lib/mysql-native/websql');

var db = webdb.openDatabase('test');
db.transaction(function (tx) {
  tx.executeSql("CREATE TABLE `foo` (`id` int(20) DEFAULT NULL, `text` blob ) ENGINE=InnoDB");  
  tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "foobar")');
});

db.transaction(function (tx) {
  tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
    sys.puts('found rows (should be 1): ' + sys.inspect(results)); 
  }, function (tx, err) {
    sys.puts('select* failed: ' + err.message);
  });
});

db.transaction(function (tx) {
  tx.executeSql('DROP TABLE foo');
  // known to fail - so should rollback the DROP statement
  tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "foobar")', [], 
  function(tx, rs)
  {
      sys.puts("insrted " + sys.inspect(rs));
  });
}, function (err) {
  sys.puts('should be rolling back caused by: ' + err.message);
});

db.transaction(function (tx) {
  tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
    sys.puts('found rows (should be 1): ' + sys.inspect(results)); 
  }, function (tx, err) {
    sys.puts('select* failed: ' + err.message);
  });
});
<commit_msg>sys.puts replaced with console.log<commit_after>// websql example adapted from  http://html5demos.com/database-rollback
// original code (c) 

var webdb = require('../lib/mysql-native/websql');

var db = webdb.openDatabase('test');
db.transaction(function (tx) {
  tx.executeSql("CREATE TABLE `foo` (`id` int(20) DEFAULT NULL, `text` blob ) ENGINE=InnoDB");  
  tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "foobar")');
});

db.transaction(function (tx) {
  tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
    console.log('found rows (should be 1): ' + sys.inspect(results)); 
  }, function (tx, err) {
    console.log('select* failed: ' + err.message);
  });
});

db.transaction(function (tx) {
  tx.executeSql('DROP TABLE foo');
  // known to fail - so should rollback the DROP statement
  tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "foobar")', [], 
  function(tx, rs)
  {
      console.log("insrted " + sys.inspect(rs));
  });
}, function (err) {
  sys.puts('should be rolling back caused by: ' + err.message);
});

db.transaction(function (tx) {
  tx.executeSql('SELECT * FROM foo', [], function (tx, results) {
    console.log('found rows (should be 1): ' + sys.inspect(results)); 
  }, function (tx, err) {
    console.log('select* failed: ' + err.message);
  });
});

{'fraction_non_alphanumeric': 0.1903300076745971, 'fraction_numerical': 0.005372217958557176, 'mean_word_length': 3.956273764258555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '187485', 'n_tokens_mistral': 914, 'n_tokens_neox': 881, 'n_words': 226}