Socket
Socket
Sign inDemoInstall

sqlite-sync

Package Overview
Dependencies
2
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sqlite-sync

Node module to sqlite sync and async


Version published
Weekly downloads
394
increased by20.86%
Maintainers
1
Install size
51.8 MB
Created
Weekly downloads
 

Changelog

Source

0.3.9 (2019-08-12)

  • use of fixed sql.js version 0.3.2 instead of latest to avoid compability errors

Readme

Source

sqlite-sync.js

Node module to sqlite sync and async
NPM

node.js package for database connection with SQLite , and execute SQL commands synchronously or asynchronously.

Install

npm install sqlite-sync

Usage

var sqlite = require('sqlite-sync'); //requiring

//Connecting - if the file does not exist it will be created
sqlite.connect('test/test.db'); 

//Creating table - you can run any command
sqlite.run("CREATE TABLE COMPANYS(ID  INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL);",function(res){
	if(res.error)
		throw res.error;
	console.log(res);
});

//Inserting - this function can be sync to, look the wiki
sqlite.insert("COMPANYS",{NAME:"My COMPANY"}, function(res){
	if(res.error)
		throw res.error;
	console.log(res);
});

//Updating - returns the number of rows modified - can be async too
var rows_modified = sqlite.update("COMPANYS",{NAME:"TESTING UPDATE"},{ID:1});

//Create your function
function test(a,b){
	return a+b;
}

//Add your function to connection
sqlite.create_function(test);

// Use your function in the SQL
console.log(sqlite.run("SELECT ID, test(NAME, ' Inc') as NAME FROM COMPANYS"));

// Closing connection 
sqlite.close();

Keywords

FAQs

Last updated on 16 Aug 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc