<commit_before>var sqlite3 = require('sqlite3').verbose()
var db = new sqlite3.Database(':memory:')

class rest_api {
  run() {
    db.serialize(function () {
      db.run('CREATE TABLE lorem (info TEXT)')
      var stmt = db.prepare('INSERT INTO lorem VALUES (?)')

      for (var i = 0; i < 10; i++) {
        stmt.run('Ipsum ' + i)
      }

      stmt.finalize()

      db.each('SELECT rowid AS id, info FROM lorem', function (err, row) {
        console.log(row.id + ': ' + row.info)
      })

    })
    db.close()
  }
}
module.exports = rest_api;<commit_msg>refs #1 : modify - check whether table exists or not  * 테이블이 존재하는지 체크해서 존재할 경우 새로 생성하지 않도록 하는  코드 추가<commit_after>var sqlite3 = require('sqlite3').verbose()
var db = new sqlite3.Database(':memory:')

class rest_api {
  run() {
    db.serialize(function () {
      db.get("SELECT name FROM sqlite_master WHERE type='table' AND name='note'", function(error, row) {
      		if (row !== undefined) {
      			console.log("table exists. skipping creation");
      		}	else {
      			console.log("creating table")
      			db.run("CREATE TABLE note (content TEXT)", function(error) {
      				if (error.message.indexOf("already exists") != -1) {
      					console.log(error);
      				}
      			});
      		}
      	});
      var stmt = db.prepare('INSERT INTO note VALUES (?)')

      for (var i = 0; i < 10; i++) {
        stmt.run('Ipsum ' + i)
      }

      stmt.finalize()

      db.each('SELECT rowid AS id, content FROM note', function (err, row) {
        console.log(row.id + ': ' + row.info)
      })

    })
    db.close()
  }
}
module.exports = rest_api;
{'fraction_non_alphanumeric': 0.1570552147239264, 'fraction_numerical': 0.008588957055214725, 'mean_word_length': 2.3016194331983804, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2732231', 'n_tokens_mistral': 615, 'n_tokens_neox': 591, 'n_words': 138}