History log of /expo/packages/expo-sqlite/src/SQLite.ts (Results 1 – 25 of 27)
Revision Date Author Comments
# c4573fff 08-Sep-2023 Kudo Chien <[email protected]>

[sqlite] only return successful result from executeSqlAsync (#24336)

# Why

only return successful `ResultSet` from `executeSqlAsync`
fixes #23884

# How

as commented at https://github.com/e

[sqlite] only return successful result from executeSqlAsync (#24336)

# Why

only return successful `ResultSet` from `executeSqlAsync`
fixes #23884

# How

as commented at https://github.com/expo/expo/issues/23884#issuecomment-1678448739, we should only return successful `ResultSet` from `executeSqlAsync`.

# Test Plan

update test-suite and make sure it passed on both ios and android

show more ...


# 50e16f8c 08-Sep-2023 Alan Hughes <[email protected]>

[android][sqlite] Add support for running raw queries (#24320)


# 8a424beb 11-Aug-2023 James Ide <[email protected]>

[lint] Upgrade to Prettier v3, typescript-eslint to v6 (#23544)

Why
---
Prettier 3 is out. Add support for it with this linter config.

**Note for reviewer:** the first commit is the one with th

[lint] Upgrade to Prettier v3, typescript-eslint to v6 (#23544)

Why
---
Prettier 3 is out. Add support for it with this linter config.

**Note for reviewer:** the first commit is the one with the actual
changes. The rest of this PR are changes to get the linter passing
(mostly autofix).

How
---
Update eslint-config-prettier and eslint-plugin-prettier. To address
deprecation warnings, also update typescript-eslint/parser and
typescript-eslint/eslint-plugin.
Because of an update to typescript-eslint/parser, we need to suppress
deprecation warnings (documented in a comment).

Regenerated test snapshots. Due to the upgraded dependencies, typecasts
and optional chaining are now auto-fixable by lint. This converts
warnings into autofixes.

Test Plan
---
`yarn test` in the linter config. Run `expotools check --all --fix-lint
--no-build --no-test --no-uniformity-check` to try this config on the
whole repo.

---------

Co-authored-by: Expo Bot <[email protected]>

show more ...


# 74e0b8df 02-Aug-2023 Alan Hughes <[email protected]>

[sqlite] CRSQLite integration (#23791)

# Why
Supercedes #23728

Completes ENG-8809
Investigate possibility of using [crsqlite](https://vlcn.io/) in
`expo-sqlite` which allows database syncing b

[sqlite] CRSQLite integration (#23791)

# Why
Supercedes #23728

Completes ENG-8809
Investigate possibility of using [crsqlite](https://vlcn.io/) in
`expo-sqlite` which allows database syncing between clients.

# How
- Added the crsqlite extension as a framework and provided an event that
contains the changeset to send to the server.
- Currently only works on iOS.
- Needs input on an API
- Discussion about how to handle the sync server
- Need to look into demo using TinyBase. This will require writing a
custom `persister`

# Test Plan


https://github.com/expo/expo/assets/30924086/1b576700-4ff7-4270-9f50-7e0d464b4975

show more ...


# 6c4baee8 28-Jul-2023 Alan Hughes <[email protected]>

[sqlite] Add synchronous close method (#23757)


# c52e83e3 28-Jul-2023 Kudo Chien <[email protected]>

[sqlite] fix missing types about transaction from openDatabase (#23751)

# Why

fixes #23667
close ENG-9446

# How

- from #23109, we moved the returned type of `openDatabase()` from `WebSQLDa

[sqlite] fix missing types about transaction from openDatabase (#23751)

# Why

fixes #23667
close ENG-9446

# How

- from #23109, we moved the returned type of `openDatabase()` from `WebSQLDatabase` to `SQLiteDatabase`. however some properties from websql like the `transaction` and `readTransaction` are missing from `SQLiteDatabase`. this pr tries to add those missing properties.
- migrates **test-suite/tests/SQLite** to typescript based which to dogfood our typings
- update generated doc

# Test Plan

- test test-suite SQLite from ios bare-expo
- run `yarn tsc` from **apps/test-suite**

show more ...


# 4a7bfa1d 27-Jun-2023 Kudo Chien <[email protected]>

[sqlite] add experimental promise support (#23109)

# Why

fixes #13357
close ENG-8685

# How

- originally, the callbacks for websql doesn't support Promise. when people using either 'async/a

[sqlite] add experimental promise support (#23109)

# Why

fixes #13357
close ENG-8685

# How

- originally, the callbacks for websql doesn't support Promise. when people using either 'async/async` or '.then` inside the callback, the statement will be executed after the "transaction end" statement.
- we should we low level control without websql at all.
- introduce low-level `execAsync`
- introduce `transactionAsync`
usage
```tsx
const db = SQLite.openDatabase('dbName', version);

const readOnly = true;
await db.transactionAsync(async tx => {
const result = await tx.executeSqlAsync('SELECT COUNT(*) FROM USERS', []);
console.log('Count:', result.rows[0]['COUNT(*)']);
}, readOnly);
```
note that the result is the [`ResultSet` type](https://github.com/expo/expo/blob/065419647694cf9341261bc7ac614d05e4bac27d/packages/expo-sqlite/src/SQLite.types.ts#L167-L177) but not the [`SQLResultSet` type](https://github.com/expo/expo/blob/065419647694cf9341261bc7ac614d05e4bac27d/packages/expo-sqlite/src/SQLite.types.ts#L93C18-L121). people can access the result items by `rows[0]` rather than `rows.item(0)`. i was thinking to deprecate websql somehow and it doesn't make sense to wrap the result by the [`WebSQLResultSet` again](https://github.com/nolanlawson/node-websql/blob/b3e48284572108feff1cd019dc7f13c1d8aa34b2/lib/websql/WebSQLTransaction.js#L12-L36)

# Test Plan

add some SQLite Async unit tests and test suite ci should be passed

show more ...


# 09ee9580 27-Jun-2023 Alan Hughes <[email protected]>

[android][sqlite] Migrate to Expo Modules API (#23115)


# c1d37355 23-Mar-2023 Alan Hughes <[email protected]>

[ios][sqlite] Migrate to Expo Modules API (#21721)

# Why
Continue migrating modules to Expo Modules API

# How
Followed the usual migration steps

# Test Plan
All tests passing in `bare-expo`


# 3f4e5fe5 11-Apr-2022 Kudo Chien <[email protected]>

[sqlite] Add `closeAsync` and `deleteAsync` method (#16831)

# Why

requested from AWS Amplify to add Expo integration for the `@aws-amplify/datastore` package.

# How

- exposing `closeAsync`

[sqlite] Add `closeAsync` and `deleteAsync` method (#16831)

# Why

requested from AWS Amplify to add Expo integration for the `@aws-amplify/datastore` package.

# How

- exposing `closeAsync` method publicly
- add `deleteAsync` method

# Test Plan

test-suite SQLite
- added a `should delete db on filesystem from the `deleteAsync()` call` test case

Co-authored-by: Bartłomiej Bukowski <[email protected]>

show more ...


# a7112dad 28-Mar-2022 Bartosz Kaszubowski <[email protected]>

[docs] detect broken internal links in generated doc comments, fix links (#16771)

Co-authored-by: Tomasz Sapeta <[email protected]>


# e2a59be1 19-Nov-2021 Evan Bacon <[email protected]>

[expo-sqlite] Remove lodash (#12523)


# 35f78160 01-Sep-2021 Bartosz Kaszubowski <[email protected]>

[eslint-config] remove `arrowParens` overwrite, reformat files (#14232)


# 8285c032 13-Aug-2021 Tomasz Sapeta <[email protected]>

Rename unimodules imports to expo-modules-core


# abded2bb 13-Aug-2021 Bartosz Kaszubowski <[email protected]>

[sqlite] add doc comments in source, update types (#13976)

* [sqlite] add doc comments in source, update types

* correct two types, support unions of array values + test

* remove debug log

[sqlite] add doc comments in source, update types (#13976)

* [sqlite] add doc comments in source, update types

* correct two types, support unions of array values + test

* remove debug log

* Update packages/expo-sqlite/src/SQLite.ts

Co-authored-by: Tomasz Sapeta <[email protected]>

* regenerate data after review

* Update docs/components/plugins/api/APISectionInterfaces.tsx

Co-authored-by: Bartłomiej Bukowski <[email protected]>

* update map file

* fix lint after review updates

Co-authored-by: Tomasz Sapeta <[email protected]>
Co-authored-by: Bartłomiej Bukowski <[email protected]>

show more ...


# b91f886f 18-Mar-2020 James Ide <[email protected]>

[lint] Add "prefer-const" setting (#7389)

* [lint] Add "prefer-const" setting

See https://github.com/expo/expo/blob/master/guides/Expo%20JavaScript%20Style%20Guide.md#let-and-const which explains

[lint] Add "prefer-const" setting (#7389)

* [lint] Add "prefer-const" setting

See https://github.com/expo/expo/blob/master/guides/Expo%20JavaScript%20Style%20Guide.md#let-and-const which explains the overall rationale for using `const` (mainly to pick a lintable option and to reduce attention cost talking about it).

Tested by adding a test case to the linter and running tests and looking at the snapshot to see that the linter autofixed let to const.

* [lint] Apply let/const autofixes

* Add build files

show more ...


# 92f6de58 14-Feb-2020 Will Schurman <[email protected]>

[eslint-config-universe] Add import ordering alphabetization (#7038)


# 034d2790 09-Sep-2019 Szymon20000 <[email protected]>

[sqlite] Improve exported types in expo-sqlite module. (#5544)

# Why

Resolves #5264

# How

Copy several types from @types/websql.


# 79a5fc63 31-Aug-2019 James Ide <[email protected]>

[lint] Add a "lint" script to all packages and fix lint warnings & errors

This turns on linting for all of the packages, enforced by `expotools check-packages`. I added a "lint" script to each packa

[lint] Add a "lint" script to all packages and fix lint warnings & errors

This turns on linting for all of the packages, enforced by `expotools check-packages`. I added a "lint" script to each package and an `.eslintrc.js` file created by expo-module-scripts. For some packages like jest-expo that are intended to run on Node, I used a small handwritten ESLint config that uses the universe/node config.

Tested with `expotools check-packages` after fixing all the lint warnings and errors.

show more ...


# 5daa27a2 04-Jul-2019 Tomasz Sapeta <[email protected]>

[sqlite] fix typings of SQLiteCallback


# 5cb26b36 04-Jul-2019 Tomo Krajina <[email protected]>

[sqlite] Export WebSQLDatabase and Query (#4446)

# Why

The current `d.ts` file for SQLIte is:

```typescript
import './polyfillNextTick';
declare type InternalResultSet = {
error: Error;

[sqlite] Export WebSQLDatabase and Query (#4446)

# Why

The current `d.ts` file for SQLIte is:

```typescript
import './polyfillNextTick';
declare type InternalResultSet = {
error: Error;
} | {
insertId?: number;
rowsAffected: number;
rows: Array<{
[column: string]: any;
}>;
};
export declare type SQLiteCallback = (error?: Error | null, resultSet?: InternalResultSet) => void;
export declare function openDatabase(name: string, version?: string, description?: string, size?: number, callback?: (db: WebSQLDatabase) => void): WebSQLDatabase;
declare type WebSQLDatabase = unknown;
declare const _default: {
openDatabase: typeof openDatabase;
};
export default _default;
```

Since `WebSQLDatabase` is `unknown` it forces the user to work with the result of `openDatabase()` as with any other type-unsafe object. Basically erasing any improvement from a typescript declaration file.

Note that even the DefinitelyTyped `.d.ts` has (almost) everything needed to make the API completely typesafe (one thing missing is probably `openDatabase()` returning a `Database` instead of `any`): https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/expo/index.d.ts#L2595

# How

This PR adds a new interface `WebSQLDatabase` with the following method:

```
exec(queries: Query[], readOnly: boolean, callback: SQLiteCallback): void
```

and makes `openDatabase()` return that interface.

In addition to that it also exposes `Query` and `ResultSet`. They are renamed from `InternalQuery` and `InternalResultSet`, since they aren't really "internal" types, but exposed to the user in the APIs.

This PR is just an idea, feedback is welcome.

show more ...


# e712c79c 07-May-2019 Tomasz Sapeta <[email protected]>

[av][sqlite] fix TS errors when building packages


# 23ecce05 07-May-2019 Cedric van Putten <[email protected]>

Refactor lodash modules to cherry-picked usage (#4091)

Why

This PR fixes #4086, Lodash has dropped support for the separate module packages. With this, you are using an "active" supported Lodash

Refactor lodash modules to cherry-picked usage (#4091)

Why

This PR fixes #4086, Lodash has dropped support for the separate module packages. With this, you are using an "active" supported Lodash version.

How

I basically replaced all usages of the `lodash.<package>` with `lodash` in the `package.json` and updated their imports to `require('lodash/<package>')`.

Test Plan

It's a relatively small change, and if I screwed up the CI should show my (character) flaws.

show more ...


# 8254067a 21-Mar-2019 Szymon20000 <[email protected]>

[expo-sqlite] Fix PRAGMA detection and .exec method (#3804)


# 0002abea 20-Mar-2019 Szymon20000 <[email protected]>

[expo-sqlite] Add .exec method to let execute SQL code outside of a transaction (#3790)

Resolves #3496


12