Skip to content

Commit

Permalink
Merge pull request #528 from mk3008/522-request-add-sign-inversion-fu…
Browse files Browse the repository at this point in the history
…nction

Enhancement: Changed target framework
  • Loading branch information
mk3008 authored Aug 27, 2024
2 parents 19b053c + d3680f6 commit f67392b
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 124 deletions.
4 changes: 2 additions & 2 deletions demo/Migration/Demo.Migration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
</ItemGroup>

</Project>
18 changes: 9 additions & 9 deletions demo/Parse/Demo.Parse.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
</ItemGroup>

</Project>
36 changes: 18 additions & 18 deletions src/Carbunql.Dapper/Carbunql.Dapper.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.6.1</Version>
<Authors>mk3008net</Authors>
<Copyright>mk3008net</Copyright>
<PackageProjectUrl>https://github.com/mk3008/Carbunql</PackageProjectUrl>
<RepositoryUrl>https://github.com/mk3008/Carbunql.git</RepositoryUrl>
<PackageTags>SQL;SQLBuilder;SQLParser;SQLRebuilder;Dapper</PackageTags>
<Description>A utility for using the query class generated by Carbunql with Dapper as it is.</Description>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.6.1</Version>
<Authors>mk3008net</Authors>
<Copyright>mk3008net</Copyright>
<PackageProjectUrl>https://github.com/mk3008/Carbunql</PackageProjectUrl>
<RepositoryUrl>https://github.com/mk3008/Carbunql.git</RepositoryUrl>
<PackageTags>SQL;SQLBuilder;SQLParser;SQLRebuilder;Dapper</PackageTags>
<Description>A utility for using the query class generated by Carbunql with Dapper as it is.</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Carbunql\Carbunql.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Carbunql\Carbunql.csproj" />
</ItemGroup>

</Project>
26 changes: 0 additions & 26 deletions src/Carbunql/Analysis/ReadQueryParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,4 @@ public static ReadQuery Parse(ITokenReader r)

throw new NotSupportedException($"Unsupported token: '{r.Peek()}'");
}

/// <summary>
/// Parses the READ query while ignoring surrounding brackets.
/// </summary>
/// <param name="r">The ITokenReader instance.</param>
/// <returns>The parsed ReadQuery object.</returns>
internal static ReadQuery ParseIgnoringBrackets(ITokenReader r)
{
// Skip opening brackets
var cnt = 0;
while (r.TryRead("(", out _))
{
cnt++;
}

var q = Parse(r);

// Skip closing brackets
while (cnt > 0)
{
r.Read(")");
cnt--;
}

return q;
}
}
29 changes: 28 additions & 1 deletion src/Carbunql/Analysis/SelectQueryParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,34 @@ internal static SelectQuery Parse(ITokenReader r)
{
//read operator
var op = r.Read();
sq.AddOperatableValue(op, ReadQueryParser.ParseIgnoringBrackets(r));

// Skip opening brackets
var cnt = 0;
while (r.TryRead("(", out _))
{
cnt++;
}

if (r.Peek().IsEqualNoCase("select"))
{
sq.AddOperatableValue(op, ParseMain(r));
}
else if (r.Peek().IsEqualNoCase("values"))
{
sq.AddOperatableValue(op, ValuesQueryParser.Parse(r));
}
else
{
throw new NotSupportedException();
}

// Skip closing brackets
while (cnt > 0)
{
r.Read(")");
cnt--;
}

}

sq.LimitClause = ParseLimitOrDefault(r);
Expand Down
2 changes: 1 addition & 1 deletion src/Carbunql/Carbunql.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
42 changes: 21 additions & 21 deletions test/Carbunql.Analysis.Test/Carbunql.Analysis.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion test/Carbunql.Benchmark/Carbunql.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
46 changes: 23 additions & 23 deletions test/Carbunql.Dapper.Test/Carbunql.Dapper.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Testcontainers.PostgreSql" Version="3.7.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Npgsql" Version="8.0.3" />
<PackageReference Include="Testcontainers.PostgreSql" Version="3.7.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql.Dapper\Carbunql.Dapper.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql.Dapper\Carbunql.Dapper.csproj" />
</ItemGroup>

</Project>
42 changes: 21 additions & 21 deletions test/Carbunql.DynamicQuery.Test/Carbunql.DynamicQuery.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Carbunql\Carbunql.csproj" />
</ItemGroup>

</Project>

0 comments on commit f67392b

Please sign in to comment.