Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use @db/sqlite example #1177

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
use @db/sqlite example
  • Loading branch information
boda-sh authored Nov 21, 2024
commit b9d556bc2ba932e28820f1c9a1029baf956253b1
7 changes: 5 additions & 2 deletions runtime/tutorials/connecting_to_databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,17 @@ There are two primary solutions to connect to SQLite in Deno:

### Connect to SQLite with the FFI Module

[sqlite3](https://deno.land/x/sqlite3) provides JavaScript bindings to the
[@db/sqlite](https://jsr.io/@db/sqlite) provides JavaScript bindings to the
SQLite3 C API, using [Deno FFI](../reference/deno_namespace_apis.md#ffi).

```ts
import { Database } from "https://deno.land/x/sqlite3@LATEST_VERSION/mod.ts";
import { Database } from "jsr:@db/[email protected]";

const db = new Database("test.db");

const [version] = db.prepare("select sqlite_version()").value<[string]>()!;
console.log(version);

db.close();
```

Expand Down
Loading