MCPcopy Create free account
hub / github.com/effect-app/libs / runStatement

Function runStatement

repos/effect/packages/sql/sqlite-node/src/SqliteClient.ts:149–167  ·  view source on GitHub ↗
(
        statement: Sqlite.Statement,
        params: ReadonlyArray<unknown>,
        raw: boolean
      )

Source from the content-addressed store, hash-verified

147 )
148 db.exec(`PRAGMA busy_timeout = ${busyTimeout}`)
149
150 if (options.disableWAL !== true) {
151 db.exec("PRAGMA journal_mode = WAL")
152 }
153
154 const prepareCache = yield* Cache.make({
155 capacity: options.prepareCacheSize ?? 200,
156 timeToLive: options.prepareCacheTTL ?? Duration.minutes(10),
157 lookup: (sql: string) =>
158 Effect.try({
159 try: () => db.prepare(sql),
160 catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to prepare statement", "prepare") })
161 })
162 })
163
164 const runStatement = (
165 statement: StatementSync,
166 params: ReadonlyArray<unknown>,
167 raw: boolean
168 ) =>
169 Effect.withFiber<ReadonlyArray<any>, SqlError>((fiber) => {
170 const useSafeIntegers = Context.get(fiber.context, Client.SafeIntegers)

Callers 2

runFunction · 0.70
executeUnpreparedFunction · 0.70

Calls 5

classifyErrorFunction · 0.70
getMethod · 0.65
succeedMethod · 0.45
runMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…