Permalink
Browse files

Added a sqlite64 bit ormlite provider. with specific 64 bit dlls stor…

…ed in the x64/ folder
  • Loading branch information...
1 parent b372fc9 commit fc8b3c7378cf3ca30cd4020f92ffa9da18c3aa59 @mythz mythz committed Feb 23, 2011
View
@@ -1,8 +1,10 @@
REM SET BUILD=Debug
SET BUILD=Release
-COPY ..\src\ServiceStack.OrmLite.Sqlite\bin\%BUILD%\ServiceStack.OrmLite.* ..\..\ServiceStack\release\latest\ServiceStack.OrmLite
-COPY ..\src\ServiceStack.OrmLite.SqlServer\bin\%BUILD%\ServiceStack.OrmLite.* ..\..\ServiceStack\release\latest\ServiceStack.OrmLite
+COPY ..\src\ServiceStack.OrmLite.Sqlite\bin\%BUILD%\ServiceStack.* ..\..\ServiceStack\release\latest\ServiceStack.OrmLite
+
+COPY ..\src\ServiceStack.OrmLite.Sqlite64\bin\%BUILD%\ServiceStack.OrmLite.Sqlite64.* ..\..\ServiceStack\release\latest\ServiceStack.OrmLite\x64
+COPY ..\src\ServiceStack.OrmLite.Sqlite64\bin\%BUILD%\System.Data.SQLite.dll ..\..\ServiceStack\release\latest\ServiceStack.OrmLite\x64
COPY ..\src\ServiceStack.OrmLite.Sqlite\bin\%BUILD%\ServiceStack.OrmLite.* ..\..\ServiceStack\lib
COPY ..\src\ServiceStack.OrmLite.Sqlite\bin\%BUILD%\ServiceStack.OrmLite.* ..\..\ServiceStack\lib\tests
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
- <ProjectView>ProjectFiles</ProjectView>
+ <ProjectView>ShowAllFiles</ProjectView>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
@@ -0,0 +1,36 @@
+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("ServiceStack.OrmLite.Sqlite64")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("ServiceStack.OrmLite.Sqlite64")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[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("540d6e0c-97cd-42a8-9bed-89a7a887928b")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +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>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{59E6B217-24AD-4F55-B032-FCD0090CD300}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ServiceStack.OrmLite.Sqlite</RootNamespace>
+ <AssemblyName>ServiceStack.OrmLite.Sqlite64</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>
+ <PlatformTarget>x64</PlatformTarget>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="ServiceStack.Text">
+ <HintPath>..\..\lib\ServiceStack.Text.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Data.SQLite">
+ <HintPath>..\..\lib\x64\System.Data.SQLite.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SqliteOrmLiteDialectProvider.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\ServiceStack.OrmLite\ServiceStack.OrmLite.csproj">
+ <Project>{96179AC6-F6F1-40C3-9FDD-4F6582F54C5C}</Project>
+ <Name>ServiceStack.OrmLite</Name>
+ </ProjectReference>
+ </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>
@@ -0,0 +1,125 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SQLite;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using ServiceStack.Text.Common;
+
+namespace ServiceStack.OrmLite.Sqlite
+{
+ public class SqliteOrmLiteDialectProvider
+ : OrmLiteDialectProviderBase
+ {
+ public static SqliteOrmLiteDialectProvider Instance = new SqliteOrmLiteDialectProvider();
+
+ public SqliteOrmLiteDialectProvider()
+ {
+ base.DateTimeColumnDefinition = base.StringColumnDefinition;
+ base.BoolColumnDefinition = base.IntColumnDefinition;
+ base.GuidColumnDefinition = "CHAR(32)";
+
+ base.InitColumnTypeMap();
+ }
+
+ public static string CreateFullTextCreateTableStatement(object objectWithProperties)
+ {
+ var sbColumns = new StringBuilder();
+ foreach (var propertyInfo in objectWithProperties.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
+ {
+ var columnDefinition = (sbColumns.Length == 0)
+ ? string.Format("{0} TEXT PRIMARY KEY", propertyInfo.Name)
+ : string.Format(", {0} TEXT", propertyInfo.Name);
+
+ sbColumns.AppendLine(columnDefinition);
+ }
+
+ var tableName = objectWithProperties.GetType().Name;
+ var sql = string.Format("CREATE VIRTUAL TABLE \"{0}\" USING FTS3 ({1});", tableName, sbColumns);
+
+ return sql;
+ }
+
+ public override IDbConnection CreateConnection(string connectionString, Dictionary<string, string> options)
+ {
+ var isFullConnectionString = connectionString.Contains(";");
+
+ if (!isFullConnectionString)
+ {
+ if (connectionString != ":memory:")
+ {
+ var existingDir = Path.GetDirectoryName(connectionString);
+ if (!Directory.Exists(existingDir))
+ {
+ Directory.CreateDirectory(existingDir);
+ }
+ }
+ connectionString =
+ @"Data Source=" + connectionString + ";Version=3;New=True;Compress=True;";
+ }
+
+ if (options != null)
+ {
+ foreach (var option in options)
+ {
+ connectionString += option.Key + "=" + option.Value + ";";
+ }
+ }
+
+ return new SQLiteConnection(connectionString);
+ }
+
+ public override object ConvertDbValue(object value, Type type)
+ {
+ if (value == null || value is DBNull) return null;
+
+ if (type == typeof(bool))
+ {
+ var intVal = int.Parse(value.ToString());
+ return intVal != 0;
+ }
+
+ try
+ {
+ return base.ConvertDbValue(value, type);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public override string GetQuotedValue(object value, Type fieldType)
+ {
+ if (value == null) return "NULL";
+
+ if (fieldType == typeof(Guid))
+ {
+ var guidValue = (Guid)value;
+ return base.GetQuotedValue(guidValue.ToString("N"), typeof(string));
+ }
+ if (fieldType == typeof(DateTime))
+ {
+ var dateValue = (DateTime)value;
+ return base.GetQuotedValue(
+ DateTimeSerializer.ToShortestXsdDateTimeString(dateValue),
+ typeof(string));
+ }
+ if (fieldType == typeof(bool))
+ {
+ var boolValue = (bool)value;
+ return base.GetQuotedValue(boolValue ? 1 : 0, typeof(int));
+ }
+
+ return base.GetQuotedValue(value, fieldType);
+ }
+
+ public override long GetLastInsertId(IDbCommand dbCmd)
+ {
+ dbCmd.CommandText = "SELECT last_insert_rowid()";
+ var result = dbCmd.ExecuteScalar();
+ return (long)result;
+ }
+ }
+}
@@ -16,6 +16,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.OrmLite.Tests"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.OrmLite.TestsPerf", "..\tests\ServiceStack.OrmLite.TestsPerf\ServiceStack.OrmLite.TestsPerf.csproj", "{24E0D2DB-1F1E-43BE-83DB-B999ACE5A700}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.OrmLite.Sqlite64", "ServiceStack.OrmLite.Sqlite64\ServiceStack.OrmLite.Sqlite64.csproj", "{59E6B217-24AD-4F55-B032-FCD0090CD300}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.OrmLite.Sqlite64Tests", "..\tests\ServiceStack.OrmLite.Sqlite64Tests\ServiceStack.OrmLite.Sqlite64Tests.csproj", "{1B97B329-8B70-4034-A2C9-35BF5DF428DC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -64,6 +68,22 @@ Global
{24E0D2DB-1F1E-43BE-83DB-B999ACE5A700}.Release|Any CPU.Build.0 = Release|Any CPU
{24E0D2DB-1F1E-43BE-83DB-B999ACE5A700}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.ActiveCfg = Release|Any CPU
{24E0D2DB-1F1E-43BE-83DB-B999ACE5A700}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.Build.0 = Release|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.MonoTouch|Any CPU.ActiveCfg = Release|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.MonoTouch|Any CPU.Build.0 = Release|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.Release|Any CPU.Build.0 = Release|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.ActiveCfg = Release|Any CPU
+ {59E6B217-24AD-4F55-B032-FCD0090CD300}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.Build.0 = Release|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.MonoTouch|Any CPU.ActiveCfg = Release|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.MonoTouch|Any CPU.Build.0 = Release|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.ActiveCfg = Release|Any CPU
+ {1B97B329-8B70-4034-A2C9-35BF5DF428DC}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,48 @@
+using System;
+using System.IO;
+using NUnit.Framework;
+using ServiceStack.Common.Utils;
+using ServiceStack.Logging;
+using ServiceStack.Logging.Support.Logging;
+using ServiceStack.OrmLite.Sqlite;
+
+namespace ServiceStack.OrmLite.Tests
+{
+ public class OrmLiteTestBase
+ {
+ protected virtual string ConnectionString { get; set; }
+
+ protected string GetFileConnectionString()
+ {
+ var connectionString = "~/App_Data/db.sqlite".MapAbsolutePath();
+ if (File.Exists(connectionString))
+ File.Delete(connectionString);
+
+ return connectionString;
+ }
+
+ protected void CreateNewDatabase()
+ {
+ if (ConnectionString.Contains(".sqlite"))
+ ConnectionString = GetFileConnectionString();
+ }
+
+ [TestFixtureSetUp]
+ public void TestFixtureSetUp()
+ {
+ LogManager.LogFactory = new ConsoleLogFactory();
+
+ OrmLiteConfig.DialectProvider = SqliteOrmLiteDialectProvider.Instance;
+ //ConnectionString = ":memory:";
+ ConnectionString = GetFileConnectionString();
+
+ //OrmLiteConfig.DialectProvider = SqlServerOrmLiteDialectProvider.Instance;
+ //ConnectionString = "~/App_Data/Database1.mdf".MapAbsolutePath();
+ }
+
+ public void Log(string text)
+ {
+ Console.WriteLine(text);
+ }
+ }
+}
@@ -0,0 +1,36 @@
+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("ServiceStack.OrmLite.Sqlite64Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("ServiceStack.OrmLite.Sqlite64Tests")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[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("a03645ee-363c-428c-b556-c009a536f817")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Oops, something went wrong.

0 comments on commit fc8b3c7

Please sign in to comment.