internal void Bind(NativeToBackendTypeConverterOptions nativeToBackendTypeConverterOptions) { BoundValue = TypeInfo.ConvertToBackend(NpgsqlValue, true, nativeToBackendTypeConverterOptions); if (BoundValue == null) { BoundFormatCode = (short)FormatCode.Binary; } else { BoundFormatCode = TypeInfo.SupportsBinaryBackendData ? (short)FormatCode.Binary : (short)FormatCode.Text; } IsBound = true; }
/// <summary> /// Constructor. /// </summary> /// <param name="ConnectionString">Connection string.</param> /// <param name="Pooled">Pooled</param> /// <param name="Shared">Controls whether the connector can be shared.</param> public NpgsqlConnector(NpgsqlConnectionStringBuilder ConnectionString, bool Pooled, bool Shared) { this.settings = ConnectionString; _connection_state = ConnectionState.Closed; _pooled = Pooled; _shared = Shared; _isInitialized = false; _state = NpgsqlClosedState.Instance; _mediator = new NpgsqlMediator(); _NativeToBackendTypeConverterOptions = NativeToBackendTypeConverterOptions.Default.Clone(new NpgsqlBackendTypeMapping()); _planIndex = 0; _portalIndex = 0; _notificationThreadStopCount = 1; }
internal void SetTypeOID(int oid, NativeToBackendTypeConverterOptions nativeToBackendTypeConverterOptions) { TypeOID = oid; // If the db backend specified another type, we have to use that one. NpgsqlBackendTypeInfo backendTypeInfo; nativeToBackendTypeConverterOptions.OidToNameMapping.TryGetValue(TypeOID, out backendTypeInfo); if (backendTypeInfo != null && backendTypeInfo.Name != TypeInfo.Name && !explicitUnknown) { NpgsqlDbType = backendTypeInfo.NpgsqlDbType; Value = NpgsqlValue; } }