Socket
Book a DemoInstallSign in
Socket

dbdjs.db-sql

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbdjs.db-sql

A like package of dbdjs.db with better-sqlite3 wrapper.

npmnpm
Version
1.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

dbd.js

NPM Downloads Discord Server Repo License Package Version

dbdjs.db-sql

A SQLite version of dbdjs.db, wrapper of better-sqlite3

Table of Contents

Changelog

  • Renamed Database method fetchAll to all

About

dbdjs.db-sql is a SQLite version of dbdjs.db, which was a database for dbd.js version 3.0.0+. This package is a wrapper of better-sqlite3, a better version of node-sqlite3. This package was made with TypeScript and was compiled with typescript to JavaScript ES5, which it's JavaScript code was operateable in old browsers ( typescript package explanation ).

Setup

const Package = require("dbdjs.db-sql")
const db = new Package.Database("database.sql", { timeout: 5000 })

API

  • Package.Database(filename: string[, Interfaces.Options]): Database - Initializing class Database
  • Database.set(table: string, key: string, value: any): none - Creating/Updating the value of a created/existing data
  • Database.get(table: string, key: string): SQLData - Return a data with matching key from the Database
  • Database.delete(table:string, key: string): none - Remove a data with matching key from the Database
  • Database.fetchAll(table: string): Interfaces.SQLData[] - Returns an Array of data in the Table
  • Database.getTables(): Interfaces.TableInformation[] - Returns an Array of Information about Tables from the Database
  • Database.clearTable(table: string): none - Removes the entire data of the Table
  • Database.clearDatabase(): none - Removes the entire table from the Database with it's contents

Interfaces

Options ( BetterSqlite3.Options )

  • readonly?: boolean - open the database connection in readonly mode (default: false).
  • fileMustExist?: boolean - if the database does not exist, an Error will be thrown instead of creating a new file. This option does not affect in-memory or readonly database connections (default: false).
  • timeout?: number - the number of milliseconds to wait when executing queries on a locked database, before throwing a SQLITE_BUSY error (default: 5000).
  • verbose?: function | null - provide a function that gets called with every SQL string executed by the database connection (default: null).

SQLData

  • key: string - The key of data
  • value: any - The value of data

TableInformation

  • type: string - The type of information
  • name: string - The table name
  • tbl_name: string - The table name
  • rootpage: number
  • sql: string - The query which creates the table

License

See LICENSE file in the Github Repository for License.

FAQs

Package last updated on 08 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts