MCPcopy
hub / github.com/prisma/prisma / $queryRaw

Method $queryRaw

packages/client/src/runtime/getPrismaClient.ts:668–685  ·  view source on GitHub ↗

* Executes a raw query provided through a safe tag function * @see https://github.com/prisma/prisma/issues/7142 * * @param query * @param values * @returns

(query: TemplateStringsArray | Sql, ...values: any[])

Source from the content-addressed store, hash-verified

666 * @returns
667 */
668 $queryRaw(query: TemplateStringsArray | Sql, ...values: any[]) {
669 return this._createPrismaPromise((transaction) => {
670 if ((query as TemplateStringsArray).raw !== undefined || (query as Sql).sql !== undefined) {
671 return this.$queryRawInternal(transaction, '$queryRaw', ...toSql(query, values))
672 }
673
674 throw new PrismaClientValidationError(
675 `\`$queryRaw\` is a tag function, please use it like the following:
676\`\`\`
677const result = await prisma.$queryRaw\`SELECT * FROM User WHERE id = \${1} OR email = \${'user@email.com'};\`
678\`\`\`
679
680Or read our docs at https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#queryraw
681`,
682 { clientVersion: this._clientVersion },
683 )
684 })
685 }
686
687 /**
688 * Counterpart to $queryRaw, that returns strongly typed results

Callers 15

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
doPrismaQueryFunction · 0.95
doPrismaQueryFunction · 0.95
doPrismaQueryFunction · 0.95
doPrismaQueryFunction · 0.95
doPrismaQueryFunction · 0.95
fetchFunction · 0.95
test.tsFile · 0.80
test.tsFile · 0.80
index.test-d.tsFile · 0.80

Calls 2

$queryRawInternalMethod · 0.95
toSqlFunction · 0.85

Tested by 3

mainFunction · 0.76
mainFunction · 0.76
mainFunction · 0.76