internal static Exception TimeScaleValueOutOfRange(byte scale) { return(ADP.Argument(Res.GetString(Res.SQL_TimeScaleValueOutOfRange, scale.ToString(CultureInfo.InvariantCulture)))); }
internal static Exception UnknownSQLType(ODBC32.SQL_TYPE sqltype) { return(ADP.Argument(SR.GetString(SR.Odbc_UnknownSQLType, sqltype.ToString()))); }
internal static ArgumentException GetSchemaRestrictionRequired() { return(ADP.Argument(SR.GetString(SR.ODBC_GetSchemaRestrictionRequired))); }
internal static ArgumentException Fill_EmptyRecord(string parameter, Exception innerException) { return(ADP.Argument(SR.Format(SR.OleDb_Fill_EmptyRecord), parameter, innerException)); }
internal static bool Start(string connectionString, string queue, bool useDefaults) { if (string.IsNullOrEmpty(connectionString)) { if (null == connectionString) { throw ADP.ArgumentNull(nameof(connectionString)); } else { throw ADP.Argument(nameof(connectionString)); } } if (!useDefaults && string.IsNullOrEmpty(queue)) { // If specified but null or empty, use defaults. useDefaults = true; queue = null; // Force to null - for proper hashtable comparison for default case. } // End duplicate Start/Stop logic. bool errorOccurred = false; bool result = false; lock (s_startStopLock) { try { if (null == s_processDispatcher) { // Ensure _processDispatcher reference is present - inside lock. s_processDispatcher = SqlDependencyProcessDispatcher.SingletonProcessDispatcher; } if (useDefaults) { // Default listener. string server = null; DbConnectionPoolIdentity identity = null; string user = null; string database = null; string service = null; bool appDomainStart = false; RuntimeHelpers.PrepareConstrainedRegions(); try { // CER to ensure that if Start succeeds we add to hash completing setup. // Start using process wide default service/queue & database from connection string. result = s_processDispatcher.StartWithDefault( connectionString, out server, out identity, out user, out database, ref service, s_appDomainKey, SqlDependencyPerAppDomainDispatcher.SingletonInstance, out errorOccurred, out appDomainStart); } finally { if (appDomainStart && !errorOccurred) { // If success, add to hashtable. IdentityUserNamePair identityUser = new IdentityUserNamePair(identity, user); DatabaseServicePair databaseService = new DatabaseServicePair(database, service); if (!AddToServerUserHash(server, identityUser, databaseService)) { try { Stop(connectionString, queue, useDefaults, true); } catch (Exception e) { // Discard stop failure! if (!ADP.IsCatchableExceptionType(e)) { throw; } ADP.TraceExceptionWithoutRethrow(e); // Discard failure, but trace for now. } throw SQL.SqlDependencyDuplicateStart(); } } } } else { // Start with specified service/queue & database. result = s_processDispatcher.Start( connectionString, queue, s_appDomainKey, SqlDependencyPerAppDomainDispatcher.SingletonInstance); // No need to call AddToServerDatabaseHash since if not using default queue user is required // to provide options themselves. } } catch (Exception e) { if (!ADP.IsCatchableExceptionType(e)) { throw; } ADP.TraceExceptionWithoutRethrow(e); // Discard failure, but trace for now. throw; } } return(result); }
internal static ArgumentException InvalidRestrictionsDbInfoLiteral(string parameter) { return(ADP.Argument(SR.Format(SR.OleDb_InvalidRestrictionsDbInfoLiteral), parameter)); }
internal static ArgumentException NotSupportedSchemaTable(Guid schema, OleDbConnection connection) { return(ADP.Argument(SR.Format(SR.OleDb_NotSupportedSchemaTable, OleDbSchemaGuid.GetTextFromValue(schema), connection.Provider))); }
internal static Exception UnsupportedColumnTypeForSqlProvider(string columnName, string typeName) { return(ADP.Argument(Res.GetString(Res.SqlProvider_InvalidDataColumnType, columnName, typeName))); }
internal static Exception NotEnoughColumnsInStructuredType() { return(ADP.Argument(Res.GetString(Res.SqlProvider_NotEnoughColumnsInStructuredType))); }
internal static Exception InvalidSqlDbTypeForConstructor(SqlDbType type) { return(ADP.Argument(Res.GetString(Res.SqlMetaData_InvalidSqlDbTypeForConstructorFormat, type.ToString()))); }
internal static Exception NameTooLong(string parameterName) { return(ADP.Argument(Res.GetString(Res.SqlMetaData_NameTooLong), parameterName)); }
internal static Exception EnumeratedRecordFieldCountChanged(int recordNumber) { return(ADP.Argument(Res.GetString(Res.SQL_EnumeratedRecordFieldCountChanged, recordNumber))); }
internal static Exception EnumeratedRecordMetaDataChanged(string fieldName, int recordNumber) { return(ADP.Argument(Res.GetString(Res.SQL_EnumeratedRecordMetaDataChanged, fieldName, recordNumber))); }
internal static Exception MustSetTypeNameForParam(string paramType, string paramName) { return(ADP.Argument(Res.GetString(Res.SQL_ParameterTypeNameRequired, paramType, paramName))); }
internal static ArgumentException AsynchronousNotSupported() { return(ADP.Argument(SR.Format(SR.OleDb_AsynchronousNotSupported))); }
internal static Exception IEnumerableOfSqlDataRecordHasNoRows() { return(ADP.Argument(Res.GetString(Res.IEnumerableOfSqlDataRecordHasNoRows))); }
internal static ArgumentException InvalidProviderSpecified() { return(ADP.Argument(SR.Format(SR.OleDb_InvalidProviderSpecified))); }
internal static Exception BulkLoadInvalidTimeout(int timeout) { return(ADP.Argument(Res.GetString(Res.SQL_BulkLoadInvalidTimeout, timeout.ToString(CultureInfo.InvariantCulture)))); }
internal static ArgumentException InvalidRestrictionsSchemaGuids(string parameter) { return(ADP.Argument(SR.Format(SR.OleDb_InvalidRestrictionsSchemaGuids), parameter)); }
internal static Exception BulkLoadConflictingTransactionOption() { return(ADP.Argument(Res.GetString(Res.SQL_BulkLoadConflictingTransactionOption))); }
// OleDbDataAdapter internal static ArgumentException Fill_NotADODB(string parameter) { return(ADP.Argument(SR.Format(SR.OleDb_Fill_NotADODB), parameter)); }
internal static Exception MultiSubnetFailoverWithNonTcpProtocol() { string msg = GetSNIErrorMessage((int)SNINativeMethodWrapper.SniSpecialErrors.MultiSubnetFailoverWithNonTcpProtocol); return(ADP.Argument(msg)); }
// OleDbEnumerator internal static ArgumentException ISourcesRowsetNotSupported() { throw ADP.Argument(SR.OleDb_ISourcesRowsetNotSupported); }
// // Read-only routing // internal static Exception ROR_FailoverNotSupportedConnString() { return(ADP.Argument(Res.GetString(Res.SQLROR_FailoverNotSupported))); }
internal static bool Stop(string connectionString, string queue, bool useDefaults, bool startFailed) { if (string.IsNullOrEmpty(connectionString)) { if (null == connectionString) { throw ADP.ArgumentNull(nameof(connectionString)); } else { throw ADP.Argument(nameof(connectionString)); } } if (!useDefaults && string.IsNullOrEmpty(queue)) { // If specified but null or empty, use defaults. useDefaults = true; queue = null; // Force to null - for proper hashtable comparison for default case. } // End duplicate Start/Stop logic. bool result = false; lock (s_startStopLock) { if (null != s_processDispatcher) { // If _processDispatcher null, no Start has been called. try { string server = null; DbConnectionPoolIdentity identity = null; string user = null; string database = null; string service = null; if (useDefaults) { bool appDomainStop = false; RuntimeHelpers.PrepareConstrainedRegions(); try { // CER to ensure that if Stop succeeds we remove from hash completing teardown. // Start using process wide default service/queue & database from connection string. result = s_processDispatcher.Stop( connectionString, out server, out identity, out user, out database, ref service, s_appDomainKey, out appDomainStop); } finally { if (appDomainStop && !startFailed) { // If success, remove from hashtable. Debug.Assert(!string.IsNullOrEmpty(server) && !string.IsNullOrEmpty(database), "Server or Database null/Empty upon successfull Stop()!"); IdentityUserNamePair identityUser = new IdentityUserNamePair(identity, user); DatabaseServicePair databaseService = new DatabaseServicePair(database, service); RemoveFromServerUserHash(server, identityUser, databaseService); } } } else { result = s_processDispatcher.Stop( connectionString, out server, out identity, out user, out database, ref queue, s_appDomainKey, out bool ignored); // No need to call RemoveFromServerDatabaseHash since if not using default queue user is required // to provide options themselves. } } catch (Exception e) { if (!ADP.IsCatchableExceptionType(e)) { throw; } ADP.TraceExceptionWithoutRethrow(e); // Discard failure, but trace for now. } } } return(result); }
// OleDbConnection internal static ArgumentException SchemaRowsetsNotSupported(string provider) { return(ADP.Argument(SR.Format(SR.OleDb_SchemaRowsetsNotSupported, "IDBSchemaRowset", provider))); }
internal static Exception ConnectionStringTooLong() { return(ADP.Argument(SR.GetString(SR.OdbcConnection_ConnectionStringTooLong, ODBC32.MAX_CONNECTION_STRING_LENGTH))); }
internal static ArgumentException MSDASQLNotSupported() { return(ADP.Argument(SR.Format(SR.OleDb_MSDASQLNotSupported))); }
internal static Exception NegativeArgument() { return(ADP.Argument(SR.GetString(SR.Odbc_NegativeArgument))); }
internal static Exception PrecisionValueOutOfRange(byte precision) { return(ADP.Argument(Res.GetString(Res.SQL_PrecisionValueOutOfRange, precision.ToString(CultureInfo.InvariantCulture)))); }