Registry / database / react-native-sqlite-helper

react-native-sqlite-helper

JSON →
library1.1.4jsnpmunverified

react-native-sqlite-helper is a Promise-based wrapper for react-native-sqlite-storage, providing non-blocking SQLite operations in React Native. It offers a functional SQL interface with formatted return values (arrays of objects). Current stable version is 1.1.4 (last updated 2022?). It requires react-native-sqlite-storage as a peer dependency, which must be linked natively. Differentiators: simpler Promise API compared to the callback-based react-native-sqlite-storage, and no native code inclusion itself, relying on the parent library.

npm install react-native-sqlite-helper
INSTALL
IMPORT
SIG · REACT-NATIVE-SQLIT
R
react-native-sqlite-helper
databasejavascriptv1.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import SQLite from 'react-native-sqlite-helper'
import { SQLite } from 'react-native-sqlite-helper'
This package exports a default object containing the API methods (openDB, executeSql, etc.). Named import will be undefined.
openDB
import SQLite from 'react-native-sqlite-helper'; SQLite.openDB({ name: 'test.db' })
import { openDB } from 'react-native-sqlite-helper'
All methods like openDB are properties of the default export.
executeSql
import SQLite from 'react-native-sqlite-helper'; SQLite.executeSql('SELECT * FROM users')
const db = SQLite.openDB(...); db.executeSql(...)
The package does not expose a database object; instead it uses a singleton pattern. executeSql is called statically from the default import, not from a database instance.

Demonstrates typical CRUD operations: open database, create table, insert, query, and close. Note that executeSql returns an array of objects directly (formatted return).

import SQLite from 'react-native-sqlite-helper'; // Open or create a database (singleton) await SQLite.openDB({ name: 'mydb.db', location: 'default' }); // Create a table await SQLite.executeSql('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)'); // Insert a row await SQLite.executeSql('INSERT INTO users (name, age) VALUES (?, ?)', ['Alice', 30]); // Query rows const rows = await SQLite.executeSql('SELECT * FROM users'); console.log(rows); // [{id:1, name:'Alice', age:30}] // Close the database await SQLite.closeDB();
Debug
Known issues
breakingYou must install react-native-sqlite-storage and link it natively before using this package.
fix
Install react-native-sqlite-storage via npm, then run react-native link react-native-sqlite-storage or follow the Android/iOS linking steps.
affects: >=1.0.0
gotchaPackage uses a singleton pattern: calling executeSql is done statically, not on a database instance. Mixing multiple databases may cause confusion.
fix
Use openDB with a unique name for each database; the library internally manages a singleton connection map based on database name. Always call openDB before any operations.
affects: >=1.0.0
gotchaexecuteSql returns an array of objects directly, not a resultSet object like the parent library. Do not expect rows._array or something similar.
fix
Use async/await and treat the result as a plain array of row objects.
affects: >=1.0.0
deprecatedThis package has not been updated in years and may not work with newer React Native versions (e.g., autolinking, Hermes).
fix
Consider switching to alternatives like react-native-quick-sqlite or expo-sqlite, or use react-native-sqlite-storage directly.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'react-native-sqlite-storage'
Missing peer dependency react-native-sqlite-storage.
fix
npm install react-native-sqlite-storage && react-native link react-native-sqlite-storage
Undefined is not an object (evaluating 'SQLite.openDB')
Incorrect import: trying named import instead of default import.
fix
Use: import SQLite from 'react-native-sqlite-helper'
No database connection: you must call openDB first
Calling executeSql before openDB.
fix
Ensure await SQLite.openDB({ name: 'mydb.db', location: 'default' }) is called before any database operations.
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies
react-native-sqlite-storagerequiredpeer dependency: provides native SQLite bindings; this package is a wrapper
Agent activity
9 hits · last 30 days
node
8
Resources
react-native-sqlite-helper — npm install react-native-sqlite-helper · libregistry