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)); }
/// <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)); }