<commit_before>export default {
  insert: {
    newTx: {
      row: `INSERT INTO new_txs (hex) VALUES ($1) RETURNING id`
    }
  },
  select: {
    blocks: {
      latest: `SELECT
                 height as height,
                 hash as hash,
                 header as header
               FROM
                 blocks
               ORDER BY
                 height DESC
               LIMIT 1`,
      txids: `SELECT
                blocks.height as height,
                hash as hash,
                txids as txids,
                txid as txid
              FROM
                blocks
              RIGHT OUTER JOIN
                transactions ON transactions.height = blocks.height
              WHERE
                txid = $1`,
      heightByHash: `SELECT
                       height as height
                     FROM
                       blocks
                     WHERE
                       hash = $1`,
      heightByHeight: `SELECT
                         height as height
                       FROM
                         blocks
                       WHERE
                         height = $1`,
      headers: `SELECT
                  header as header
                FROM
                  blocks
                WHERE
                  height > $1 AND
                  height <= $2
                ORDER BY
                  height ASC`
    },
    transactions: {
      byTxId: `SELECT
                 tx as tx,
                 height as height
               FROM
                 transactions
               WHERE
                 txid = $1`
    },
    history: {
      transactions: `SELECT
                       otxid as otxid,
                       oheight as oheight,
                       itxid as itxid,
                       iheight as iheight
                     FROM
                       history
                     WHERE
                       address = ANY($1)
                       (oheight > $2 OR iheight > $2) AND
                       (oheight <= $3 OR iheight <= $3)`,
      unspent: `SELECT
                  otxid as otxid,
                  oindex as oindex,
                  ovalue as ovalue,
                  oscript as oscript,
                  oheight as oheight
                FROM
                  history
                WHERE
                  address = ANY($1) AND
                  (oheight > $2 OR iheight > $2) AND
                  (oheight <= $3 OR iheight <= $3) AND
                  itxid IS NULL`,<commit_msg>fix sql queries for addresses/query<commit_after>export default {
  insert: {
    newTx: {
      row: `INSERT INTO new_txs (hex) VALUES ($1) RETURNING id`
    }
  },
  select: {
    blocks: {
      latest: `SELECT
                 height as height,
                 hash as hash,
                 header as header
               FROM
                 blocks
               ORDER BY
                 height DESC
               LIMIT 1`,
      txids: `SELECT
                blocks.height as height,
                hash as hash,
                txids as txids,
                txid as txid
              FROM
                blocks
              RIGHT OUTER JOIN
                transactions ON transactions.height = blocks.height
              WHERE
                txid = $1`,
      heightByHash: `SELECT
                       height as height
                     FROM
                       blocks
                     WHERE
                       hash = $1`,
      heightByHeight: `SELECT
                         height as height
                       FROM
                         blocks
                       WHERE
                         height = $1`,
      headers: `SELECT
                  header as header
                FROM
                  blocks
                WHERE
                  height > $1 AND
                  height <= $2
                ORDER BY
                  height ASC`
    },
    transactions: {
      byTxId: `SELECT
                 tx as tx,
                 height as height
               FROM
                 transactions
               WHERE
                 txid = $1`
    },
    history: {
      transactions: `SELECT
                       otxid as otxid,
                       oheight as oheight,
                       itxid as itxid,
                       iheight as iheight
                     FROM
                       history
                     WHERE
                       address = ANY($1) AND
                       (oheight > $2 OR iheight > $2) AND
                       (oheight <= $3 OR iheight <= $3 OR oheight IS NULL OR (iheight IS NULL AND itxid IS NOT NULL)`,
      unspent: `SELECT
                  otxid as otxid,
                  oindex as oindex,
                  ovalue as ovalue,
                  oscript as oscript,
                  oheight as oheight
                FROM
                  history
                WHERE
                  address = ANY($1) AND
                  (oheight > $2 OR iheight > $2) AND
                  (oheight <= $3 OR iheight <= $3 OR oheight IS NULL) AND
                  itxid IS NULL`,
{'fraction_non_alphanumeric': 0.05003909304143862, 'fraction_numerical': 0.007036747458952306, 'mean_word_length': 0.7056666666666667, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '4697852', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1086, 'n_words': 381}