Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jas88 committed Aug 31, 2023
2 parents 98d80e9 + 7107c7b commit 4a3e4b0
Show file tree
Hide file tree
Showing 50 changed files with 160 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: dotnet test --logger "console;verbosity=minimal" --nologo
- name: Pack
run: |
dotnet pack -c Release --include-symbols --nologo -p:Version=$(fgrep AssemblyInformationalVersion SharedAssemblyInfo.cs|cut -d'"' -f2) -o .
dotnet pack -c Release -p:SymbolPackageFormat=snupkg --include-symbols --nologo -p:Version=$(fgrep AssemblyInformationalVersion SharedAssemblyInfo.cs|cut -d'"' -f2) -o .
- name: Nuget push
if: contains(github.ref,'refs/tags/')
run: dotnet nuget push HIC.FAnsiSql.*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }} --skip-duplicate
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

...
- Bugfix: MySQL text was erroneously capped at 64k (TEXT) instead of LONGTEXT (4GiB)

## [3.1.0] - 2023-05-15

- Now targeting .Net 6
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Connections/IManagedTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace FAnsi.Connections;

/// <summary>
/// Wrapper for DbTransaction that associates it with a specific DbConnection. Helps simplify calls to information
/// Wrapper for DbTransaction that associates it with a specific DbConnection. Helps simplify calls to information
/// methods such as DiscoveredTable.GetRowCount etc during the middle of an ongoing database transaction
/// </summary>
public interface IManagedTransaction
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Connections/ManagedConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ManagedConnection : IManagedConnection

/// <inheritdoc/>
public bool CloseOnDispose { get; set; }

internal ManagedConnection(DiscoveredServer discoveredServer, IManagedTransaction managedTransaction)
{
//get a new connection or use the existing one within the transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace FAnsi.Discovery.ConnectionStringDefaults;

/// <summary>
/// <para>Gathers keywords for use in building connection strings for a given <see cref="DatabaseType"/>. Once created you can add keywords and then apply the template
/// <para>Gathers keywords for use in building connection strings for a given <see cref="DatabaseType"/>. Once created you can add keywords and then apply the template
/// to new novel connection strings (see <see cref="EnforceOptions"/>).</para>
///
/// <para>Also handles connection string keyword aliases (where two words mean the same thing)</para>
Expand All @@ -33,7 +33,7 @@ public ConnectionStringKeywordAccumulator(DatabaseType databaseType)
}

