GetSourceTableName() private static method

private static GetSourceTableName ( string srcTable, int index ) : string
srcTable string
index int
return string
Beispiel #1
0
        private SchemaMapping FillMappingInternal(DataSet dataset, DataTable datatable, string srcTable, DataReaderContainer dataReader, int schemaCount, DataColumn parentChapterColumn, object parentChapterValue)
        {
            bool   withKeyInfo = (Data.MissingSchemaAction.AddWithKey == MissingSchemaAction);
            string tmp         = null;

            if (null != dataset)
            {
                tmp = DataAdapter.GetSourceTableName(srcTable, schemaCount);
            }
            return(new SchemaMapping(this, dataset, datatable, dataReader, withKeyInfo, SchemaType.Mapped, tmp, true, parentChapterColumn, parentChapterValue));
        }
Beispiel #2
0
        internal object FillSchemaFromReader(DataSet dataset, DataTable datatable, SchemaType schemaType, string srcTable, IDataReader dataReader)
        {
            DataTable[] dataTables  = null;
            int         schemaCount = 0;

            do
            {
                DataReaderContainer readerHandler = DataReaderContainer.Create(dataReader, ReturnProviderSpecificTypes);

                AssertReaderHandleFieldCount(readerHandler);
                if (0 >= readerHandler.FieldCount)
                {
                    continue;
                }
                string tmp = null;
                if (null != dataset)
                {
                    tmp = DataAdapter.GetSourceTableName(srcTable, schemaCount);
                    schemaCount++; // don't increment if no SchemaTable ( a non-row returning result )
                }

                SchemaMapping mapping = new SchemaMapping(this, dataset, datatable, readerHandler, true, schemaType, tmp, false, null, null);

                if (null != datatable)
                {
                    // do not read remaining results in single DataTable case
                    return(mapping.DataTable);
                }
                else if (null != mapping.DataTable)
                {
                    if (null == dataTables)
                    {
                        dataTables = new DataTable[1] {
                            mapping.DataTable
                        };
                    }
                    else
                    {
                        dataTables = DataAdapter.AddDataTableToArray(dataTables, mapping.DataTable);
                    }
                }
            } while (dataReader.NextResult()); // FillSchema does not capture errors for FillError event

            object value = dataTables;

            if ((null == value) && (null == datatable))
            {
                value = Array.Empty <DataTable>();
            }
            return(value); // null if datatable had no results
        }