~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/pars/pars0sym.c

  • Committer: Stewart Smith
  • Author(s): Marko Mäkelä, Stewart Smith
  • Date: 2010-11-17 05:52:09 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1971.
  • Revision ID: stewart@flamingspork.com-20101117055209-69m035q6h7e1txrc
Merge Revision revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4

Merge and adjust a forgotten change to fix this bug.
rb://393 approved by Jimmy Yang
  ------------------------------------------------------------------------
  r3794 | marko | 2009-01-07 14:14:53 +0000 (Wed, 07 Jan 2009) | 18 lines

  branches/6.0: Allow the minimum length of a multi-byte character to be
  up to 4 bytes. (Bug #35391)

  dtype_t, dict_col_t: Replace mbminlen:2, mbmaxlen:3 with mbminmaxlen:5.
  In this way, the 5 bits can hold two values of 0..4, and the storage size
  of the fields will not cross the 64-bit boundary.  Encode the values as
  DATA_MBMAX * mbmaxlen + mbminlen.  Define the auxiliary macros
  DB_MBMINLEN(mbminmaxlen), DB_MBMAXLEN(mbminmaxlen), and
  DB_MINMAXLEN(mbminlen, mbmaxlen).

  Try to trim and pad UTF-16 and UTF-32 with spaces as appropriate.

  Alexander Barkov suggested the use of cs->cset->fill(cs, buff, len, 0x20).
  ha_innobase::store_key_val_for_row() now does that, but the added function
  row_mysql_pad_col() does not, because it doesn't have the MySQL TABLE object.

  rb://49 approved by Heikki Tuuri
  ------------------------------------------------------------------------

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
34
34
#include "data0data.h"
35
35
#ifndef PARS0GRM_H
36
36
# define PARS0GRM_H
37
 
# include "pars0grm.hh"
 
37
# include "pars0grm.h"
38
38
#endif
39
39
#include "pars0pars.h"
40
40
#include "que0que.h"
52
52
{
53
53
        sym_tab_t*      sym_tab;
54
54
 
55
 
        sym_tab = static_cast<sym_tab_t *>(mem_heap_alloc(heap, sizeof(sym_tab_t)));
 
55
        sym_tab = mem_heap_alloc(heap, sizeof(sym_tab_t));
56
56
 
57
57
        UT_LIST_INIT(sym_tab->sym_list);
58
58
        UT_LIST_INIT(sym_tab->func_node_list);
103
103
/******************************************************************//**
104
104
Adds an integer literal to a symbol table.
105
105
@return symbol table node */
106
 
#ifdef __cplusplus
107
 
extern "C"
108
 
#endif
109
106
UNIV_INTERN
110
107
sym_node_t*
111
108
sym_tab_add_int_lit(
116
113
        sym_node_t*     node;
117
114
        byte*           data;
118
115
 
119
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
116
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
120
117
 
121
118
        node->common.type = QUE_NODE_SYMBOL;
122
119
 
127
124
 
128
125
        dtype_set(dfield_get_type(&node->common.val), DATA_INT, 0, 4);
129
126
 
130
 
        data = static_cast<byte *>(mem_heap_alloc(sym_tab->heap, 4));
 
127
        data = mem_heap_alloc(sym_tab->heap, 4);
131
128
        mach_write_to_4(data, val);
132
129
 
133
130
        dfield_set_data(&(node->common.val), data, 4);
146
143
/******************************************************************//**
147
144
Adds a string literal to a symbol table.
148
145
@return symbol table node */
149
 
#ifdef __cplusplus
150
 
extern "C"
151
 
#endif
152
146
UNIV_INTERN
153
147
sym_node_t*
154
148
sym_tab_add_str_lit(
161
155
        sym_node_t*     node;
162
156
        byte*           data;
163
157
 
164
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
158
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
165
159
 
166
160
        node->common.type = QUE_NODE_SYMBOL;
167
161
 
174
168
                  DATA_VARCHAR, DATA_ENGLISH, 0);
175
169
 
176
170
        if (len) {
177
 
                data = static_cast<byte *>(mem_heap_alloc(sym_tab->heap, len));
 
171
                data = mem_heap_alloc(sym_tab->heap, len);
178
172
                ut_memcpy(data, str, len);
179
173
        } else {
180
174
                data = NULL;
196
190
/******************************************************************//**
197
191
Add a bound literal to a symbol table.
198
192
@return symbol table node */
199
 
#ifdef __cplusplus
200
 
extern "C"
201
 
#endif
202
193
UNIV_INTERN
203
194
sym_node_t*
204
195
sym_tab_add_bound_lit(
214
205
        blit = pars_info_get_bound_lit(sym_tab->info, name);
215
206
        ut_a(blit);
216
207
 
217
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
208
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
218
209
 
219
210
        node->common.type = QUE_NODE_SYMBOL;
220
211
 
275
266
/******************************************************************//**
276
267
Adds an SQL null literal to a symbol table.
277
268
@return symbol table node */
278
 
#ifdef __cplusplus
279
 
extern "C"
280
 
#endif
281
269
UNIV_INTERN
282
270
sym_node_t*
283
271
sym_tab_add_null_lit(
286
274
{
287
275
        sym_node_t*     node;
288
276
 
289
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
277
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
290
278
 
291
279
        node->common.type = QUE_NODE_SYMBOL;
292
280
 
313
301
/******************************************************************//**
314
302
Adds an identifier to a symbol table.
315
303
@return symbol table node */
316
 
#ifdef __cplusplus
317
 
extern "C"
318
 
#endif
319
304
UNIV_INTERN
320
305
sym_node_t*
321
306
sym_tab_add_id(
326
311
{
327
312
        sym_node_t*     node;
328
313
 
329
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
314
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
330
315
 
331
316
        node->common.type = QUE_NODE_SYMBOL;
332
317
 
352
337
/******************************************************************//**
353
338
Add a bound identifier to a symbol table.
354
339
@return symbol table node */
355
 
#ifdef __cplusplus
356
 
extern "C"
357
 
#endif
358
340
UNIV_INTERN
359
341
sym_node_t*
360
342
sym_tab_add_bound_id(
368
350
        bid = pars_info_get_bound_id(sym_tab->info, name);
369
351
        ut_a(bid);
370
352
 
371
 
        node = static_cast<sym_node_t *>(mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t)));
 
353
        node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
372
354
 
373
355
        node->common.type = QUE_NODE_SYMBOL;
374
356