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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-sqlite3

v0.1.1

Published

SQlite3 binding for react native based on FMDB.

Readme

react-native-sqlite3

React native wrapper for sqlite3 using FMDB. Currently only limited FMDB commands are exposed.

Thread safety:

All sql commands are executed using FMDatabaseQueue, so thread safety comes for free(FMDB rocks!).

Getting Started

  1. First, cd to your RN project directory
  2. Run the command npm install react-native-sqlite3 --save.
  3. Go to Build Phases tab -> Expand the Link Binary With Libraries and click the + button to add libsqlite3.tbd(for newer xcode version) or libsqlite3.dylib(for older version of xcode).

iOS: Using CocoaPods

Assuming you have CocoaPods installed, create a PodFile like this in your app's project directory. You can leave out the modules you don't need.

xcodeproj 'path/to/YourProject.xcodeproj/'

pod 'React', :subspecs => ['Core', 'RCTText', 'RCTWebSocket'], :path => 'node_modules/react-native'
pod 'react-native-sqlite3', :path => 'node_modules/react-native-sqlite3'

post_install do |installer|
  target = installer.pods_project.targets.select{|t| 'React' == t.name}.first
  phase = target.new_shell_script_build_phase('Run Script')
  phase.shell_script = "if nc -w 5 -z localhost 8081 ; then\n  if ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\n    echo \"Port 8081 already in use, packager is either not running or not running correctly\"\n    exit 2\n  fi\nelse\n  open $SRCROOT/../node_modules/react-native/packager/launchPackager.command || echo \"Can't start packager automatically\"\nfi"
end

Now run pod install. This will create an Xcode workspace containing all necessary native files, including react-native-sqlite3. From now on open YourProject.xcworkspace instead of YourProject.xcodeproject in Xcode. Because React Native's iOS code is now pulled in via CocoaPods, you also need to remove the React, RCTImage, etc. subprojects from your app's Xcode project, in case they were added previously.

iOS: Manual install(not tested yet- please let me know if you run into any issues)

  1. Add FMDB to your project as describe here http://stackoverflow.com/a/11441518/3371160
  2. Open up your project in xcode and right click the package.
  3. Click Add files to 'Your project name'
  4. Navigate to /node_modules/react-native-sqlite3/iOS/RNSqlite
  5. Click 'Add'

Example Usage:

var db = require('react-native-sqlite3');

////you don't have to open the db explicitly. When you execute a sql, db is opened if not already open.
var openPromise = db.open(dbName);

var insertEmpSql = "insert into Employee (id, name) values (:id, :name)";
var insertEmpParams = {id: "11111", name: "John Doe"};
var insertPromise = db.executeInsert("employee.db", insertEmpSql, insertEmpParams);

var updateEmpSql = "update Employee set name = :newName where id = :empId";
var updateEmpParams = {empId: "11111", newName: "John DoeChanged"};
var updatePromise = this.db.executeUpdate("employee.db", updateEmpSql, updateEmpParams);
    
var myEmpId = "11111"; 
var sqlStmt = 'SELECT * from Employees where id = :employeeId';
var paramMap = {employeeId: myEmpId};  
var getEmployeePromise = this.db.executeQuery("employee.db", sqlStmt, params);
getEmployeePromise.then(function(data){
   console.log("employee data is"+ data);
});
   

Known limitations:

  1. No batch statements support.(this should be trivial though)
  2. No transaction support yet.
  3. No built in migration support yet.

Android support:

I saw this RN plugin https://github.com/jbrodriguez/react-native-android-sqlite based on SqliteOpenHelper. Will be reusing it or create a wrapper directly against SqliteOpenHelper in the next few weeks. Any PR's are welcome :)