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/TableAdapterWrapper
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.