Jaguar-dart / jaguar_orm

Source-generated ORM with relations (one-to-one, one-to-many, many-to-many), preloading, cascading, polymorphic relations, etc
https://jaguar-dart.github.io
BSD 3-Clause "New" or "Revised" License
217 stars 54 forks source link

Print SQL from Find statement #190

Open jamespet77 opened 4 years ago

jamespet77 commented 4 years ago

Is it possible to print the generated SQL from a Find statement? I am trying to recreate some rather complicated queries and would like to know if it is correct?

JamesMcIntosh commented 4 years ago

Something like this should be able to do it, you'll just have to choose the correct composer for your database, in this case SQFlite.

import 'package:jaguar_query/jaguar_query.dart';
import 'package:jaguar_query_sqflite/composer.dart';

class SQFlite {
  static void print(Find query) => print(composeFind(query));
}