Expected behavior: No Exception? Perhaps a IsNullOrEmpty check on primaryKeyColumn and return of the original results instead.
Steps to reproduce: I have a mysql test database and a ms sql test database with sample data. The TestDB in SqlServer has one table called Inventory. The table description can be seen in the output log.
// Program idea: Copy db tables and content from ms sql to mysql.
var tables = mssql_client.ListTables();
foreach (var table in tables)
{
var cols = mssql_client.DescribeTable(table);
var primkey = mssql_client.GetPrimaryKeyColumn(table);
Console.WriteLine($"TableName: {table}, PrimaryKey: {primkey}");
if (mysql_client.TableExists(table))
{
mysql_client.DropTable(table);
}
mysql_client.CreateTable(table, cols);
var data = mssql_client.Select(table, null, null, null, new Expression());
if (data != null && data.Rows.Count > 0)
{
var dictlist = data.AsEnumerable().Select(
row => data.Columns.Cast<DataColumn>().ToDictionary(
column => column.ColumnName,
column => row[column]
)).ToList();
foreach (var item in dictlist)
{
var res = mysql_client.Insert(table, item);
}
}
}