How to use the sqlite.open 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 acarl005 / join-monster-graphql-tools-adapter / src / schema.js View on Github external
email
    posts {
      id
      body
      numComments
      comments {
        id
        body
        authorId
        archived
      }
    }
  }
}`

db.open(path.join(__dirname, '..', 'db', 'test1-data.sl3'))
.then(() => graphql(schema, query))
.then(res => {
  console.log(require('util').inspect(res, { depth: 10 })) // eslint-disable-line
})
.catch(console.error) // eslint-disable-line

github v0idp / Mellow / src / BotClient.js View on Github external
this.on('ready', this.onReady())
			.on('commandPrefixChange', this.onCommandPrefixChange())
			.on('error', console.error)
			.on('warn', console.warn)
			//.on('debug', console.log)
			.on('disconnect', this.onDisconnect())
			.on('reconnecting', this.onReconnect())
			.on('commandError', this.onCmdErr())
			.on('commandBlocked', this.onCmdBlock())
			.on('commandStatusChange', this.onCmdStatusChange())
			.on('groupStatusChange', this.onGroupStatusChange())
			.on('message', this.onMessage());

		// set provider sqlite so we can actually save our config permanently
		this.setProvider(
			sqlite.open(path.join(__dirname.slice(0, -3), 'data/BotSettings.sqlite3')).then(db => new Commando.SQLiteProvider(db))
		).catch(console.error);

		// first we register groups and commands
		this.registry
			.registerDefaultGroups()
			.registerGroups([
				['ombi', 'Ombi'],
				['sonarr', 'Sonarr'],
				['radarr', 'Radarr'],
				['tautulli', 'Tautulli']
			])
			.registerDefaultTypes()
			.registerDefaultCommands({
				'help': true,
				'prefix': true,
				'ping': true,
github blurHY / HorizonSpider / ZeroNet / ContentDB.js View on Github external
async function getContentDB() {
    if (contentDB && contentDB.open)
        return contentDB
    else
        return contentDB = await sqlite.open(path.join(process.env.ZeronetDataPath, "content.db"))
}
github arestivo / splurt / src / database / ArticleDatabase.ts View on Github external
public static async connect(database: string = ':memory:') {
    const conn = await sqlite.open(database)
    await conn.run(createCommand)
    return new ArticleDatabase(database)
  }
github arestivo / splurt / src / database / ArticleDatabase.ts View on Github external
public async replace(articles: Article[]) {
    if (this.database) {
      const conn = await sqlite.open(this.database)
      await conn.run('UPDATE article SET included = false AND excluded = false')

      await conn.run('BEGIN TRANSACTION')
      articles.forEach(async article => {
        const stmt = await conn.prepare('SELECT * FROM article WHERE title = ? AND year = ? AND origin = ?')
        const existing = await stmt.get(article.title, article.year, article.origin)

        if (existing)
          await conn.run('UPDATE article SET doi = ?, publication = ?, authors = ?, type = ?, included = true, excluded = false WHERE title = ? AND year = ? AND origin = ?',
            article.doi,
            article.publication,
            article.authors,
            article.type,

            article.title,
            article.year,
github bhj / karaoke-forever / server / scannerWorker.js View on Github external
  .then(() => sqlite.open(config.database, { Promise }))
  .then(() => {
github bhj / karaoke-forever / server / serverWorker.js View on Github external
  .then(() => sqlite.open(config.database, { Promise }))
  .then(db => db.migrate({
github Syntheti / Orcinus / commands / softban.js View on Github external
const Discord = require("discord.js");
const bot = new Discord.Client();
const sql = require("sqlite");
sql.open("./assets/guildsettings.sqlite");
exports.run = (client, message, args) => {
  sql.get(`SELECT * FROM scores WHERE guildId ="${message.guild.id}"`).then(row => {
  const prefixtouse = row.prefix
  const usage = new Discord.RichEmbed()
            .setColor(0x00A2E8)
            .setThumbnail(client.user.avatarURL)
            .setTitle("Command: " + prefixtouse + "softban")
            .addField("Usage", prefixtouse + "softban @Someone ")
            .addField("Example", prefixtouse + "softban @Someone trying to start trouble.")
            .setDescription("Description: " + "Bans and unbans a user from the current server");

 if (message.member.hasPermission("KICK_MEMBERS")) {
    if (!message.guild.member(client.user).hasPermission('KICK_MEMBERS')) return message.reply('Sorry, i dont have the perms to do this cmd i need KICK_MEMBERS. :x:')
    let reason = args.slice(1).join(' ') || `Moderator didn't give a reason.`;
    if (message.mentions.users.size < 1) return message.channel.send(usage)
    let user = message.guild.member(message.mentions.users.first());

sqlite

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

MIT
Latest version published 6 months ago

Package Health Score

72 / 100
Full package analysis