in RowsetImportEngine/TextRowsetImporter.cs [770:823]
private bool CheckForRowsetStart (string ColumnLines, string ColumnNames, string RowsetIdentifier, bool NonTabularOnly)
{
ArrayList rowsets;
try
{
// See whether any of the known rowsets "claims" this one.
if (NonTabularOnly)
rowsets = this.KnownNonTabularRowsets;
else
rowsets = this.KnownRowsets;
foreach (TextRowset r in rowsets)
{
if (r.CheckForRowsetStart(ColumnLines, ColumnNames, RowsetIdentifier))
{
this.CurrentRowset = r;
break;
}
}
if (!(null == this.CurrentRowset))
{
// We've found a rowset object that claims the current rowset.
this.CurrentRowset.DefineRowsetColumns(ColumnLines, ColumnNames);
// Issue a DROP TABLE for this rowset if this is the first time we've encountered it and if
// we're not supposed to be appending rows to existing tables.
if ((this.dropTables) && (!this.CurrentRowset.HasBeenEncountered))
DropCurrentTable();
// Create table in SQL if this is the first time we've run into it.
if (!this.CurrentRowset.HasBeenEncountered)
{
logger.LogMessage("First time encoutering row identifier '" + RowsetIdentifier + "'");
CreateTable();
}
// If we don't have an in-progress bulk load for the rowset, start one.
if (!this.CurrentRowset.InBCPRowset)
{
if (!SetUpBulkLoadRowset(this.CurrentRowset))
return false;
}
// We're all set. Mark this rowset as "encountered" so we don't drop it again next time.
this.CurrentRowset.HasBeenEncountered = true;
return true;
}
else
return false;
}
catch (Exception e)
{
ErrorDialog ed = new ErrorDialog(e, true, this.logger);
ed.Handle();
}
return true;
}