isSpecialQuery static method

bool isSpecialQuery(
  1. ParseResult result
)

Implementation

static bool isSpecialQuery(ParseResult result) {
  // Pragma queries don't need to be intercepted and transformed
  if (result.sql.toUpperCase().startsWith('PRAGMA')) {
    return true;
  }

  //  IF the query is on the lookup table, we don't need to add CRDT columns
  if (_specialQueries.contains(result.sql.toUpperCase())) {
    return true;
  }
  ;

  final statement = result.rootNode;
  if (statement is SelectStatement) {
    //     If the query is accessing the schema table, we don't need to add CRDT columns
    if (statement.from != null) {
      if (statement.from is TableReference) {
        final table = statement.from as TableReference;
        if ([
          'sqlite_schema',
          'sqlite_master',
          'sqlite_temp_schema',
          'sqlite_temp_master'
        ].contains(table.tableName)) {
          return true;
        }
      }
    }
  }
  return false;
}