Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/26/09 12:18:32 (15 years ago)
Author:
svonolfe
Message:

Streaming of Jobs and JobsResults directly from/to the DB (#680)

Location:
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs

    r2099 r2117  
    3232using System.Data.SqlClient;
    3333using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper;
     34using System.IO;
    3435
    3536namespace HeuristicLab.Hive.Server.ADODataAccess {
     
    436437          }
    437438        });
     439    }
     440
     441    public Stream GetSerializedJobStream(Guid jobId, bool useExistingConnection) {
     442      return
     443        ((JobAdapterWrapper)base.DataAdapterWrapper).
     444          GetSerializedJobStream(jobId, useExistingConnection);
    438445    }
    439446
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobResultsAdapter.cs

    r2099 r2117  
    1010using System.Data.SqlClient;
    1111using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper;
     12using System.IO;
    1213
    1314namespace HeuristicLab.Hive.Server.ADODataAccess {
     
    152153    }
    153154
     155    public Stream GetSerializedJobResultStream(Guid jobResultId, bool useExistingConnection) {
     156      return
     157        ((JobResultsAdapterWrapper)
     158        base.DataAdapterWrapper).
     159          GetSerializedJobResultStream(jobResultId, useExistingConnection);
     160    }
     161
    154162    public void UpdateSerializedJobResult(SerializedJobResult jobResult) {
    155163      if (jobResult != null &&
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/TableAdapterWrapper/JobAdapterWrapper.cs

    r2083 r2117  
    77using HeuristicLab.Hive.Contracts.BusinessObjects;
    88using System.Data.Common;
     9using System.IO;
     10using System.Data.SqlTypes;
     11using System.Data;
    912
    1013namespace HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper {
     
    3942    }
    4043
    41     public byte[] GetSerializedJob(Guid jobId) {
    42       return TransactionalAdapter.GetSerializedJobById(jobId);
    43     }
     44    public Stream GetSerializedJobStream(Guid jobId,
     45      bool useExistingConnection) {
     46      SqlConnection connection = null;
     47      SqlTransaction transaction = null;
    4448
    45     public bool UpdateSerialiedJob(byte[] serializedJob, Guid jobId) {
    46       return TransactionalAdapter.UpdateSerializedJob(serializedJob, jobId) > 0;
     49      if (useExistingConnection) {
     50        connection =
     51          base.Session.Connection as SqlConnection;
     52
     53        transaction =
     54          adapter.Transaction;
     55      } else {
     56        connection =
     57         ((SessionFactory)
     58           (base.Session.Factory)).CreateConnection()
     59           as SqlConnection;
     60      }
     61
     62      VarBinarySource source =
     63        new VarBinarySource(
     64          connection, transaction,
     65          "Job", "SerializedJob", "JobId", jobId);
     66
     67      return new VarBinaryStream(source);
    4768    }
    4869
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/TableAdapterWrapper/JobResultsAdapterWrapper.cs

    r2099 r2117  
    77using HeuristicLab.Hive.Contracts.BusinessObjects;
    88using System.Data.Common;
     9using System.IO;
    910
    1011namespace HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper {
     
    3637    }
    3738
    38     public byte[] GetSerializedJobResult(Guid jobResultId) {
    39       return TransactionalAdapter.GetSerializedJobResultById(jobResultId);
    40     }
     39    public Stream GetSerializedJobResultStream(Guid jobResultId,
     40      bool useExistingConnection) {
     41      SqlConnection connection = null;
     42      SqlTransaction transaction = null;
    4143
    42     public bool UpdateSerialiedJobResult(byte[] serializedJobResult, Guid jobResultId) {
    43       return TransactionalAdapter.UpdateSerializedJobResultById(serializedJobResult, jobResultId) > 0;
     44      if (useExistingConnection) {
     45        connection =
     46          base.Session.Connection as SqlConnection;
     47
     48        transaction =
     49          adapter.Transaction;
     50      } else {
     51        connection =
     52         ((SessionFactory)
     53           (base.Session.Factory)).CreateConnection()
     54           as SqlConnection;
     55      }
     56
     57      VarBinarySource source =
     58        new VarBinarySource(
     59          connection, transaction,
     60          "JobResult", "JobResult", "JobResultId", jobResultId);
     61
     62      return new VarBinaryStream(source);
    4463    }
    4564
Note: See TracChangeset for help on using the changeset viewer.