-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
2,220 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Database } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { Database } from "../../vendor/[email protected]/mod.ts"; | ||
import * as pkgutils from "../utils/pkg.ts"; | ||
import usePantry from "./usePantry.ts"; | ||
import useConfig from "./useConfig.ts"; | ||
|
@@ -9,10 +9,9 @@ export default async function() { | |
const path = useConfig().cache.join('pantry.db').rm() // delete it first so pantry instantiation doesn't use cache | ||
const { ls, ...pantry } = usePantry() | ||
|
||
const sqlite = await install_sqlite() | ||
if (!sqlite) return | ||
Deno.env.set("DENO_SQLITE_PATH", sqlite.string) | ||
const db = new Database(path.string) | ||
const sqlite3 = (await install_sqlite())?.string | ||
if (!sqlite3) return | ||
const db = new Database(path.string, { sqlite3 }) | ||
|
||
// unique or don’t insert what is already there or just dump tables first perhaps | ||
|
||
|
@@ -161,8 +160,7 @@ async function _db() { | |
const sqlite = await useCellar().has({ project: "sqlite.org", constraint: new semver.Range('*') }) | ||
if (!sqlite) return | ||
const ext = host().platform == 'darwin' ? 'dylib' : 'so' | ||
Deno.env.set("DENO_SQLITE_PATH", sqlite.path.join(`lib/libsqlite3.${ext}`).string) | ||
return new Database(path.string) | ||
return new Database(path.string, {readonly: true, sqlite3: sqlite.path.join(`lib/libsqlite3.${ext}`).string}) | ||
} | ||
|
||
import install from "../porcelain/install.ts" | ||
|
@@ -178,4 +176,4 @@ async function install_sqlite(): Promise<Path | undefined> { | |
return bar.path.join(`lib/libsqlite3.${ext}`) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# [email protected] | ||
|
||
vendored and modified to not download their binary of sqlite and instead be | ||
customizable to use our own. | ||
|
||
https://github.com/denodrivers/sqlite3/issues/119 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./src/database.ts"; | ||
export * from "./src/statement.ts"; | ||
export { SqliteError } from "./src/util.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Result Codes | ||
export const SQLITE3_OK = 0; | ||
export const SQLITE3_ERROR = 1; | ||
export const SQLITE3_INTERNAL = 2; | ||
export const SQLITE3_PERM = 3; | ||
export const SQLITE3_ABORT = 4; | ||
export const SQLITE3_BUSY = 5; | ||
export const SQLITE3_LOCKED = 6; | ||
export const SQLITE3_NOMEM = 7; | ||
export const SQLITE3_READONLY = 8; | ||
export const SQLITE3_INTERRUPT = 9; | ||
export const SQLITE3_IOERR = 10; | ||
export const SQLITE3_CORRUPT = 11; | ||
export const SQLITE3_NOTFOUND = 12; | ||
export const SQLITE3_FULL = 13; | ||
export const SQLITE3_CANTOPEN = 14; | ||
export const SQLITE3_PROTOCOL = 15; | ||
export const SQLITE3_EMPTY = 16; | ||
export const SQLITE3_SCHEMA = 17; | ||
export const SQLITE3_TOOBIG = 18; | ||
export const SQLITE3_CONSTRAINT = 19; | ||
export const SQLITE3_MISMATCH = 20; | ||
export const SQLITE3_MISUSE = 21; | ||
export const SQLITE3_NOLFS = 22; | ||
export const SQLITE3_AUTH = 23; | ||
export const SQLITE3_FORMAT = 24; | ||
export const SQLITE3_RANGE = 25; | ||
export const SQLITE3_NOTADB = 26; | ||
export const SQLITE3_NOTICE = 27; | ||
export const SQLITE3_WARNING = 28; | ||
export const SQLITE3_ROW = 100; | ||
export const SQLITE3_DONE = 101; | ||
|
||
// Open Flags | ||
export const SQLITE3_OPEN_READONLY = 0x00000001; | ||
export const SQLITE3_OPEN_READWRITE = 0x00000002; | ||
export const SQLITE3_OPEN_CREATE = 0x00000004; | ||
export const SQLITE3_OPEN_DELETEONCLOSE = 0x00000008; | ||
export const SQLITE3_OPEN_EXCLUSIVE = 0x00000010; | ||
export const SQLITE3_OPEN_AUTOPROXY = 0x00000020; | ||
export const SQLITE3_OPEN_URI = 0x00000040; | ||
export const SQLITE3_OPEN_MEMORY = 0x00000080; | ||
export const SQLITE3_OPEN_MAIN_DB = 0x00000100; | ||
export const SQLITE3_OPEN_TEMP_DB = 0x00000200; | ||
export const SQLITE3_OPEN_TRANSIENT_DB = 0x00000400; | ||
export const SQLITE3_OPEN_MAIN_JOURNAL = 0x00000800; | ||
export const SQLITE3_OPEN_TEMP_JOURNAL = 0x00001000; | ||
export const SQLITE3_OPEN_SUBJOURNAL = 0x00002000; | ||
export const SQLITE3_OPEN_SUPER_JOURNAL = 0x00004000; | ||
export const SQLITE3_OPEN_NONMUTEX = 0x00008000; | ||
export const SQLITE3_OPEN_FULLMUTEX = 0x00010000; | ||
export const SQLITE3_OPEN_SHAREDCACHE = 0x00020000; | ||
export const SQLITE3_OPEN_PRIVATECACHE = 0x00040000; | ||
export const SQLITE3_OPEN_WAL = 0x00080000; | ||
export const SQLITE3_OPEN_NOFOLLOW = 0x01000000; | ||
|
||
// Prepare Flags | ||
export const SQLITE3_PREPARE_PERSISTENT = 0x00000001; | ||
export const SQLITE3_PREPARE_NORMALIZE = 0x00000002; | ||
export const SQLITE3_PREPARE_NO_VTAB = 0x00000004; | ||
|
||
// Fundamental Datatypes | ||
export const SQLITE_INTEGER = 1; | ||
export const SQLITE_FLOAT = 2; | ||
export const SQLITE_TEXT = 3; | ||
export const SQLITE_BLOB = 4; | ||
export const SQLITE_NULL = 5; |
Oops, something went wrong.