~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/innobase/dict/dict0mem.cc

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-10-29 15:43:40 UTC
  • mfrom: (1.2.12) (2.1.19 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131029154340-2gp39el6cv8bwf2o
Tags: 1:7.2.3-2ubuntu1
* Merge from debian, remaining changes:
  - Link against boost_system because of boost_thread.
  - Add required libs to message/include.am
  - Add upstart job and adjust init script to be upstart compatible.
  - Disable -floop-parallelize-all due to gcc-4.8/4.9 compiler ICE
    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57732

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "data0type.h"
34
34
#include "mach0data.h"
35
35
#include "dict0dict.h"
 
36
#include "srv0srv.h" /* srv_lower_case_table_names */
 
37
#include "ha_prototypes.h" /* innobase_casedn_str()*/
36
38
#ifndef UNIV_HOTBACKUP
37
39
# include "lock0lock.h"
38
40
#endif /* !UNIV_HOTBACKUP */
 
41
#ifdef UNIV_BLOB_DEBUG
 
42
# include "ut0rbt.h"
 
43
#endif /* UNIV_BLOB_DEBUG */
39
44
 
40
45
#define DICT_HEAP_SIZE          100     /*!< initial memory heap size when
41
46
                                        creating a table or index object */
288
293
}
289
294
 
290
295
/**********************************************************************//**
 
296
Sets the foreign_table_name_lookup pointer based on the value of
 
297
srv_lower_case_table_names.  If that is 0 or 1, foreign_table_name_lookup
 
298
will point to foreign_table_name.  If 2, then another string is allocated
 
299
of the heap and set to lower case. */
 
300
UNIV_INTERN
 
301
void
 
302
dict_mem_foreign_table_name_lookup_set(
 
303
/*===================================*/
 
304
        dict_foreign_t* foreign,        /*!< in/out: foreign struct */
 
305
        ibool           do_alloc)       /*!< in: is an alloc needed */
 
306
{
 
307
        if (srv_lower_case_table_names == 2) {
 
308
                if (do_alloc) {
 
309
                  foreign->foreign_table_name_lookup = static_cast<char *>(mem_heap_alloc(
 
310
                                foreign->heap,
 
311
                                strlen(foreign->foreign_table_name) + 1));
 
312
                }
 
313
                strcpy(foreign->foreign_table_name_lookup,
 
314
                       foreign->foreign_table_name);
 
315
                innobase_casedn_str(foreign->foreign_table_name_lookup);
 
316
        } else {
 
317
                foreign->foreign_table_name_lookup
 
318
                        = foreign->foreign_table_name;
 
319
        }
 
320
}
 
321
 
 
322
/**********************************************************************//**
 
323
Sets the referenced_table_name_lookup pointer based on the value of
 
324
srv_lower_case_table_names.  If that is 0 or 1,
 
325
referenced_table_name_lookup will point to referenced_table_name.  If 2,
 
326
then another string is allocated of the heap and set to lower case. */
 
327
UNIV_INTERN
 
328
void
 
329
dict_mem_referenced_table_name_lookup_set(
 
330
/*======================================*/
 
331
        dict_foreign_t* foreign,        /*!< in/out: foreign struct */
 
332
        ibool           do_alloc)       /*!< in: is an alloc needed */
 
333
{
 
334
        if (srv_lower_case_table_names == 2) {
 
335
                if (do_alloc) {
 
336
                  foreign->referenced_table_name_lookup = static_cast<char *>(mem_heap_alloc(
 
337
                                foreign->heap,
 
338
                                strlen(foreign->referenced_table_name) + 1));
 
339
                }
 
340
                strcpy(foreign->referenced_table_name_lookup,
 
341
                       foreign->referenced_table_name);
 
342
                innobase_casedn_str(foreign->referenced_table_name_lookup);
 
343
        } else {
 
344
                foreign->referenced_table_name_lookup
 
345
                        = foreign->referenced_table_name;
 
346
        }
 
347
}
 
348
 
 
349
/**********************************************************************//**
291
350
Adds a field definition to an index. NOTE: does not take a copy
292
351
of the column name if the field is a column. The memory occupied
293
352
by the column name may be released only after publishing the index. */
324
383
{
325
384
        ut_ad(index);
326
385
        ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
 
386
#ifdef UNIV_BLOB_DEBUG
 
387
        if (index->blobs) {
 
388
                mutex_free(&index->blobs_mutex);
 
389
                rbt_free(index->blobs);
 
390
        }
 
391
#endif /* UNIV_BLOB_DEBUG */
327
392
 
328
393
        mem_heap_free(index->heap);
329
394
}