parse static method

QualifiedTablename parse(
  1. String fullyQualifiedName
)

Implementation

static QualifiedTablename parse(String fullyQualifiedName) {
  try {
    // allow only paired double quotes within the quotes
    // identifiers can't be empty
    final regex = RegExp(r'^"((?:[^"]|"")+)"\."((?:[^"]|"")+)"$');

    final match = regex.firstMatch(fullyQualifiedName)!;
    final namespace = match.group(1)!;
    final tablename = match.group(2)!;

    return QualifiedTablename(
      unescDoubleQ(namespace),
      unescDoubleQ(tablename),
    );
  } catch (_e) {
    throw Exception(
      'Could not parse string into a qualified table name: $fullyQualifiedName',
    );
  }
}