We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using LinqToDB; using LinqToDB.Mapping; using System.Diagnostics; namespace Linq2dbTestMySqlTempTable.Tests { [Table("TMP_MIN_TEMPORARY")] public partial class TMP_MIN_TEMPORARY { [Column(IsPrimaryKey = true, IsIdentity = true, CanBeNull = false)] public int IDX { get; set; } [Column(CanBeNull = false, Length = 80)] public string KEY_A { get; set; } } [Table("TEST_TB_A1")] public class TEST_TB_AA { [Column(IsPrimaryKey = true, IsIdentity = true, CanBeNull = false)] public int AID { get; set; } [Column(CanBeNull = false, Length = 80)] public string CODE_AA { get; set; } } [TestClass()] public class ProgramTests { [TestMethod()] public void TestMySqlTranTest() { using (var db = new MyDataConn()) { db.CreateTable<TEST_TB_AA>(tableOptions: TableOptions.CreateIfNotExists); } var code = $"{DateTime.Now:HH:mm:ss.fffff}.{Guid.NewGuid():N}"; using (var db = new MyDataConn()) { try { db.BeginTransaction(); db.Insert(new TEST_TB_AA() { CODE_AA = code }); using (var tempTB = db.CreateTempTable<TMP_MIN_TEMPORARY>(tableOptions: TableOptions.IsTemporary | TableOptions.CheckExistence)) { Debug.WriteLine(db.LastQuery); } //expected: DROP TEMPORARY TABLE IF EXISTS `TMP_MIN_TEMPORARY` //actual: DROP TABLE IF EXISTS `TMP_MIN_TEMPORARY` Debug.WriteLine(db.LastQuery); db.Insert(new TEST_TB_AA() { CODE_AA = code }); throw new Exception("Need Call RollbackTransaction!"); db.CommitTransaction(); } catch (Exception ex) { db.RollbackTransaction(); } } using (var db = new MyDataConn()) { //DDL [drop table] causes MySql transactions to fail to roll back, and all DML statements in the context have been committed var exists = db.GetTable<TEST_TB_AA>().Any(x => x.CODE_AA == code); Assert.IsFalse(exists); } } [TestMethod()] public void TestDropTamporaryTable() { using (var db = new MyDataConn()) { db.DropTable<TMP_MIN_TEMPORARY>(tableOptions: TableOptions.DropIfExists | TableOptions.IsTemporary); Assert.IsTrue(db.LastQuery.Contains(" TEMPORARY "), db.LastQuery); } } } }
Linq To DB version: 5.4
Linq To DB
Database (with version): MySql 8.0.16
ADO.NET Provider (with version): MySqlConnector 2.3.5
Operating system: any
.NET Version: .net6
The text was updated successfully, but these errors were encountered:
DDL is not transaction-controlled.
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce
Environment details
Linq To DB
version: 5.4Database (with version): MySql 8.0.16
ADO.NET Provider (with version): MySqlConnector 2.3.5
Operating system: any
.NET Version: .net6
The text was updated successfully, but these errors were encountered: