Anonymous
My feedback
6 results found
-
115 votes
Anonymous supported this idea ·
-
24 votes
Anonymous supported this idea ·
-
1 vote
Anonymous shared this idea ·
-
8 votes
Anonymous supported this idea ·
-
7 votes
Anonymous supported this idea ·
An error occurred while saving the comment Anonymous shared this idea ·
-
148 votes
An error occurred while saving the comment Anonymous commented
+1.. Cluster has been out 2 yrs...
I did a crude patch for MySql As Follows:
public static int Save(T record)
{
var sqlToExecute = "";
using (var Db = GetConnection())
{
try
{
var insertSQL = Db.ToInsertStatement(record);
var updateSQL = Db.ToUpdateStatement(record);
// strip out the UPDATE 'tablename' SET ....
updateSQL = updateSQL.Replace(Db.GetQuotedTableName<T>(), "");
updateSQL = updateSQL.Replace(" SET", "");
// remove trailing WHERE <PK=Id>...
updateSQL = updateSQL.Substring(0, updateSQL.IndexOf(" WHERE `"));
//lastly something weird with nulls = '{}'
sqlToExecute = (insertSQL + " ON DUPLICATE KEY " + updateSQL).Replace("'{}'", "NULL");
Db.ExecuteSql(sqlToExecute);
return 1;
}
catch (Exception e)
{
Log.Error(0, $"Error saving record, sql={sqlToExecute}", e);
return -1;
}
}
}