~mordred/drizzle/codestyle

« back to all changes in this revision

Viewing changes to storage/innobase/handler/ha_innodb.cc

  • Committer: Monty Taylor
  • Date: 2008-08-18 23:04:17 UTC
  • mfrom: (327.1.12 drizzle)
  • Revision ID: monty@inaugust.com-20080818230417-442rhihpahnout34
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2421
2421
get_field_offset(
2422
2422
/*=============*/
2423
2423
                        /* out: offset */
2424
 
        TABLE*  table,  /* in: MySQL table object */
 
2424
        Table*  table,  /* in: MySQL table object */
2425
2425
        Field*  field)  /* in: MySQL field object */
2426
2426
{
2427
2427
        return((uint) (field->ptr - table->record[0]));
2435
2435
field_in_record_is_null(
2436
2436
/*====================*/
2437
2437
                        /* out: 1 if NULL, 0 otherwise */
2438
 
        TABLE*  table,  /* in: MySQL table object */
 
2438
        Table*  table,  /* in: MySQL table object */
2439
2439
        Field*  field,  /* in: MySQL field object */
2440
2440
        char*   record) /* in: a row in MySQL format */
2441
2441
{
2464
2464
void
2465
2465
set_field_in_record_to_null(
2466
2466
/*========================*/
2467
 
        TABLE*  table,  /* in: MySQL table object */
 
2467
        Table*  table,  /* in: MySQL table object */
2468
2468
        Field*  field,  /* in: MySQL field object */
2469
2469
        char*   record) /* in: a row in MySQL format */
2470
2470
{
2913
2913
        THD*            thd __attribute__((unused)),            /* in: current user thread, used
2914
2914
                                        only if templ_type is
2915
2915
                                        ROW_DRIZZLE_REC_FIELDS */
2916
 
        TABLE*          table,          /* in: MySQL table */
 
2916
        Table*          table,          /* in: MySQL table */
2917
2917
        ha_innobase*    file,           /* in: ha_innobase handler */
2918
2918
        uint            templ_type)     /* in: ROW_DRIZZLE_WHOLE_ROW or
2919
2919
                                        ROW_DRIZZLE_REC_FIELDS */
3307
3307
             || sql_command == SQLCOM_CREATE_INDEX
3308
3308
             || sql_command == SQLCOM_DROP_INDEX)
3309
3309
            && num_write_row >= 10000) {
3310
 
                /* ALTER TABLE is COMMITted at every 10000 copied rows.
 
3310
                /* ALTER Table is COMMITted at every 10000 copied rows.
3311
3311
                The IX table lock for the original table has to be re-issued.
3312
3312
                As this method will be called on a temporary table where the
3313
3313
                contents of the original table is being copied to, it is
3334
3334
                        /*
3335
3335
                        ut_print_timestamp(stderr);
3336
3336
                        fprintf(stderr,
3337
 
                                "  InnoDB: ALTER TABLE is holding lock"
 
3337
                                "  InnoDB: ALTER Table is holding lock"
3338
3338
                                " on %lu tables!\n",
3339
3339
                                prebuilt->trx->mysql_n_tables_locked);
3340
3340
                        */
3484
3484
        upd_t*          uvect,          /* in/out: update vector */
3485
3485
        uchar*          old_row,        /* in: old row in MySQL format */
3486
3486
        uchar*          new_row,        /* in: new row in MySQL format */
3487
 
        struct st_table* table,         /* in: table in MySQL data
 
3487
        Table *table,           /* in: table in MySQL data
3488
3488
                                        dictionary */
3489
3489
        uchar*          upd_buff,       /* in: buffer to use */
3490
3490
        ulint           buff_len,       /* in: buffer length */
4511
4511
create_table_def(
4512
4512
/*=============*/
4513
4513
        trx_t*          trx,            /* in: InnoDB transaction handle */
4514
 
        TABLE*          form,           /* in: information on table
 
4514
        Table*          form,           /* in: information on table
4515
4515
                                        columns and indexes */
4516
4516
        const char*     table_name,     /* in: table name */
4517
4517
        const char*     path_of_temp_table,/* in: if this is a table explicitly
4623
4623
create_index(
4624
4624
/*=========*/
4625
4625
        trx_t*          trx,            /* in: InnoDB transaction handle */
4626
 
        TABLE*          form,           /* in: information on table
 
4626
        Table*          form,           /* in: information on table
4627
4627
                                        columns and indexes */
4628
4628
        const char*     table_name,     /* in: table name */
4629
4629
        uint            key_num)        /* in: index number */
4771
4771
}
4772
4772
 
