~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/table_function.cc

[patch 106/129] Merge patch for revision 1915 from InnoDB SVN:
revno: 1915
revision-id: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6130
parent: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6126
committer: marko
timestamp: Mon 2009-11-02 09:42:56 +0000
message:
  branches/zip: Free all resources at shutdown. Set pointers to NULL, so
  that Valgrind will not complain about freed data structures that are
  reachable via pointers.  This addresses Bug #45992 and Bug #46656.
  
  This patch is mostly based on changes copied from branches/embedded-1.0,
  mainly c5432, c3439, c3134, c2994, c2978, but also some other code was
  copied.  Some added cleanup code is specific to MySQL/InnoDB.
  
  rb://199 approved by Sunny Bains
modified:
  ChangeLog                      2425@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2FChangeLog
  btr/btr0sea.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbtr%2Fbtr0sea.c
  buf/buf0buf.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fbuf%2Fbuf0buf.c
  dict/dict0dict.c               2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fdict%2Fdict0dict.c
  fil/fil0fil.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Ffil%2Ffil0fil.c
  ibuf/ibuf0ibuf.c               2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fibuf%2Fibuf0ibuf.c
  include/btr0sea.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fbtr0sea.h
  include/dict0dict.h            2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fdict0dict.h
  include/fil0fil.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ffil0fil.h
  include/ibuf0ibuf.h            2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fibuf0ibuf.h
  include/lock0lock.h            2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Flock0lock.h
  include/log0log.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Flog0log.h
  include/log0recv.h             2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Flog0recv.h
  include/mem0mem.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fmem0mem.h
  include/mem0pool.h             2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fmem0pool.h
  include/os0file.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fos0file.h
  include/pars0pars.h            2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fpars0pars.h
  include/srv0srv.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fsrv0srv.h
  include/thr0loc.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fthr0loc.h
  include/trx0i_s.h              1864@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Finclude%2Ftrx0i_s.h
  include/trx0purge.h            2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ftrx0purge.h
  include/trx0rseg.h             2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ftrx0rseg.h
  include/trx0sys.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ftrx0sys.h
  include/trx0undo.h             2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ftrx0undo.h
  include/usr0sess.h             2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Fusr0sess.h
  lock/lock0lock.c               2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Flock%2Flock0lock.c
  log/log0log.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Flog%2Flog0log.c
  log/log0recv.c                 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Flog%2Flog0recv.c
  mem/mem0dbg.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fmem%2Fmem0dbg.c
  mem/mem0pool.c                 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fmem%2Fmem0pool.c
  os/os0file.c                   2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fos%2Fos0file.c
  os/os0sync.c                   2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fos%2Fos0sync.c
  os/os0thread.c                 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fos%2Fos0thread.c
  pars/lexyy.c                   2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fpars%2Flexyy.c
  pars/pars0lex.l                2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fpars%2Fpars0lex.l
  que/que0que.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fque%2Fque0que.c
  srv/srv0srv.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fsrv%2Fsrv0srv.c
  srv/srv0start.c                2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fsrv%2Fsrv0start.c
  sync/sync0arr.c                2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fsync%2Fsync0arr.c
  sync/sync0sync.c               2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fsync%2Fsync0sync.c
  thr/thr0loc.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fthr%2Fthr0loc.c
  trx/trx0i_s.c                  1864@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Ftrx%2Ftrx0i_s.c
  trx/trx0purge.c                2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Ftrx%2Ftrx0purge.c
  trx/trx0rseg.c                 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Ftrx%2Ftrx0rseg.c
  trx/trx0sys.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Ftrx%2Ftrx0sys.c
  trx/trx0undo.c                 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Ftrx%2Ftrx0undo.c
  usr/usr0sess.c                 2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fusr%2Fusr0sess.c
  ut/ut0mem.c                    2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Fut%2Fut0mem.c
diff:
=== modified file 'ChangeLog'

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
#include <vector>
30
30
 
 
31
using namespace std;
 
32
 
31
33
namespace drizzled
32
34
{
33
35
 
59
61
  return false;
60
62
}
61
63
 
