78
79
#define REC_OFFS_NORMAL_SIZE 100
79
80
#define REC_OFFS_SMALL_SIZE 10
81
/**********************************************************
82
/******************************************************//**
82
83
The following function is used to get the pointer of the next chained record
85
@return pointer to the next chained record, or NULL if none */
86
88
rec_get_next_ptr_const(
87
89
/*===================*/
88
/* out: pointer to the next chained record, or
90
const rec_t* rec, /* in: physical record */
91
ulint comp); /* in: nonzero=compact page format */
92
/**********************************************************
90
const rec_t* rec, /*!< in: physical record */
91
ulint comp); /*!< in: nonzero=compact page format */
92
/******************************************************//**
93
93
The following function is used to get the pointer of the next chained record
95
@return pointer to the next chained record, or NULL if none */
99
/* out: pointer to the next chained record, or
101
rec_t* rec, /* in: physical record */
102
ulint comp); /* in: nonzero=compact page format */
103
/**********************************************************
100
rec_t* rec, /*!< in: physical record */
101
ulint comp); /*!< in: nonzero=compact page format */
102
/******************************************************//**
104
103
The following function is used to get the offset of the
105
next chained record on the same page. */
104
next chained record on the same page.
105
@return the page offset of the next chained record, or 0 if none */
108
108
rec_get_next_offs(
109
109
/*==============*/
110
/* out: the page offset of the next
111
chained record, or 0 if none */
112
const rec_t* rec, /* in: physical record */
113
ulint comp); /* in: nonzero=compact page format */
114
/**********************************************************
110
const rec_t* rec, /*!< in: physical record */
111
ulint comp); /*!< in: nonzero=compact page format */
112
/******************************************************//**
115
113
The following function is used to set the next record offset field
116
114
of an old-style record. */
119
117
rec_set_next_offs_old(
120
118
/*==================*/
121
rec_t* rec, /* in: old-style physical record */
122
ulint next); /* in: offset of the next record */
123
/**********************************************************
119
rec_t* rec, /*!< in: old-style physical record */
120
ulint next); /*!< in: offset of the next record */
121
/******************************************************//**
124
122
The following function is used to set the next record offset field
125
123
of a new-style record. */
128
126
rec_set_next_offs_new(
129
127
/*==================*/
130
rec_t* rec, /* in/out: new-style physical record */
131
ulint next); /* in: offset of the next record */
132
/**********************************************************
128
rec_t* rec, /*!< in/out: new-style physical record */
129
ulint next); /*!< in: offset of the next record */
130
/******************************************************//**
133
131
The following function is used to get the number of fields
134
in an old-style record. */
132
in an old-style record.
133
@return number of data fields */
137
136
rec_get_n_fields_old(
138
137
/*=================*/
139
/* out: number of data fields */
140
const rec_t* rec); /* in: physical record */
141
/**********************************************************
138
const rec_t* rec); /*!< in: physical record */
139
/******************************************************//**
142
140
The following function is used to get the number of fields
142
@return number of data fields */
146
145
rec_get_n_fields(
147
146
/*=============*/
148
/* out: number of data fields */
149
const rec_t* rec, /* in: physical record */
150
const dict_index_t* index); /* in: record descriptor */
151
/**********************************************************
147
const rec_t* rec, /*!< in: physical record */
148
const dict_index_t* index); /*!< in: record descriptor */
149
/******************************************************//**
152
150
The following function is used to get the number of records owned by the
153
previous directory record. */
151
previous directory record.
152
@return number of owned records */
156
155
rec_get_n_owned_old(
157
156
/*================*/
158
/* out: number of owned records */
159
const rec_t* rec); /* in: old-style physical record */
160
/**********************************************************
157
const rec_t* rec); /*!< in: old-style physical record */
158
/******************************************************//**
161
159
The following function is used to set the number of owned records. */
164
162
rec_set_n_owned_old(
165
163
/*================*/
166
/* out: TRUE on success */
167
rec_t* rec, /* in: old-style physical record */
168
ulint n_owned); /* in: the number of owned */
169
/**********************************************************
164
rec_t* rec, /*!< in: old-style physical record */
165
ulint n_owned); /*!< in: the number of owned */
166
/******************************************************//**
170
167
The following function is used to get the number of records owned by the
171
previous directory record. */
168
previous directory record.
169
@return number of owned records */
174
172
rec_get_n_owned_new(
175
173
/*================*/
176
/* out: number of owned records */
177
const rec_t* rec); /* in: new-style physical record */
178
/**********************************************************
174
const rec_t* rec); /*!< in: new-style physical record */
175
/******************************************************//**
179
176
The following function is used to set the number of owned records. */
182
179
rec_set_n_owned_new(
183
180
/*================*/
184
rec_t* rec, /* in/out: new-style physical record */
185
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
186
ulint n_owned);/* in: the number of owned */
187
/**********************************************************
181
rec_t* rec, /*!< in/out: new-style physical record */
182
page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
183
ulint n_owned);/*!< in: the number of owned */
184
/******************************************************//**
188
185
The following function is used to retrieve the info bits of
192
190
rec_get_info_bits(
193
191
/*==============*/
195
const rec_t* rec, /* in: physical record */
196
ulint comp); /* in: nonzero=compact page format */
197
/**********************************************************
192
const rec_t* rec, /*!< in: physical record */
193
ulint comp); /*!< in: nonzero=compact page format */
194
/******************************************************//**
198
195
The following function is used to set the info bits of a record. */
201
198
rec_set_info_bits_old(
202
199
/*==================*/
203
rec_t* rec, /* in: old-style physical record */
204
ulint bits); /* in: info bits */
205
/**********************************************************
200
rec_t* rec, /*!< in: old-style physical record */
201
ulint bits); /*!< in: info bits */
202
/******************************************************//**
206
203
The following function is used to set the info bits of a record. */
209
206
rec_set_info_bits_new(
210
207
/*==================*/
211
rec_t* rec, /* in/out: new-style physical record */
212
ulint bits); /* in: info bits */
213
/**********************************************************
214
The following function retrieves the status bits of a new-style record. */
208
rec_t* rec, /*!< in/out: new-style physical record */
209
ulint bits); /*!< in: info bits */
210
/******************************************************//**
211
The following function retrieves the status bits of a new-style record.
212
@return status bits */
219
/* out: status bits */
220
const rec_t* rec); /* in: physical record */
217
const rec_t* rec); /*!< in: physical record */
222
/**********************************************************
219
/******************************************************//**
223
220
The following function is used to set the status bits of a new-style record. */
228
rec_t* rec, /* in/out: physical record */
229
ulint bits); /* in: info bits */
225
rec_t* rec, /*!< in/out: physical record */
226
ulint bits); /*!< in: info bits */
231
/**********************************************************
228
/******************************************************//**
232
229
The following function is used to retrieve the info and status
233
bits of a record. (Only compact records have status bits.) */
230
bits of a record. (Only compact records have status bits.)
236
234
rec_get_info_and_status_bits(
237
235
/*=========================*/
239
const rec_t* rec, /* in: physical record */
240
ulint comp); /* in: nonzero=compact page format */
241
/**********************************************************
236
const rec_t* rec, /*!< in: physical record */
237
ulint comp); /*!< in: nonzero=compact page format */
238
/******************************************************//**
242
239
The following function is used to set the info and status
243
240
bits of a record. (Only compact records have status bits.) */
246
243
rec_set_info_and_status_bits(
247
244
/*=========================*/
248
rec_t* rec, /* in/out: compact physical record */
249
ulint bits); /* in: info bits */
245
rec_t* rec, /*!< in/out: compact physical record */
246
ulint bits); /*!< in: info bits */
251
/**********************************************************
252
The following function tells if record is delete marked. */
248
/******************************************************//**
249
The following function tells if record is delete marked.
250
@return nonzero if delete marked */
255
253
rec_get_deleted_flag(
256
254
/*=================*/
257
/* out: nonzero if delete marked */
258
const rec_t* rec, /* in: physical record */
259
ulint comp); /* in: nonzero=compact page format */
260
/**********************************************************
255
const rec_t* rec, /*!< in: physical record */
256
ulint comp); /*!< in: nonzero=compact page format */
257
/******************************************************//**
261
258
The following function is used to set the deleted bit. */
264
261
rec_set_deleted_flag_old(
265
262
/*=====================*/
266
rec_t* rec, /* in: old-style physical record */
267
ulint flag); /* in: nonzero if delete marked */
268
/**********************************************************
263
rec_t* rec, /*!< in: old-style physical record */
264
ulint flag); /*!< in: nonzero if delete marked */
265
/******************************************************//**
269
266
The following function is used to set the deleted bit. */
272
269
rec_set_deleted_flag_new(
273
270
/*=====================*/
274
rec_t* rec, /* in/out: new-style physical record */
275
page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
276
ulint flag); /* in: nonzero if delete marked */
277
/**********************************************************
278
The following function tells if a new-style record is a node pointer. */
271
rec_t* rec, /*!< in/out: new-style physical record */
272
page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
273
ulint flag); /*!< in: nonzero if delete marked */
274
/******************************************************//**
275
The following function tells if a new-style record is a node pointer.
276
@return TRUE if node pointer */
281
279
rec_get_node_ptr_flag(
282
280
/*==================*/
283
/* out: TRUE if node pointer */
284
const rec_t* rec); /* in: physical record */
285
/**********************************************************
281
const rec_t* rec); /*!< in: physical record */
282
/******************************************************//**
286
283
The following function is used to get the order number
287
of an old-style record in the heap of the index page. */
284
of an old-style record in the heap of the index page.
285
@return heap order number */
290
288
rec_get_heap_no_old(
291
289
/*================*/
292
/* out: heap order number */
293
const rec_t* rec); /* in: physical record */
294
/**********************************************************
290
const rec_t* rec); /*!< in: physical record */
291
/******************************************************//**
295
292
The following function is used to set the heap number
296
293
field in an old-style record. */
299
296
rec_set_heap_no_old(
300
297
/*================*/
301
rec_t* rec, /* in: physical record */
302
ulint heap_no);/* in: the heap number */
303
/**********************************************************
298
rec_t* rec, /*!< in: physical record */
299
ulint heap_no);/*!< in: the heap number */
300
/******************************************************//**
304
301
The following function is used to get the order number
305
of a new-style record in the heap of the index page. */
302
of a new-style record in the heap of the index page.
303
@return heap order number */
308
306
rec_get_heap_no_new(
309
307
/*================*/
310
/* out: heap order number */
311
const rec_t* rec); /* in: physical record */
312
/**********************************************************
308
const rec_t* rec); /*!< in: physical record */
309
/******************************************************//**
313
310
The following function is used to set the heap number
314
311
field in a new-style record. */
317
314
rec_set_heap_no_new(
318
315
/*================*/
319
rec_t* rec, /* in/out: physical record */
320
ulint heap_no);/* in: the heap number */
321
/**********************************************************
316
rec_t* rec, /*!< in/out: physical record */
317
ulint heap_no);/*!< in: the heap number */
318
/******************************************************//**
322
319
The following function is used to test whether the data offsets
323
in the record are stored in one-byte or two-byte format. */
320
in the record are stored in one-byte or two-byte format.
321
@return TRUE if 1-byte form */
326
324
rec_get_1byte_offs_flag(
327
325
/*====================*/
328
/* out: TRUE if 1-byte form */
329
const rec_t* rec); /* in: physical record */
326
const rec_t* rec); /*!< in: physical record */
331
/**********************************************************
328
/******************************************************//**
332
329
Determine how many of the first n columns in a compact
333
physical record are stored externally. */
330
physical record are stored externally.
331
@return number of externally stored columns */
336
334
rec_get_n_extern_new(
337
335
/*=================*/
338
/* out: number of externally stored columns */
339
const rec_t* rec, /* in: compact physical record */
340
dict_index_t* index, /* in: record descriptor */
341
ulint n); /* in: number of columns to scan */
336
const rec_t* rec, /*!< in: compact physical record */
337
dict_index_t* index, /*!< in: record descriptor */
338
ulint n); /*!< in: number of columns to scan */
343
/**********************************************************
340
/******************************************************//**
344
341
The following function determines the offsets to each field
345
in the record. It can reuse a previously allocated array. */
342
in the record. It can reuse a previously allocated array.
343
@return the new offsets */
348
346
rec_get_offsets_func(
349
347
/*=================*/
350
/* out: the new offsets */
351
const rec_t* rec, /* in: physical record */
352
const dict_index_t* index, /* in: record descriptor */
353
ulint* offsets,/* in/out: array consisting of
348
const rec_t* rec, /*!< in: physical record */
349
const dict_index_t* index, /*!< in: record descriptor */
350
ulint* offsets,/*!< in/out: array consisting of
354
351
offsets[0] allocated elements,
355
352
or an array from rec_get_offsets(),
357
ulint n_fields,/* in: maximum number of
354
ulint n_fields,/*!< in: maximum number of
358
355
initialized fields
359
356
(ULINT_UNDEFINED if all fields) */
360
mem_heap_t** heap, /* in/out: memory heap */
361
const char* file, /* in: file name where called */
362
ulint line); /* in: line number where called */
357
mem_heap_t** heap, /*!< in/out: memory heap */
358
const char* file, /*!< in: file name where called */
359
ulint line); /*!< in: line number where called */
364
361
#define rec_get_offsets(rec,index,offsets,n,heap) \
365
362
rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__)
367
/**********************************************************
364
/******************************************************//**
368
365
Determine the offset to each field in a leaf-page record
369
366
in ROW_FORMAT=COMPACT. This is a special case of
370
367
rec_init_offsets() and rec_get_offsets_func(). */
373
370
rec_init_offsets_comp_ordinary(
374
371
/*===========================*/
375
const rec_t* rec, /* in: physical record in
372
const rec_t* rec, /*!< in: physical record in
376
373
ROW_FORMAT=COMPACT */
377
ulint extra, /* in: number of bytes to reserve
374
ulint extra, /*!< in: number of bytes to reserve
378
375
between the record header and
380
377
(usually REC_N_NEW_EXTRA_BYTES) */
381
const dict_index_t* index, /* in: record descriptor */
382
ulint* offsets);/* in/out: array of offsets;
378
const dict_index_t* index, /*!< in: record descriptor */
379
ulint* offsets);/*!< in/out: array of offsets;
383
380
in: n=rec_offs_n_fields(offsets) */
385
/**********************************************************
382
/******************************************************//**
386
383
The following function determines the offsets to each field
387
384
in the record. It can reuse a previously allocated array. */
390
387
rec_get_offsets_reverse(
391
388
/*====================*/
392
const byte* extra, /* in: the extra bytes of a
389
const byte* extra, /*!< in: the extra bytes of a
393
390
compact record in reverse order,
394
391
excluding the fixed-size
395
392
REC_N_NEW_EXTRA_BYTES */
396
const dict_index_t* index, /* in: record descriptor */
397
ulint node_ptr,/* in: nonzero=node pointer,
393
const dict_index_t* index, /*!< in: record descriptor */
394
ulint node_ptr,/*!< in: nonzero=node pointer,
399
ulint* offsets);/* in/out: array consisting of
396
ulint* offsets);/*!< in/out: array consisting of
400
397
offsets[0] allocated elements */
402
/****************************************************************
403
Validates offsets returned by rec_get_offsets(). */
399
/************************************************************//**
400
Validates offsets returned by rec_get_offsets().
401
@return TRUE if valid */
406
404
rec_offs_validate(
407
405
/*==============*/
408
/* out: TRUE if valid */
409
const rec_t* rec, /* in: record or NULL */
410
const dict_index_t* index, /* in: record descriptor or NULL */
411
const ulint* offsets);/* in: array returned by
406
const rec_t* rec, /*!< in: record or NULL */
407
const dict_index_t* index, /*!< in: record descriptor or NULL */
408
const ulint* offsets);/*!< in: array returned by
412
409
rec_get_offsets() */
413
410
#ifdef UNIV_DEBUG
414
/****************************************************************
411
/************************************************************//**
415
412
Updates debug data in offsets, in order to avoid bogus
416
413
rec_offs_validate() failures. */
419
416
rec_offs_make_valid(
420
417
/*================*/
421
const rec_t* rec, /* in: record */
422
const dict_index_t* index, /* in: record descriptor */
423
ulint* offsets);/* in: array returned by
418
const rec_t* rec, /*!< in: record */
419
const dict_index_t* index, /*!< in: record descriptor */
420
ulint* offsets);/*!< in: array returned by
424
421
rec_get_offsets() */
426
423
# define rec_offs_make_valid(rec, index, offsets) ((void) 0)
427
424
#endif /* UNIV_DEBUG */
429
/****************************************************************
426
/************************************************************//**
430
427
The following function is used to get the offset to the nth
431
data field in an old-style record. */
428
data field in an old-style record.
429
@return offset to the field */
434
432
rec_get_nth_field_offs_old(
435
433
/*=======================*/
436
/* out: offset to the field */
437
const rec_t* rec, /* in: record */
438
ulint n, /* in: index of the field */
439
ulint* len); /* out: length of the field; UNIV_SQL_NULL
434
const rec_t* rec, /*!< in: record */
435
ulint n, /*!< in: index of the field */
436
ulint* len); /*!< out: length of the field; UNIV_SQL_NULL
441
438
#define rec_get_nth_field_old(rec, n, len) \
442
439
((rec) + rec_get_nth_field_offs_old(rec, n, len))
443
/****************************************************************
440
/************************************************************//**
444
441
Gets the physical size of an old-style field.
445
442
Also an SQL null may have a field of size > 0,
446
if the data type is of a fixed size. */
443
if the data type is of a fixed size.
444
@return field size in bytes */
449
447
rec_get_nth_field_size(
450
448
/*===================*/
451
/* out: field size in bytes */
452
const rec_t* rec, /* in: record */
453
ulint n); /* in: index of the field */
454
/****************************************************************
449
const rec_t* rec, /*!< in: record */
450
ulint n); /*!< in: index of the field */
451
/************************************************************//**
455
452
The following function is used to get an offset to the nth
456
data field in a record. */
453
data field in a record.
454
@return offset from the origin of rec */
459
457
rec_get_nth_field_offs(
460
458
/*===================*/
461
/* out: offset from the origin of rec */
462
const ulint* offsets,/* in: array returned by rec_get_offsets() */
463
ulint n, /* in: index of the field */
464
ulint* len); /* out: length of the field; UNIV_SQL_NULL
459
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
460
ulint n, /*!< in: index of the field */
461
ulint* len); /*!< out: length of the field; UNIV_SQL_NULL
466
463
#define rec_get_nth_field(rec, offsets, n, len) \
467
464
((rec) + rec_get_nth_field_offs(offsets, n, len))
468
/**********************************************************
465
/******************************************************//**
469
466
Determine if the offsets are for a record in the new
468
@return nonzero if compact format */
475
/* out: nonzero if compact format */
476
const ulint* offsets);/* in: array returned by rec_get_offsets() */
477
/**********************************************************
473
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
474
/******************************************************//**
478
475
Determine if the offsets are for a record containing
479
externally stored columns. */
476
externally stored columns.
477
@return nonzero if externally stored */
482
480
rec_offs_any_extern(
483
481
/*================*/
484
/* out: nonzero if externally stored */
485
const ulint* offsets);/* in: array returned by rec_get_offsets() */
486
/**********************************************************
487
Returns nonzero if the extern bit is set in nth field of rec. */
482
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
483
/******************************************************//**
484
Returns nonzero if the extern bit is set in nth field of rec.
485
@return nonzero if externally stored */
490
488
rec_offs_nth_extern(
491
489
/*================*/
492
/* out: nonzero if externally stored */
493
const ulint* offsets,/* in: array returned by rec_get_offsets() */
494
ulint n); /* in: nth field */
495
/**********************************************************
496
Returns nonzero if the SQL NULL bit is set in nth field of rec. */
490
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
491
ulint n); /*!< in: nth field */
492
/******************************************************//**
493
Returns nonzero if the SQL NULL bit is set in nth field of rec.
494
@return nonzero if SQL NULL */
499
497
rec_offs_nth_sql_null(
500
498
/*==================*/
501
/* out: nonzero if SQL NULL */
502
const ulint* offsets,/* in: array returned by rec_get_offsets() */
503
ulint n); /* in: nth field */
504
/**********************************************************
505
Gets the physical size of a field. */
499
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
500
ulint n); /*!< in: nth field */
501
/******************************************************//**
502
Gets the physical size of a field.
503
@return length of field */
508
506
rec_offs_nth_size(
509
507
/*==============*/
510
/* out: length of field */
511
const ulint* offsets,/* in: array returned by rec_get_offsets() */
512
ulint n); /* in: nth field */
508
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
509
ulint n); /*!< in: nth field */
514
/**********************************************************
515
Returns the number of extern bits set in a record. */
511
/******************************************************//**
512
Returns the number of extern bits set in a record.
513
@return number of externally stored fields */
518
516
rec_offs_n_extern(
519
517
/*==============*/
520
/* out: number of externally stored fields */
521
const ulint* offsets);/* in: array returned by rec_get_offsets() */
522
/***************************************************************
518
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
519
/***********************************************************//**
523
520
This is used to modify the value of an already existing field in a record.
524
521
The previous value must have exactly the same size as the new value. If len
525
522
is UNIV_SQL_NULL then the field is treated as an SQL null.
530
527
rec_set_nth_field(
531
528
/*==============*/
532
rec_t* rec, /* in: record */
533
const ulint* offsets,/* in: array returned by rec_get_offsets() */
534
ulint n, /* in: index number of the field */
535
const void* data, /* in: pointer to the data if not SQL null */
536
ulint len); /* in: length of the data or UNIV_SQL_NULL */
537
/**************************************************************
529
rec_t* rec, /*!< in: record */
530
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
531
ulint n, /*!< in: index number of the field */
532
const void* data, /*!< in: pointer to the data if not SQL null */
533
ulint len); /*!< in: length of the data or UNIV_SQL_NULL */
534
/**********************************************************//**
538
535
The following function returns the data size of an old-style physical
539
536
record, that is the sum of field lengths. SQL null fields
540
537
are counted as length 0 fields. The value returned by the function
541
is the distance from record origin to record end in bytes. */
538
is the distance from record origin to record end in bytes.
544
542
rec_get_data_size_old(
545
543
/*==================*/
547
const rec_t* rec); /* in: physical record */
548
/**************************************************************
544
const rec_t* rec); /*!< in: physical record */
545
/**********************************************************//**
549
546
The following function returns the number of allocated elements
550
for an array of offsets. */
547
for an array of offsets.
548
@return number of elements */
553
551
rec_offs_get_n_alloc(
554
552
/*=================*/
555
/* out: number of elements */
556
const ulint* offsets);/* in: array for rec_get_offsets() */
557
/**************************************************************
553
const ulint* offsets);/*!< in: array for rec_get_offsets() */
554
/**********************************************************//**
558
555
The following function sets the number of allocated elements
559
556
for an array of offsets. */
562
559
rec_offs_set_n_alloc(
563
560
/*=================*/
564
ulint* offsets, /* out: array for rec_get_offsets(),
561
ulint* offsets, /*!< out: array for rec_get_offsets(),
565
562
must be allocated */
566
ulint n_alloc); /* in: number of elements */
563
ulint n_alloc); /*!< in: number of elements */
567
564
#define rec_offs_init(offsets) \
568
565
rec_offs_set_n_alloc(offsets, (sizeof offsets) / sizeof *offsets)
569
/**************************************************************
570
The following function returns the number of fields in a record. */
566
/**********************************************************//**
567
The following function returns the number of fields in a record.
568
@return number of fields */
573
571
rec_offs_n_fields(
574
572
/*==============*/
575
/* out: number of fields */
576
const ulint* offsets);/* in: array returned by rec_get_offsets() */
577
/**************************************************************
573
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
574
/**********************************************************//**
578
575
The following function returns the data size of a physical
579
576
record, that is the sum of field lengths. SQL null fields
580
577
are counted as length 0 fields. The value returned by the function
581
is the distance from record origin to record end in bytes. */
578
is the distance from record origin to record end in bytes.
584
582
rec_offs_data_size(
585
583
/*===============*/
587
const ulint* offsets);/* in: array returned by rec_get_offsets() */
588
/**************************************************************
584
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
585
/**********************************************************//**
589
586
Returns the total size of record minus data size of record.
590
587
The value returned by the function is the distance from record
591
start to record origin in bytes. */
588
start to record origin in bytes.
594
592
rec_offs_extra_size(
595
593
/*================*/
597
const ulint* offsets);/* in: array returned by rec_get_offsets() */
598
/**************************************************************
599
Returns the total size of a physical record. */
594
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
595
/**********************************************************//**
596
Returns the total size of a physical record.
605
const ulint* offsets);/* in: array returned by rec_get_offsets() */
606
/**************************************************************
607
Returns a pointer to the start of the record. */
602
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
603
/**********************************************************//**
604
Returns a pointer to the start of the record.
605
@return pointer to start */
612
/* out: pointer to start */
613
rec_t* rec, /* in: pointer to record */
614
const ulint* offsets);/* in: array returned by rec_get_offsets() */
615
/**************************************************************
616
Returns a pointer to the end of the record. */
610
rec_t* rec, /*!< in: pointer to record */
611
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
612
/**********************************************************//**
613
Returns a pointer to the end of the record.
614
@return pointer to end */
621
/* out: pointer to end */
622
rec_t* rec, /* in: pointer to record */
623
const ulint* offsets);/* in: array returned by rec_get_offsets() */
624
/*******************************************************************
625
Copies a physical record to a buffer. */
619
rec_t* rec, /*!< in: pointer to record */
620
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
621
/***************************************************************//**
622
Copies a physical record to a buffer.
623
@return pointer to the origin of the copy */
630
/* out: pointer to the origin of the copy */
631
void* buf, /* in: buffer */
632
const rec_t* rec, /* in: physical record */
633
const ulint* offsets);/* in: array returned by rec_get_offsets() */
634
/******************************************************************
628
void* buf, /*!< in: buffer */
629
const rec_t* rec, /*!< in: physical record */
630
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
631
#ifndef UNIV_HOTBACKUP
632
/**************************************************************//**
635
633
Copies the first n fields of a physical record to a new physical record in
635
@return own: copied record */
639
638
rec_copy_prefix_to_buf(
640
639
/*===================*/
641
/* out, own: copied record */
642
const rec_t* rec, /* in: physical record */
643
const dict_index_t* index, /* in: record descriptor */
644
ulint n_fields, /* in: number of fields
640
const rec_t* rec, /*!< in: physical record */
641
const dict_index_t* index, /*!< in: record descriptor */
642
ulint n_fields, /*!< in: number of fields
646
byte** buf, /* in/out: memory buffer
644
byte** buf, /*!< in/out: memory buffer
647
645
for the copied prefix,
649
ulint* buf_size); /* in/out: buffer size */
650
/****************************************************************
651
Folds a prefix of a physical record to a ulint. */
647
ulint* buf_size); /*!< in/out: buffer size */
648
/************************************************************//**
649
Folds a prefix of a physical record to a ulint.
650
@return the folded value */
656
/* out: the folded value */
657
const rec_t* rec, /* in: the physical record */
658
const ulint* offsets, /* in: array returned by
655
const rec_t* rec, /*!< in: the physical record */
656
const ulint* offsets, /*!< in: array returned by
659
657
rec_get_offsets() */
660
ulint n_fields, /* in: number of complete
658
ulint n_fields, /*!< in: number of complete
661
659
fields to fold */
662
ulint n_bytes, /* in: number of bytes to fold
660
ulint n_bytes, /*!< in: number of bytes to fold
663
661
in an incomplete last field */
664
dulint tree_id) /* in: index tree id */
662
dulint tree_id) /*!< in: index tree id */
665
663
__attribute__((pure));
666
/*************************************************************
664
#endif /* !UNIV_HOTBACKUP */
665
/*********************************************************//**
667
666
Builds a ROW_FORMAT=COMPACT record out of a data tuple. */
670
669
rec_convert_dtuple_to_rec_comp(
671
670
/*===========================*/
672
rec_t* rec, /* in: origin of record */
673
ulint extra, /* in: number of bytes to
671
rec_t* rec, /*!< in: origin of record */
672
ulint extra, /*!< in: number of bytes to
674
673
reserve between the record
675
674
header and the data payload
676
675
(normally REC_N_NEW_EXTRA_BYTES) */
677
const dict_index_t* index, /* in: record descriptor */
678
ulint status, /* in: status bits of the record */
679
const dfield_t* fields, /* in: array of data fields */
680
ulint n_fields);/* in: number of data fields */
681
/*************************************************************
676
const dict_index_t* index, /*!< in: record descriptor */
677
ulint status, /*!< in: status bits of the record */
678
const dfield_t* fields, /*!< in: array of data fields */
679
ulint n_fields);/*!< in: number of data fields */
680
/*********************************************************//**
682
681
Builds a physical record out of a data tuple and
683
stores it into the given buffer. */
682
stores it into the given buffer.
683
@return pointer to the origin of physical record */
686
686
rec_convert_dtuple_to_rec(
687
687
/*======================*/
688
/* out: pointer to the origin
689
of physical record */
690
byte* buf, /* in: start address of the
688
byte* buf, /*!< in: start address of the
691
689
physical record */
692
const dict_index_t* index, /* in: record descriptor */
693
const dtuple_t* dtuple, /* in: data tuple */
694
ulint n_ext); /* in: number of
690
const dict_index_t* index, /*!< in: record descriptor */
691
const dtuple_t* dtuple, /*!< in: data tuple */
692
ulint n_ext); /*!< in: number of
695
693
externally stored columns */
696
/**************************************************************
694
/**********************************************************//**
697
695
Returns the extra size of an old-style physical record if we know its
698
data size and number of fields. */
696
data size and number of fields.
697
@return extra size */
701
700
rec_get_converted_extra_size(
702
701
/*=========================*/
703
/* out: extra size */
704
ulint data_size, /* in: data size */
705
ulint n_fields, /* in: number of fields */
706
ulint n_ext) /* in: number of externally stored columns */
707
__attribute__((__const__));
708
/**************************************************************
709
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. */
702
ulint data_size, /*!< in: data size */
703
ulint n_fields, /*!< in: number of fields */
704
ulint n_ext) /*!< in: number of externally stored columns */
705
__attribute__((const));
706
/**********************************************************//**
707
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
708
@return total size */
712
711
rec_get_converted_size_comp_prefix(
713
712
/*===============================*/
714
/* out: total size */
715
const dict_index_t* index, /* in: record descriptor;
713
const dict_index_t* index, /*!< in: record descriptor;
716
714
dict_table_is_comp() is
717
715
assumed to hold, even if
719
const dfield_t* fields, /* in: array of data fields */
720
ulint n_fields,/* in: number of data fields */
721
ulint* extra); /* out: extra size */
722
/**************************************************************
723
Determines the size of a data tuple in ROW_FORMAT=COMPACT. */
717
const dfield_t* fields, /*!< in: array of data fields */
718
ulint n_fields,/*!< in: number of data fields */
719
ulint* extra); /*!< out: extra size */
720
/**********************************************************//**
721
Determines the size of a data tuple in ROW_FORMAT=COMPACT.
722
@return total size */
726
725
rec_get_converted_size_comp(
727
726
/*========================*/
728
/* out: total size */
729
const dict_index_t* index, /* in: record descriptor;
727
const dict_index_t* index, /*!< in: record descriptor;
730
728
dict_table_is_comp() is
731
729
assumed to hold, even if
733
ulint status, /* in: status bits of the record */
734
const dfield_t* fields, /* in: array of data fields */
735
ulint n_fields,/* in: number of data fields */
736
ulint* extra); /* out: extra size */
737
/**************************************************************
731
ulint status, /*!< in: status bits of the record */
732
const dfield_t* fields, /*!< in: array of data fields */
733
ulint n_fields,/*!< in: number of data fields */
734
ulint* extra); /*!< out: extra size */
735
/**********************************************************//**
738
736
The following function returns the size of a data tuple when converted to
739
a physical record. */
742
741
rec_get_converted_size(
743
742
/*===================*/
745
dict_index_t* index, /* in: record descriptor */
746
const dtuple_t* dtuple, /* in: data tuple */
747
ulint n_ext); /* in: number of externally stored columns */
748
/******************************************************************
743
dict_index_t* index, /*!< in: record descriptor */
744
const dtuple_t* dtuple, /*!< in: data tuple */
745
ulint n_ext); /*!< in: number of externally stored columns */
746
#ifndef UNIV_HOTBACKUP
747
/**************************************************************//**
749
748
Copies the first n fields of a physical record to a data tuple.
750
749
The fields are copied to the memory heap. */
753
752
rec_copy_prefix_to_dtuple(
754
753
/*======================*/
755
dtuple_t* tuple, /* out: data tuple */
756
const rec_t* rec, /* in: physical record */
757
const dict_index_t* index, /* in: record descriptor */
758
ulint n_fields, /* in: number of fields
754
dtuple_t* tuple, /*!< out: data tuple */
755
const rec_t* rec, /*!< in: physical record */
756
const dict_index_t* index, /*!< in: record descriptor */
757
ulint n_fields, /*!< in: number of fields
760
mem_heap_t* heap); /* in: memory heap */
761
/*******************************************************************
762
Validates the consistency of a physical record. */
759
mem_heap_t* heap); /*!< in: memory heap */
760
#endif /* !UNIV_HOTBACKUP */
761
/***************************************************************//**
762
Validates the consistency of a physical record.
763
@return TRUE if ok */
767
/* out: TRUE if ok */
768
const rec_t* rec, /* in: physical record */
769
const ulint* offsets);/* in: array returned by rec_get_offsets() */
770
/*******************************************************************
768
const rec_t* rec, /*!< in: physical record */
769
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
770
/***************************************************************//**
771
771
Prints an old-style physical record. */
776
FILE* file, /* in: file where to print */
777
const rec_t* rec); /* in: physical record */
778
/*******************************************************************
776
FILE* file, /*!< in: file where to print */
777
const rec_t* rec); /*!< in: physical record */
778
#ifndef UNIV_HOTBACKUP
779
/***************************************************************//**
779
780
Prints a physical record in ROW_FORMAT=COMPACT. Ignores the
780
781
record header. */
785
FILE* file, /* in: file where to print */
786
const rec_t* rec, /* in: physical record */
787
const ulint* offsets);/* in: array returned by rec_get_offsets() */
788
/*******************************************************************
786
FILE* file, /*!< in: file where to print */
787
const rec_t* rec, /*!< in: physical record */
788
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
789
/***************************************************************//**
789
790
Prints a physical record. */
794
FILE* file, /* in: file where to print */
795
const rec_t* rec, /* in: physical record */
796
const ulint* offsets);/* in: array returned by rec_get_offsets() */
797
/*******************************************************************
795
FILE* file, /*!< in: file where to print */
796
const rec_t* rec, /*!< in: physical record */
797
const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
798
/***************************************************************//**
798
799
Prints a physical record. */
803
FILE* file, /* in: file where to print */
804
const rec_t* rec, /* in: physical record */
805
dict_index_t* index); /* in: record descriptor */
804
FILE* file, /*!< in: file where to print */
805
const rec_t* rec, /*!< in: physical record */
806
dict_index_t* index); /*!< in: record descriptor */
807
#endif /* UNIV_HOTBACKUP */
807
809
#define REC_INFO_BITS 6 /* This is single byte bit-field */