4773
4773
/*********************************************************************
4774
 
Update create_info.  Used in SHOW CREATE TABLE et al. */
 
4774
Update create_info.  Used in SHOW CREATE Table et al. */
4775
4775
 
4776
4776
void
4777
4777
ha_innobase::update_create_info(
4792
4792
/*================*/
4793
4793
                                        /* out: error number */
4794
4794
        const char*     name,           /* in: table name */
4795
 
        TABLE*          form,           /* in: information on table
 
4795
        Table*          form,           /* in: information on table
4796
4796
                                        columns and indexes */
4797
4797
        HA_CREATE_INFO* create_info)    /* in: more information of the
4798
4798
                                        created table, contains also the
4948
4948
        if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
4949
4949
           (create_info->auto_increment_value != 0)) {
4950
4950
 
4951
 
                /* Query was ALTER TABLE...AUTO_INCREMENT = x; or
4952
 
                CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
 
4951
                /* Query was ALTER Table...AUTO_INCREMENT = x; or
 
4952
                CREATE Table ...AUTO_INCREMENT = x; Find out a table
4953
4953
                definition from the dictionary and get the current value
4954
4954
                of the auto increment field. Set a new value to the
4955
4955
                auto increment field if the value is greater than the
5029
5029
 
5030
5030
        if (thd_sql_command(user_thd) != SQLCOM_TRUNCATE) {
5031
5031
        fallback:
5032
 
                /* We only handle TRUNCATE TABLE t as a special case.
 
5032
                /* We only handle TRUNCATE Table t as a special case.
5033
5033
                DELETE FROM t will have to use ha_innobase::delete_row(). */
5034
5034
                return(my_errno=HA_ERR_WRONG_COMMAND);
5035
5035
        }
5555
5555
                unpack_filename(path,path);
5556
5556
 
5557
5557
                /* Note that we do not know the access time of the table,
5558
 
                nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
 
5558
                nor the CHECK Table time, nor the UPDATE or INSERT time. */
5559
5559
 
