<commit_before>local DBI, dbh = require [[DBI]]

function db_connect()
  local connection = settings.db.default
  dbh = assert(DBI.Connect(
    connection.driver,
    connection.database,
    connection.username,
    connection.password,
    connection.host,
    connection.port
  ))

  -- check status of the connection
  return dbh:ping()
end

function db_query(query, ...)
  -- prepare a query
  local sth = assert(dbh:prepare(query))

  -- execute select with a bind variable
  sth:execute(...)

  return sth
end

<commit_msg>Database connection autocommit set to 'true' by default.<commit_after>local DBI, dbh = require [[DBI]]

function db_connect()
  local connection = settings.db.default
  if not connection.autocommit then connection.autocommit = true end

  dbh = assert(DBI.Connect(
    connection.driver,
    connection.database,
    connection.username,
    connection.password,
    connection.host,
    connection.port
  ))

  -- commit the transaction
  dbh:autocommit(connection.autocommit)

  -- check status of the connection
  return dbh:ping()
end

function db_query(query, ...)
  -- prepare a query
  local sth = assert(dbh:prepare(query))

  -- execute select with a bind variable
  sth:execute(...)

  return sth
end


{'fraction_non_alphanumeric': 0.10305958132045089, 'fraction_numerical': 0.0, 'mean_word_length': 3.392226148409894, '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': '1962694', 'n_tokens_mistral': 385, 'n_tokens_neox': 373, 'n_words': 106}