~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_share.cc

  • Committer: Brian Aker
  • Date: 2010-08-05 22:16:39 UTC
  • mfrom: (1685.1.8 drizzle)
  • Revision ID: brian@gaz-20100805221639-w0x32wre7t9slqov
Rollup of Embedded, resolve_stack_dump, boost LIB in include, Archive refactoring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
  bool to_be_deleted= false;
139
139
  safe_mutex_assert_owner(&LOCK_open);
140
140
 
141
 
  pthread_mutex_lock(&share->mutex);
 
141
  share->lock();
142
142
  if (!--share->ref_count)
143
143
  {
144
144
    to_be_deleted= true;
157
157
    }
158
158
    return;
159
159
  }
160
 
  pthread_mutex_unlock(&share->mutex);
 
160
  share->unlock();
161
161
}
162
162
 
163
163
void TableShare::release(TableIdentifier &identifier)
169
169
    share->version= 0;                          // Mark for delete
170
170
    if (share->ref_count == 0)
171
171
    {
172
 
      pthread_mutex_lock(&share->mutex);
 
172
      share->lock();
173
173
      plugin::EventObserver::deregisterTableEvents(*share);
174
174
      table_def_cache.erase(identifier.getKey());
175
175
      delete share;
186
186
  */
187
187
 
188
188
  /* We must do a lock to ensure that the structure is initialized */
189
 
  (void) pthread_mutex_lock(&share->mutex);
 
189
  share->lock();
190
190
  if (share->error)
191
191
  {
192
192
    /* Table definition contained an error */
193
193
    share->open_table_error(share->error, share->open_errno, share->errarg);
194
 
    (void) pthread_mutex_unlock(&share->mutex);
 
194
    share->unlock();
195
195
 
196
196
    return NULL;
197
197
  }
198
198
 
199
199
  share->incrementTableCount();
200
 
  (void) pthread_mutex_unlock(&share->mutex);
 
200
  share->unlock();
201
201
 
202
202
  return share;
203
203
}
250
250
    Lock mutex to be able to read table definition from file without
251
251
    conflicts
252
252
  */
253
 
  (void) pthread_mutex_lock(&share->mutex);
 
253
  share->lock();
254
254
 
255
255
  /**
256
256
   * @TODO: we need to eject something if we exceed table_def_size
276
276
  
277
277
  plugin::EventObserver::registerTableEvents(*share);
278
278
  
279
 
  (void) pthread_mutex_unlock(&share->mutex);
 
279
  share->unlock();
280
280
 
281
281
  return share;
282
282
}
999
999
 
1000
1000
      key_part->length= part.compare_length();
1001
1001
 
 
1002
      int mbmaxlen= 1;
 
1003
 
 
1004
      if (table.field(part.fieldnr()).type() == message::Table::Field::VARCHAR
 
1005
          || table.field(part.fieldnr()).type() == message::Table::Field::BLOB)
 
1006
      {
 
1007
        uint32_t collation_id;
 
1008
 
 
1009
        if (table.field(part.fieldnr()).string_options().has_collation_id())
 
1010
          collation_id= table.field(part.fieldnr()).string_options().collation_id();
 
1011
        else
 
1012
          collation_id= table.options().collation_id();
 
1013
 
 
1014
        const CHARSET_INFO *cs= get_charset(collation_id);
 
1015
 
 
1016
        mbmaxlen= cs->mbmaxlen;
 
1017
      }
 
1018
      key_part->length*= mbmaxlen;
 
1019
 
1002
1020
      key_part->store_length= key_part->length;
1003
1021
 
1004
1022
      /* key_part->offset is set later */