mssqlTypeForSqlTypeName function

MssqlType? mssqlTypeForSqlTypeName(
  1. String sqlTypeName
)

The driver's classification of sqlTypeName, or null if nothing here recognises it.

A null answer is a real answer: the caller decides whether to stop, skip the column or ask for a converter. Guessing would move the failure to runtime.

Implementation

MssqlType? mssqlTypeForSqlTypeName(String sqlTypeName) {
  final name = sqlTypeName.toLowerCase();
  final known = _byName[name];
  if (known != null) return known;
  // The CLR types arrive as text, which is what varchar means to the driver.
  if (textOnlySqlTypes.contains(name)) return MssqlType.varchar;
  return null;
}