getSelectQueryAndArgs method

Map<String, dynamic> getSelectQueryAndArgs({
  1. bool withValues = false,
})

Implementation

Map<String, dynamic> getSelectQueryAndArgs({bool withValues = false}) {
  // compile query
  this._compileSelect();

  // get args
  final args = List<dynamic>.from(this._getQueryArgs());

  // if with values assign args to ?
  if (withValues) {
    this._query = this._query!.replaceAllMapped(new RegExp(r'\?'), (match) {
      final value = args.first;
      args.removeAt(0);
      return "'$value'";
    });
  }

  // return query
  return {
    'query': this._query,
    'args': this._queryArgs,
  };
}