mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
A fix and a test case for Bug#12713 "Error in a stored function called from
a SELECT doesn't cause ROLLBACK of statem". The idea of the fix is to ensure that we always commit the current statement at the end of dispatch_command(). In order to not issue redundant disc syncs, an optimization of the two-phase commit protocol is implemented to bypass the two phase commit if the transaction is read-only.
This commit is contained in:
@ -382,6 +382,14 @@ static udf_func *add_udf(LEX_STRING *name, Item_result ret, char *dl,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a user defined function.
|
||||
|
||||
@note Like implementations of other DDL/DML in MySQL, this function
|
||||
relies on the caller to close the thread tables. This is done in the
|
||||
end of dispatch_command().
|
||||
*/
|
||||
|
||||
int mysql_create_function(THD *thd,udf_func *udf)
|
||||
{
|
||||
int error;
|
||||
@ -489,7 +497,6 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
table->field[3]->store((longlong) u_d->type, TRUE);
|
||||
error = table->file->ha_write_row(table->record[0]);
|
||||
|
||||
close_thread_tables(thd);
|
||||
if (error)
|
||||
{
|
||||
my_error(ER_ERROR_ON_WRITE, MYF(0), "mysql.func", error);
|
||||
|
Reference in New Issue
Block a user