/// <summary>
/// Adds a new connection string option (which must be compatible with <see cref="DatabaseType"/>)
/// Adds a new connection string option (which must be compatible with <see cref="DatabaseType"/>)
/// </summary>
/// <param name="keyword"></param>
/// <param name="value"></param>
Expand All @@ -44,12 +44,12 @@ public void AddOrUpdateKeyword(string keyword, string value, ConnectionStringKey

if (collision != null)
{
//if there is already a semantically equivalent keyword....
//if there is already a semantically equivalent keyword....

//if it is of lower or equal priority
if (_keywords[collision].Item2 <= priority)
_keywords[collision] = Tuple.Create(value, priority); //update it
_keywords[collision] = Tuple.Create(value, priority); //update it

//either way don't record it as a new keyword
return;
}
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 @@ -26,7 +26,7 @@ public class DiscoveredRelationship
public DiscoveredTable ForeignKeyTable { get; private set; }

/// <summary>
/// Mapping of primary key column(s) in <see cref="PrimaryKeyTable"/> to foreign key column(s) in <see cref="ForeignKeyTable"/>. If there are more than one entry
/// Mapping of primary key column(s) in <see cref="PrimaryKeyTable"/> to foreign key column(s) in <see cref="ForeignKeyTable"/>. If there are more than one entry
/// then the foreign key is a composite key.
/// </summary>
public Dictionary<DiscoveredColumn, DiscoveredColumn> Keys { get; private set; }
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 @@ -7,7 +7,7 @@
namespace FAnsi.Discovery.Constraints;

/// <summary>
/// Helps resolve a dependency order between a collection of tables with interlinking foreign key constraints. Implements Khan's algorithm.
/// Helps resolve a dependency order between a collection of tables with interlinking foreign key constraints. Implements Khan's algorithm.
/// </summary>
public class RelationshipTopologicalSort
{
Expand Down Expand Up @@ -42,7 +42,7 @@ public RelationshipTopologicalSort(IEnumerable<DiscoveredTable> tables)
}

/// <summary>
/// Topological Sorting (Kahn's algorithm)
/// Topological Sorting (Kahn's algorithm)
/// </summary>
/// <remarks>https://en.wikipedia.org/wiki/Topological_sorting</remarks>
/// <typeparam name="T"></typeparam>
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/DatabaseColumnRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class DatabaseColumnRequest:ISupplementalColumnInformation,IHasRuntimeNam
public bool AllowNulls { get; set; }

/// <summary>
/// True to include the column as part of the tables primary key
/// True to include the column as part of the tables primary key
/// </summary>
public bool IsPrimaryKey { get; set; }

Expand All @@ -53,7 +53,7 @@ public class DatabaseColumnRequest:ISupplementalColumnInformation,IHasRuntimeNam
public MandatoryScalarFunctions Default { get; set; }

/// <summary>
/// Applies only if the <see cref="TypeRequested"/> is string based. Setting this will override the default collation and specify
/// Applies only if the <see cref="TypeRequested"/> is string based. Setting this will override the default collation and specify
/// a specific collation. The value specified must be an installed collation supported by the DBMS
/// </summary>
public string Collation { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Discovery/DiscoveredDatabaseHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace FAnsi.Discovery;

/// <summary>
/// DBMS specific implementation of all functionality that relates to interacting with existing databases (dropping databases, creating tables, finding stored proceedures etc). For
/// DBMS specific implementation of all functionality that relates to interacting with existing databases (dropping databases, creating tables, finding stored procedures etc). For
/// database creation see <see cref="DiscoveredServerHelper"/>
/// </summary>
public abstract class DiscoveredDatabaseHelper:IDiscoveredDatabaseHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void Validate()
/// The single aggregate function line e.g. "count(distinct chi) as Fish,"
/// </summary>
public CustomLine CountSelect => Lines.SingleOrDefault(l => l.Role == CustomLineRole.CountFunction && l.LocationToInsert == QueryComponent.QueryTimeColumn);

/// <summary>
/// The (optional) single line of SELECT SQL which is the Axis join column e.g. "[MyDb]..[mytbl].[AdmissionDate] as Admt,"
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private CustomLine GetPivotOnlyNonPivotColumn(AggregateCustomLineCollection quer
/// <param name="query"></param>
/// <returns></returns>
protected abstract string BuildAxisAggregate(AggregateCustomLineCollection query);

protected abstract string BuildPivotOnlyAggregate(AggregateCustomLineCollection query,CustomLine nonPivotColumn);

protected abstract string BuildPivotAndAxisAggregate(AggregateCustomLineCollection query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace FAnsi.Discovery.QuerySyntax.Aggregation;

/// <summary>
/// Cross Database Type class for turning a collection of arbitrary sql lines (CustomLine) into a Group by query. The query can include an axis calendar
/// Cross Database Type class for turning a collection of arbitrary sql lines (CustomLine) into a Group by query. The query can include an axis calendar
/// table and can include a dynamic pivot. See AggregateDataBasedTests for expected inputs/outputs.
///
/// <para>Because building a dynamic pivot / calendar table for a group by is so different in each DatabaseType the input is basically just a collection of strings
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/QuerySyntax/Aggregation/IQueryAxis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace FAnsi.Discovery.QuerySyntax.Aggregation;

/// <summary>
/// Describes the requirement for a Calendar Table in a Group By query. The calendar should go between the two dates in increments of the AxisIncrement.
/// Records returned by the Group By query should be grouped by the Calendar table.
/// Records returned by the Group By query should be grouped by the Calendar table.
///
/// <para>A Calendar Table ensures a consistent axis in the DataTable returned by the sql query (avoids skipping months/years where there are no dates in the
/// <para>A Calendar Table ensures a consistent axis in the DataTable returned by the sql query (avoids skipping months/years where there are no dates in the
/// data set being queried). Implementation logic for Calendar Tables varies wildly depending on database engine (See IAggregateHelper).</para>
/// </summary>
public interface IQueryAxis
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/QuerySyntax/CustomLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class CustomLine
public QueryComponent LocationToInsert { get; set; }

public CustomLineRole Role { get; set; }

/// <summary>
/// The line of code that caused the CustomLine to be created, this can be a StackTrace passed into the constructor or calculated automatically by CustomLine
/// The line of code that caused the CustomLine to be created, this can be a StackTrace passed into the constructor or calculated automatically by CustomLine
/// </summary>
public string StackTrace { get; private set; }

Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/QuerySyntax/IHasQuerySyntaxHelper.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace FAnsi.Discovery.QuerySyntax;

/// <summary>
/// Object which works with a known DatabaseType and therefore has an associated IQuerySyntaxHelper (e.g. DatabaseType.MicrosoftSQLServer and
/// MicrosoftQuerySyntaxHelper).
/// Object which works with a known DatabaseType and therefore has an associated IQuerySyntaxHelper (e.g. DatabaseType.MicrosoftSQLServer and
/// MicrosoftQuerySyntaxHelper).
///
/// <para>When implementing this class you most likely want to start with 'new QuerySyntaxHelperFactory().Create(DatabaseType);'</para>
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/QuerySyntax/Update/IUpdateHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace FAnsi.Discovery.QuerySyntax.Update;
public delegate string UpdateStatementSqlGetter(string table2Alias);

/// <summary>
/// Cross Database Type class for turning a collection of arbitrary sql lines (CustomLine) into an UPDATE query where no suitable ANSI solution exists. For example
/// Cross Database Type class for turning a collection of arbitrary sql lines (CustomLine) into an UPDATE query where no suitable ANSI solution exists. For example
/// updating a table using a join to another table where the relationship is n..n.
///
/// <para>Look at UpdateHelper.permissableLocations to determine which CustomLines you are allowed to pass in.</para>
Expand All @@ -20,7 +20,7 @@ public interface IUpdateHelper
/// <param name="table1">The table to UPDATE</param>
/// <param name="table2">The table to join against (which might be a self join)</param>
/// <param name="lines">All SET, WHERE and JoinInfo lines needed to build the query, columns should be specified using the alias t1.colX and t2.colY instead of the full names of
/// table1/table2. if you have multiple WHERE lines then they will be ANDed. To avoid this you can concatenate your CustomLines together yourself and serve only one to this
/// table1/table2. if you have multiple WHERE lines then they will be ANDed. To avoid this you can concatenate your CustomLines together yourself and serve only one to this
/// method(e.g. to use OR) </param>
/// <returns></returns>
string BuildUpdate(DiscoveredTable table1, DiscoveredTable table2,List<CustomLine> lines);
Expand Down
2 changes: 1 addition & 1 deletion FAnsiSql/Discovery/QuerySyntaxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ private string ValidateName(string candidate, string objectType, int maximumLeng
return null;
}



public DbParameter GetParameter(DbParameter p, DiscoveredColumn discoveredColumn, object value)
{
Expand Down
10 changes: 5 additions & 5 deletions FAnsiSql/Discovery/TableCreation/CreateTableArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class CreateTableArgs
public bool TableCreated { get; private set; }

/// <summary>
/// Customise guessing behaviour
/// Customise guessing behaviour
/// </summary>
public GuessSettings GuessSettings { get; set; }

Expand All @@ -92,7 +92,7 @@ public CreateTableArgs(DiscoveredDatabase database, string tableName, string sch
Schema = schema;
GuessSettings = GuessSettingsFactory.Create();
}

/// <summary>
/// Create a table with the given name. Set your columns in <see cref="ExplicitColumnDefinitions"/>
/// </summary>
Expand All @@ -104,7 +104,7 @@ public CreateTableArgs(DiscoveredDatabase database,string tableName,string schem
}

/// <summary>
/// Create a table with the given name based on the columns and data in the provided <paramref name="dataTable"/>. If you want to override the
/// Create a table with the given name based on the columns and data in the provided <paramref name="dataTable"/>. If you want to override the
/// data type of a given column set <see cref="ExplicitColumnDefinitions"/>
/// </summary>
public CreateTableArgs(DiscoveredDatabase database, string tableName, string schema,DataTable dataTable, bool createEmpty)
Expand All @@ -113,9 +113,9 @@ public CreateTableArgs(DiscoveredDatabase database, string tableName, string sch
DataTable = dataTable;
CreateEmpty = createEmpty;
}

/// <summary>
/// Create a table with the given name based on the columns and data in the provided <paramref name="dataTable"/>. If you want to override the
/// Create a table with the given name based on the columns and data in the provided <paramref name="dataTable"/>. If you want to override the
/// data type of a given column set <see cref="ExplicitColumnDefinitions"/>
/// </summary>
public CreateTableArgs(DiscoveredDatabase database, string tableName, string schema,DataTable dataTable, bool createEmpty, Dictionary<DatabaseColumnRequest, DiscoveredColumn> foreignKeyPairs, bool cascadeDelete)
Expand Down
8 changes: 4 additions & 4 deletions FAnsiSql/Discovery/TypeTranslation/ITypeTranslater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace FAnsi.Discovery.TypeTranslation;

/// <summary>
/// Cross database type functionality for translating between database proprietary datatypes e.g. varchar (varchar2 in Oracle) and the C# Type (and vice
/// versa).
/// versa).
///
/// <para>When translating into a database type from a C# Type you also need to know additonal information e.g. how long is the maximum length of a string, how much
/// scale/precision should a decimal have. This is represented by the DatabaseTypeRequest class.</para>
Expand All @@ -15,7 +15,7 @@ namespace FAnsi.Discovery.TypeTranslation;
public interface ITypeTranslater
{
/// <summary>
/// DatabaseTypeRequest is turned into the proprietary string e.g. A DatabaseTypeRequest with CSharpType = typeof(DateTime) is translated into
/// DatabaseTypeRequest is turned into the proprietary string e.g. A DatabaseTypeRequest with CSharpType = typeof(DateTime) is translated into
/// 'datetime2' in Microsoft SQL Server but 'datetime' in MySql server.
/// </summary>
/// <param name="request"></param>
Expand All @@ -37,7 +37,7 @@ public interface ITypeTranslater
/// <param name="sqlType"></param>
/// <returns>The C# Type which can be used to store values of this database type</returns>
Type GetCSharpTypeForSQLDBType(string sqlType);

/// <summary>
/// Translates a database proprietary type e.g. 'decimal(10,2)' into a C# type e.g. 'typeof(decimal)'
///
Expand All @@ -64,7 +64,7 @@ public interface ITypeTranslater

int GetLengthIfString(string sqlType);
DecimalSize GetDigitsBeforeAndAfterDecimalPointIfDecimal(string sqlType);

/// <summary>
/// Translates the given sqlType which must be an SQL string compatible with this TypeTranslater e.g. varchar(10) into the destination ITypeTranslater
/// e.g. Varchar2(10) if destinationTypeTranslater was Oracle. Even if both this and the destination are the same you might find a different datatype
Expand Down
4 changes: 2 additions & 2 deletions FAnsiSql/Discovery/TypeTranslation/TypeTranslater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public string TranslateSQLDBType(string sqlType, ITypeTranslater destinationType


/// <summary>
/// Return the number of characters required to not truncate/loose any data when altering a column from time (e.g. TIME etc) to varchar(x). Return
/// Return the number of characters required to not truncate/lose any data when altering a column from time (e.g. TIME etc) to varchar(x). Return
/// x such that the column does not loose integrity. This is needed when dynamically discovering what size to make a column by streaming data into a table.
/// if we see many times and nulls we will decide to use a time column then we see strings and have to convert the column to a varchar column without loosing the
/// currently loaded data.
Expand Down Expand Up @@ -409,7 +409,7 @@ select LEN(dt) from omgTimes

/// <summary>
/// Return the number of characters required to not truncate/loose any data when altering a column from datetime (e.g. datetime2, DATE etc) to varchar(x). Return
/// x such that the column does not loose integrity. This is needed when dynamically discovering what size to make a column by streaming data into a table.
/// x such that the column does not lose integrity. This is needed when dynamically discovering what size to make a column by streaming data into a table.
/// if we see many dates and nulls we will decide to use a date column then we see strings and have to convert the column to a varchar column without loosing the
/// currently loaded data.
/// </summary>
Expand Down
Loading

0 comments on commit 4a3e4b0

Please sign in to comment.