Skip to content

Commit

Permalink
Fixing query command-timeout based on suggestion at subsonic#257
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanb committed Feb 14, 2019
1 parent 31ce330 commit 73bf7da
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 2,141 deletions.
122 changes: 59 additions & 63 deletions PerfRunner/PerfRunner.csproj
Original file line number Diff line number Diff line change
@@ -1,70 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{45BA3F78-05F5-4344-AD0D-309F2AED9A0A}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PerfRunner</RootNamespace>
<AssemblyName>PerfRunner</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SubSonic.Core\SubSonic.Core.csproj">
<Project>{53FF90B2-2D33-4EC0-91B6-A30FDF1B3374}</Project>
<Name>SubSonic.Core</Name>
</ProjectReference>
<ProjectReference Include="..\SubSonic.Tests\SubSonic.Tests.csproj">
<Project>{6B23B65F-2E09-4531-BDA1-A6EA08CBA843}</Project>
<Name>SubSonic.Tests</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="MySql.Data.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{45BA3F78-05F5-4344-AD0D-309F2AED9A0A}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PerfRunner</RootNamespace>
<AssemblyName>PerfRunner</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SubSonic.Core\SubSonic.Core.csproj">
<Project>{53FF90B2-2D33-4EC0-91B6-A30FDF1B3374}</Project>
<Name>SubSonic.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="MySql.Data.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-->
</Project>
5 changes: 4 additions & 1 deletion SubSonic.Core/DataProviders/DbDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public DbDataReader ExecuteReader(QueryCommand qry)

DbCommand cmd = scope.Connection.CreateCommand();
cmd.Connection = scope.Connection; //CreateConnection();

cmd.CommandTimeout = qry.CommandTimeout;
cmd.CommandText = qry.CommandSql;
cmd.CommandType = qry.CommandType;

Expand Down Expand Up @@ -179,6 +179,7 @@ public DataSet ExecuteDataSet(QueryCommand qry)
DbCommand cmd = Factory.CreateCommand();
cmd.CommandText = qry.CommandSql;
cmd.CommandType = qry.CommandType;
cmd.CommandTimeout = qry.CommandTimeout;
DataSet ds = new DataSet();

using(AutomaticConnectionScope scope = new AutomaticConnectionScope(this))
Expand All @@ -203,6 +204,7 @@ public object ExecuteScalar(QueryCommand qry)
DbCommand cmd = Factory.CreateCommand();
cmd.Connection = automaticConnectionScope.Connection;
cmd.CommandType = qry.CommandType;
cmd.CommandTimeout = qry.CommandTimeout;
cmd.CommandText = qry.CommandSql;
AddParams(cmd, qry);
result = cmd.ExecuteScalar();
Expand Down Expand Up @@ -241,6 +243,7 @@ public int ExecuteQuery(QueryCommand qry)
DbCommand cmd = automaticConnectionScope.Connection.CreateCommand();
cmd.CommandText = qry.CommandSql;
cmd.CommandType = qry.CommandType;
cmd.CommandTimeout = qry.CommandTimeout;
AddParams(cmd, qry);
result = cmd.ExecuteNonQuery();
// Issue 11 fix introduced by [email protected]
Expand Down
Loading

0 comments on commit 73bf7da

Please sign in to comment.