~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Brian Aker
  • Date: 2009-04-29 00:32:11 UTC
  • mto: This revision was merged to the branch mainline in revision 1001.
  • Revision ID: brian@gaz-20090429003211-nnomdlvzv4hb15jt
More refactoring back to TableShare object.

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
    share->next->prev= share->prev;
173
173
    pthread_mutex_unlock(&LOCK_table_share);
174
174
  }
175
 
  free_table_share(share);
 
175
  share->free_table_share();
176
176
  return;
177
177
}
178
178
 
216
216
  table_list            Table that should be opened
217
217
  key                   Table cache key
218
218
  key_length            Length of key
219
 
  db_flags              Flags to open_table_def():
220
 
                        OPEN_VIEW
221
219
  error                 out: Error code from open_table_def()
222
220
 
223
221
  IMPLEMENTATION
234
232
*/
235
233
 
236
234
TableShare *get_table_share(Session *session, TableList *table_list, char *key,
237
 
                             uint32_t key_length, uint32_t db_flags, int *error)
 
235
                             uint32_t key_length, uint32_t, int *error)
238
236
{
239
237
  TableShare *share;
240
238
 
258
256
 
259
257
  if (my_hash_insert(&table_def_cache, (unsigned char*) share))
260
258
  {
261
 
    free_table_share(share);
 
259
    share->free_table_share();
262
260
    return(0);                          // return error
263
261
  }
264
 
  if (open_table_def(session, share, db_flags))
 
262
  if (open_table_def(session, share))
265
263
  {
266
264
    *error= share->error;
267
265
    (void) hash_delete(&table_def_cache, (unsigned char*) share);
1386
1384
 
1387
1385
  if (free_share)
1388
1386
  {
1389
 
    free_table_share(table->s);
 
1387
    table->s->free_table_share();
1390
1388
    free((char*) table);
1391
1389
  }
1392
1390
  return;
3460
3458
  saved_cache_key= strcpy(tmp_path, path)+path_length+1;
3461
3459
  memcpy(saved_cache_key, cache_key, key_length);
3462
3460
 
3463
 
  share->init_tmp_table_share(saved_cache_key, key_length, strchr(saved_cache_key, '\0')+1, tmp_path);
 
3461
  share->init(saved_cache_key, key_length, strchr(saved_cache_key, '\0')+1, tmp_path);
3464
3462
 
3465
 
  if (open_table_def(session, share, 0) ||
 
3463
  if (open_table_def(session, share) ||
3466
3464
      open_table_from_share(session, share, table_name,
3467
3465
                            (open_mode == OTM_ALTER) ? 0 :
3468
3466
                            (uint32_t) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
3474
3472
                            tmp_table, open_mode))
3475
3473
  {
3476
3474
    /* No need to lock share->mutex as this is not needed for tmp tables */
3477
 
    free_table_share(share);
 
3475
    share->free_table_share();
3478
3476
    free((char*) tmp_table);
3479
3477
    return(0);
3480
3478
  }
5823
5821
          /* We should cut file extention before deleting of table */
5824
5822
          memcpy(filePathCopy, filePath, filePath_len - ext_len);
5825
5823
          filePathCopy[filePath_len - ext_len]= 0;
5826
 
          share.init_tmp_table_share("", 0, "", filePathCopy);
5827
 
          if (!open_table_def(session, &share, 0) &&
 
5824
          share.init(NULL, filePathCopy);
 
5825
          if (!open_table_def(session, &share) &&
5828
5826
              ((handler_file= get_new_handler(&share, session->mem_root,
5829
5827
                                              share.db_type()))))
5830
5828
          {
5831
5829
            handler_file->ha_delete_table(filePathCopy);
5832
5830
            delete handler_file;
5833
5831
          }
5834
 
          free_table_share(&share);
 
5832
          share.free_table_share();
5835
5833
        }
5836
5834
        /*
5837
5835
          File can be already deleted by tmp_table.file->delete_table().