protected override Type GetFieldType(int a, GDADataRecord b)
        {
                        #if UNMANAGED
            var c = (global::Oracle.DataAccess.Client.OracleDataReader)b.BaseDataRecord;
#elif DEVART
            var c = (Devart.Data.Oracle.OracleDataReader)b.BaseDataRecord;
#else
            var c = (global::Oracle.ManagedDataAccess.Client.OracleDataReader)b.BaseDataRecord;
                        #endif
            var d = c.GetFieldType(a);
            return((d == typeof(DateTime)) ? typeof(DateTimeOffset) : d);
        }
        /// <summary>
        /// Recupera o tipo do campo.
        /// </summary>
        /// <param name="ordinal">Posição ordinal do campo.</param>
        /// <param name="dataRecord">O record sobre qual será buscado o campo.</param>
        /// <returns>Tipo do campo.</returns>
        protected override Type GetFieldType(int ordinal, GDADataRecord dataRecord)
        {
                        #if UNMANAGED
            var dataReader = (global::Oracle.DataAccess.Client.OracleDataReader)dataRecord.BaseDataRecord;
#elif DEVART
            var dataReader = (Devart.Data.Oracle.OracleDataReader)dataRecord.BaseDataRecord;
#else
            var dataReader = (global::Oracle.ManagedDataAccess.Client.OracleDataReader)dataRecord.BaseDataRecord;
                        #endif
            var type = dataReader.GetFieldType(ordinal);
            return((type == typeof(DateTime)) ? typeof(DateTimeOffset) : type);
        }
        /// <summary>
        /// Recupera os dados do registro.
        /// </summary>
        /// <param name="descriptor"></param>
        /// <param name="record"></param>
        /// <returns></returns>
        protected Record GetRecord(Record.RecordDescriptor descriptor, GDADataRecord record)
        {
            var values = new object[descriptor.Count];

            for (int i = 0; i < values.Length; i++)
            {
                var field     = descriptor[i];
                var fieldName = field.Name;
                if (fieldName == DataAccessConstants.ReturnValueColumnName)
                {
                    fieldName = "";
                }
                values[i] = GetValue(i, record, field.Type);
                if (field.Type == typeof(object) && values[i] is byte[])
                {
                    field.ChangeFieldType(typeof(byte[]));
                }
            }
            return(descriptor.CreateRecord(values));
        }
 /// <summary>
 /// Move para o próximo registro.
 /// </summary>
 /// <returns></returns>
 public bool MoveNext()
 {
     if (_enumerator == null)
     {
         return(false);
     }
     if (_firstRecord != null)
     {
         _record      = _firstRecord;
         _firstRecord = null;
         return(true);
     }
     if (_enumerator.MoveNext())
     {
         GDADataRecord dataRecord = _enumerator.Current;
         _record = _dataSource.GetRecord(_descriptor, dataRecord);
         return(true);
     }
     Dispose();
     return(false);
 }
        protected override object GetValue(int a, GDADataRecord b, Type c)
        {
                        #if UNMANAGED
            var d = (global::Oracle.DataAccess.Client.OracleDataReader)b.BaseDataRecord;
#elif DEVART
            var d = (Devart.Data.Oracle.OracleDataReader)b.BaseDataRecord;
#else
            var d = (global::Oracle.ManagedDataAccess.Client.OracleDataReader)b.BaseDataRecord;
                        #endif
            var e = a;
            var f = d.GetDataTypeName(e);
            if (f == "Date" && !d.IsDBNull(e))
            {
                return(b.GetDateTime(e));
            }
            else if ((f == "TimeStampTZ" || c == typeof(DateTime)) && !d.IsDBNull(e))
                                #if DEVART
            { return(d.GetOracleTimeStamp(e).ToDateTimeOffset()); }
#else
            { return(d.GetOracleTimeStampTZ(e).ToDateTimeOffset()); }
                        #endif
            return(b [e].GetValue());
        }
        /// <summary>
        /// Recupera valor do dataRecord.
        /// </summary>
        /// <param name="ordinal">Posição ordinal do campo que será recuperado.</param>
        /// <param name="fieldType">Tipo do campo.</param>
        /// <param name="dataRecord">Objeto dataRecord sobre qual será recuperado.</param>
        protected override object GetValue(int ordinal, GDADataRecord dataRecord, Type fieldType)
        {
                        #if UNMANAGED
            var dataReader = (global::Oracle.DataAccess.Client.OracleDataReader)dataRecord.BaseDataRecord;
#elif DEVART
            var dataReader = (Devart.Data.Oracle.OracleDataReader)dataRecord.BaseDataRecord;
#else
            var dataReader = (global::Oracle.ManagedDataAccess.Client.OracleDataReader)dataRecord.BaseDataRecord;
                        #endif
            var fieldIndex = ordinal;
            var dataType   = dataReader.GetDataTypeName(fieldIndex);
            if (dataType == "Date" && !dataReader.IsDBNull(fieldIndex))
            {
                return(dataRecord.GetDateTime(fieldIndex));
            }
            else if ((dataType == "TimeStampTZ" || fieldType == typeof(DateTime)) && !dataReader.IsDBNull(fieldIndex))
                                #if DEVART
            { return(dataReader.GetOracleTimeStamp(fieldIndex).ToDateTimeOffset()); }
#else
            { return(dataReader.GetOracleTimeStampTZ(fieldIndex).ToDateTimeOffset()); }
                        #endif
            return(dataRecord[fieldIndex].GetValue());
        }
        /// <summary>
        /// Recupera o descritor dos registro.
        /// </summary>
        /// ?<param name="queryInfo">Informações da consulta.</param>
        /// <param name="query">Consulta nativa do GDA.</param>
        /// <param name="dataRecord">Registro com os dados.</param>
        /// <returns></returns>
        protected virtual Record.RecordDescriptor GetRecordDescriptor(QueryInfo queryInfo, GDA.Sql.NativeQuery query, GDADataRecord dataRecord)
        {
            var fields = new List <Record.Field>();
            int fieldCount;

            if (IgnoreLastFieldWithPaging && query.TakeCount > 0 && query.SkipCount > 0)
            {
                fieldCount = dataRecord.FieldCount - 1;
            }
            else
            {
                fieldCount = dataRecord.FieldCount;
            }
            for (int i = 0; i < fieldCount; i++)
            {
                var fieldName = dataRecord.GetName(i);
                var fieldType = GetFieldType(i, dataRecord);
                fields.Add(new Record.Field(fieldName, fieldType));
            }
            return(new Record.RecordDescriptor("descriptor", fields));
        }
 /// <summary>
 /// Recupera o tipo do campo.
 /// </summary>
 /// <param name="ordinal">Posição do campo.</param>
 /// <param name="dataRecord">O record sobre qual será buscado o campo.</param>
 /// <returns>Tipo do campo.</returns>
 protected virtual Type GetFieldType(int ordinal, GDADataRecord dataRecord)
 {
     return(dataRecord.GetFieldType(ordinal));
 }
 /// <summary>
 /// Recupera valor do dataRecord.
 /// </summary>
 /// <param name="ordinal">Posição ordinal do campo que será recuperado.</param>
 /// <param name="dataRecord">Objeto dataRecord sobre qual será recuperado.</param>
 /// <param name="fieldType">Tipo do campo.</param>
 protected virtual object GetValue(int ordinal, GDADataRecord dataRecord, Type fieldType)
 {
     return(dataRecord[ordinal].GetValue());
 }
 protected override Record.RecordDescriptor GetRecordDescriptor(QueryInfo a, GDA.Sql.NativeQuery b, GDADataRecord c)
 {
     if (a.Projection.Count > 0)
     {
         var d = new List <Record.Field> ();
         int e;
         if (IgnoreLastFieldWithPaging && b.TakeCount > 0 && b.SkipCount > 0)
         {
             e = c.FieldCount - 1;
         }
         else
         {
             e = c.FieldCount;
         }
         var f = a.Projection.Select(g => g.Alias).ToArray();
         if (e >= f.Length)
         {
             for (int h = 0; h < e; h++)
             {
                 var i = (h < f.Length ? f [h] : c.GetName(h)) ?? c.GetName(h);
                 var j = GetFieldType(h, c);
                 d.Add(new Record.Field(i, j));
             }
             return(new Record.RecordDescriptor("descriptor", d));
         }
     }
     return(base.GetRecordDescriptor(a, b, c));
 }
 /// <summary>
 /// Recupera o descritor dos campos do registro.
 /// </summary>
 /// <param name="queryInfo"></param>
 /// <param name="query"></param>
 /// <param name="dataRecord"></param>
 /// <returns></returns>
 protected override Record.RecordDescriptor GetRecordDescriptor(QueryInfo queryInfo, GDA.Sql.NativeQuery query, GDADataRecord dataRecord)
 {
     if (queryInfo.Projection.Count > 0)
     {
         var fields = new List <Record.Field>();
         int fieldCount;
         if (IgnoreLastFieldWithPaging && query.TakeCount > 0 && query.SkipCount > 0)
         {
             fieldCount = dataRecord.FieldCount - 1;
         }
         else
         {
             fieldCount = dataRecord.FieldCount;
         }
         var projection = queryInfo.Projection.Select(f => f.Alias).ToArray();
         if (fieldCount >= projection.Length)
         {
             for (int i = 0; i < fieldCount; i++)
             {
                 var fieldName = (i < projection.Length ? projection[i] : dataRecord.GetName(i)) ?? dataRecord.GetName(i);
                 var fieldType = GetFieldType(i, dataRecord);
                 fields.Add(new Record.Field(fieldName, fieldType));
             }
             return(new Record.RecordDescriptor("descriptor", fields));
         }
     }
     return(base.GetRecordDescriptor(queryInfo, query, dataRecord));
 }