Registry / database / expo-sqlite-query-helper

expo-sqlite-query-helper

JSON →
library1.1.4jsnpmunverified

SQLite query helper library for expo-sqlite providing a simplified API for common database operations like create table, insert, search, update, and delete. Version 1.1.4 (latest as of 2022) offers a promise-based async interface and TypeScript types. It wraps expo-sqlite to reduce boilerplate but has limited documentation and no active maintenance. Key differentiators: minimal abstraction, direct result objects with insertId/rowsAffected/lastQuery, and support for batch inserts. However, it lacks full SQL flexibility and is not recommended for complex queries.

npm install expo-sqlite-query-helper
INSTALL
IMPORT
SIG · EXPO-SQLITE-QUERY-
E
expo-sqlite-query-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.

Database
import Database from 'expo-sqlite-query-helper'
import { Database } from 'expo-sqlite-query-helper'
Default export, not named. Use default import syntax.
createTable
import { createTable } from 'expo-sqlite-query-helper'
import createTable from 'expo-sqlite-query-helper'
Named export. Do not use default import.
insert
import { insert } from 'expo-sqlite-query-helper'
const insert = require('expo-sqlite-query-helper').insert
ESM named export. CommonJS require works but may fail in bundlers.
search
import { search } from 'expo-sqlite-query-helper'
import search from 'expo-sqlite-query-helper'
Named export. Ensure correct import syntax.
update
import { update } from 'expo-sqlite-query-helper'
const { update } = require('expo-sqlite-query-helper')
CommonJS require works but prefer ESM for tree-shaking.

Initialize database, create a table, insert a row, and select all rows using promise-based async/await.

import { useEffect } from 'react'; import Database, { createTable, insert, search, update, remove } from 'expo-sqlite-query-helper'; const App = () => { Database('myDatabase.db'); useEffect(() => { const setup = async () => { try { await createTable('user', { name: 'TEXT NOT NULL', email: 'TEXT UNIQUE' }); await insert([{ name: 'Alice', email: 'alice@example.com' }], 'user'); const result = await search('user', null, null, null); console.log('Rows:', result.row._array); } catch (e) { console.error(e); } }; setup(); }, []); };
Debug
Known issues
breakingDatabase() must be called before any query function; otherwise queries fail silently.
fix
Call Database('dbName') at the top level of your component or module before using createTable, insert, etc.
affects: >=1.0.0
gotchasearch() returns rows in a `row._array` property, not directly as an array.
fix
Access results via result.row._array instead of expecting result.row to be an array.
affects: >=1.0.0
gotchainsert() expects data as an array of objects, even for a single row; passing a plain object may cause unexpected behavior.
fix
Always pass an array: insert([{...}], 'table').
affects: >=1.0.0
gotchaThe library uses expo-sqlite's WebSQL under the hood, which is deprecated in modern Expo versions.
fix
Consider using expo-sqlite's newer async API directly or switch to a maintained library.
affects: >=1.0.0
deprecatedPeer dependency expo-sqlite ^8.4.0 is outdated; newer versions (>=10) have breaking API changes.
fix
Pin expo-sqlite to 8.4.x or upgrade library if compatible version exists.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property '_array' of undefined
Database() not called before query, or table does not exist.
fix
Ensure Database('dbName') is called before any query, and the table exists.
SQLiteError: no such table: tablename
createTable not called or table name misspelled.
fix
Check that createTable is executed successfully before inserting/selecting.
TypeError: (0 , _expoSqliteQueryHelper.insert) is not a function
Incorrect import (named instead of default, or vice versa).
fix
Use correct import: import { insert } from 'expo-sqlite-query-helper'.
undefined is not an object (evaluating 'result.row._array')
Trying to access row before promise resolves.
fix
Use await or .then() to get the result before accessing properties.
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies
exporequiredPeer dependency; required for React Native environment
expo-sqliterequiredPeer dependency; underlying SQLite database driver
reactrequiredPeer dependency; React core
Agent activity
8 hits · last 30 days
node
8
Resources
expo-sqlite-query-helper — npm install expo-sqlite-query-helper · libregistry