-
Notifications
You must be signed in to change notification settings - Fork 345
Description
Software versions
MySqlConnector version:2.3.6
Server type (MySQL, MariaDB, Aurora, etc.) and version:
MariaDB11.3.2-1.el8
MariaDB-columnstore-cmapi.x86_64 23.10.0-1
MariaDB-columnstore-engine.x86_64 11.3.2_23.10.0-1.el8
.NET version: .NET 8
(Optional) ORM NuGet packages and versions:
Describe the bug
MySqlCommandBuilder.GetInsertCommand(); fails the execution in case the table is a ColumnStore
Exception
System.InvalidOperationException: Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.
at System.Data.Common.DbCommandBuilder.BuildInformation(DataTable schemaTable)
at System.Data.Common.DbCommandBuilder.BuildCache(Boolean closeConnection, Boolean useColumnsForParameterNames)
at System.Data.Common.DbCommandBuilder.GetInsertCommand(DataRow dataRow, Boolean useColumnsForParameterNames)
at MySqlConnector.MySqlCommandBuilder.GetInsertCommand() in /_/src/MySqlConnector/MySqlCommandBuilder.cs:line 66
at IssueMySql.Test.DoTest() in F:\butta\IssueMySql\IssueMySql\Test.cs:line 28
at IssueMySql.Test.Run() in F:\butta\IssueMySql\IssueMySql\Test.cs:line 39
at Program.
Code sample
using System.Data;
using MySqlConnector;
namespace IssueMySql;
public class Test
{
private MySqlConnection conn;
private string Store;
public void DoTest()
{
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn;
cmd.CommandText = " drop table if exists test";
cmd.ExecuteNonQuery();
cmd.CommandText =
$" CREATE TABLE test ( id int, message varchar(200)\n) ENGINE={Store} ";
cmd.ExecuteNonQuery();
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand("select * from test", conn);
MySqlCommandBuilder builder = new MySqlCommandBuilder(adapter);
builder.GetInsertCommand();
}
public void Run()
{
conn = new MySqlConnection("server=devel;uid=DD_SIMULATOR;pwd=simulator;database=DD_SIMULATOR");
conn.Open();
Store = "InnoDb";
DoTest();
Store = "ColumnStore";
DoTest();
}
}
Expected behavior
Works as InnoDb
Additional context