$queryRaw method

Future $queryRaw(
  1. String query, {
  2. List parameters = const [],
})

Query raw SQL.

Example:

final result = await prisma.$queryRaw('SELECT * FROM User');

Implementation

Future<dynamic> $queryRaw(
  String query, {
  List<dynamic> parameters = const [],
}) async {
  final String sdl = GraphQLField(
    'mutation',
    fields: GraphQLFields([
      GraphQLField(
        'queryRaw',
        args: GraphQLArgs([
          GraphQLArg('query', query),
          GraphQLArg('parameters', serializeRawParameters),
        ]),
      )
    ]),
  ).toSdl();

  // Request the query.
  final QueryEngineResult result = await $engine.request(
    query: sdl,
    headers: $headers,
  );

  // Get query result.
  final dynamic queryRawResult = result.data['queryRaw'];

  // Return the result.
  return deserializeRawResult(queryRawResult);
}