Skip to content

Commit

Permalink
add boolean syntax helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Oct 16, 2024
1 parent 203ed2b commit 69a749a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions FAnsiSql/Discovery/QuerySyntaxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public abstract partial class QuerySyntaxHelper(
/// <inheritdoc/>
public virtual char[] IllegalNameChars { get; } = ['.', '(', ')'];

public abstract string False { get; }
public abstract string True { get; }

/// <summary>
/// Regex for identifying parameters in blocks of SQL (starts with @ or : (Oracle)
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public sealed class MicrosoftQuerySyntaxHelper : QuerySyntaxHelper

public override string CloseQualifier => "]";

public override string False => "0";

public override string True => "1";

public override TopXResponse HowDoWeAchieveTopX(int x) => new($"TOP {x}", QueryComponent.SELECT);

public override string GetParameterDeclaration(string proposedNewParameterName, string sqlType) => $"DECLARE {proposedNewParameterName} AS {sqlType};";
Expand Down
4 changes: 4 additions & 0 deletions FAnsiSql/Implementations/MySql/MySqlQuerySyntaxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public sealed class MySqlQuerySyntaxHelper : QuerySyntaxHelper

public override string CloseQualifier => "`";

public override string False => "0";

public override string True => "1";

private MySqlQuerySyntaxHelper() : base(MySqlTypeTranslater.Instance, MySqlAggregateHelper.Instance,MySqlUpdateHelper.Instance,DatabaseType.MySql)//no specific type translation required
{
}
Expand Down
4 changes: 4 additions & 0 deletions FAnsiSql/Implementations/Oracle/OracleQuerySyntaxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ private OracleQuerySyntaxHelper() : base(OracleTypeTranslater.Instance, OracleAg

public override char ParameterSymbol => ':';

public override string False => "0";

public override string True => "1";

[return: NotNullIfNotNull(nameof(s))]
public override string? GetRuntimeName(string? s)
{
Expand Down
4 changes: 4 additions & 0 deletions FAnsiSql/Implementations/PostgreSql/PostgreSqlSyntaxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ private PostgreSqlSyntaxHelper() : base(PostgreSqlTypeTranslater.Instance, Postg

public override string CloseQualifier => "\"";

public override string False => "FALSE";

public override string True => "TRUE";

public override bool SupportsEmbeddedParameters() => false;

protected override object FormatDateTimeForDbParameter(DateTime dateTime) =>
Expand Down

0 comments on commit 69a749a

Please sign in to comment.