Source/Providers/NFX.MySQL/MySQLCRUDScriptQueryHandler.cs
/// <summary>
/// Reads data from reader into rowset. the reader is NOT disposed
/// </summary>
Reads data from reader into rowset. the reader is NOT disposed
Reads data from reader into rowset . the reader is NOT disposed
public static Row PopulateRow(MySQLCRUDQueryExecutionContext context, Type tRow, Schema schema, Schema.FieldDef[] toLoad, MySqlDataReader reader)
            {
              var store= context.DataStore;
              var row = Row.MakeRow(schema, tRow);
              for (int i = 0; i < reader.FieldCount; i++)
              {
                var fdef = toLoad[i];
                if (fdef==null) continue;
                var val = reader.GetValue(i);
                if (val==null || val is DBNull)
                {
                  row[fdef.Order] = null;
                  continue;
                }
                if (fdef.NonNullableType == typeof(bool))
                {
                  if (store.StringBool)
                  {
                    var bval = (val is bool) ? (bool)val : val.ToString().EqualsIgnoreCase(store.StringForTrue);
                    row[fdef.Order] = bval;
                  }
                  else
                    row[fdef.Order] = val.AsNullableBool();
                }
                else if (fdef.NonNullableType == typeof(DateTime))
                {
                  var dtVal = val.AsNullableDateTime();
                  row[fdef.Order] = dtVal.HasValue ? DateTime.SpecifyKind(dtVal.Value, store.DateTimeKind) : (DateTime?)null;
                }
                else
                  row[fdef.Order] = val;
              }
              return row;
            }
public static Row PopulateRow ( MySQLCRUDQueryExecutionContext context , Type tRow , Schema schema , Schema . FieldDef [ ] toLoad , MySqlDataReader reader ) { var store = context . DataStore ; var row = Row . MakeRow ( schema , tRow ) ; for ( int i = 0 ; i < reader . FieldCount ; i ++ ) { var fdef = toLoad [ i ] ; if ( fdef == null ) continue ; var val = reader . GetValue ( i ) ; if ( val == null || val is DBNull ) { row [ fdef . Order ] = null ; continue ; } if ( fdef . NonNullableType == typeof ( bool ) ) { if ( store . StringBool ) { var bval = ( val is bool ) ? ( bool ) val : val . ToString ( ) . EqualsIgnoreCase ( store . StringForTrue ) ; row [ fdef . Order ] = bval ; } else row [ fdef . Order ] = val . AsNullableBool ( ) ; } else if ( fdef . NonNullableType == typeof ( DateTime ) ) { var dtVal = val . AsNullableDateTime ( ) ; row [ fdef . Order ] = dtVal . HasValue ? DateTime . SpecifyKind ( dtVal . Value , store . DateTimeKind ) : ( DateTime ? ) null ; } else row [ fdef . Order ] = val ; } return row ; }
Reads data from reader into rowset.
Reads data from reader into rowset .
context
MySQLCRUDQueryExecutionContext
tRow
Type
schema
Schema
toLoad
Schema.FieldDef[]
reader
MySqlDataReader