5560
5560
                if (os_file_get_status(path,&stat_info)) {
5561
5561
                        stats.create_time = stat_info.ctime;
5572
5572
                The MySQL optimizer seems to assume in a left join that n_rows
5573
5573
                is an accurate estimate if it is zero. Of course, it is not,
5574
5574
                since we do not have any locks on the rows yet at this phase.
5575
 
                Since SHOW TABLE STATUS seems to call this function with the
 
5575
                Since SHOW Table STATUS seems to call this function with the
5576
5576
                HA_STATUS_TIME flag set, while the left join optimizer does not
5577
5577
                set that flag, we add one to a zero value if the flag is not
5578
 
                set. That way SHOW TABLE STATUS will show the best estimate,
 
5578
                set. That way SHOW Table STATUS will show the best estimate,
5579
5579
                while the optimizer never sees the table empty. */
5580
5580
 
5581
5581
                if (n_rows < 0) {
5725
5725
}
5726
5726
 
5727
5727
/**************************************************************************
5728
 
This is mapped to "ALTER TABLE tablename ENGINE=InnoDB", which rebuilds
 
5728
This is mapped to "ALTER Table tablename ENGINE=InnoDB", which rebuilds
5729
5729
the table in MySQL. */
5730
5730
 
5731
5731
int
5776
5776
 
5777
5777
/*****************************************************************
5778
5778
Adds information about free space in the InnoDB tablespace to a table comment
5779
 
which is printed out when a user calls SHOW TABLE STATUS. Adds also info on
 
5779
which is printed out when a user calls SHOW Table STATUS. Adds also info on
5780
5780
foreign keys. */
5781
5781
 
5782
5782
char*
5857
5857
ha_innobase::get_foreign_key_create_info(void)
5858
5858
/*==========================================*/
5859
5859
                        /* out, own: character string in the form which
5860
 
                        can be inserted to the CREATE TABLE statement,
 
5860
                        can be inserted to the CREATE Table statement,
5861
5861
                        MUST be freed with ::free_foreign_key_create_info */
5862
5862
{
5863
5863
        char*   str     = 0;
6042
6042
}
6043
6043
 
6044
6044
/*********************************************************************
6045
 
Checks if ALTER TABLE may change the storage engine of the table.
 
6045
Checks if ALTER Table may change the storage engine of the table.
6046
6046
Changing storage engines is not allowed for tables for which there
6047
6047
are foreign key constraints (parent or child tables). */
6048
6048
 
6335
6335
 
6336
6336
        if (lock_type == F_WRLCK) {
6337
6337
 
6338
 
                /* If this is a SELECT, then it is in UPDATE TABLE ...
 
6338
                /* If this is a SELECT, then it is in UPDATE Table ...
6339
6339
                or SELECT ... FOR UPDATE */
6340
6340
                prebuilt->select_lock_type = LOCK_X;
6341
6341
                prebuilt->stored_select_lock_type = LOCK_X;
6877
6877
 
6878
6878
        if (sql_command == SQLCOM_DROP_TABLE) {
6879
6879
 
6880
 
                /* MySQL calls this function in DROP TABLE though this table
 
6880
                /* MySQL calls this function in DROP Table though this table
6881
6881
                handle may belong to another thd that is running a query. Let
6882
6882
                us in that case skip any changes to the prebuilt struct. */ 
6883
6883
 
6974
6974
                        lock_type = TL_READ_NO_INSERT;
6975
6975
                }
6976
6976
 
6977
 
                /* If we are not doing a LOCK TABLE, DISCARD/IMPORT
6978
 
                TABLESPACE or TRUNCATE TABLE then allow multiple
6979
 
                writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ
 
6977
                /* If we are not doing a LOCK Table, DISCARD/IMPORT
 
6978
                TABLESPACE or TRUNCATE Table then allow multiple
 
6979
                writers. Note that ALTER Table uses a TL_WRITE_ALLOW_READ
6980
6980
                < TL_WRITE_CONCURRENT_INSERT.
6981
6981
 
6982
6982
                We especially allow multiple writers if MySQL is at the
7100
7100
 
7101
7101
        dict_table_autoinc_unlock(prebuilt->table);
7102
7102
 
7103
 
        /* Since MySQL does not seem to call autocommit after SHOW TABLE
 
7103
        /* Since MySQL does not seem to call autocommit after SHOW Table
7104
7104
        STATUS (even if we would register the trx here), we commit our
7105
7105
        transaction here if it was started here. This is to eliminate a
7106
7106
        dangling transaction. If the user had AUTOCOMMIT=0, then SHOW
7107
 
        TABLE STATUS does leave a dangling transaction if the user does not
 
7107
        Table STATUS does leave a dangling transaction if the user does not
7108
7108
        himself call COMMIT. */
7109
7109
 
7110
7110
        if (trx_was_not_started) {
7843
7843
 
7844
7844
static DRIZZLE_SYSVAR_BOOL(stats_on_metadata, innobase_stats_on_metadata,
7845
7845
  PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_NOSYSVAR,
7846
 
  "Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
 
7846
  "Enable statistics gathering for metadata commands such as SHOW Table STATUS (on by default)",
7847
7847
  NULL, NULL, TRUE);
7848
7848
 
7849
7849
static DRIZZLE_SYSVAR_BOOL(use_adaptive_hash_indexes, innobase_use_adaptive_hash_indexes,