Source/Providers/NFX.MySQL/MySQLCRUDScriptQueryHandler.cs
/// <summary>
/// Gets schema from reader taking Query.ResultRowType in consideration
/// </summary>
Gets schema from reader taking Query.ResultRowType in consideration
Gets schema from reader taking Query . ResultRowType in consideration
public static Schema GetSchemaForQuery(string target, Query query, MySqlDataReader reader, QuerySource qSource, out Schema.FieldDef[] toLoad)
            {
              Schema schema;
              var rtp = query.ResultRowType;
              if (rtp != null && typeof(TypedRow).IsAssignableFrom(rtp))
                schema = Schema.GetForTypedRow(query.ResultRowType);
              else
                schema = GetSchemaFromReader(query.Name, qSource, reader);
              toLoad = new Schema.FieldDef[reader.FieldCount];
              for (int i = 0; i < reader.FieldCount; i++)
              {
                var name = reader.GetName(i);
                var fdef = schema[name];
                if (fdef==null) continue;
                var attr =  fdef[target];
                if (attr!=null)
                {
                  if (attr.StoreFlag!=StoreFlag.LoadAndStore && attr.StoreFlag!=StoreFlag.OnlyLoad) continue;
                }
                toLoad[i] = fdef;
              }
              return schema;
            }
public static Schema GetSchemaForQuery ( string target , Query query , MySqlDataReader reader , QuerySource qSource , out Schema . FieldDef [ ] toLoad ) { Schema schema ; var rtp = query . ResultRowType ; if ( rtp != null && typeof ( TypedRow ) . IsAssignableFrom ( rtp ) ) schema = Schema . GetForTypedRow ( query . ResultRowType ) ; else schema = GetSchemaFromReader ( query . Name , qSource , reader ) ; toLoad = new Schema . FieldDef [ reader . FieldCount ] ; for ( int i = 0 ; i < reader . FieldCount ; i ++ ) { var name = reader . GetName ( i ) ; var fdef = schema [ name ] ; if ( fdef == null ) continue ; var attr = fdef [ target ] ; if ( attr != null ) { if ( attr . StoreFlag != StoreFlag . LoadAndStore && attr . StoreFlag != StoreFlag . OnlyLoad ) continue ; } toLoad [ i ] = fdef ; } return schema ; }
Gets schema from reader taking Query.ResultRowType in consideration
Gets schema from reader taking Query . ResultRowType in consideration
//determine what fields to load // 2017-09-08 EIbr + DKh fixed binding by backend name bug  //var fdef = schema.GetFieldDefByBackendName(target, name); //todo A gde GetBackendNameFor target?
target
string
query
Query
reader
MySqlDataReader
qSource
QuerySource
Schema.FieldDef[]
out