RepoDB
RepoDB copied to clipboard
Bug: InsertAll<>() fails differently now
Bug Description
The previous InsertAll<> is now fixed with 1.12.8-b1 but a different InsertAll<> error is now being thrown on a similar simple insert
Exception Message:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT LAST_INSERT_ID() AS `Id`, ? AS `OrderColumn` ; INSERT INTO `syncchecksums' at line 1"} MySql.Data.MySqlClient.MySqlException
Schema and Model:
Model:
using RepoDb.Attributes;
namespace dsync.Models
{
[Map("syncchecksums")]
class HashResult
{
[Primary]
public int recordno { get; set; }
public string name { get; set; }
public int date { get; set; }
public string hash { get; set; }
public int espsitecode { get; set; }
public int count { get; set; }
public string ids { get; set; }
}
}
CREATE TABLE `syncchecksums` (
`recordno` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
`date` INT(11) NULL DEFAULT NULL,
`hash` VARCHAR(10000) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
`espsitecode` INT(11) NULL DEFAULT NULL,
`count` INT(11) NULL DEFAULT NULL,
`ids` VARCHAR(10000) NULL DEFAULT NULL COLLATE 'utf8_general_ci',
PRIMARY KEY (`recordno`) USING BTREE,
UNIQUE INDEX `key_record_no` (`recordno`) USING BTREE
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
RepoDb 1.12.8-beta1 RepoDb.MySql 1.1.4
thanks and sorry for another problem :/
Yeah, it seems related to the issue on the latest release of MySQL.Data. Can you share me the version of MySql.Data library are you using?
and, can you try to set the ignore prepare attribute to true in the connection string?
mysqlData 8.0.23
ignore prepare set to true stops the crash - is that a setting i can run with in production? or is this a diagnostic test for your debug thinking?
thanks btw
From 8.0.22 to 8.0.23, Oracle changed the default value of this attribute. Prepare is a no_op in MySQL. You can use this in Prod, there are no effects as the previous version is true by default. This is a recommendation from Bradley Graigner directly to me (see my latest Tweet), the creator of MySqlConnector.
amazing! thanks so much for your time and help :)
hi again - sorry to bother - i have a couple of questions:
- i get warnings that ignorePrepare is deprecated - will this cause problems going forward?
- how could i set the commandtimeout value for a conn.ExecuteNonQuery() call? been looking through the docs but cannot find anything obvious
otherwise all is working great so thanks again :)
- Not on the current version you are using it, but maybe in the future version. But, I would assume that Oracle would fix the no_ops on the
Prepare()method. - Simply pass the value to the
commandTimeoutargument.
See here.
thank you again
you can close this issue if you want to :)