Changeset 1111


Ignore:
Timestamp:
01/12/09 10:52:23 (12 years ago)
Author:
gkronber
Message:

merged implementation of #461 (r1110) to CEDMA refactoring branch (see #419)

Location:
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.Grid
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.Grid/Database.cs

    r507 r1111  
    2525using System.Text;
    2626using System.Data;
    27 using System.Data.SQLite;
    2827using System.Data.Common;
    2928using System.Threading;
     
    3332    private string connectionString;
    3433    private ReaderWriterLockSlim rwLock;
     34    private DbProviderFactory factory;
    3535    public Database(string connectionString) {
    3636      this.connectionString = connectionString;
    3737      rwLock = new ReaderWriterLockSlim();
     38      factory = DbProviderFactories.GetFactory("System.Data.SQLite");
    3839    }
    3940
     
    4243      rwLock.EnterWriteLock();
    4344      try {
    44         using(DbConnection cnn = new SQLiteConnection(connectionString)) {
     45        using (DbConnection cnn = factory.CreateConnection()) {
     46          cnn.ConnectionString = connectionString;
    4547          cnn.Open();
    4648          using(DbTransaction t = cnn.BeginTransaction()) {
     
    6264      rwLock.EnterWriteLock();
    6365      try {
    64         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
     66        using (DbConnection cnn = factory.CreateConnection()) {
     67          cnn.ConnectionString = connectionString;
    6568          cnn.Open();
    6669          using(DbTransaction t = cnn.BeginTransaction()) {
     
    104107      rwLock.EnterUpgradeableReadLock();
    105108      try {
    106         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
     109        using (DbConnection cnn = factory.CreateConnection()) {
     110          cnn.ConnectionString = connectionString;
    107111          cnn.Open();
    108112          JobEntry job = new JobEntry();
     
    159163      rwLock.EnterWriteLock();
    160164      try {
    161         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
     165        using (DbConnection cnn = factory.CreateConnection()) {
     166          cnn.ConnectionString = connectionString;
    162167          cnn.Open();
    163168          using(DbTransaction t = cnn.BeginTransaction()) {
     
    190195      rwLock.EnterWriteLock();
    191196      try {
    192         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
     197        using (DbConnection cnn = factory.CreateConnection()) {
     198          cnn.ConnectionString = connectionString;
    193199          cnn.Open();
    194200          using(DbTransaction t = cnn.BeginTransaction()) {
     
    225231      rwLock.EnterReadLock();
    226232      try {
    227         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
     233        using (DbConnection cnn = factory.CreateConnection()) {
     234          cnn.ConnectionString = connectionString;
    228235          cnn.Open();
    229236          DbCommand c = cnn.CreateCommand();
     
    255262      rwLock.EnterReadLock();
    256263      try {
    257         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
     264        using (DbConnection cnn = factory.CreateConnection()) {
     265          cnn.ConnectionString = connectionString;
    258266          cnn.Open();
    259267          DbCommand c = cnn.CreateCommand();
     
    279287      rwLock.EnterReadLock();
    280288      try {
    281         using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) {
     289        using (DbConnection cnn = factory.CreateConnection()) {
     290          cnn.ConnectionString = connectionString;
    282291          cnn.Open();
    283292          DbCommand c = cnn.CreateCommand();
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.Grid/HeuristicLab.Grid.csproj

    r1109 r1111  
    5555    <Reference Include="System.Core">
    5656      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    57     </Reference>
    58     <Reference Include="System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
    59       <SpecificVersion>False</SpecificVersion>
    60       <HintPath>..\HeuristicLab.SQLite\System.Data.SQLite.DLL</HintPath>
    6157    </Reference>
    6258    <Reference Include="System.Drawing" />
Note: See TracChangeset for help on using the changeset viewer.