Registry / database / expo-sqlite-query-helper-next

expo-sqlite-query-helper-next

JSON →
library1.1.6jsnpmunverified

SQLite query helper library for expo-sqlite, providing a simplified API for common database operations like createTable, insert, search, update, and delete. Current stable version 1.1.6 targets Expo SDK 45+ and expo-sqlite ^10.2.0. It wraps SQLite queries with promise-based results and includes auto-increment ID tracking. Unlike raw expo-sqlite, this library reduces boilerplate but is tightly coupled to Expo's SQLite implementation and lacks support for transactions, migrations, or raw SQL passthrough.

npm install expo-sqlite-query-helper-next
INSTALL
IMPORT
SIG · EXPO-SQLITE-QUERY-
E
expo-sqlite-query-helper-next
databasejavascriptv1.1.6
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-next'
import { Database } from 'expo-sqlite-query-helper-next'
This is a default export. Named import will result in undefined.
createTable
import { createTable } from 'expo-sqlite-query-helper-next'
import createTable from 'expo-sqlite-query-helper-next'
createTable is a named export. Default import will not work.
insert
import { insert } from 'expo-sqlite-query-helper-next'
import { Insert } from 'expo-sqlite-query-helper-next'
Function name is lowercase 'insert'. Case-sensitive.
search
import { search } from 'expo-sqlite-query-helper-next'
import { select } from 'expo-sqlite-query-helper-next'
This library uses 'search' not 'select' for SELECT queries.
update
import { update } from 'expo-sqlite-query-helper-next'
import update from 'expo-sqlite-query-helper-next'
Named export, not default.
remove
import { remove } from 'expo-sqlite-query-helper-next'
import { delete } from 'expo-sqlite-query-helper-next'
This library uses 'remove' not 'delete'.

Initializes a database, creates a table, inserts a row, and selects all rows, logging the result.

import Database, { createTable, insert, search } from 'expo-sqlite-query-helper-next'; import React, { useEffect } from 'react'; import { Text, View } from 'react-native'; export default function App() { Database('myApp.db'); useEffect(() => { createTable('users', { name: 'TEXT NOT NULL', email: 'TEXT UNIQUE' }).then(() => { return insert('users', [{ name: 'Alice', email: 'alice@test.com' }]); }).then(() => { return search('users', null, null, null, null); }).then(({ row }) => { console.log('Users:', row._array); }).catch(err => console.error(err)); }, []); return <View><Text>App ready</Text></View>; }
Debug
Known issues
breakingDatabase initialization must be called before any query function, otherwise queries hang silently.
fix
Call Database('name') at top level of app before any createTable/insert/search etc.
affects: >=0.0.0
gotchaThe insert function expects an array of objects even for single row. Passing a plain object will cause unexpected behavior.
fix
Always wrap data in array: insert('table', [{...}])
affects: >=0.0.0
gotchaResult objects have row, rowAffected, insertID, lastQuery. insertID is only populated after insert, not after update/delete.
fix
Check insertID only when result is from insert() function.
affects: >=0.0.0
deprecatedThe library hardcodes version to '1.0' and ignores user-provided version in Database() call.
fix
Accept that version parameter is currently ignored.
affects: >=0.0.0
gotchasearch() returns data inside row._array, not row directly. row has length and _array properties.
fix
Access results via row._array, not row.
affects: >=0.0.0
Errors
Common errors & fixes
undefined is not an object (evaluating 'row._array')
search() returned undefined because Database was not initialized before calling search.
fix
Call Database('name') at the top of your app, before any useEffect or component that uses search.
TypeError: Cannot destructure property 'row' of 'undefined' or 'null'
Promise from createTable/insert/etc not awaited correctly or Database not initialized.
fix
Ensure Database() is called and that query functions are awaited inside an async function.
SQLiteError: no such table: users
Table not created before insert/search, or database initialized with wrong name.
fix
Call createTable first and wait for it to resolve. Also check that Database('name') matches the database name you use.
insertId is undefined after insert
Insert may have failed silently, or the inserted row didn't generate an auto-increment ID (e.g., table without INTEGER PRIMARY KEY).
fix
Ensure table has an auto-increment column: `id INTEGER PRIMARY KEY AUTOINCREMENT`.
Upgrade
Version history
1.1.6latest on npm
Audit
Dependencies
exporequiredRequired for Expo SQLite module
expo-sqliterequiredCore SQLite functionality
reactrequiredPeer dependency for Expo
Agent activity
7 hits · last 30 days
node
6
Resources
expo-sqlite-query-helper-next — npm install expo-sqlite-query-helper-next · libregistry