Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-quick-sqlite

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-quick-sqlite

Fast sqlite implementation for react-native

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.6K
decreased by-13.07%
Maintainers
1
Weekly downloads
 
Created
Source

React Native Quick SQLite

The **fastest** SQLite implementation for react-native.

Frame 2


Quick SQLite uses JSI bindings, removes all the overhead of intercommunication between JavaScript code and C++ code, making CRUDing entities from SQLite super fast!

Big ❤️ to react-native-sqlite-storage and react-native-sqlite2 for paving the way, this library should offer a similar API.

GOTCHAS

  • JSI bindings are not available when connected to the web browser debugger, from now on you should use Flipper.
  • TODO: Everything is saved on the application's home folder. I got lazy and ignore any passed path parameter, if you need this feel free to open a PR.
  • TODO: When parsing the SQLite rows the strings are parsed as ASCII strings instead of UTF-8, C++ could help fixing this issue
  • TODO: The API is NOT 100% the same as sqlite-storage, sqlite-storage returns an item function on the query result, it takes an index number and returns an object, I simply return an array, because creating deeply nested structures from C++ is somewhat cumbersome.

Use TypeORM

The recommended way to use this package is to use TypeORM with patch-package. TypeORM already has a sqlite-storage driver. In the example project on the patch folder you can a find a patch for TypeORM, it basically just replaces all the react-native-sqlite-storage strings in TypeORM with react-native-quick-sqlite, and does a tiny change for the way it accesses the resulting rows from the SQL execution.

Follow the instructions to make TypeORM work with rn (enable decorators, configure babel, etc), then apply the patch via patch-package and you should be good to go.

If you are particularly masochistic you can hand write SQL and query the database directly yourself.

Installation

yarn add react-native-quick-sqlite

Low level API

interface ISQLite {
  open: (dbName: string) => any;
  close: (dbName: string) => any;
  executeSql: (
    dbName: string,
    query: string,
    params: any[] | undefined
  ) => {
    rows: any[];
    insertId?: number;
  };
}

// It is globally available in a variable called `sqlite`
sqlite.open({...options})

sqlite is a globally registered object, so you can directly call it from anywhere in your javascript. The methods throw when an execution error happens, so try ... catch them.

License

react-native-quick-sqlite is licensed under MIT.

Keywords

FAQs

Package last updated on 31 Jul 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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc