ConnectionOptions.fromUsageProfile constructor

ConnectionOptions.fromUsageProfile(
  1. OdbcUsageProfile profile
)

Preset timeouts and reconnect policy for a usage profile.

OdbcUsageProfile.legacy matches the historical all-null constructor. Other profiles enable login/query timeouts and transient reconnect.

Implementation

factory ConnectionOptions.fromUsageProfile(OdbcUsageProfile profile) {
  final preset = resolveOdbcUsageProfilePreset(profile);
  return ConnectionOptions(
    connectionTimeout: preset.connectionTimeout,
    loginTimeout: preset.loginTimeout,
    queryTimeout: preset.queryTimeout,
    autoReconnectOnConnectionLost: preset.autoReconnectOnConnectionLost,
    maxReconnectAttempts: preset.maxReconnectAttempts,
    reconnectBackoff: preset.reconnectBackoff,
  );
}