wasCSharpSQLite

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 3  →  ?path2? @ 4
/trunk/Community.CsharpSqlite.UnitTests/Community.CsharpSQLite.UnitTests.csproj
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" 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>{59E27BF3-3D31-42E5-BA21-FAEE135E699F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Community.Data.SQLite.UnitTests</RootNamespace>
<AssemblyName>Community.Data.SQLite.UnitTests</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>
</StartupObject>
<TargetFrameworkSubset>
</TargetFrameworkSubset>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0168 ; 0169; 0414; 0618; 0649</NoWarn>
</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.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Management" />
<Reference Include="System.XML" />
<Reference Include="xunit, Version=1.4.9.1465, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\External\xUnit\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Community.CsharpSqlite.Benchmark\Classes\SQLiteDatabase.cs">
<Link>Classes\SQLiteDatabase.cs</Link>
</Compile>
<Compile Include="..\Community.CsharpSqlite.Benchmark\Classes\SQLiteVdbe.cs">
<Link>Classes\SQLiteVdbe.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Stress.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Community.CsharpSqlite\Community.CsharpSqlite.csproj">
<Project>{F1653F20-D47D-4F29-8C55-3C835542AF5F}</Project>
<Name>Community.CsharpSqlite</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</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>
/trunk/Community.CsharpSqlite.UnitTests/Community.CsharpSQLite.UnitTests.sln
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSQLite.UnitTests", "Community.CsharpSQLite.UnitTests.csproj", "{59E27BF3-3D31-42E5-BA21-FAEE135E699F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community.CsharpSqlite", "..\Community.CsharpSqlite\Community.CsharpSqlite.csproj", "{F1653F20-D47D-4F29-8C55-3C835542AF5F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{59E27BF3-3D31-42E5-BA21-FAEE135E699F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59E27BF3-3D31-42E5-BA21-FAEE135E699F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59E27BF3-3D31-42E5-BA21-FAEE135E699F}.Debug|x86.ActiveCfg = Debug|Any CPU
{59E27BF3-3D31-42E5-BA21-FAEE135E699F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59E27BF3-3D31-42E5-BA21-FAEE135E699F}.Release|Any CPU.Build.0 = Release|Any CPU
{59E27BF3-3D31-42E5-BA21-FAEE135E699F}.Release|x86.ActiveCfg = Release|Any CPU
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|x86.ActiveCfg = Debug|x86
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Debug|x86.Build.0 = Debug|x86
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|Any CPU.Build.0 = Release|Any CPU
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|x86.ActiveCfg = Release|x86
{F1653F20-D47D-4F29-8C55-3C835542AF5F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
/trunk/Community.CsharpSqlite.UnitTests/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
 
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "Community.CsharpSQLite.UnitTests.Properties" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Microsoft" )]
[assembly: AssemblyProduct( "Community.CsharpSQLite.UnitTests.Properties" )]
[assembly: AssemblyCopyright( "Copyright © Microsoft 2010" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
 
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
 
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "9fac3657-8906-445b-8359-e470ad17542e" )]
 
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.7.5.0")]
[assembly: AssemblyFileVersion( "1.0.0.0" )]
/trunk/Community.CsharpSqlite.UnitTests/Stress.cs
@@ -0,0 +1,94 @@
using System.Diagnostics;
using System.IO;
 
using Community.CsharpSQLite;
using Xunit;
using Community.CsharpSqlite;
 
namespace Community.CsharpSQLite.UnitTests
{
public class Stress
{
public Stress()
{
var db = OpenDB(databaseName);
InitializeTables(db);
db.CloseDatabase();
}
 
private SQLiteDatabase OpenDB(string fileName)
{
if (File.Exists(fileName))
File.Delete(fileName);
 
var db = new SQLiteDatabase(fileName);
 
for (int i = 0; i < PRAGMA_Commands.Length; i++)
{
db.ExecuteNonQuery(PRAGMA_Commands[i]);
}
 
return db;
}
 
private void InitializeTables(SQLiteDatabase db)
{
db.ExecuteNonQuery("BEGIN EXCLUSIVE");
for (int i = 0; i < CREATE_Commands.Length; i++)
{
db.ExecuteNonQuery(CREATE_Commands[i]);
}
}
 
private const string databaseName = "test.db";
 
private static readonly string[] CREATE_Commands =
{
"CREATE TABLE Root (intIndex INTEGER PRIMARY KEY, strIndex TEXT)",
"CREATE INDEX RootStrIndex ON Root (strIndex)"
};
 
private static readonly string[] PRAGMA_Commands =
{
"PRAGMA synchronous = OFF",
"PRAGMA temp_store = MEMORY",
"PRAGMA journal_mode = OFF",
"PRAGMA locking_mode=EXCLUSIVE"
};
 
private const string INSERT_Command =
"INSERT INTO Root VALUES (?,?)";
 
[Fact]
public void InsertRecords()
{
var db = OpenDB(databaseName);
 
db.ExecuteNonQuery("BEGIN");
var stmt = new SQLiteVdbe(db, INSERT_Command);
long key = 1999;
for (var i = 0; i < 1000; i++)
{
key = (3141592621L * key + 2718281829L) % 1000000007L;
stmt.Reset();
stmt.BindLong(1, key);
stmt.BindText(2, key.ToString());
stmt.ExecuteStep();
}
stmt.Close();
db.ExecuteNonQuery("END");
 
db.CloseDatabase();
}
 
[Fact]
public void Insert_1000()
{
for (var i = 0; i < 1000; i++)
{
Debug.WriteLine("Round " + i);
InsertRecords();
}
}
}
}
/trunk/Community.CsharpSqlite.UnitTests/app.config
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>