How to use the sqlite.OPEN_READONLY function in sqlite

To help you get started, we’ve selected a few sqlite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github germanrcuriel / conan-exiles-admin-map / src / controllers / api / pets.js View on Github external
async getAll (req, res) {
    try {
      const db = await sqlite.open(res.database.file, { mode: sqlite.OPEN_READONLY })
      const data = await db.all(queries.pets)

      data.map(async (pet) => {
        pet.name = getPetName(pet)
        pet.info = getPetInfo(pet)
        pet.owner = getPetOwnerId(pet)
        pet.greater = pet.info.indexOf('Greater') > -1
        return pet
      })

      res.send({ data: data, update: res.database.time })
      await db.close()
    } catch (e) {
      res.send({ error: "There was an error while querying the database" })
    }
  }
github germanrcuriel / conan-exiles-admin-map / src / controllers / api / players.js View on Github external
async getAll (req, res) {
    try {
      const db = await sqlite.open(res.database.file, { mode: sqlite.OPEN_READONLY })
      const data = await db.all(queries.players)

      data.map((player) => {
        if (player.char_name) player.char_name = player.char_name.slice(1, -1)
        if (player.guild_name) {
          if (player.guild_name === nullValue || !player.guild_name) {
            player.guild_name = ''
          } else {
            player.guild_name = player.guild_name.slice(1, -1)
          }
        }
        if (player.rank === nullValue || !player.rank) player.rank = ''
      })

      res.send({ data: data, update: res.database.time })
      await db.close()
github germanrcuriel / conan-exiles-admin-map / src / controllers / api / pippi / thespians.js View on Github external
async getAll (req, res) {
    try {
      const db = await sqlite.open(res.database.file, { mode: sqlite.OPEN_READONLY })
      const data = await db.all(queries.pippiThespians)

      data.map((pippi) => {
        pippi.name = getPippiMobName(pippi)
        pippi.info = getPippiMobProfession(pippi)
        delete pippi.buffer
      })

      res.send({ data: data, update: res.database.time })
      await db.close()
    } catch (e) {
      res.send({ error: "There was an error while querying the database" })
    }
  }

sqlite

SQLite client for Node.js applications with SQL-based migrations API written in Typescript

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis