npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

opendatabase

v0.2.1

Published

The WebSql standard for Nodejs using Sqlite3.

Downloads

32

Readme

#opendatabase

A WebSql standardized Sqlite3 wrapper for Nodejs

NPM

Author: Robert Edward Steckroth II

Digital Persona: Surgemcgee, Bustout [email protected]

License: GNU GENERAL PUBLIC LICENSE Version 3

Features:

  • Modified Sqlite3 binaries to efficiently support this module
  • Low overhead (no regex or looping mechanisms are used).
  • Conforms to WebSql practices

Caveats:

  1. SQLResultSet.rowsAffected is not integrated.
  2. Data type assignment is not supported. All "?" replacements will be inserted as a STRING into the database
  3. Synchronous database calls (Although the module utilizes asynchronous practice).
  4. Database init version and size attributes are superficial (not important).
  5. Only works on Linux varients (developed on Ubuntu)

#####NOTE: opendatabase works the same way as WebSql. The WebSql documentation should be suitable to learn this module.

Description:

This module conforms to the WebSql standard. However, some WebSql features are not integrated yet (see caveats above). A modified version of the Sqlite3 binaries is used to format json data and efficiently integrated into nodejs. Query results are stored statically into JavaScript objects and retrieved via object keys. The module has no dependencies other than the Sqlite3 binaries distributed with it. The install_sqlite3_json.sh script in the base directory compiles and install this module into the correct directory for use with the opendatabase module.

// Example opendatabase run through

var path = require('path'),
        opendatabase = require('opendatabase')

var database_dir = path.join(path.dirname(__filename), 'test_openDatabase.sqlite')
var open_db = new opendatabase({name: database_dir, version: "1.0", description: "Example database for indurate.js", size: 3*1024*1024})


var log = function(message) {
    console.log('[opendatabase test script] '+message)

}

var err = function(tx, error) {
    console.log(error.message+'Code: '+error.code)
    // tx object is here as well
    log('inserting data into table from the error callback..')
    tx.executeSql('INSERT OR REPLACE INTO opendb_test VALUES(?, ?);', ['Column 1 text', 'Column 2 text'], function(tx, results) {
        log('Successfully inserted data with sql command --> '+results.rows.sql+'\nResults length is '+results.rows.length)
        log('\n\n-- This should indicate that your opendatabase module is working correctly. --')
    }, err) // <-- !THIS WILL BE CALLED IN A INFINATE LOOP IF THE TX RETURNS AN ERROR

}


log('Opening a new transaction..')
open_db.transaction(function(tx) {
    log('Creating a new table if not exists..')
    tx.executeSql('CREATE TABLE IF NOT EXISTS opendb_test(? TEXT UNIQUE, ? TEXT);', ['name', 'column_field'], function(tx, results) {
        log('Successfully created new table with sql command --> '+results.rows.sql+'\nResults length is '+results.rows.length)
        log('Inserting a table with a bad sql command (syntax errors)..')
        tx.executeSql('INSERT OR REPdLACE INTO opendb_test VALUES(?, ?);', ['Column 1 text', 'Column 2 text'], function(tx, results) {
            log('This can\'t happen because the command syntax is bad')
        }, err) // Call this due to syntax errors
    }, err)

})

The Indurate.js wrapper for opendatabase is the recomended way to manage your server/phonegap application database needs