Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

Unable to use server sql_mode (or to specify mine) (no replies)

$
0
0
Hi,

I'm using .Net connector latest version (6.9.8 ) with entity Framework.

I've enabled strict mode in my mysql server (for example to avoid the 2038 timestamp "bug" serverside)

I've tested this strict mode sucessfully with MySQL Workbench.

My problem is that behaviour is totally ignored using .Net MySQL Connector. Enabling general log points me out that the connector is sending a session sql_mode

2015-12-16T17:21:44.438980Z 7 Query SET SESSION sql_mode='ANSI';
2015-12-16T17:21:44.438980Z 7 Query INSERT INTO

But the connector documentation doesn't tell how to enforce sql_mode with entity Framework...

Moreover My.SqlData.Entity.InsertStatement source code confirms me that there is an awfull bug!!!

public override void WriteSql(StringBuilder sql)
{
if (this.ReturningSelect != null && this.ReturningSelect.Columns.Count > 0)
{
sql.Append("SET SESSION sql_mode='ANSI';");
}
sql.Append("INSERT INTO ");
this.Target.WriteSql(sql);
if (this.Sets.Count > 0)
{
sql.Append("(");
base.WriteList(this.Sets, sql);
sql.Append(")");
}
sql.Append(" VALUES ");
sql.Append("(");
base.WriteList(this.Values, sql);
sql.Append(")");
if (this.ReturningSelect != null)
{
sql.Append(";\r\n");
this.ReturningSelect.WriteSql(sql);
}
}

sql_mode is set to ANSI, being careless of global sql_mode!!! ANSI mode should be added to global options, it must not replace global mode

(and in a perfect world we should be able to specify our session sql_mode, whild should be merged with ANSI mode!!!)

So Am I really stuck? Or is there a way to trully enable strict mode with entity Framework and the MySQL .Net Connector?

Thanks for your help...

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>