String sqlWhereBy(Map<String, dynamic> whereValues, [ int option, String append ])

Returns the where criteria (without where) by anding whereValues.

  • option - whether to use FOR_SHARE, FOR_UPDATE or null (default; no lock).

Source Link to Crossdart

String sqlWhereBy(Map<String, dynamic> whereValues, [int option, String append]) {
  final StringBuffer where = new StringBuffer();
  bool first = true;
  for (final String name in whereValues.keys) {
    if (first) first = false;
    else where.write(' and ');


    if (whereValues[name] != null)
      where..write('"[email protected]')..write(name);
      where.write('" is null');

  if (append != null)
    where..write(' ')..write(append);
  if (option == FOR_UPDATE)
    where.write(' for update');
  else if (option == FOR_SHARE)
    where.write(' for share');
  return where.toString();