Skip to content

Commit

Permalink
Bump Npgsql from 7.0.6 to 8.0.0 (#226)
Browse files Browse the repository at this point in the history
* Bump Npgsql from 7.0.6 to 8.0.0
  • Loading branch information
dependabot[bot] authored Nov 22, 2023
1 parent 4f64189 commit c4da099
Show file tree
Hide file tree
Showing 73 changed files with 250 additions and 254 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:

strategy:
fail-fast: false
matrix:
language: [ csharp ]

steps:
- name: Checkout
Expand All @@ -29,13 +27,13 @@ jobs:
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
languages: csharp
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Build
run: dotnet build -c Debug

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
category: "/language:csharp"
6 changes: 3 additions & 3 deletions FAnsiSql/Discovery/BulkCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public virtual int Upload(DataTable dt)
TargetTable.Database.Helper.ThrowIfObjectColumns(dt);

ConvertStringTypesToHardTypes(dt);

return UploadImpl(dt);
}

Expand All @@ -102,10 +102,10 @@ protected void ConvertStringTypesToHardTypes(DataTable dt)
var dict = GetMapping(dt.Columns.Cast<DataColumn>(),out _);

var factory = new TypeDeciderFactory(Culture);

//These are the problematic Types
var deciders = factory.Dictionary;

