mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
a418a35ceb
innobase/btr/btr0btr.c: Add parameter to ut_print_name() and dict_index_name_print() calls innobase/btr/btr0cur.c: Add parameter to dict_index_name_print() calls innobase/buf/buf0buf.c: Add parameter to dict_index_name_print() calls innobase/dict/dict0crea.c: Add parameter to ut_print_name() calls innobase/dict/dict0dict.c: Add parameter to ut_print_name() calls Update documentation links to http://dev.mysql.com innobase/dict/dict0load.c: Add parameter to ut_print_name() calls innobase/fil/fil0fil.c: Use ut_print_filename() Update links to documentation to http://dev.mysql.com innobase/ibuf/ibuf0ibuf.c: Replaced printf(...) with fprintf(stderr,...) innobase/include/dict0dict.h: Added trx parameters innobase/include/row0row.h: Added trx parameter innobase/include/row0sel.h: Added trx parameter innobase/include/row0upd.h: Added trx parameters innobase/include/row0upd.ic: Added trx parameter for dict_index_name_print() innobase/include/trx0rec.h: Added trx parameter innobase/include/ut0ut.h: Added ut_print_filename() Added trx parameter to ut_print_name() and ut_print_namel() innobase/lock/lock0lock.c: Added parameter to dict_index_name_print() and ut_print_name() calls innobase/page/page0page.c: Added parameter to dict_index_name_print() calls innobase/pars/pars0opt.c: Added parameter to dict_index_name_print() call innobase/pars/pars0pars.c: Added parameter to upd_field_set_field_no() call innobase/row/row0ins.c: Added trx parameters innobase/row/row0mysql.c: Added trx parameters innobase/row/row0purge.c: Added trx parameter innobase/row/row0row.c: Added trx parameter innobase/row/row0sel.c: Added trx parameters innobase/row/row0umod.c: Added trx parameters innobase/row/row0upd.c: Added trx parameters innobase/trx/trx0rec.c: Added trx parameters innobase/trx/trx0roll.c: Added parameter to ut_print_name() calls innobase/ut/ut0ut.c: Added ut_print_filename() Added trx parameter to ut_print_namel() and ut_print_name() calls sql/ha_innodb.cc: Added trx parameters Rewrote mysql_get_identifier_quote_char() sql/mysql_priv.h: Added get_quote_char_for_identifier() sql/sql_show.cc: Added get_quote_char_for_identifier() Removed append_quoted_simple_identifier() Make append_identifier() use get_quote_char_for_identifier()
120 lines
3.1 KiB
Text
120 lines
3.1 KiB
Text
/******************************************************
|
|
Update of a row
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
Created 12/27/1996 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#include "mtr0log.h"
|
|
#include "trx0trx.h"
|
|
#include "trx0undo.h"
|
|
#include "row0row.h"
|
|
#include "btr0sea.h"
|
|
|
|
/*************************************************************************
|
|
Creates an update vector object. */
|
|
UNIV_INLINE
|
|
upd_t*
|
|
upd_create(
|
|
/*=======*/
|
|
/* out, own: update vector object */
|
|
ulint n, /* in: number of fields */
|
|
mem_heap_t* heap) /* in: heap from which memory allocated */
|
|
{
|
|
upd_t* update;
|
|
ulint i;
|
|
|
|
update = mem_heap_alloc(heap, sizeof(upd_t));
|
|
|
|
update->info_bits = 0;
|
|
update->n_fields = n;
|
|
update->fields = mem_heap_alloc(heap, sizeof(upd_field_t) * n);
|
|
|
|
for (i = 0; i < n; i++) {
|
|
update->fields[i].extern_storage = 0;
|
|
}
|
|
|
|
return(update);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Returns the number of fields in the update vector == number of columns
|
|
to be updated by an update vector. */
|
|
UNIV_INLINE
|
|
ulint
|
|
upd_get_n_fields(
|
|
/*=============*/
|
|
/* out: number of fields */
|
|
upd_t* update) /* in: update vector */
|
|
{
|
|
ut_ad(update);
|
|
|
|
return(update->n_fields);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Returns the nth field of an update vector. */
|
|
UNIV_INLINE
|
|
upd_field_t*
|
|
upd_get_nth_field(
|
|
/*==============*/
|
|
/* out: update vector field */
|
|
upd_t* update, /* in: update vector */
|
|
ulint n) /* in: field position in update vector */
|
|
{
|
|
ut_ad(update);
|
|
ut_ad(n < update->n_fields);
|
|
|
|
return(update->fields + n);
|
|
}
|
|
|
|
/*************************************************************************
|
|
Sets an index field number to be updated by an update vector field. */
|
|
UNIV_INLINE
|
|
void
|
|
upd_field_set_field_no(
|
|
/*===================*/
|
|
upd_field_t* upd_field, /* in: update vector field */
|
|
ulint field_no, /* in: field number in a clustered
|
|
index */
|
|
dict_index_t* index, /* in: index */
|
|
trx_t* trx) /* in: transaction */
|
|
{
|
|
upd_field->field_no = field_no;
|
|
|
|
if (field_no >= dict_index_get_n_fields(index)) {
|
|
fprintf(stderr,
|
|
"InnoDB: Error: trying to access field %lu in ",
|
|
(ulong) field_no);
|
|
dict_index_name_print(stderr, trx, index);
|
|
fprintf(stderr, "\n"
|
|
"InnoDB: but index only has %lu fields\n",
|
|
(ulong) dict_index_get_n_fields(index));
|
|
}
|
|
|
|
dtype_copy(dfield_get_type(&(upd_field->new_val)),
|
|
dict_index_get_nth_type(index, field_no));
|
|
}
|
|
|
|
/*************************************************************************
|
|
Updates the trx id and roll ptr field in a clustered index record when
|
|
a row is updated or marked deleted. */
|
|
UNIV_INLINE
|
|
void
|
|
row_upd_rec_sys_fields(
|
|
/*===================*/
|
|
rec_t* rec, /* in: record */
|
|
dict_index_t* index, /* in: clustered index */
|
|
trx_t* trx, /* in: transaction */
|
|
dulint roll_ptr)/* in: roll ptr of the undo log record */
|
|
{
|
|
ut_ad(index->type & DICT_CLUSTERED);
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
ut_ad(!buf_block_align(rec)->is_hashed
|
|
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
row_set_rec_trx_id(rec, index, trx->id);
|
|
row_set_rec_roll_ptr(rec, index, roll_ptr);
|
|
}
|