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"); }
private void processData(CJSCursor pCursor, StringBuilder vDoc, ref EBioException vEx) { try { var needClose = false; if(!pCursor.IsActive && (pCursor.Connection != null)) { pCursor.Open(120); needClose = true; } // перебираем все записи в курсоре while(pCursor.Next()) { // перебираем все поля одной записи var fRow = new StringBuilder(); foreach(DictionaryEntry vCur in pCursor.RowValues) { fRow.Append(SQLUtils.ObjectAsString(vCur.Value)); } vDoc.Append(fRow); } if(needClose) pCursor.Close(); } catch(Exception ex) { vEx = EBioException.CreateIfNotEBio(ex); } }
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(); } }
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(); } }