mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 15:54:37 +01:00
2361720c98
into mysql.com:/home/my/mysql-5.1 BUILD/FINISH.sh: Auto merged BitKeeper/deleted/.del-makefilewin.i~5c8479dcb8a455b2: Auto merged BitKeeper/deleted/.del-makefilewin~13888739357b3025: Auto merged BitKeeper/deleted/.del-makefilewin~14f24a4a173e2fcd: Auto merged BitKeeper/deleted/.del-makefilewin~15e9e5c9e8fa870b: Auto merged BitKeeper/deleted/.del-makefilewin~1c53f31b88dd36e: Auto merged BitKeeper/deleted/.del-makefilewin~1dbc058d76ebf1db: Auto merged BitKeeper/deleted/.del-makefilewin~2e0407fe123f8365: Auto merged BitKeeper/deleted/.del-makefilewin~2fc379bd4065c995: Auto merged BitKeeper/deleted/.del-makefilewin~389ee2dcf79afb79: Auto merged BitKeeper/deleted/.del-makefilewin~4d139e182457e553: Auto merged BitKeeper/deleted/.del-makefilewin~5104767c73775697: Auto merged BitKeeper/deleted/.del-makefilewin~608ed49dcd88e0f7: Auto merged BitKeeper/deleted/.del-makefilewin~63acd666293282a: Auto merged BitKeeper/deleted/.del-makefilewin~6ba64863bce3d0b8: Auto merged BitKeeper/deleted/.del-makefilewin~72a64128bacce71b: Auto merged BitKeeper/deleted/.del-makefilewin~78000390c783b1c5: Auto merged BitKeeper/deleted/.del-makefilewin~7a9d7d5a42bbfaf5: Auto merged Makefile.am: Auto merged BitKeeper/deleted/.del-makefilewin~a40ea12eebdd6ef0: Auto merged BitKeeper/deleted/.del-makefilewin~aeea7c82f21f7cf5: Auto merged BitKeeper/deleted/.del-makefilewin~b643e38d8da389ac: Auto merged BitKeeper/deleted/.del-makefilewin~c7b621c745e5de95: Auto merged BitKeeper/deleted/.del-makefilewin~c8273a47b90f52bb: Auto merged BitKeeper/deleted/.del-makefilewin~d1a9d1f7d33fcb73: Auto merged BitKeeper/deleted/.del-makefilewin~d37b6b303348c871: Auto merged BitKeeper/deleted/.del-makefilewin~d90f35fdc3f2ee5f: Auto merged BitKeeper/deleted/.del-makefilewin~dc4b8ad5ea53bd: Auto merged BitKeeper/deleted/.del-makefilewin~dea10ec1c94f7be: Auto merged BitKeeper/deleted/.del-makefilewin~ef3a208fa0e9b0db: Auto merged BitKeeper/deleted/.del-makefilewin~f1e3b890aa1c9ea3: Auto merged BitKeeper/deleted/.del-makefilewin~f4b7b99a887b7de: Auto merged BitKeeper/deleted/.del-makefilewin~fdda94ad32fa9e34: Auto merged BitKeeper/deleted/.del-my_cnf~977f69858affc57b: Auto merged BitKeeper/etc/config: Auto merged VC++Files/libmysqld/libmysqld.dsp: Auto merged VC++Files/sql/mysqld.dsp: Auto merged client/mysqltest.c: Auto merged include/Makefile.am: Auto merged include/base64.h: Auto merged include/my_base.h: Auto merged include/mysql_com.h: Auto merged libmysqld/Makefile.am: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/ndb_basic.result: Auto merged mysql-test/r/ndb_condition_pushdown.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/query_cache.test: Auto merged mysys/Makefile.am: Auto merged mysys/base64.c: Auto merged scripts/make_win_src_distribution.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged sql/Makefile.am: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_berkeley.h: Auto merged sql/ha_federated.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.h: Auto merged sql/item.cc: Auto merged sql/item_subselect.cc: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sp.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged storage/heap/_check.c: Auto merged storage/heap/hp_create.c: Auto merged storage/innobase/include/Makefile.am: Auto merged storage/innobase/include/rem0rec.h: Auto merged storage/innobase/include/rem0rec.ic: Auto merged storage/innobase/row/row0ins.c: Auto merged storage/innobase/row/row0upd.c: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_delete.c: Auto merged storage/myisam/mi_rkey.c: Auto merged storage/myisam/mi_rnext_same.c: Auto merged storage/myisam/mi_search.c: Auto merged storage/myisam/mi_write.c: Auto merged storage/myisam/myisamchk.c: Auto merged storage/myisam/myisamdef.h: Auto merged storage/myisam/sort.c: Auto merged storage/myisammrg/myrg_queue.c: Auto merged storage/ndb/config/type_util.mk.am: Auto merged storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp: Auto merged storage/ndb/include/mgmapi/mgmapi_config_parameters.h: Auto merged storage/ndb/include/mgmapi/ndbd_exit_codes.h: Auto merged storage/ndb/include/transporter/TransporterCallback.hpp: Auto merged storage/ndb/src/common/mgmcommon/IPCConfig.cpp: Auto merged storage/ndb/src/common/transporter/SHM_Transporter.cpp: Auto merged storage/ndb/src/common/transporter/SHM_Transporter.hpp: Auto merged storage/ndb/src/common/transporter/SHM_Transporter.unix.cpp: Auto merged storage/ndb/src/common/transporter/SHM_Transporter.win32.cpp: Auto merged storage/ndb/src/common/transporter/Transporter.hpp: Auto merged storage/ndb/src/common/transporter/TransporterRegistry.cpp: Auto merged storage/ndb/src/common/util/Makefile.am: Auto merged storage/ndb/src/common/util/Parser.cpp: Auto merged storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp: Auto merged storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp: Auto merged storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp: Auto merged storage/ndb/src/kernel/error/ndbd_exit_codes.c: Auto merged storage/ndb/src/kernel/vm/FastScheduler.cpp: Auto merged storage/ndb/src/kernel/vm/TransporterCallback.cpp: Auto merged storage/ndb/src/kernel/vm/VMSignal.hpp: Auto merged storage/ndb/src/mgmapi/mgmapi.cpp: Auto merged storage/ndb/src/mgmsrv/ConfigInfo.cpp: Auto merged storage/ndb/src/mgmsrv/InitConfigFileParser.cpp: Auto merged storage/ndb/src/mgmsrv/MgmtSrvr.cpp: Auto merged storage/ndb/src/mgmsrv/MgmtSrvr.hpp: Auto merged storage/ndb/src/mgmsrv/Services.cpp: Auto merged storage/ndb/src/ndbapi/TransporterFacade.cpp: Auto merged storage/ndb/test/ndbapi/testBackup.cpp: Auto merged storage/ndb/test/ndbapi/testOperations.cpp: Auto merged storage/ndb/test/src/HugoCalculator.cpp: Auto merged storage/ndb/tools/ndb_condig.cpp: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-ucs2.c: Auto merged support-files/mysql.spec.sh: Auto merged BUILD/SETUP.sh: manual merge configure.in: manual merge mysql-test/r/alter_table.result: manual merge sql/handler.cc: manual merge sql/mysql_priv.h: manual merge sql/records.cc: manual merge sql/share/errmsg.txt: manual merge sql/sql_table.cc: manual merge Fix labels sql/sql_update.cc: manual merge sql/table.cc: manual merge sql/unireg.cc: manual merge storage/ndb/config/type_ndbapi.mk.am: manual merge
588 lines
20 KiB
C
588 lines
20 KiB
C
/************************************************************************
|
|
Record manager
|
|
|
|
(c) 1994-1996 Innobase Oy
|
|
|
|
Created 5/30/1994 Heikki Tuuri
|
|
*************************************************************************/
|
|
|
|
#ifndef rem0rec_h
|
|
#define rem0rec_h
|
|
|
|
#include "univ.i"
|
|
#include "data0data.h"
|
|
#include "rem0types.h"
|
|
#include "mtr0types.h"
|
|
|
|
/* Maximum values for various fields (for non-blob tuples) */
|
|
#define REC_MAX_N_FIELDS (1024 - 1)
|
|
#define REC_MAX_HEAP_NO (2 * 8192 - 1)
|
|
#define REC_MAX_N_OWNED (16 - 1)
|
|
|
|
/* Flag denoting the predefined minimum record: this bit is ORed in the 4
|
|
info bits of a record */
|
|
#define REC_INFO_MIN_REC_FLAG 0x10UL
|
|
|
|
/* Number of extra bytes in an old-style record,
|
|
in addition to the data and the offsets */
|
|
#define REC_N_OLD_EXTRA_BYTES 6
|
|
/* Number of extra bytes in a new-style record,
|
|
in addition to the data and the offsets */
|
|
#define REC_N_NEW_EXTRA_BYTES 5
|
|
|
|
/* Record status values */
|
|
#define REC_STATUS_ORDINARY 0
|
|
#define REC_STATUS_NODE_PTR 1
|
|
#define REC_STATUS_INFIMUM 2
|
|
#define REC_STATUS_SUPREMUM 3
|
|
|
|
/* Number of elements that should be initially allocated for the
|
|
offsets[] array, first passed to rec_get_offsets() */
|
|
#define REC_OFFS_NORMAL_SIZE 100
|
|
#define REC_OFFS_SMALL_SIZE 10
|
|
|
|
/**********************************************************
|
|
The following function is used to get the offset of the
|
|
next chained record on the same page. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_next_offs(
|
|
/*==============*/
|
|
/* out: the page offset of the next
|
|
chained record */
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp); /* in: nonzero=compact page format */
|
|
/**********************************************************
|
|
The following function is used to set the next record offset field
|
|
of the record. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_next_offs(
|
|
/*==============*/
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp, /* in: nonzero=compact page format */
|
|
ulint next); /* in: offset of the next record */
|
|
/**********************************************************
|
|
The following function is used to get the number of fields
|
|
in an old-style record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_n_fields_old(
|
|
/*=================*/
|
|
/* out: number of data fields */
|
|
rec_t* rec); /* in: physical record */
|
|
/**********************************************************
|
|
The following function is used to get the number of fields
|
|
in a record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_n_fields(
|
|
/*=============*/
|
|
/* out: number of data fields */
|
|
rec_t* rec, /* in: physical record */
|
|
dict_index_t* index); /* in: record descriptor */
|
|
/**********************************************************
|
|
The following function is used to get the number of records
|
|
owned by the previous directory record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_n_owned(
|
|
/*============*/
|
|
/* out: number of owned records */
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp); /* in: nonzero=compact page format */
|
|
/**********************************************************
|
|
The following function is used to set the number of owned
|
|
records. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_n_owned(
|
|
/*============*/
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp, /* in: nonzero=compact page format */
|
|
ulint n_owned); /* in: the number of owned */
|
|
/**********************************************************
|
|
The following function is used to retrieve the info bits of
|
|
a record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_info_bits(
|
|
/*==============*/
|
|
/* out: info bits */
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp); /* in: nonzero=compact page format */
|
|
/**********************************************************
|
|
The following function is used to set the info bits of a record. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_info_bits(
|
|
/*==============*/
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp, /* in: nonzero=compact page format */
|
|
ulint bits); /* in: info bits */
|
|
/**********************************************************
|
|
The following function retrieves the status bits of a new-style record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_status(
|
|
/*===========*/
|
|
/* out: status bits */
|
|
rec_t* rec); /* in: physical record */
|
|
|
|
/**********************************************************
|
|
The following function is used to set the status bits of a new-style record. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_status(
|
|
/*===========*/
|
|
rec_t* rec, /* in: physical record */
|
|
ulint bits); /* in: info bits */
|
|
|
|
/**********************************************************
|
|
The following function is used to retrieve the info and status
|
|
bits of a record. (Only compact records have status bits.) */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_info_and_status_bits(
|
|
/*=========================*/
|
|
/* out: info bits */
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp); /* in: nonzero=compact page format */
|
|
/**********************************************************
|
|
The following function is used to set the info and status
|
|
bits of a record. (Only compact records have status bits.) */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_info_and_status_bits(
|
|
/*=========================*/
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp, /* in: nonzero=compact page format */
|
|
ulint bits); /* in: info bits */
|
|
|
|
/**********************************************************
|
|
The following function tells if record is delete marked. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_deleted_flag(
|
|
/*=================*/
|
|
/* out: nonzero if delete marked */
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp); /* in: nonzero=compact page format */
|
|
/**********************************************************
|
|
The following function is used to set the deleted bit. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_deleted_flag(
|
|
/*=================*/
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp, /* in: nonzero=compact page format */
|
|
ulint flag); /* in: nonzero if delete marked */
|
|
/**********************************************************
|
|
The following function tells if a new-style record is a node pointer. */
|
|
UNIV_INLINE
|
|
ibool
|
|
rec_get_node_ptr_flag(
|
|
/*=================*/
|
|
/* out: TRUE if node pointer */
|
|
rec_t* rec); /* in: physical record */
|
|
/**********************************************************
|
|
The following function is used to get the order number
|
|
of the record in the heap of the index page. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_heap_no(
|
|
/*=============*/
|
|
/* out: heap order number */
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp); /* in: nonzero=compact page format */
|
|
/**********************************************************
|
|
The following function is used to set the heap number
|
|
field in the record. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_heap_no(
|
|
/*=============*/
|
|
rec_t* rec, /* in: physical record */
|
|
ulint comp, /* in: nonzero=compact page format */
|
|
ulint heap_no);/* in: the heap number */
|
|
/**********************************************************
|
|
The following function is used to test whether the data offsets
|
|
in the record are stored in one-byte or two-byte format. */
|
|
UNIV_INLINE
|
|
ibool
|
|
rec_get_1byte_offs_flag(
|
|
/*====================*/
|
|
/* out: TRUE if 1-byte form */
|
|
rec_t* rec); /* in: physical record */
|
|
/**********************************************************
|
|
The following function determines the offsets to each field
|
|
in the record. It can reuse a previously allocated array. */
|
|
|
|
ulint*
|
|
rec_get_offsets_func(
|
|
/*=================*/
|
|
/* out: the new offsets */
|
|
rec_t* rec, /* in: physical record */
|
|
dict_index_t* index, /* in: record descriptor */
|
|
ulint* offsets,/* in: array consisting of offsets[0]
|
|
allocated elements, or an array from
|
|
rec_get_offsets(), or NULL */
|
|
ulint n_fields,/* in: maximum number of initialized fields
|
|
(ULINT_UNDEFINED if all fields) */
|
|
mem_heap_t** heap, /* in/out: memory heap */
|
|
const char* file, /* in: file name where called */
|
|
ulint line); /* in: line number where called */
|
|
|
|
#define rec_get_offsets(rec,index,offsets,n,heap) \
|
|
rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__)
|
|
|
|
/****************************************************************
|
|
Validates offsets returned by rec_get_offsets(). */
|
|
UNIV_INLINE
|
|
ibool
|
|
rec_offs_validate(
|
|
/*==============*/
|
|
/* out: TRUE if valid */
|
|
rec_t* rec, /* in: record or NULL */
|
|
dict_index_t* index, /* in: record descriptor or NULL */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/****************************************************************
|
|
Updates debug data in offsets, in order to avoid bogus
|
|
rec_offs_validate() failures. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_offs_make_valid(
|
|
/*================*/
|
|
rec_t* rec, /* in: record */
|
|
dict_index_t* index,/* in: record descriptor */
|
|
ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
|
|
/****************************************************************
|
|
The following function is used to get a pointer to the nth
|
|
data field in an old-style record. */
|
|
|
|
byte*
|
|
rec_get_nth_field_old(
|
|
/*==================*/
|
|
/* out: pointer to the field */
|
|
rec_t* rec, /* in: record */
|
|
ulint n, /* in: index of the field */
|
|
ulint* len); /* out: length of the field; UNIV_SQL_NULL
|
|
if SQL null */
|
|
/****************************************************************
|
|
Gets the physical size of an old-style field.
|
|
Also an SQL null may have a field of size > 0,
|
|
if the data type is of a fixed size. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_nth_field_size(
|
|
/*===================*/
|
|
/* out: field size in bytes */
|
|
rec_t* rec, /* in: record */
|
|
ulint n); /* in: index of the field */
|
|
/****************************************************************
|
|
The following function is used to get a pointer to the nth
|
|
data field in a record. */
|
|
UNIV_INLINE
|
|
byte*
|
|
rec_get_nth_field(
|
|
/*==============*/
|
|
/* out: pointer to the field */
|
|
rec_t* rec, /* in: record */
|
|
const ulint* offsets,/* in: array returned by rec_get_offsets() */
|
|
ulint n, /* in: index of the field */
|
|
ulint* len); /* out: length of the field; UNIV_SQL_NULL
|
|
if SQL null */
|
|
/**********************************************************
|
|
Determine if the offsets are for a record in the new
|
|
compact format. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_comp(
|
|
/*==========*/
|
|
/* out: nonzero if compact format */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/**********************************************************
|
|
Returns nonzero if the extern bit is set in nth field of rec. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_nth_extern(
|
|
/*================*/
|
|
/* out: nonzero if externally stored */
|
|
const ulint* offsets,/* in: array returned by rec_get_offsets() */
|
|
ulint n); /* in: nth field */
|
|
/**********************************************************
|
|
Returns nonzero if the SQL NULL bit is set in nth field of rec. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_nth_sql_null(
|
|
/*==================*/
|
|
/* out: nonzero if SQL NULL */
|
|
const ulint* offsets,/* in: array returned by rec_get_offsets() */
|
|
ulint n); /* in: nth field */
|
|
/**********************************************************
|
|
Gets the physical size of a field. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_nth_size(
|
|
/*==============*/
|
|
/* out: length of field */
|
|
const ulint* offsets,/* in: array returned by rec_get_offsets() */
|
|
ulint n); /* in: nth field */
|
|
|
|
/**********************************************************
|
|
Returns TRUE if the extern bit is set in any of the fields
|
|
of rec. */
|
|
UNIV_INLINE
|
|
ibool
|
|
rec_offs_any_extern(
|
|
/*================*/
|
|
/* out: TRUE if a field is stored externally */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/***************************************************************
|
|
Sets the value of the ith field extern storage bit. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_nth_field_extern_bit(
|
|
/*=========================*/
|
|
rec_t* rec, /* in: record */
|
|
dict_index_t* index, /* in: record descriptor */
|
|
ulint i, /* in: ith field */
|
|
ibool val, /* in: value to set */
|
|
mtr_t* mtr); /* in: mtr holding an X-latch to the page
|
|
where rec is, or NULL; in the NULL case
|
|
we do not write to log about the change */
|
|
/***************************************************************
|
|
Sets TRUE the extern storage bits of fields mentioned in an array. */
|
|
|
|
void
|
|
rec_set_field_extern_bits(
|
|
/*======================*/
|
|
rec_t* rec, /* in: record */
|
|
dict_index_t* index, /* in: record descriptor */
|
|
const ulint* vec, /* in: array of field numbers */
|
|
ulint n_fields,/* in: number of fields numbers */
|
|
mtr_t* mtr); /* in: mtr holding an X-latch to the page
|
|
where rec is, or NULL; in the NULL case
|
|
we do not write to log about the change */
|
|
/***************************************************************
|
|
This is used to modify the value of an already existing field in a record.
|
|
The previous value must have exactly the same size as the new value. If len
|
|
is UNIV_SQL_NULL then the field is treated as an SQL null for old-style
|
|
records. For new-style records, len must not be UNIV_SQL_NULL. */
|
|
UNIV_INLINE
|
|
void
|
|
rec_set_nth_field(
|
|
/*==============*/
|
|
rec_t* rec, /* in: record */
|
|
const ulint* offsets,/* in: array returned by rec_get_offsets() */
|
|
ulint n, /* in: index number of the field */
|
|
const void* data, /* in: pointer to the data if not SQL null */
|
|
ulint len); /* in: length of the data or UNIV_SQL_NULL.
|
|
If not SQL null, must have the same
|
|
length as the previous value.
|
|
If SQL null, previous value must be
|
|
SQL null. */
|
|
/**************************************************************
|
|
The following function returns the data size of an old-style physical
|
|
record, that is the sum of field lengths. SQL null fields
|
|
are counted as length 0 fields. The value returned by the function
|
|
is the distance from record origin to record end in bytes. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_data_size_old(
|
|
/*==================*/
|
|
/* out: size */
|
|
rec_t* rec); /* in: physical record */
|
|
/**************************************************************
|
|
The following function returns the number of fields in a record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_n_fields(
|
|
/*===============*/
|
|
/* out: number of fields */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/**************************************************************
|
|
The following function returns the data size of a physical
|
|
record, that is the sum of field lengths. SQL null fields
|
|
are counted as length 0 fields. The value returned by the function
|
|
is the distance from record origin to record end in bytes. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_data_size(
|
|
/*===============*/
|
|
/* out: size */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/**************************************************************
|
|
Returns the total size of record minus data size of record.
|
|
The value returned by the function is the distance from record
|
|
start to record origin in bytes. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_extra_size(
|
|
/*================*/
|
|
/* out: size */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/**************************************************************
|
|
Returns the total size of a physical record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_offs_size(
|
|
/*==========*/
|
|
/* out: size */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/**************************************************************
|
|
Returns a pointer to the start of the record. */
|
|
UNIV_INLINE
|
|
byte*
|
|
rec_get_start(
|
|
/*==========*/
|
|
/* out: pointer to start */
|
|
rec_t* rec, /* in: pointer to record */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/**************************************************************
|
|
Returns a pointer to the end of the record. */
|
|
UNIV_INLINE
|
|
byte*
|
|
rec_get_end(
|
|
/*========*/
|
|
/* out: pointer to end */
|
|
rec_t* rec, /* in: pointer to record */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/*******************************************************************
|
|
Copies a physical record to a buffer. */
|
|
UNIV_INLINE
|
|
rec_t*
|
|
rec_copy(
|
|
/*=====*/
|
|
/* out: pointer to the origin of the copy */
|
|
void* buf, /* in: buffer */
|
|
const rec_t* rec, /* in: physical record */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/******************************************************************
|
|
Copies the first n fields of a physical record to a new physical record in
|
|
a buffer. */
|
|
|
|
rec_t*
|
|
rec_copy_prefix_to_buf(
|
|
/*===================*/
|
|
/* out, own: copied record */
|
|
rec_t* rec, /* in: physical record */
|
|
dict_index_t* index, /* in: record descriptor */
|
|
ulint n_fields, /* in: number of fields to copy */
|
|
byte** buf, /* in/out: memory buffer
|
|
for the copied prefix, or NULL */
|
|
ulint* buf_size); /* in/out: buffer size */
|
|
/****************************************************************
|
|
Folds a prefix of a physical record to a ulint. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_fold(
|
|
/*=====*/
|
|
/* out: the folded value */
|
|
rec_t* rec, /* in: the physical record */
|
|
const ulint* offsets, /* in: array returned by
|
|
rec_get_offsets() */
|
|
ulint n_fields, /* in: number of complete
|
|
fields to fold */
|
|
ulint n_bytes, /* in: number of bytes to fold
|
|
in an incomplete last field */
|
|
dulint tree_id); /* in: index tree id */
|
|
/*************************************************************
|
|
Builds a physical record out of a data tuple and stores it beginning from
|
|
address destination. */
|
|
|
|
rec_t*
|
|
rec_convert_dtuple_to_rec(
|
|
/*======================*/
|
|
/* out: pointer to the origin
|
|
of physical record */
|
|
byte* buf, /* in: start address of the
|
|
physical record */
|
|
dict_index_t* index, /* in: record descriptor */
|
|
dtuple_t* dtuple);/* in: data tuple */
|
|
/**************************************************************
|
|
Returns the extra size of an old-style physical record if we know its
|
|
data size and number of fields. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_converted_extra_size(
|
|
/*=========================*/
|
|
/* out: extra size */
|
|
ulint data_size, /* in: data size */
|
|
ulint n_fields) /* in: number of fields */
|
|
__attribute__((const));
|
|
/**************************************************************
|
|
The following function returns the size of a data tuple when converted to
|
|
a physical record. */
|
|
UNIV_INLINE
|
|
ulint
|
|
rec_get_converted_size(
|
|
/*===================*/
|
|
/* out: size */
|
|
dict_index_t* index, /* in: record descriptor */
|
|
dtuple_t* dtuple);/* in: data tuple */
|
|
/******************************************************************
|
|
Copies the first n fields of a physical record to a data tuple.
|
|
The fields are copied to the memory heap. */
|
|
|
|
void
|
|
rec_copy_prefix_to_dtuple(
|
|
/*======================*/
|
|
dtuple_t* tuple, /* in: data tuple */
|
|
rec_t* rec, /* in: physical record */
|
|
dict_index_t* index, /* in: record descriptor */
|
|
ulint n_fields, /* in: number of fields to copy */
|
|
mem_heap_t* heap); /* in: memory heap */
|
|
/*******************************************************************
|
|
Validates the consistency of a physical record. */
|
|
|
|
ibool
|
|
rec_validate(
|
|
/*=========*/
|
|
/* out: TRUE if ok */
|
|
rec_t* rec, /* in: physical record */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/*******************************************************************
|
|
Prints an old-style physical record. */
|
|
|
|
void
|
|
rec_print_old(
|
|
/*==========*/
|
|
FILE* file, /* in: file where to print */
|
|
rec_t* rec); /* in: physical record */
|
|
/*******************************************************************
|
|
Prints a physical record. */
|
|
|
|
void
|
|
rec_print_new(
|
|
/*==========*/
|
|
FILE* file, /* in: file where to print */
|
|
rec_t* rec, /* in: physical record */
|
|
const ulint* offsets);/* in: array returned by rec_get_offsets() */
|
|
/*******************************************************************
|
|
Prints a physical record. */
|
|
|
|
void
|
|
rec_print(
|
|
/*======*/
|
|
FILE* file, /* in: file where to print */
|
|
rec_t* rec, /* in: physical record */
|
|
dict_index_t* index); /* in: record descriptor */
|
|
|
|
#define REC_INFO_BITS 6 /* This is single byte bit-field */
|
|
|
|
/* Maximum lengths for the data in a physical record if the offsets
|
|
are given in one byte (resp. two byte) format. */
|
|
#define REC_1BYTE_OFFS_LIMIT 0x7FUL
|
|
#define REC_2BYTE_OFFS_LIMIT 0x7FFFUL
|
|
|
|
/* The data size of record must be smaller than this because we reserve
|
|
two upmost bits in a two byte offset for special purposes */
|
|
#define REC_MAX_DATA_SIZE (16 * 1024)
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "rem0rec.ic"
|
|
#endif
|
|
|
|
#endif
|