Exemplo n.º 1
0
        public DataReaderAdapter(IDataReader reader, int nrows)
            : base(nrows, MakeColumnNames(reader), MakeModelRow(reader), MakeTNULL(reader))
        {
            _haveRow = reader.Read();
              _reader = reader;
              _rowStuffers = new RowStuffer[reader.FieldCount];
              //_rowStuffers = new RowStuffer[reader.GetSchemaTable().Columns.Count];

              for(int i = 0; i < _rowStuffers.Length; ++i)
              {
            Type t = reader.GetFieldType(i);
            //_rowStuffers[i] = RowStuffer.GetRowStuffer(reader.GetFieldType(i));
            try
            {
              _rowStuffers[i] = RowStuffer.GetRowStuffer(t);
            }
            catch(Exception e)
            {
              throw e;
            }
            if(reader.GetFieldType(i) == typeof(String))
            {
            _rowStuffers[i] =
              //new RowStuffer.StringRowStuffer(reader.GetSchemaTable().Columns[i].MaxLength);
              new RowStuffer.StringRowStuffer(30);
            }
              }
        }
Exemplo n.º 2
0
        public DataReaderAdapter(IDataReader reader, int nrows) :
            base(nrows, MakeColumnNames(reader), MakeModelRow(reader), MakeTNULL(reader))
        {
            _haveRow     = reader.Read();
            _reader      = reader;
            _rowStuffers = new RowStuffer[reader.FieldCount];
            //_rowStuffers = new RowStuffer[reader.GetSchemaTable().Columns.Count];

            for (int i = 0; i < _rowStuffers.Length; ++i)
            {
                Type t = reader.GetFieldType(i);
                //_rowStuffers[i] = RowStuffer.GetRowStuffer(reader.GetFieldType(i));
                try
                {
                    _rowStuffers[i] = RowStuffer.GetRowStuffer(t);
                }
                catch (Exception e)
                {
                    throw e;
                }
                if (reader.GetFieldType(i) == typeof(String))
                {
                    _rowStuffers[i] =
                        //new RowStuffer.StringRowStuffer(reader.GetSchemaTable().Columns[i].MaxLength);
                        new RowStuffer.StringRowStuffer(30);
                }
            }
        }