//for each column in the destination
foreach(var kvp in dict)
{
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/ColumnMappingException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public class ColumnMappingException : Exception
{
public ColumnMappingException(string msg):base(msg)
{

}

public ColumnMappingException(string msg, Exception innerException):base(msg,innerException)
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private string GetCollisionWithKeyword(string keyword, string value)
{
//don't output the value since that could be a password
throw new ArgumentException(string.Format(FAnsiStrings.ConnectionStringKeyword_ValueNotSupported, keyword),ex);
}
}

//now iterate all the keys we had before and add those too, if the key count doesn't change for any of them we know it's a duplicate semantically
if (_builder.Keys == null) return null;
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Discovery/Constraints/DiscoveredRelationship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public DiscoveredRelationship(string fkName, DiscoveredTable pkTable, Discovered
PrimaryKeyTable = pkTable;
ForeignKeyTable = fkTable;
CascadeDelete = deleteRule;

Keys = new Dictionary<DiscoveredColumn, DiscoveredColumn>();
}

Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/Constraints/RelationshipTopologicalSort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ private List<T> TopologicalSort<T>(IEnumerable<T> nodes, ICollection<Tuple<T, T>
if (edges.Any())
// return error (graph has at least one cycle)
throw new CircularDependencyException(FAnsiStrings.RelationshipTopologicalSort_FoundCircularDependencies);


// return L (a topologically sorted order)
return l;
}
Expand Down
8 changes: 4 additions & 4 deletions FAnsiSql/Discovery/DiscoveredDataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public override string ToString()
public void Resize(int newSize, IManagedTransaction managedTransaction = null)
{
var toReplace = GetLengthIfString();

if(newSize == toReplace)
return;

Expand Down Expand Up @@ -126,11 +126,11 @@ public void Resize(int numberOfDigitsBeforeDecimalPoint, int numberOfDigitsAfter

if (toReplace.NumbersAfterDecimalPlace> numberOfDigitsAfterDecimalPoint)
throw new InvalidResizeException(string.Format(FAnsiStrings.DiscoveredDataType_Resize_Cannot_shrink_column__number_of_digits_after_the_decimal_point_is_currently__0__and_you_asked_to_set_it_to__1___Current_SQLType_is__2__, toReplace.NumbersAfterDecimalPlace, numberOfDigitsAfterDecimalPoint, SQLType));

var newDataType = Column.Table.GetQuerySyntaxHelper()
.TypeTranslater.GetSQLDBTypeForCSharpType(new DatabaseTypeRequest(typeof (decimal), null,
new DecimalSize(numberOfDigitsBeforeDecimalPoint, numberOfDigitsAfterDecimalPoint)));

AlterTypeTo(newDataType, managedTransaction);
}

Expand Down Expand Up @@ -164,7 +164,7 @@ public void AlterTypeTo(string newType, IManagedTransaction managedTransaction =
}
}

SQLType = newType;
SQLType = newType;
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Discovery/DiscoveredDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public DiscoveredTable CreateTable(string tableName, DatabaseColumnRequest[] col
Adjuster = adjuster,
ExplicitColumnDefinitions = columns
});

}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions FAnsiSql/Discovery/DiscoveredDatabaseHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private void CopySettings(Guesser guesser, CreateTableArgs args)
public void ThrowIfObjectColumns(DataTable dt)
{
var objCol = dt.Columns.Cast<DataColumn>().FirstOrDefault(c => c.DataType == typeof(object));

if(objCol != null)
throw new NotSupportedException(
string.Format(
Expand Down Expand Up @@ -210,7 +210,7 @@ public virtual string GetCreateTableSql(DiscoveredDatabase database, string tabl
var pks = columns.Where(c => c.IsPrimaryKey).ToArray();
if (pks.Any())
bodySql.Append(GetPrimaryKeyDeclarationSql(tableName, pks,syntaxHelper));

if (foreignKeyPairs != null)
{
bodySql.AppendLine();
Expand All @@ -219,7 +219,7 @@ public virtual string GetCreateTableSql(DiscoveredDatabase database, string tabl
}

var toReturn = bodySql.ToString().TrimEnd('\r', '\n', ',');

toReturn += $"){Environment.NewLine}";

return toReturn;
Expand Down Expand Up @@ -302,7 +302,7 @@ public void ExecuteBatchNonQuery(string sql, DbConnection conn, DbTransaction tr

using var cmd = helper.GetCommand(string.Empty, conn, transaction);
var hadToOpen = false;

if (conn.State != ConnectionState.Open)
{

Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/DiscoveredServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public DiscoveredServer(string connectionString, DatabaseType databaseType)
public DiscoveredServer(string server,string database, DatabaseType databaseType,string usernameIfAny,string passwordIfAny)
{
Helper = ImplementationManager.GetImplementation(databaseType).GetServerHelper();

Builder = Helper.GetConnectionStringBuilder(server,database,usernameIfAny,passwordIfAny);

if(!string.IsNullOrWhiteSpace(database))
Expand Down Expand Up @@ -353,7 +353,7 @@ public DiscoveredDatabase CreateDatabase(string newDatabaseName)
var db = ExpectDatabase(newDatabaseName);

Helper.CreateDatabase(Builder, db);

if(!db.Exists())
throw new Exception(string.Format(FAnsiStrings.DiscoveredServer_CreateDatabase_Helper___0___tried_to_create_database___1___but_the_database_didn_t_exist_after_the_creation_attempt, Helper.GetType().Name,newDatabaseName));

Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Discovery/DiscoveredServerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public string[] ListDatabasesAsync(DbConnectionStringBuilder builder, Cancellati
{
//list the database on the server
var con = GetConnection(builder);

//this will work or timeout
var openTask = con.OpenAsync(token);
openTask.Wait(token);
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/DiscoveredTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public DataTable GetDataTable(int topX = int.MaxValue,bool enforceTypesAndNullne
public DataTable GetDataTable(DatabaseOperationArgs args,int topX = int.MaxValue, bool enforceTypesAndNullness = true)
{
var dt = new DataTable();

if (enforceTypesAndNullness)
foreach (var c in DiscoverColumns(args.TransactionIfAny))
{
Expand Down Expand Up @@ -439,7 +439,7 @@ public int Insert(Dictionary<DiscoveredColumn,object> toInsert, CultureInfo cult
{
var syntaxHelper = GetQuerySyntaxHelper();
var server = Database.Server;

var _parameterNames = syntaxHelper.GetParameterNamesFor(toInsert.Keys.ToArray(),c=>c.GetRuntimeName());

using var connection = Database.Server.GetManagedConnection(transaction);
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Discovery/DiscoveredTableHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public virtual void MakeDistinct(DatabaseOperationArgs args,DiscoveredTable disc
cmdTruncate.CommandTimeout = args.TimeoutInSeconds;
cmdTruncate.ExecuteNonQuery();
}

using(var cmdBack = server.GetCommand($"INSERT INTO {tableName} (SELECT * FROM {tempTable})", con))
{
cmdBack.CommandTimeout = args.TimeoutInSeconds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AggregateCustomLineCollectionException : Exception
{
public AggregateCustomLineCollectionException(string msg):base(msg)
{

}

}
6 changes: 3 additions & 3 deletions FAnsiSql/Discovery/QuerySyntax/Aggregation/AggregateHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public abstract class AggregateHelper:IAggregateHelper
public string BuildAggregate(List<CustomLine> queryLines, IQueryAxis axisIfAny)
{
var lines = new AggregateCustomLineCollection(queryLines, axisIfAny, GetQuerySyntaxHelper());

//no axis no pivot
if (lines.AxisSelect == null && lines.PivotSelect == null)
return BuildBasicAggregate(lines);
return BuildBasicAggregate(lines);

//axis (no pivot)
if (lines.PivotSelect == null)
return BuildAxisAggregate(lines);

//pivot (no axis)
if (lines.AxisSelect == null)
return BuildPivotOnlyAggregate(lines,GetPivotOnlyNonPivotColumn(lines));
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/QuerySyntax/RuntimeNameException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RuntimeNameException:Exception
/// <param name="innerException"></param>
public RuntimeNameException(string message, Exception innerException):base(message,innerException)
{

}

/// <summary>
Expand All @@ -23,6 +23,6 @@ public RuntimeNameException(string message, Exception innerException):base(messa
/// <param name="message"></param>
public RuntimeNameException(string message):base(message)
{

}
}
8 changes: 4 additions & 4 deletions FAnsiSql/Discovery/QuerySyntaxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected Regex GetAliasRegex()

//alias is a word
//(w+)

//alias is a wrapped word e.g. [hey hey]. In this case we must allow anything between the brackets that is not closing bracket
//[[`""]([^[`""]+)[]`""]

Expand Down Expand Up @@ -402,7 +402,7 @@ public DbParameter GetParameter(DbParameter p, DiscoveredColumn discoveredColumn
catch(Exception ex)
{
throw new Exception(string.Format(FAnsiStrings.QuerySyntaxHelper_GetParameter_Could_not_GetParameter_for_column___0__, discoveredColumn.GetFullyQualifiedName()),ex);
}
}

return p;
}
Expand Down Expand Up @@ -528,9 +528,9 @@ public override int GetHashCode()
public Dictionary<T, string> GetParameterNamesFor<T>(T[] columns, Func<T,string> toStringFunc)
{
var toReturn = new Dictionary<T, string>();

var reservedKeywords = GetReservedWords();


//sensible parameter names have no spaces or symbols!
var sensibleParameterNamesInclude = new Regex(@"^\w*$");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace FAnsi.Discovery.TypeTranslation;
public class TypeNotMappedException : Exception
{
public TypeNotMappedException(string msg):base(msg)
{
{
}

public TypeNotMappedException(string msg, Exception innerException) : base(msg, innerException)
Expand Down
16 changes: 8 additions & 8 deletions FAnsiSql/Discovery/TypeTranslation/TypeTranslater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ public string GetSQLDBTypeForCSharpType(DatabaseTypeRequest request)

if (t == typeof(byte))
return GetByteDataType();

if (t == typeof(short) || t == typeof(short) || t == typeof(ushort) || t == typeof(short?) || t == typeof(ushort?))
return GetSmallIntDataType();

if (t == typeof(int) || t == typeof(int) || t == typeof(uint) || t == typeof(int?) || t == typeof(uint?))
return GetIntDataType();

if (t == typeof (long) || t == typeof(ulong) || t == typeof(long?) || t == typeof(ulong?))
return GetBigIntDataType();

Expand All @@ -80,7 +80,7 @@ public string GetSQLDBTypeForCSharpType(DatabaseTypeRequest request)

if (t == typeof(TimeSpan) || t == typeof(TimeSpan?))
return GetTimeDataType();

if (t == typeof (byte[]))
return GetByteArrayDataType();

Expand Down Expand Up @@ -120,7 +120,7 @@ protected string GetStringDataType(int? maxExpectedStringWidth)

if (maxExpectedStringWidth > MaxStringWidthBeforeMax)
return GetStringDataTypeWithUnlimitedWidth();

return GetStringDataTypeImpl(maxExpectedStringWidth.Value);
}

Expand All @@ -139,7 +139,7 @@ private string GetUnicodeStringDataType(int? maxExpectedStringWidth)

if (maxExpectedStringWidth > MaxStringWidthBeforeMax)
return GetUnicodeStringDataTypeWithUnlimitedWidth();

return GetUnicodeStringDataTypeImpl(maxExpectedStringWidth.Value);
}

Expand Down Expand Up @@ -259,13 +259,13 @@ public DbType GetDbTypeForSQLDBType(string sqlType)

if (IsString(sqlType))
return DbType.String;

if (IsDate(sqlType))
return DbType.DateTime;

if (IsTime(sqlType))
return DbType.Time;

if (IsByteArray(sqlType))
return DbType.Object;

Expand Down Expand Up @@ -295,7 +295,7 @@ public virtual DatabaseTypeRequest GetDataTypeRequestForSQLDBType(string sqlType

if (cSharpType == typeof(TimeSpan))
lengthIfString = GetStringLengthForTimeSpan();

var request = new DatabaseTypeRequest(cSharpType, lengthIfString, digits);

if (cSharpType == typeof(string))
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Exceptions/AlterFailedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public class AlterFailedException : Exception
public AlterFailedException(string message, Exception inner)
: base(message, inner)
{

}
}
2 changes: 1 addition & 1 deletion FAnsiSql/Exceptions/CircularDependencyException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class CircularDependencyException : Exception
{
public CircularDependencyException(string msg):base(msg)
{

}
}
Loading

0 comments on commit c4da099

Please sign in to comment.