chore: initial git load of code space

This commit is contained in:
Thom Lamb
2026-05-12 08:52:33 -05:00
parent 9abada692f
commit 5e467bcc9c
384 changed files with 65960 additions and 2 deletions
@@ -0,0 +1,91 @@
using System.Collections;
using Strata.SqlTools.SqlBreakdown.Interfaces;
namespace Strata.SqlTools.SqlBreakdown.Classes;
/// <summary>
/// A simple ISqlBreakdown implementation that holds only raw SQL without parsing into clauses.
/// </summary>
/// <remarks>
/// This class is primarily used for batch SQL parsing where raw statements need to be stored
/// without detailed clause breakdown. Actual clause parsing can be performed separately.
/// </remarks>
[Serializable]
public class RawSqlBreakdown : ISqlBreakdown
{
/// <summary>
/// Gets or sets the raw SQL statement.
/// </summary>
public string? RawSql { get; set; }
/// <summary>
/// Gets or sets the setup clauses to execute before the main statement.
/// </summary>
public List<string> SetupClauses { get; set; } = new List<string>();
/// <summary>
/// Gets a value indicating whether setup clauses are being used.
/// </summary>
public bool IsUsingSetupClause => SetupClauses.Count > 0;
/// <summary>
/// Gets or sets the finish clauses to execute after the main statement.
/// </summary>
public ArrayList FinishClauses { get; set; } = new ArrayList();
/// <summary>
/// Gets a value indicating whether finish clauses are being used.
/// </summary>
public bool IsUsingFinishClause => FinishClauses.Count > 0;
/// <summary>
/// Gets the complete SQL statement including optional setup and finish clauses.
/// </summary>
/// <param name="includeSetupFinish">Whether to include setup and finish clauses.</param>
/// <returns>The complete SQL statement string.</returns>
public string GetSql(bool includeSetupFinish = true)
{
if (!includeSetupFinish)
{
return RawSql ?? string.Empty;
}
var sql = RawSql ?? string.Empty;
if (IsUsingSetupClause || IsUsingFinishClause)
{
var lines = new List<string>();
if (IsUsingSetupClause)
{
lines.AddRange(SetupClauses);
}
lines.Add(sql);
if (IsUsingFinishClause)
{
lines.AddRange(FinishClauses.Cast<string>());
}
return string.Join(Environment.NewLine, lines);
}
return sql;
}
/// <summary>
/// Creates a deep copy of this breakdown.
/// </summary>
/// <returns>A new RawSqlBreakdown with copied data.</returns>
public object Clone()
{
return new RawSqlBreakdown
{
RawSql = RawSql,
SetupClauses = new List<string>(SetupClauses),
FinishClauses = new ArrayList(FinishClauses)
};
}
}