public bool Read() { if (_uds == null) { return(false); } if (_rowIdx < _uds.RowCount) { UniRecord urRow = _uds.GetRecord(_rowIdx); _row.Clear(); _row.Add(urRow.RecordID); for (int colIdx = 1; colIdx < 8; colIdx++) { _row.Add(urRow.Record.Extract(colIdx).ToString()); } _rowIdx++; return(true); } else { return(false); } }
public bool Read() { if (_keySample == null) { return(false); } if ((_blockIdx > _keySample.Length) || (Limit > 0 && RecordsAffected >= Limit)) { return(false); } if (0 == _rowIdx) { UniCommand uCmd = _uSession.CreateUniCommand(); _keyBlock = null; while (_keyBlock == null) { uCmd.Command = string.Format("SELECT {0} BY @ID", uFile.FileName); if (_blockIdx > 0) { uCmd.Command += string.Format(" WITH @ID >= \"{0}\"", _keySample[_blockIdx - 1].Replace("\"", "\"\"")); } if (_blockIdx < _keySample.Length) { if (_blockIdx > 0) { uCmd.Command += " AND "; } else { uCmd.Command += " WITH "; } uCmd.Command += string.Format("@ID < \"{0}\"", _keySample[_blockIdx].Replace("\"", "\"\"")); } uCmd.Execute(); usl = _uSession.CreateUniSelectList(0); _keyBlock = usl.ReadListAsStringArray(); if (_keyBlock == null) { _blockIdx++; } } // Console.Write(_keyBlock.ToString()); _uds = uFile.ReadRecords(_keyBlock); } if (_rowIdx < _keyBlock.Length) { _row.Clear(); _row.Add(_keyBlock[_rowIdx]); _row.Add(_uds.GetRecord(_rowIdx).Record.ToString()); _rowIdx++; if (_rowIdx == _keyBlock.Length) { _rowIdx = 0; _blockIdx++; } } RecordsAffected++; return(true); /* * try * { * * if (0 == i) * value = key; * else * { * var fld = udaRow.Extract(i).ToString(); * if ("" != fld) * { * var xf = new XElement("fld" / *, new XAttribute("loc", i) * /); * for (var v = 1; v <= udaRow.Dcount(i); v++) * { * / * * XElement xv = new XElement("val", new XAttribute("loc", v)); * string val = udaRow.Extract(i, v).ToString(); * if ("" != val) * { * for (int s = 1; s <= udaRow.Dcount(i, v); s++) * { * xv.Add(new XElement("sub", new XAttribute("loc", s), udaRow.Extract(i, v, s).ToString())); * } * } * xf.Add(xv); * / * * var val = udaRow.Extract(i, v).ToString(); * * * //replace control characters that are invalid in xml with empty string * var re = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]"; * val = Regex.Replace(val, re, ""); * * // replace text and subtext remarks with carriage return * re = @"[\xFB\xFC]"; * val = Regex.Replace(val, re, "\n"); * //const string TM_CHAR = "\xFB"; * //const string SM_CHAR = "\xFC"; * //val.Replace(SM_CHAR, "\n"); * //val.Replace(TM_CHAR, "\n"); * * xf.Add(new XElement("val", new XAttribute("loc", v), val)); * } * value = xf.ToString(); * } * } * } * catch (Exception e) * { * Console.WriteLine(e.ToString()); * } * if (null == value) * return DBNull.Value; * else * return value; * */ }