SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Add Flow lib defs for node:sqlite (#55284)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55284

This diff adds Flow type definitions for the `node:sqlite` module, Node.js's built-in SQLite database interface added experimentally in v22.5.0.

**Module Overview:**

The `node:sqlite` module provides synchronous SQLite database operations, enabling embedded database functionality without external dependencies.

**Core Classes:**

1. **DatabaseSync** - Main database interface
   - `constructor(location: string, options?: DatabaseSyncOptions)`
   - `exec(sql: string)` - Execute SQL without returning results
   - `prepare(sql: string)` - Create prepared statement
   - `close()` / `open()` - Manage connection lifecycle
   - `function()` - Register custom SQL functions
   - `createSession()` / `applyChangeset()` - Session/changeset support
   - https://nodejs.org/api/sqlite.html#class-databasesync

2. **StatementSync** - Prepared statement interface
   - `all(...params)` - Return all rows as array
   - `get(...params)` - Return first row
   - `run(...params)` - Execute and return changes/lastInsertRowid
   - `iterate(...params)` - Return iterator over rows
   - `expandedSQL` / `sourceSQL` - SQL inspection
   - https://nodejs.org/api/sqlite.html#class-statementsync

3. **Session** - Change tracking interface
   - `changeset()` - Get changes as Uint8Array
   - `patchset()` - Get minimal changes
   - `close()` - End session

**References:**
- Node.js sqlite module documentation: https://nodejs.org/api/sqlite.html

**Stability:** Experimental (added in v22.5.0)

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D90764441

fbshipit-source-id: 9bce1e13bf8d550211c62d7d5cde255854379363
R
Rob Hogan committed
3d0aa9fa8d1cbd0b364220e22d98781f4d4e1a84
Parent: 534c06f
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 1/23/2026, 2:41:38 PM