Function resolve_connection_ref_and_secret_ref

Source
pub(crate) fn resolve_connection_ref_and_secret_ref(
    with_options: WithOptions,
    session: &SessionImpl,
    object: Option<TelemetryDatabaseObject>,
) -> Result<(WithOptionsSecResolved, PbConnectionType, Option<u32>), RwError>
Expand description

Resolves connection references and secret references in WithOptions.

This function takes WithOptions (typically from a CREATE/ALTER statement), resolves any CONNECTION and SECRET references, and merges their properties with the directly specified options.

§Arguments

  • with_options - The original WithOptions containing user-specified options and references
  • session - The current user session, used to access catalogs and verify permissions
  • object - Optional telemetry information about the database object being created/altered

§Returns

A tuple containing:

  • WithOptionsSecResolved - WithOptions with all references resolved and merged
  • PbConnectionType - The type of the referenced connection (if any)
  • Option<u32> - The ID of the referenced connection (if any)

§Workflow

  1. Extract connector name, options, secret refs, and connection refs from with_options
  2. Resolve any CONNECTION references by looking them up in the catalog
  3. Resolve any SECRET references by looking them up in the catalog
  4. Merge properties from CONNECTION with directly specified options
  5. Perform validation to ensure no conflicts between options
  6. Return the merged options, connection type, and connection ID