~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cached_directory.cc

  • 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
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
50
50
 
51
51
 
52
52
CachedDirectory::CachedDirectory(const string &in_path) :
53
 
  error(0),
54
 
  use_full_path(false)
 
53
  error(0)
55
54
{
56
55
  // TODO: Toss future exception
57
56
  (void) open(in_path);
59
58
 
60
59
 
61
60
CachedDirectory::CachedDirectory(const string& in_path, set<string>& allowed_exts) :
62
 
  error(0),
63
 
  use_full_path(false)
 
61
  error(0)
64
62
{
65
63
  // TODO: Toss future exception
66
64
  (void) open(in_path, allowed_exts);
67
65
}
68
66
 
69
 
CachedDirectory::CachedDirectory(const string& in_path, enum CachedDirectory::FILTER filter, bool use_full_path_arg) :
70
 
  error(0),
71
 
  use_full_path(use_full_path_arg)
 
67
CachedDirectory::CachedDirectory(const string& in_path, enum CachedDirectory::FILTER filter) :
 
68
  error(0)
72
69
{
73
70
  set<string> empty;
74
71
  // TODO: Toss future exception
131
128
         result != NULL)
132
129
  {
133
130
    std::string buffered_fullpath;
134
 
    if (not allowed_exts.empty())
 
131
    if (! allowed_exts.empty())
135
132
    {
136
133
      char *ptr= rindex(result->d_name, '.');
137
134
 
157
154
          if (result->d_name[0] == '.') // We don't pass back anything hidden at the moment.
158
155
            continue;
159
156
 
160
 
          if (use_full_path)
161
 
          {
162
 
            buffered_fullpath.append(in_path);
163
 
            if (buffered_fullpath[buffered_fullpath.length()] != '/')
164
 
              buffered_fullpath.append(1, FN_LIBCHAR);
165
 
          }
 
157
          buffered_fullpath.append(in_path);
 
158
          if (buffered_fullpath[buffered_fullpath.length()] != '/')
 
159
            buffered_fullpath.append(1, FN_LIBCHAR);
166
160
 
167
 
          buffered_fullpath.append(result->d_name);
 
161
          buffered_fullpath.assign(result->d_name);
168
162
 
169
163
          stat(buffered_fullpath.c_str(), &entrystat);
170
164