Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private DBConnectionString(DbConnectionOptions connectionOptions, string restric
_keychain = connectionOptions.ReplacePasswordPwd(out _encryptedUsersConnectionString, true);
}

if (!ADP.IsEmpty(restrictions))
if (!string.IsNullOrEmpty(restrictions))
{
_restrictionValues = ParseRestrictions(restrictions, synonyms);
_restrictions = restrictions;
Expand Down Expand Up @@ -168,7 +168,7 @@ internal string Restrictions
StringBuilder builder = new StringBuilder();
for (int i = 0; i < restrictionValues.Length; ++i)
{
if (!ADP.IsEmpty(restrictionValues[i]))
if (!string.IsNullOrEmpty(restrictionValues[i]))
{
builder.Append(restrictionValues[i]);
builder.Append("=;");
Expand Down Expand Up @@ -496,13 +496,13 @@ private static string[] ParseRestrictions(string restrictions, Dictionary<string

string keyname; // since parsing restrictions ignores values, it doesn't matter if we use ODBC rules or OLEDB rules
nextStartPosition = DbConnectionOptions.GetKeyValuePair(restrictions, startPosition, buffer, false, out keyname, out _);
if (!ADP.IsEmpty(keyname))
if (!string.IsNullOrEmpty(keyname))
{
#if DEBUG
SqlClientEventSource.Log.TryAdvancedTraceEvent("<comm.DBConnectionString|INFO|ADV> KeyName='{0}'", keyname);
#endif
string realkeyname = synonyms != null ? (string)synonyms[keyname] : keyname; // MDAC 85144
if (ADP.IsEmpty(realkeyname))
if (string.IsNullOrEmpty(realkeyname))
{
throw ADP.KeywordNotSupported(keyname);
}
Expand Down Expand Up @@ -559,8 +559,8 @@ private static void Verify(string[] restrictionValues)
{
for (int i = 1; i < restrictionValues.Length; ++i)
{
Debug.Assert(!ADP.IsEmpty(restrictionValues[i - 1]), "empty restriction");
Debug.Assert(!ADP.IsEmpty(restrictionValues[i]), "empty restriction");
Debug.Assert(!string.IsNullOrEmpty(restrictionValues[i - 1]), "empty restriction");
Debug.Assert(!string.IsNullOrEmpty(restrictionValues[i]), "empty restriction");
Debug.Assert(0 >= StringComparer.Ordinal.Compare(restrictionValues[i - 1], restrictionValues[i]));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ internal bool HasBlankPassword
{
if (_parsetable.ContainsKey(KEY.Password))
{
return ADP.IsEmpty(_parsetable[KEY.Password]);
return string.IsNullOrEmpty(_parsetable[KEY.Password]);
}
else
if (_parsetable.ContainsKey(SYNONYM.Pwd))
{
return ADP.IsEmpty(_parsetable[SYNONYM.Pwd]); // MDAC 83097
return string.IsNullOrEmpty(_parsetable[SYNONYM.Pwd]); // MDAC 83097
}
else
{
return (_parsetable.ContainsKey(KEY.User_ID) && !ADP.IsEmpty(_parsetable[KEY.User_ID])) ||
(_parsetable.ContainsKey(SYNONYM.UID) && !ADP.IsEmpty(_parsetable[SYNONYM.UID]));
return (_parsetable.ContainsKey(KEY.User_ID) && !string.IsNullOrEmpty(_parsetable[KEY.User_ID])) ||
(_parsetable.ContainsKey(SYNONYM.UID) && !string.IsNullOrEmpty(_parsetable[SYNONYM.UID]));
}
}
return false;
Expand Down Expand Up @@ -178,7 +178,7 @@ internal static string ExpandDataDirectory(string keyword, string value, ref str
{
throw ADP.InvalidDataDirectory();
}
else if (ADP.IsEmpty(rootFolderPath))
else if (string.IsNullOrEmpty(rootFolderPath))
{
rootFolderPath = AppDomain.CurrentDomain.BaseDirectory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private string CreateInitialQuery()
{
throw SQL.BulkLoadInvalidDestinationTable(DestinationTableName, e);
}
if (ADP.IsEmpty(parts[MultipartIdentifier.TableIndex]))
if (string.IsNullOrEmpty(parts[MultipartIdentifier.TableIndex]))
{
throw SQL.BulkLoadInvalidDestinationTable(DestinationTableName, null);
}
Expand All @@ -442,7 +442,7 @@ private string CreateInitialQuery()

string TableName = parts[MultipartIdentifier.TableIndex];
bool isTempTable = TableName.Length > 0 && '#' == TableName[0];
if (!ADP.IsEmpty(TableName))
if (!string.IsNullOrEmpty(TableName))
{
// Escape table name to be put inside TSQL literal block (within N'').
TableName = SqlServerEscapeHelper.EscapeStringAsLiteral(TableName);
Expand All @@ -451,7 +451,7 @@ private string CreateInitialQuery()
}

string SchemaName = parts[MultipartIdentifier.SchemaIndex];
if (!ADP.IsEmpty(SchemaName))
if (!string.IsNullOrEmpty(SchemaName))
{
// Escape schema name to be put inside TSQL literal block (within N'').
SchemaName = SqlServerEscapeHelper.EscapeStringAsLiteral(SchemaName);
Expand All @@ -460,7 +460,7 @@ private string CreateInitialQuery()
}

string CatalogName = parts[MultipartIdentifier.CatalogIndex];
if (isTempTable && ADP.IsEmpty(CatalogName))
if (isTempTable && string.IsNullOrEmpty(CatalogName))
{
TDSCommand += string.Format("exec tempdb..{0} N'{1}.{2}'",
TableCollationsStoredProc,
Expand All @@ -471,7 +471,7 @@ private string CreateInitialQuery()
else
{
// VSDD 581951 - escape the catalog name
if (!ADP.IsEmpty(CatalogName))
if (!string.IsNullOrEmpty(CatalogName))
{
CatalogName = SqlServerEscapeHelper.EscapeIdentifier(CatalogName);
}
Expand Down Expand Up @@ -1437,7 +1437,7 @@ private void AppendColumnNameAndTypeName(StringBuilder query, string columnName,

private string UnquotedName(string name)
{
if (ADP.IsEmpty(name))
if (string.IsNullOrEmpty(name))
return null;
if (name[0] == '[')
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ override public SecurityElement ToXml()

tmp = value.ConnectionString; // WebData 97375
tmp = EncodeXmlValue(tmp);
if (!ADP.IsEmpty(tmp))
if (!string.IsNullOrEmpty(tmp))
{
valueElement.AddAttribute(XmlStr._ConnectionString, tmp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3388,7 +3388,7 @@ internal void DeriveParameters()

// Use common parser for SqlClient and OleDb - parse into 4 parts - Server, Catalog, Schema, ProcedureName
string[] parsedSProc = MultipartIdentifier.ParseMultipartIdentifier(CommandText, "[\"", "]\"", Strings.SQL_SqlCommandCommandText, false);
if (parsedSProc[3] == null || ADP.IsEmpty(parsedSProc[3]))
if (parsedSProc[3] == null || string.IsNullOrEmpty(parsedSProc[3]))
{
throw ADP.NoStoredProcedureExists(CommandText);
}
Expand All @@ -3402,14 +3402,14 @@ internal void DeriveParameters()
// [user server, if provided].[user catalog, else current database].[sys if 2005, else blank].[sp_procedure_params_rowset]

// Server - pass only if user provided.
if (!ADP.IsEmpty(parsedSProc[0]))
if (!string.IsNullOrEmpty(parsedSProc[0]))
{
SqlCommandSet.BuildStoredProcedureName(cmdText, parsedSProc[0]);
cmdText.Append(".");
}

// Catalog - pass user provided, otherwise use current database.
if (ADP.IsEmpty(parsedSProc[1]))
if (string.IsNullOrEmpty(parsedSProc[1]))
{
parsedSProc[1] = Connection.Database;
}
Expand Down Expand Up @@ -3459,7 +3459,7 @@ internal void DeriveParameters()
param.Value = groupNumber;
}

if (!ADP.IsEmpty(parsedSProc[2]))
if (!string.IsNullOrEmpty(parsedSProc[2]))
{ // SchemaName is 3rd element in parsed array
SqlParameter param = paramsCmd.Parameters.Add(new SqlParameter("@procedure_schema", SqlDbType.NVarChar, 255));
param.Value = UnquoteProcedurePart(parsedSProc[2]);
Expand Down Expand Up @@ -3672,7 +3672,7 @@ private void CheckNotificationStateAndAutoEnlist()
if (NotificationAutoEnlist)
{
string notifyContext = SqlNotificationContext();
if (!ADP.IsEmpty(notifyContext))
if (!string.IsNullOrEmpty(notifyContext))
{
// Map to dependency by ID set in context data.
SqlDependency dependency = SqlDependencyPerAppDomainDispatcher.SingletonInstance.LookupDependencyEntry(notifyContext);
Expand Down Expand Up @@ -5777,7 +5777,7 @@ private void ValidateCommand(string method, bool async)
throw ADP.TransactionConnectionMismatch();
}

if (ADP.IsEmpty(this.CommandText))
if (string.IsNullOrEmpty(this.CommandText))
{
throw ADP.CommandTextRequired(method);
}
Expand Down Expand Up @@ -6772,15 +6772,15 @@ internal string BuildParamList(TdsParser parser, SqlParameterCollection paramete
if (mt.SqlDbType == SqlDbType.Udt)
{
string fullTypeName = sqlParam.UdtTypeName;
if (ADP.IsEmpty(fullTypeName))
if (string.IsNullOrEmpty(fullTypeName))
throw SQL.MustSetUdtTypeNameForUdtParams();

paramList.Append(ParseAndQuoteIdentifier(fullTypeName, true /* is UdtTypeName */));
}
else if (mt.SqlDbType == SqlDbType.Structured)
{
string typeName = sqlParam.TypeName;
if (ADP.IsEmpty(typeName))
if (string.IsNullOrEmpty(typeName))
{
throw SQL.MustSetTypeNameForParam(mt.TypeName, sqlParam.GetPrefixedParameterName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ private bool UsesClearUserIdOrPassword(SqlConnectionString opt)
bool result = false;
if (opt != null)
{
result = (!ADP.IsEmpty(opt.UserID) || !ADP.IsEmpty(opt.Password));
result = (!string.IsNullOrEmpty(opt.UserID) || !string.IsNullOrEmpty(opt.Password));
}
return result;
}
Expand Down Expand Up @@ -2258,7 +2258,7 @@ internal void ValidateConnectionForExecute(string method, SqlCommand command)
// as native OleDb and Odbc.
static internal string FixupDatabaseTransactionName(string name)
{
if (!ADP.IsEmpty(name))
if (!string.IsNullOrEmpty(name))
{
return SqlServerEscapeHelper.EscapeIdentifier(name);
}
Expand Down Expand Up @@ -2407,11 +2407,11 @@ public static void ChangePassword(string connectionString, string newPassword)
{
SqlClientEventSource.Log.TryCorrelationTraceEvent("<sc.SqlConnection.ChangePassword|API|Correlation> ActivityID {0}", ActivityCorrelator.Current);

if (ADP.IsEmpty(connectionString))
if (string.IsNullOrEmpty(connectionString))
{
throw SQL.ChangePasswordArgumentMissing("connectionString");
}
if (ADP.IsEmpty(newPassword))
if (string.IsNullOrEmpty(newPassword))
{
throw SQL.ChangePasswordArgumentMissing("newPassword");
}
Expand All @@ -2427,7 +2427,7 @@ public static void ChangePassword(string connectionString, string newPassword)
{
throw SQL.ChangePasswordConflictsWithSSPI();
}
if (!ADP.IsEmpty(connectionOptions.AttachDBFilename))
if (!string.IsNullOrEmpty(connectionOptions.AttachDBFilename))
{
throw SQL.ChangePasswordUseOfUnallowedKey(SqlConnectionString.KEY.AttachDBFilename);
}
Expand All @@ -2450,7 +2450,7 @@ public static void ChangePassword(string connectionString, SqlCredential credent
{
SqlClientEventSource.Log.TryCorrelationTraceEvent("<sc.SqlConnection.ChangePassword|API|Correlation> ActivityID {0}", ActivityCorrelator.Current);

if (ADP.IsEmpty(connectionString))
if (string.IsNullOrEmpty(connectionString))
{
throw SQL.ChangePasswordArgumentMissing("connectionString");
}
Expand Down Expand Up @@ -2481,7 +2481,7 @@ public static void ChangePassword(string connectionString, SqlCredential credent
SqlConnectionString connectionOptions = SqlConnectionFactory.FindSqlConnectionOptions(key);

// Check for incompatible connection string value with SqlCredential
if (!ADP.IsEmpty(connectionOptions.UserID) || !ADP.IsEmpty(connectionOptions.Password))
if (!string.IsNullOrEmpty(connectionOptions.UserID) || !string.IsNullOrEmpty(connectionOptions.Password))
{
throw ADP.InvalidMixedArgumentOfSecureAndClearCredential();
}
Expand All @@ -2491,7 +2491,7 @@ public static void ChangePassword(string connectionString, SqlCredential credent
throw SQL.ChangePasswordConflictsWithSSPI();
}

if (!ADP.IsEmpty(connectionOptions.AttachDBFilename))
if (!string.IsNullOrEmpty(connectionOptions.AttachDBFilename))
{
throw SQL.ChangePasswordUseOfUnallowedKey(SqlConnectionString.KEY.AttachDBFilename);
}
Expand Down Expand Up @@ -2671,7 +2671,7 @@ internal void CheckGetExtendedUDTInfo(SqlMetaDataPriv metaData, bool fThrow)
{
if (metaData.udt?.Type == null)
{ // If null, we have not obtained extended info.
Debug.Assert(!ADP.IsEmpty(metaData.udt?.AssemblyQualifiedName), "Unexpected state on GetUDTInfo");
Debug.Assert(!string.IsNullOrEmpty(metaData.udt?.AssemblyQualifiedName), "Unexpected state on GetUDTInfo");
// Parameter throwOnError determines whether exception from Assembly.Load is thrown.
metaData.udt.Type =
Type.GetType(typeName: metaData.udt.AssemblyQualifiedName, assemblyResolver: asmRef => ResolveTypeAssembly(asmRef, fThrow), typeResolver: null, throwOnError: fThrow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ override protected DbConnectionInternal CreateConnection(DbConnectionOptions opt

protected override DbConnectionOptions CreateConnectionOptions(string connectionString, DbConnectionOptions previous)
{
Debug.Assert(!ADP.IsEmpty(connectionString), "empty connectionString");
Debug.Assert(!string.IsNullOrEmpty(connectionString), "empty connectionString");
SqlConnectionString result = new SqlConnectionString(connectionString);
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,32 +736,32 @@ public override DataTable GetSchemaTable()
schemaRow[IsRowVersion] = false;
}

if (!ADP.IsEmpty(colMetaData.ColumnName))
if (!string.IsNullOrEmpty(colMetaData.ColumnName))
{
schemaRow[BaseColumnName] = colMetaData.ColumnName;
}
else if (!ADP.IsEmpty(colMetaData.Name))
else if (!string.IsNullOrEmpty(colMetaData.Name))
{
// Use projection name if base column name is not present
schemaRow[BaseColumnName] = colMetaData.Name;
}

if (!ADP.IsEmpty(colMetaData.TableName))
if (!string.IsNullOrEmpty(colMetaData.TableName))
{
schemaRow[BaseTableName] = colMetaData.TableName;
}

if (!ADP.IsEmpty(colMetaData.SchemaName))
if (!string.IsNullOrEmpty(colMetaData.SchemaName))
{
schemaRow[BaseSchemaName] = colMetaData.SchemaName;
}

if (!ADP.IsEmpty(colMetaData.CatalogName))
if (!string.IsNullOrEmpty(colMetaData.CatalogName))
{
schemaRow[BaseCatalogName] = colMetaData.CatalogName;
}

if (!ADP.IsEmpty(colMetaData.ServerName))
if (!string.IsNullOrEmpty(colMetaData.ServerName))
{
schemaRow[BaseServerName] = colMetaData.ServerName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ private void OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectio

_timeoutErrorInternal.SetInternalSourceType(useFailoverPartner ? SqlConnectionInternalSourceType.Failover : SqlConnectionInternalSourceType.Principle);

bool hasFailoverPartner = !ADP.IsEmpty(failoverPartner);
bool hasFailoverPartner = !string.IsNullOrEmpty(failoverPartner);

// Open the connection and Login
try
Expand Down Expand Up @@ -3192,7 +3192,7 @@ internal void SetDerivedNames(string protocol, string serverName)
// when using the Dbnetlib dll. If the protocol is not specified, the netlib will
// try all protocols in the order listed in the Client Network Utility. Connect will
// then fail if all protocols fail.
if (!ADP.IsEmpty(protocol))
if (!string.IsNullOrEmpty(protocol))
{
ExtendedServerName = protocol + ":" + serverName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ internal SqlError ProcessSNIError(TdsParserStateObject stateObj)
* !=null | == 0 | replace text left of errorMessage
*/

Debug.Assert(!ADP.IsEmpty(errorMessage), "Empty error message received from SNI");
Debug.Assert(!string.IsNullOrEmpty(errorMessage), "Empty error message received from SNI");

string sqlContextInfo = StringsHelper.GetString(Enum.GetName(typeof(SniContext), stateObj.SniContext));
string providerRid = string.Format("SNI_PN{0}", (int)details.provider);
Expand Down Expand Up @@ -4863,7 +4863,7 @@ internal TdsOperationStatus TryProcessAltMetaData(int cColumns, TdsParserStateOb
return result;
}

if (ADP.IsEmpty(col.column))
if (string.IsNullOrEmpty(col.column))
{
// create column name from op
switch (col.op)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,6 @@ internal static Exception InvalidMixedUsageOfAccessTokenCallbackAndIntegratedSec
=> InvalidOperation(StringsHelper.GetString(Strings.ADP_InvalidMixedUsageOfAccessTokenCallbackAndIntegratedSecurity));
#endregion

internal static bool IsEmpty(string str) => string.IsNullOrEmpty(str);
internal static readonly IntPtr s_ptrZero = IntPtr.Zero;
#if NETFRAMEWORK
#region netfx project only
Expand Down
Loading
Loading