62
 
plugin::TableFunction *plugin::TableFunction::getFunction(const std::string &arg)
 
64
plugin::TableFunction *plugin::TableFunction::getFunction(const string &arg)
63
65
{
64
66
  return table_functions.getFunction(arg);
65
67
}
66
68
 
67
 
void plugin::TableFunction::getNames(const std::string &arg,
68
 
                                     std::set<std::string> &set_of_names)
 
69
void plugin::TableFunction::getNames(const string &arg,
 
70
                                     set<std::string> &set_of_names)
69
71
{
70
72
  table_functions.getNames(arg, set_of_names);
71
73
}
113
115
    field_options->set_default_null(false);
114
116
    field_constraints->set_is_nullable(false);
115
117
  case TableFunction::STRING:
116
 
    {
117
 
      drizzled::message::Table::Field::StringFieldOptions *string_field_options;
118
 
      if (field_length >= TABLE_FUNCTION_BLOB_SIZE)
119
 
      {
120
 
        field->set_type(drizzled::message::Table::Field::BLOB);
121
 
        string_field_options= field->mutable_string_options();
122
 
        string_field_options->set_collation_id(default_charset_info->number);
123
 
        string_field_options->set_collation(default_charset_info->name);
124
 
      }
125
 
      else
126
 
      {
127
 
        field->set_type(drizzled::message::Table::Field::VARCHAR);
128
 
        string_field_options= field->mutable_string_options();
129
 
        string_field_options->set_length(field_length);
130
 
      }
131
 
    }
 
118
  {
 
119
    drizzled::message::Table::Field::StringFieldOptions *string_field_options;
 
120
    field->set_type(drizzled::message::Table::Field::VARCHAR);
 
121
 
 
122
    string_field_options= field->mutable_string_options();
 
123
    string_field_options->set_length(field_length);
 
124
  }
132
125
    break;
133
126
  case TableFunction::VARBINARY:
134
 
    {
135
 
      drizzled::message::Table::Field::StringFieldOptions *string_field_options;
136
 
      field->set_type(drizzled::message::Table::Field::VARCHAR);
 
127
  {
 
128
    drizzled::message::Table::Field::StringFieldOptions *string_field_options;
 
129
    field->set_type(drizzled::message::Table::Field::VARCHAR);
137
130
 
138
 
      string_field_options= field->mutable_string_options();
139
 
      string_field_options->set_length(field_length);
140
 
      string_field_options->set_collation(my_charset_bin.csname);
141
 
      string_field_options->set_collation_id(my_charset_bin.number);
142
 
    }
 
131
    string_field_options= field->mutable_string_options();
 
132
    string_field_options->set_length(field_length);
 
133
    string_field_options->set_collation(my_charset_bin.csname);
 
134
    string_field_options->set_collation_id(my_charset_bin.number);
 
135
  }
143
136
    break;
144
137
  case TableFunction::NUMBER: // Currently NUMBER always has a value
145
138
    field->set_type(drizzled::message::Table::Field::BIGINT);
192
185
  assert(arg);
193
186
  length= length ? length : strlen(arg);
194
187
 
195
 
  if ((*columns_iterator)->char_length() < length)
196
 
    length= (*columns_iterator)->char_length();
197
 
 
198
188
  (*columns_iterator)->store(arg, length, scs);
199
189
  (*columns_iterator)->set_notnull();
200
190
  columns_iterator++;
202
192
 
203
193
void plugin::TableFunction::Generator::push()
204
194
{
205
 
  /* Only accept NULLs */
206
 
  assert((*columns_iterator)->maybe_null());
 
195
#if 0 // @note this needs to be rewritten such that a drizzled::Field object can determine if it should ever be null
 
196
  assert((*columns_iterator)->getTable()->getShare()->getTableProto()->field((*columns_iterator)->getTable()->getFields() - columns_iterator).constraints().is_nullable());
 
197
#endif
207
198
  (*columns_iterator)->set_null();
208
199
  columns_iterator++;
209
200
}