19
19
typedef struct big_rec_struct big_rec_t;
21
/* Some non-inlined functions used in the MySQL interface: */
23
dfield_set_data_noninline(
24
dfield_t* field, /* in: field */
25
void* data, /* in: data */
26
ulint len); /* in: length or UNIV_SQL_NULL */
28
dfield_get_data_noninline(
29
dfield_t* field); /* in: field */
31
dfield_get_len_noninline(
32
dfield_t* field); /* in: field */
34
dtuple_get_n_fields_noninline(
35
dtuple_t* tuple); /* in: tuple */
37
dtuple_get_nth_field_noninline(
38
dtuple_t* tuple, /* in: tuple */
39
ulint n); /* in: index of field */
22
41
/*************************************************************************
23
42
Gets pointer to the type struct of SQL data field. */
28
47
/* out: pointer to the type struct */
29
const dfield_t* field); /* in: SQL data field */
30
/*************************************************************************
31
Gets pointer to the data in a field. */
36
/* out: pointer to data */
37
const dfield_t* field); /* in: field */
38
#else /* UNIV_DEBUG */
39
# define dfield_get_type(field) (&(field)->type)
40
# define dfield_get_data(field) ((field)->data)
41
#endif /* UNIV_DEBUG */
48
dfield_t* field); /* in: SQL data field */
42
49
/*************************************************************************
43
50
Sets the type struct of SQL data field. */
65
80
dfield_t* field, /* in: field */
66
81
ulint len); /* in: length or UNIV_SQL_NULL */
67
82
/*************************************************************************
68
Determines if a field is SQL NULL */
73
/* out: nonzero if SQL null data */
74
const dfield_t* field); /* in: field */
75
/*************************************************************************
76
Determines if a field is externally stored */
81
/* out: nonzero if externally stored */
82
const dfield_t* field); /* in: field */
83
/*************************************************************************
84
Sets the "external storage" flag */
89
dfield_t* field); /* in/out: field */
90
/*************************************************************************
91
83
Sets pointer to the data and length in a field. */
118
103
dfield_copy_data(
119
104
/*=============*/
120
dfield_t* field1, /* out: field to copy to */
121
const dfield_t* field2);/* in: field to copy from */
105
dfield_t* field1, /* in: field to copy to */
106
dfield_t* field2);/* in: field to copy from */
122
107
/*************************************************************************
123
108
Copies a data field to another. */
128
dfield_t* field1, /* out: field to copy to */
129
const dfield_t* field2);/* in: field to copy from */
130
/*************************************************************************
131
Copies the data pointed to by a data field. */
136
dfield_t* field, /* in/out: data field */
137
mem_heap_t* heap); /* in: memory heap where allocated */
113
dfield_t* field1, /* in: field to copy to */
114
dfield_t* field2);/* in: field to copy from */
138
115
/*************************************************************************
139
116
Tests if data length and content is equal for two dfields. */
142
119
dfield_datas_are_binary_equal(
143
120
/*==========================*/
144
121
/* out: TRUE if equal */
145
const dfield_t* field1, /* in: field */
146
const dfield_t* field2);/* in: field */
122
dfield_t* field1, /* in: field */
123
dfield_t* field2);/* in: field */
147
124
/*************************************************************************
148
125
Tests if dfield data length and content is equal to the given. */
151
128
dfield_data_is_binary_equal(
152
129
/*========================*/
153
130
/* out: TRUE if equal */
154
const dfield_t* field, /* in: field */
131
dfield_t* field, /* in: field */
155
132
ulint len, /* in: data length or UNIV_SQL_NULL */
156
const byte* data); /* in: data */
133
byte* data); /* in: data */
157
134
/*************************************************************************
158
135
Gets number of fields in a data tuple. */
222
195
ulint n_fields); /* in: number of fields */
224
/**************************************************************
225
Wrap data fields in a tuple. The default value for number
226
of fields used in record comparisons for this tuple is n_fields. */
231
/* out: data tuple */
232
dtuple_t* tuple, /* in: storage for data tuple */
233
const dfield_t* fields, /* in: fields */
234
ulint n_fields); /* in: number of fields */
197
/*************************************************************************
198
Creates a dtuple for use in MySQL. */
201
dtuple_create_for_mysql(
202
/*====================*/
203
/* out, own created dtuple */
204
void** heap, /* out: created memory heap */
205
ulint n_fields); /* in: number of fields */
206
/*************************************************************************
207
Frees a dtuple used in MySQL. */
210
dtuple_free_for_mysql(
211
/*==================*/
236
213
/*************************************************************************
237
214
Sets number of fields used in a tuple. Normally this is set in
238
215
dtuple_create, but if you want later to set it smaller, you can use this. */
241
218
dtuple_set_n_fields(
242
219
/*================*/
243
220
dtuple_t* tuple, /* in: tuple */
244
221
ulint n_fields); /* in: number of fields */
245
/*************************************************************************
246
Copies a data tuple to another. This is a shallow copy; if a deep copy
247
is desired, dfield_dup() will have to be invoked on each field. */
252
/* out, own: copy of tuple */
253
const dtuple_t* tuple, /* in: tuple to copy from */
254
mem_heap_t* heap); /* in: memory heap
255
where the tuple is created */
256
222
/**************************************************************
257
223
The following function returns the sum of data lengths of a tuple. The space
258
224
occupied by the field structs or the tuple struct is not counted. */
261
227
dtuple_get_data_size(
262
228
/*=================*/
263
229
/* out: sum of data lens */
264
const dtuple_t* tuple); /* in: typed data tuple */
265
/*************************************************************************
266
Computes the number of externally stored fields in a data tuple. */
271
/* out: number of fields */
272
const dtuple_t* tuple); /* in: tuple */
230
dtuple_t* tuple); /* in: typed data tuple */
273
231
/****************************************************************
274
Compare two data tuples, respecting the collation of character fields. */
279
/* out: 1, 0 , -1 if tuple1 is greater, equal,
280
less, respectively, than tuple2 */
281
const dtuple_t* tuple1, /* in: tuple 1 */
282
const dtuple_t* tuple2);/* in: tuple 2 */
232
Returns TRUE if lengths of two dtuples are equal and respective data fields
233
in them are equal when compared with collation in char fields (not as binary
237
dtuple_datas_are_ordering_equal(
238
/*============================*/
239
/* out: TRUE if length and fieds are equal
240
when compared with cmp_data_data:
241
NOTE: in character type fields some letters
242
are identified with others! (collation) */
243
dtuple_t* tuple1, /* in: tuple 1 */
244
dtuple_t* tuple2);/* in: tuple 2 */
283
245
/****************************************************************
284
246
Folds a prefix given as the number of fields of a tuple. */
289
251
/* out: the folded value */
290
const dtuple_t* tuple, /* in: the tuple */
252
dtuple_t* tuple, /* in: the tuple */
291
253
ulint n_fields,/* in: number of complete fields to fold */
292
254
ulint n_bytes,/* in: number of bytes to fold in an
293
255
incomplete last field */
294
dulint tree_id)/* in: index tree id */
295
__attribute__((pure));
256
dulint tree_id);/* in: index tree id */
296
257
/***********************************************************************
297
258
Sets types of fields binary in a tuple. */
308
269
dtuple_contains_null(
309
270
/*=================*/
310
271
/* out: TRUE if some field is SQL null */
311
const dtuple_t* tuple); /* in: dtuple */
272
dtuple_t* tuple); /* in: dtuple */
312
273
/**************************************************************
313
274
Checks that a data field is typed. Asserts an error if not. */
316
277
dfield_check_typed(
317
278
/*===============*/
318
279
/* out: TRUE if ok */
319
const dfield_t* field); /* in: data field */
280
dfield_t* field); /* in: data field */
320
281
/**************************************************************
321
282
Checks that a data tuple is typed. Asserts an error if not. */
324
285
dtuple_check_typed(
325
286
/*===============*/
326
287
/* out: TRUE if ok */
327
const dtuple_t* tuple); /* in: tuple */
288
dtuple_t* tuple); /* in: tuple */
328
289
/**************************************************************
329
290
Checks that a data tuple is typed. */
332
293
dtuple_check_typed_no_assert(
333
294
/*=========================*/
334
295
/* out: TRUE if ok */
335
const dtuple_t* tuple); /* in: tuple */
296
dtuple_t* tuple); /* in: tuple */
336
297
#ifdef UNIV_DEBUG
337
298
/**************************************************************
338
299
Validates the consistency of a tuple which must be complete, i.e,
339
300
all fields must have been set. */
344
305
/* out: TRUE if ok */
345
const dtuple_t* tuple); /* in: tuple */
306
dtuple_t* tuple); /* in: tuple */
346
307
#endif /* UNIV_DEBUG */
347
308
/*****************************************************************
348
309
Pretty prints a dfield value according to its data type. */
353
const dfield_t* dfield);/* in: dfield */
314
dfield_t* dfield);/* in: dfield */
354
315
/*****************************************************************
355
316
Pretty prints a dfield value according to its data type. Also the hex string
356
317
is printed if a string contains non-printable characters. */
359
320
dfield_print_also_hex(
360
321
/*==================*/
361
const dfield_t* dfield); /* in: dfield */
322
dfield_t* dfield); /* in: dfield */
362
323
/**************************************************************
363
324
The following function prints the contents of a tuple. */
368
329
FILE* f, /* in: output stream */
369
const dtuple_t* tuple); /* in: tuple */
330
dtuple_t* tuple); /* in: tuple */
370
331
/******************************************************************
371
332
Moves parts of long fields in entry to the big record vector so that
372
333
the size of tuple drops below the maximum record size allowed in the
373
334
database. Moves data only from those fields which are not necessary
374
335
to determine uniquely the insertion place of the tuple in the index. */
377
338
dtuple_convert_big_rec(
378
339
/*===================*/
379
340
/* out, own: created big record vector,
380
341
NULL if we are not able to shorten
381
342
the entry enough, i.e., if there are
382
too many fixed-length or short fields
383
in entry or the index is clustered */
343
too many short fields in entry */
384
344
dict_index_t* index, /* in: index */
385
dtuple_t* entry, /* in/out: index entry */
386
ulint* n_ext); /* in/out: number of
387
externally stored columns */
345
dtuple_t* entry, /* in: index entry */
346
ulint* ext_vec,/* in: array of externally stored fields,
347
or NULL: if a field already is externally
348
stored, then we cannot move it to the vector
349
this function returns */
350
ulint n_ext_vec);/* in: number of elements is ext_vec */
388
351
/******************************************************************
389
352
Puts back to entry the data stored in vector. Note that to ensure the
390
353
fields in entry can accommodate the data, vector must have been created
391
354
from entry with dtuple_convert_big_rec. */
394
357
dtuple_convert_back_big_rec(
395
358
/*========================*/