Skip to content
Open
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
4 changes: 4 additions & 0 deletions Laan.NHibernate.Appender/Laan.NHibernate.Appender.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<ProjectReference Include="..\Laan.SQL.Parser\Laan.Sql.Parser.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath=""/>
</ItemGroup>

<Import Project="$(SolutionDir)Build\Common.targets" />
<Import Project="$(SolutionDir)Build\Nuget.targets" />
</Project>
1 change: 1 addition & 0 deletions Laan.NHibernate.Appender/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please see [https://github.com/benlaan/sqlformat/wiki](https://github.com/benlaan/sqlformat/wiki)
1 change: 1 addition & 0 deletions Laan.Sql.Formatter/Factories/StatementFormatterFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static StatementFormatterFactory()
{ typeof( DeleteStatement ), typeof( DeleteStatementFormatter ) },
{ typeof( InsertStatement ), typeof( InsertStatementFormatter ) },
{ typeof( DeclareStatement ), typeof( DeclareStatementFormatter ) },
{ typeof( SetVariableStatement ), typeof( SetVariableStatementFormatter ) },
{ typeof( GoTerminator ), typeof( GoTerminatorFormatter ) },
{ typeof( IfStatement ), typeof( IfStatementFormatter ) },
{ typeof( BeginTransactionStatement ), typeof( BeginTransactionStatementFormatter ) },
Expand Down
4 changes: 4 additions & 0 deletions Laan.Sql.Formatter/Laan.Sql.Formatter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<ProjectReference Include="..\Laan.SQL.Parser\Laan.Sql.Parser.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath=""/>
</ItemGroup>

<Import Project="$(SolutionDir)Build\Common.targets" />
<Import Project="$(SolutionDir)Build\Nuget.targets" />

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Laan.Sql.Parser.Entities;
using System.Text;

namespace Laan.Sql.Formatter
{
public class SetVariableStatementFormatter : StatementFormatter<SetVariableStatement>, IStatementFormatter
{
public SetVariableStatementFormatter(IIndentable indentable, StringBuilder sql, SetVariableStatement statement)
: base(indentable, sql, statement)
{
}

public void Execute()
{
var formatter = new VariableAssignmentFormatter(_statement.Variable, _statement.Assignment, this, _sql);
formatter.Execute();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Laan.Sql.Parser;
using Laan.Sql.Parser.Expressions;
using System.Text;

namespace Laan.Sql.Formatter
{
public class VariableAssignmentFormatter : BaseFormatter
{
private string _identifier;
private Expression _assignment;

public VariableAssignmentFormatter(string identifier, Expression assignment, IIndentable indentable, StringBuilder sql) : base(indentable, sql)
{
_identifier = identifier;
_assignment = assignment;
}

public void Execute()
{
var assignmentValue = _assignment.FormattedValue(0, this);
var variableAssignment = $"{Constants.Set} {_identifier} = {assignmentValue};";

IndentAppend(variableAssignment);
}
}
}
1 change: 1 addition & 0 deletions Laan.Sql.Formatter/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please see [https://github.com/benlaan/sqlformat/wiki](https://github.com/benlaan/sqlformat/wiki)
6 changes: 5 additions & 1 deletion Laan.Sql.Parser/Laan.Sql.Parser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
</PackageReference>
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" />
</ItemGroup>


<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath=""/>
</ItemGroup>

<Import Project="$(SolutionDir)Build\Common.targets" />
<Import Project="$(SolutionDir)Build\Nuget.targets" />

Expand Down
1 change: 1 addition & 0 deletions Laan.Sql.Parser/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please see [https://github.com/benlaan/sqlformat/wiki](https://github.com/benlaan/sqlformat/wiki)