MCPcopy
hub / github.com/prisma/prisma / performIO

Method performIO

packages/adapter-mariadb/src/mariadb.ts:50–77  ·  view source on GitHub ↗
(query: SqlQuery)

Source from the content-addressed store, hash-verified

48 }
49
50 protected async performIO(query: SqlQuery): Promise<ArrayModeResult> {
51 const { sql, args } = query
52
53 try {
54 const req = {
55 sql,
56 rowsAsArray: true,
57 dateStrings: true,
58 // Disable automatic conversion of JSON blobs to objects.
59 autoJsonMap: false,
60 // Return JSON strings as strings, not objects.
61 // Available in the driver, but not provided in the typings.
62 jsonStrings: true,
63 // Disable automatic conversion of BIT(1) to boolean.
64 // Available in the driver, but not provided in the typings.
65 bitOneIsBoolean: false,
66 typeCast,
67 }
68 const values = args.map((arg, i) => mapArg(arg, query.argTypes[i]))
69 const execute = this.mariadbOptions?.useTextProtocol
70 ? this.client.query.bind(this.client)
71 : this.client.execute.bind(this.client)
72 return await execute(req, values)
73 } catch (e) {
74 const error = e as Error
75 this.onError(error)
76 }
77 }
78
79 protected onError(error: unknown): never {
80 debug('Error in performIO: %O', error)

Callers 2

queryRawMethod · 0.95
executeRawMethod · 0.95

Calls 2

onErrorMethod · 0.95
mapArgFunction · 0.90

Tested by

no test coverage detected