Esempio n. 1
0
    private void _doGet(IDbConnection conn, XmlElement ds) {
      var logger = new Logger(this.BioSession.Cfg.WorkspacePath, "debug.log") { Disabled = true };
      var cursor = new CJSCursor(conn, ds, this.bioCode);
      var rqst = this.BioRequest<JsonStoreRequestGet>();
      logger.WriteLn("_doGet - start");
      cursor.Init(rqst);
      logger.WriteLn("_doGet - cursor.Init - done");
      cursor.Open(rqst.Timeout);
      logger.WriteLn("_doGet - cursor.Open - done");
      try {
        var sqlToJson = new CSQLtoJSON();
        var packet = sqlToJson.Process(cursor, logger);
        var rsp = new JsonStoreResponse {
          BioParams = this.bioParams,
          Ex = null,
          Success = true,
          TransactionID = this.TransactionID,
          packet = packet,
        };
        logger.WriteLn("_doGet - sqlToJson.Process - done");

        this.Context.Response.Write(rsp.Encode());
        logger.WriteLn("_doGet - Response.Write - done");
      } finally {
        cursor.Close();
      }
      logger.WriteLn("_doGet - end");
    }
Esempio n. 2
0
 private void _loadDocFromCursor(XmlElement ds, StringBuilder doc, ref EBioException v_ex) {
   using (var vConn = this.BioSession.Cfg.dbSession.GetConnection()) {
     try {
       var vCursor = new CJSCursor(vConn, ds, this.bioCode);
       var v_request = this.BioRequest<JsonStoreRequestGet>();
       vCursor.Init(v_request);
       try {
         this.processData(vCursor, doc, ref v_ex);
       } finally {
         vCursor.Close();
       }
     } catch (Exception ex) {
       v_ex = EBioException.CreateIfNotEBio(ex);
     } finally {
       if (vConn != null)
         vConn.Close();
     }
   }
 }
Esempio n. 3
0
 private void _doProcessCursor() {
   var conn = this.dbSess.GetConnection();
   var vCursor = new CJSCursor(conn, this._cursor_ds, this.bioCode);
   vCursor.Init(null, this._request.BioParams, this._request.Filter, this._request.Sort, this._request.Selection, 120);
   vCursor.Open(120);
   try {
     while (vCursor.Next()) {
       if (this._state == RemoteProcState.Breaking)
         break;
       var newRow = vCursor.rqPacket.MetaData.CreateNewRow();
       // перебираем все поля одной записи
       foreach (Field vCur in vCursor.Fields) {
         var vFName = vCur.FieldName;
         var vFVal = vCur;
         newRow.Values[vCursor.rqPacket.MetaData.IndexOf(vFName)] = vCur.AsObject;
       }
       this._doProcessRecord(vCursor.rqPacket.MetaData, newRow);
     }
   } finally {
     vCursor.Close();
     if (conn != null)
       conn.Close();
   }
 }
Esempio n. 4
0
    private void _doGetSelectionPks(IDbConnection conn, XmlElement ds) {
      var v_cursor = new CJSCursor(conn, ds, this.bioCode);
      var rqst = this.BioRequest<JsonStoreRequestGet>();
      v_cursor.Init(rqst);
      v_cursor.Open(rqst.Timeout);
      try {
        String pks = null;
        while (v_cursor.Next()) 
          Utl.AppendStr(ref pks, v_cursor.PKValue, ";");
        var rsp = new JsonStoreResponse {
          BioParams = this.bioParams,
          Ex = null,
          Success = true,
          TransactionID = this.TransactionID,
          selectedPkList = pks
        };

        this.Context.Response.Write(rsp.Encode());
      } finally {
        v_cursor.Close();
      }
    }