~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
 
174
174
  switch (plug->license) {
175
175
  case PLUGIN_LICENSE_GPL:
176
 
    table->field[7]->store(PLUGIN_LICENSE_GPL_STRING, 
 
176
    table->field[7]->store(PLUGIN_LICENSE_GPL_STRING,
177
177
                           strlen(PLUGIN_LICENSE_GPL_STRING), cs);
178
178
    break;
179
179
  case PLUGIN_LICENSE_BSD:
180
 
    table->field[7]->store(PLUGIN_LICENSE_BSD_STRING, 
 
180
    table->field[7]->store(PLUGIN_LICENSE_BSD_STRING,
181
181
                           strlen(PLUGIN_LICENSE_BSD_STRING), cs);
182
182
    break;
183
183
  default:
184
 
    table->field[7]->store(PLUGIN_LICENSE_PROPRIETARY_STRING, 
 
184
    table->field[7]->store(PLUGIN_LICENSE_PROPRIETARY_STRING,
185
185
                           strlen(PLUGIN_LICENSE_PROPRIETARY_STRING), cs);
186
186
    break;
187
187
  }
255
255
    file=dirp->dir_entry+i;
256
256
    if (dir)
257
257
    {                                           /* Return databases */
258
 
      if ((file->name[0] == '.' && 
 
258
      if ((file->name[0] == '.' &&
259
259
          ((file->name[1] == '.' && file->name[2] == '\0') ||
260
260
            file->name[1] == '\0')))
261
261
        continue;                               /* . or .. */
281
281
      file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
282
282
      if (wild && wild_compare(uname, wild, 0))
283
283
        continue;
284
 
      if (!(file_name= 
 
284
      if (!(file_name=
285
285
            session->make_lex_string(file_name, uname, file_name_len, true)))
286
286
      {
287
287
        my_dirend(dirp);
307
307
          continue;
308
308
      }
309
309
    }
310
 
    if (!(file_name= 
 
310
    if (!(file_name=
311
311
          session->make_lex_string(file_name, uname, file_name_len, true)) ||
312
312
        files->push_back(file_name))
313
313
    {
336
336
 
337
337
    /*
338
338
      Clear all messages with 'error' level status and
339
 
      issue a warning with 'warning' level status in 
 
339
      issue a warning with 'warning' level status in
340
340
      case of invalid view and last error is ER_VIEW_INVALID
341
341
    */
342
342
    drizzle_reset_errors(session, true);
386
386
 
387
387
  if (store_db_create_info(session, dbname, &buffer, create_info))
388
388
  {
389
 
    /* 
 
389
    /*
390
390
      This assumes that the only reason for which store_db_create_info()
391
391
      can fail is incorrect database name (which is the case now).
392
392
    */
393
393
    my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
394
 
    return(true);    
 
394
    return(true);
395
395
  }
396
396
 
397
397
  List<Item> field_list;
433
433
  Field **ptr,*field;
434
434
  for (ptr=table->field ; (field= *ptr); ptr++)
435
435
  {
436
 
    if (!wild || !wild[0] || 
 
436
    if (!wild || !wild[0] ||
437
437
        !wild_case_compare(system_charset_info, field->field_name,wild))
438
438
    {
439
439
      field_list.push_back(new Item_field(field));
600
600
  bool has_default;
601
601
  bool has_now_default;
602
602
 
603
 
  /* 
 
603
  /*
604
604
     We are using CURRENT_TIMESTAMP instead of NOW because it is
605
605
     more standard
606
606
  */
607
607
  has_now_default= (timestamp_field == field &&
608
608
                    field->unireg_check != Field::TIMESTAMP_UN_FIELD);
609
 
    
 
609
 
610
610
  has_default= (field->type() != DRIZZLE_TYPE_BLOB &&
611
611
                !(field->flags & NO_DEFAULT_VALUE_FLAG) &&
612
612
                field->unireg_check != Field::NEXT_NUMBER
660
660
                      to tailor the format of the statement.  Can be
661
661
                      NULL, in which case only SQL_MODE is considered
662
662
                      when building the statement.
663
 
  
 
663
 
664
664
  NOTE
665
665
    Currently always return 0, but might return error code in the
666
666
    future.
667
 
    
 
667
 
668
668
  RETURN
669
669
    0       OK
670
670
 */
751
751
      if (field->is_stored)
752
752
        packet->append(STRING_WITH_LEN(" STORED"));
753
753
    }
754
 
    
 
754
 
755
755
    if (field->has_charset())
756
756
    {
757
757
      if (field->charset() != share->table_charset)
759
759
        packet->append(STRING_WITH_LEN(" CHARACTER SET "));
760
760
        packet->append(field->charset()->csname);
761
761
      }
762
 
      /* 
763
 
        For string types dump collation name only if 
 
762
      /*
 
763
        For string types dump collation name only if
764
764
        collation is not primary for the given charset
765
765
      */
766
766
      if (!(field->charset()->state & MY_CS_PRIMARY))
1013
1013
  @param  session           The current thread instance.
1014
1014
  @param  dbname        The name of the database.
1015
1015
  @param  buffer        A String instance where the statement is stored.
1016
 
  @param  create_info   If not NULL, the options member influences the resulting 
 
1016
  @param  create_info   If not NULL, the options member influences the resulting
1017
1017
                        CRATE statement.
1018
1018
 
1019
1019
  @returns true if errors are detected, false otherwise.
1085
1085
    packet->append(buff, (uint) (end - buff));
1086
1086
  }
1087
1087
 
1088
 
  assert(test(key_info->flags & HA_USES_COMMENT) == 
 
1088
  assert(test(key_info->flags & HA_USES_COMMENT) ==
1089
1089
              (key_info->comment.length > 0));
1090
1090
  if (key_info->flags & HA_USES_COMMENT)
1091
1091
  {
1092
1092
    packet->append(STRING_WITH_LEN(" COMMENT "));
1093
 
    append_unescaped(packet, key_info->comment.str, 
 
1093
    append_unescaped(packet, key_info->comment.str,
1094
1094
                     key_info->comment.length);
1095
1095
  }
1096
1096
}
1185
1185
        session_info->query=0;
1186
1186
        if (tmp->query)
1187
1187
        {
1188
 
          /* 
 
1188
          /*
1189
1189
            query_length is always set to 0 when we set query = NULL; see
1190
1190
                  the comment in session.h why this prevents crashes in possible
1191
1191
            races with query_length
1414
1414
    /* Note that SHOW_LONG_NOFLUSH variables are not reset */
1415
1415
    if (ptr->type == SHOW_LONG)
1416
1416
      *(ulong*) ptr->value= 0;
1417
 
  }  
 
1417
  }
1418
1418
}
1419
1419
 
1420
1420
/*
1587
1587
            stringstream ss (stringstream::in);
1588
1588
            ss << *(size_t*) value;
1589
1589
 
1590
 
            string str= ss.str(); 
 
1590
            string str= ss.str();
1591
1591
            strncpy(buff, str.c_str(), str.length());
1592
1592
            end= buff+ str.length();
1593
1593
          }
1668
1668
 
1669
1669
  I_List_iterator<Session> it(threads);
1670
1670
  Session *tmp;
1671
 
  
 
1671
 
1672
1672
  /* Get global values as base */
1673
1673
  *to= global_status_var;
1674
 
  
 
1674
 
1675
1675
  /* Add to this status from existing threads */
1676
1676
  while ((tmp= it++))
1677
1677
    add_to_status(to, &tmp->status_var);
1678
 
  
 
1678
 
1679
1679
  pthread_mutex_unlock(&LOCK_thread_count);
1680
1680
  return;
1681
1681
}
1712
1712
  {
1713
1713
    TMP_TABLE_PARAM *param= table->pos_in_table_list->schema_table_param;
1714
1714
 
1715
 
    if (create_myisam_from_heap(session, table, param->start_recinfo, 
 
1715
    if (create_myisam_from_heap(session, table, param->start_recinfo,
1716
1716
                                &param->recinfo, error, 0))
1717
1717
      return 1;
1718
1718
  }
1733
1733
 
1734
1734
 
1735
1735
/**
1736
 
  @brief    Get lookup value from the part of 'WHERE' condition 
 
1736
  @brief    Get lookup value from the part of 'WHERE' condition
1737
1737
 
1738
 
  @details This function gets lookup value from 
1739
 
           the part of 'WHERE' condition if it's possible and 
 
1738
  @details This function gets lookup value from
 
1739
           the part of 'WHERE' condition if it's possible and
1740
1740
           fill appropriate lookup_field_vals struct field
1741
1741
           with this value.
1742
1742
 
1743
1743
  @param[in]      session                   thread handler
1744
1744
  @param[in]      item_func             part of WHERE condition
1745
1745
  @param[in]      table                 I_S table
1746
 
  @param[in, out] lookup_field_vals     Struct which holds lookup values 
 
1746
  @param[in, out] lookup_field_vals     Struct which holds lookup values
1747
1747
 
1748
1748
  @return
1749
1749
    0             success
1751
1751
*/
1752
1752
 
1753
1753
bool get_lookup_value(Session *session, Item_func *item_func,
1754
 
                      TableList *table, 
 
1754
                      TableList *table,
1755
1755
                      LOOKUP_FIELD_VALUES *lookup_field_vals)
1756
1756
{
1757
1757
  ST_SCHEMA_TABLE *schema_table= table->schema_table;
1817
1817
 
1818
1818
 
1819
1819
/**
1820
 
  @brief    Calculates lookup values from 'WHERE' condition 
 
1820
  @brief    Calculates lookup values from 'WHERE' condition
1821
1821
 
1822
1822
  @details This function calculates lookup value(database name, table name)
1823
 
           from 'WHERE' condition if it's possible and 
 
1823
           from 'WHERE' condition if it's possible and
1824
1824
           fill lookup_field_vals struct fields with these values.
1825
1825
 
1826
1826
  @param[in]      session                   thread handler
1827
1827
  @param[in]      cond                  WHERE condition
1828
1828
  @param[in]      table                 I_S table
1829
 
  @param[in, out] lookup_field_vals     Struct which holds lookup values 
 
1829
  @param[in, out] lookup_field_vals     Struct which holds lookup values
1830
1830
 
1831
1831
  @return
1832
1832
    0             success
1975
1975
  @param[in]      session                   thread handler
1976
1976
  @param[in]      cond                  WHERE condition
1977
1977
  @param[in]      tables                I_S table
1978
 
  @param[in, out] lookup_field_values   Struct which holds lookup values 
 
1978
  @param[in, out] lookup_field_values   Struct which holds lookup values
1979
1979
 
1980
1980
  @return
1981
1981
    0             success
2035
2035
    idx_field_vals        idx_field_vals->db_name contains db name or
2036
2036
                          wild string
2037
2037
    with_i_schema         returns 1 if we added 'IS' name to list
2038
 
                          otherwise returns 0 
 
2038
                          otherwise returns 0
2039
2039
 
2040
2040
  RETURN
2041
2041
    zero                  success
2059
2059
      LIKE clause (see also get_index_field_values() function)
2060
2060
    */
2061
2061
    if (!lookup_field_vals->db_value.str ||
2062
 
        !wild_case_compare(system_charset_info, 
 
2062
        !wild_case_compare(system_charset_info,
2063
2063
                           INFORMATION_SCHEMA_NAME.c_str(),
2064
2064
                           lookup_field_vals->db_value.str))
2065
2065
    {
2103
2103
}
2104
2104
 
2105
2105
 
2106
 
struct st_add_schema_table 
 
2106
struct st_add_schema_table
2107
2107
{
2108
2108
  List<LEX_STRING> *files;
2109
2109
  const char *wild;
2165
2165
      else if (wild_compare(tmp_schema_table->table_name, wild, 0))
2166
2166
        continue;
2167
2167
    }
2168
 
    if ((file_name= 
 
2168
    if ((file_name=
2169
2169
         session->make_lex_string(file_name, tmp_schema_table->table_name,
2170
2170
                              strlen(tmp_schema_table->table_name), true)) &&
2171
2171
        !files->push_back(file_name))
2221
2221
      }
2222
2222
    }
2223
2223
    else
2224
 
    {    
 
2224
    {
2225
2225
      if (table_names->push_back(&lookup_field_vals->table_value))
2226
2226
        return 1;
2227
2227
    }
2275
2275
    @retval       1           error
2276
2276
*/
2277
2277
 
2278
 
static int 
 
2278
static int
2279
2279
fill_schema_show_cols_or_idxs(Session *session, TableList *tables,
2280
2280
                              ST_SCHEMA_TABLE *schema_table,
2281
2281
                              Open_tables_state *open_tables_state_backup)
2301
2301
    Let us set fake sql_command so views won't try to merge
2302
2302
    themselves into main statement. If we don't do this,
2303
2303
    SELECT * from information_schema.xxxx will cause problems.
2304
 
    SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()' 
 
2304
    SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
2305
2305
  */
2306
2306
  lex->sql_command= SQLCOM_SHOW_FIELDS;
2307
2307
  res= open_normal_and_derived_tables(session, show_table_list,
2311
2311
    get_all_tables() returns 1 on failure and 0 on success thus
2312
2312
    return only these and not the result code of ::process_table()
2313
2313
 
2314
 
    We should use show_table_list->alias instead of 
 
2314
    We should use show_table_list->alias instead of
2315
2315
    show_table_list->table_name because table_name
2316
2316
    could be changed during opening of I_S tables. It's safe
2317
 
    to use alias because alias contains original table name 
2318
 
    in this case(this part of code is used only for 
 
2317
    to use alias because alias contains original table name
 
2318
    in this case(this part of code is used only for
2319
2319
    'show columns' & 'show statistics' commands).
2320
2320
  */
2321
2321
   table_name= session->make_lex_string(&tmp_lex_string1, show_table_list->alias,
2322
2322
                                    strlen(show_table_list->alias), false);
2323
2323
   db_name= session->make_lex_string(&tmp_lex_string, show_table_list->db,
2324
2324
                                 show_table_list->db_length, false);
2325
 
      
 
2325
 
2326
2326
 
2327
2327
   error= test(schema_table->process_table(session, show_table_list,
2328
2328
                                           table, res, db_name,
2359
2359
  else
2360
2360
  {
2361
2361
    char path[FN_REFLEN];
2362
 
    (void) build_table_filename(path, sizeof(path), db_name->str, 
 
2362
    (void) build_table_filename(path, sizeof(path), db_name->str,
2363
2363
                                table_name->str, reg_ext, 0);
2364
2364
 
2365
2365
      table->field[3]->store(STRING_WITH_LEN("BASE Table"),
2517
2517
  List<LEX_STRING> db_names;
2518
2518
  List_iterator_fast<LEX_STRING> it(db_names);
2519
2519
  COND *partial_cond= 0;
2520
 
  uint32_t derived_tables= lex->derived_tables; 
 
2520
  uint32_t derived_tables= lex->derived_tables;
2521
2521
  int error= 1;
2522
2522
  Open_tables_state open_tables_state_backup;
2523
2523
  Query_tables_list query_tables_list_backup;
2534
2534
  schema_table_idx= get_schema_table_idx(schema_table);
2535
2535
  tables->table_open_method= table_open_method=
2536
2536
    get_table_open_method(tables, schema_table, schema_table_idx);
2537
 
  /* 
 
2537
  /*
2538
2538
    this branch processes SHOW FIELDS, SHOW INDEXES commands.
2539
2539
    see sql_parse.cc, prepare_schema_table() function where
2540
2540
    this values are initialized
2554
2554
 
2555
2555
  if (!lookup_field_vals.wild_db_value && !lookup_field_vals.wild_table_value)
2556
2556
  {
2557
 
    /* 
 
2557
    /*
2558
2558
      if lookup value is empty string then
2559
2559
      it's impossible table name or db name
2560
2560
    */
2570
2570
      !lookup_field_vals.wild_db_value)
2571
2571
    tables->has_db_lookup_value= true;
2572
2572
  if (lookup_field_vals.table_value.length &&
2573
 
      !lookup_field_vals.wild_table_value) 
 
2573
      !lookup_field_vals.wild_table_value)
2574
2574
    tables->has_table_lookup_value= true;
2575
2575
 
2576
2576
  if (tables->has_db_lookup_value && tables->has_table_lookup_value)
2614
2614
        {
2615
2615
          /*
2616
2616
            If table is I_S.tables and open_table_method is 0 (eg SKIP_OPEN)
2617
 
            we can skip table opening and we don't have lookup value for 
 
2617
            we can skip table opening and we don't have lookup value for
2618
2618
            table name or lookup value is wild string(table name list is
2619
2619
            already created by make_table_name_list() function).
2620
2620
          */
2690
2690
            else
2691
2691
            {
2692
2692
              /*
2693
 
                We should use show_table_list->alias instead of 
 
2693
                We should use show_table_list->alias instead of
2694
2694
                show_table_list->table_name because table_name
2695
2695
                could be changed during opening of I_S tables. It's safe
2696
 
                to use alias because alias contains original table name 
 
2696
                to use alias because alias contains original table name
2697
2697
                in this case.
2698
2698
              */
2699
2699
              session->make_lex_string(&tmp_lex_string, show_table_list->alias,
2877
2877
    if (share->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
2878
2878
      ptr=my_stpcpy(ptr," delay_key_write=1");
2879
2879
    if (share->row_type != ROW_TYPE_DEFAULT)
2880
 
      ptr=strxmov(ptr, " row_format=", 
 
2880
      ptr=strxmov(ptr, " row_format=",
2881
2881
                  ha_row_type[(uint) share->row_type],
2882
2882
                  NULL);
2883
2883
    if (share->block_size)
2885
2885
      ptr= my_stpcpy(ptr, " block_size=");
2886
2886
      ptr= int64_t10_to_str(share->block_size, ptr, 10);
2887
2887
    }
2888
 
    
 
2888
 
2889
2889
    if (share->transactional != HA_CHOICE_UNDEF)
2890
2890
    {
2891
2891
      ptr= strxmov(ptr, " TRANSACTIONAL=",
2896
2896
      ptr= strxmov(ptr, " transactional=",
2897
2897
                   ha_choice_values[(uint) share->transactional], NULL);
2898
2898
    table->field[19]->store(option_buff+1,
2899
 
                            (ptr == option_buff ? 0 : 
 
2899
                            (ptr == option_buff ? 0 :
2900
2900
                             (uint) (ptr-option_buff)-1), cs);
2901
2901
 
2902
2902
    tmp_buff= (share->table_charset ?
2999
2999
  @param[in]      cs                I_S table charset
3000
3000
  @param[in]      offset            offset from beginning of table
3001
3001
                                    to DATE_TYPE column in I_S table
3002
 
                                    
 
3002
 
3003
3003
  @return         void
3004
3004
*/
3005
3005
 
3028
3028
    uint32_t octet_max_length= field->max_display_length();
3029
3029
    if (is_blob && octet_max_length != (uint32_t) 4294967295U)
3030
3030
      octet_max_length /= field->charset()->mbmaxlen;
3031
 
    int64_t char_max_len= is_blob ? 
 
3031
    int64_t char_max_len= is_blob ?
3032
3032
      (int64_t) octet_max_length / field->charset()->mbminlen :
3033
3033
      (int64_t) octet_max_length / field->charset()->mbmaxlen;
3034
3034
    /* CHARACTER_MAXIMUM_LENGTH column*/
3109
3109
      /*
3110
3110
        I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
3111
3111
        rather than in SHOW COLUMNS
3112
 
      */ 
 
3112
      */
3113
3113
      if (session->is_error())
3114
3114
        push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
3115
3115
                     session->main_da.sql_errno(), session->main_da.message());
3233
3233
  for (cs= all_charsets ; cs < all_charsets+255 ; cs++)
3234
3234
  {
3235
3235
    const CHARSET_INFO * const tmp_cs= cs[0];
3236
 
    if (tmp_cs && (tmp_cs->state & MY_CS_PRIMARY) && 
 
3236
    if (tmp_cs && (tmp_cs->state & MY_CS_PRIMARY) &&
3237
3237
        (tmp_cs->state & MY_CS_AVAILABLE) &&
3238
3238
        !(tmp_cs->state & MY_CS_HIDDEN) &&
3239
3239
        !(wild && wild[0] &&
3271
3271
    for (cl= all_charsets; cl < all_charsets+255 ;cl ++)
3272
3272
    {
3273
3273
      const CHARSET_INFO *tmp_cl= cl[0];
3274
 
      if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) || 
 
3274
      if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
3275
3275
          !my_charset_same(tmp_cs, tmp_cl))
3276
3276
        continue;
3277
3277
      if (!(wild && wild[0] &&
3305
3305
  {
3306
3306
    CHARSET_INFO **cl;
3307
3307
    const CHARSET_INFO *tmp_cs= cs[0];
3308
 
    if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) || 
 
3308
    if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
3309
3309
        !(tmp_cs->state & MY_CS_PRIMARY))
3310
3310
      continue;
3311
3311
    for (cl= all_charsets; cl < all_charsets+255 ;cl ++)
3312
3312
    {
3313
3313
      const CHARSET_INFO *tmp_cl= cl[0];
3314
 
      if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) || 
 
3314
      if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
3315
3315
          !my_charset_same(tmp_cs,tmp_cl))
3316
3316
        continue;
3317
3317
      restore_record(table, s->default_values);
3408
3408
        else
3409
3409
          table->field[14]->store("", 0, cs);
3410
3410
        table->field[14]->set_notnull();
3411
 
        assert(test(key_info->flags & HA_USES_COMMENT) == 
 
3411
        assert(test(key_info->flags & HA_USES_COMMENT) ==
3412
3412
                   (key_info->comment.length > 0));
3413
3413
        if (key_info->flags & HA_USES_COMMENT)
3414
 
          table->field[15]->store(key_info->comment.str, 
 
3414
          table->field[15]->store(key_info->comment.str,
3415
3415
                                  key_info->comment.length, cs);
3416
3416
        if (schema_table_store_record(session, table))
3417
3417
          return(1);
3456
3456
    Table *show_table= tables->table;
3457
3457
    KEY *key_info=show_table->key_info;
3458
3458
    uint32_t primary_key= show_table->s->primary_key;
3459
 
    show_table->file->info(HA_STATUS_VARIABLE | 
 
3459
    show_table->file->info(HA_STATUS_VARIABLE |
3460
3460
                           HA_STATUS_NO_LOCK |
3461
3461
                           HA_STATUS_TIME);
3462
3462
    for (uint32_t i=0 ; i < show_table->s->keys ; i++, key_info++)
3485
3485
    List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
3486
3486
    while ((f_key_info=it++))
3487
3487
    {
3488
 
      if (store_constraints(session, table, db_name, table_name, 
 
3488
      if (store_constraints(session, table, db_name, table_name,
3489
3489
                            f_key_info->forein_id->str,
3490
3490
                            strlen(f_key_info->forein_id->str),
3491
3491
                            "FOREIGN KEY", 11))
3531
3531
    Table *show_table= tables->table;
3532
3532
    KEY *key_info=show_table->key_info;
3533
3533
    uint32_t primary_key= show_table->s->primary_key;
3534
 
    show_table->file->info(HA_STATUS_VARIABLE | 
 
3534
    show_table->file->info(HA_STATUS_VARIABLE |
3535
3535
                           HA_STATUS_NO_LOCK |
3536
3536
                           HA_STATUS_TIME);
3537
3537
    for (uint32_t i=0 ; i < show_table->s->keys ; i++, key_info++)
3548
3548
          restore_record(table, s->default_values);
3549
3549
          store_key_column_usage(table, db_name, table_name,
3550
3550
                                 key_info->name,
3551
 
                                 strlen(key_info->name), 
3552
 
                                 key_part->field->field_name, 
 
3551
                                 strlen(key_info->name),
 
3552
                                 key_part->field->field_name,
3553
3553
                                 strlen(key_part->field->field_name),
3554
3554
                                 (int64_t) f_idx);
3555
3555
          if (schema_table_store_record(session, table))
3585
3585
                               system_charset_info);
3586
3586
        table->field[9]->set_notnull();
3587
3587
        table->field[10]->store(f_key_info->referenced_table->str,
3588
 
                                f_key_info->referenced_table->length, 
 
3588
                                f_key_info->referenced_table->length,
3589
3589
                                system_charset_info);
3590
3590
        table->field[10]->set_notnull();
3591
3591
        table->field[11]->store(r_info->str, r_info->length,
3672
3672
    tmp1= &tmp;
3673
3673
  }
3674
3674
  else
3675
 
  { 
 
3675
  {
3676
3676
    option_type= OPT_SESSION;
3677
3677
    tmp1= &session->status_var;
3678
3678
  }
3726
3726
  {
3727
3727
    List<FOREIGN_KEY_INFO> f_key_list;
3728
3728
    Table *show_table= tables->table;
3729
 
    show_table->file->info(HA_STATUS_VARIABLE | 
 
3729
    show_table->file->info(HA_STATUS_VARIABLE |
3730
3730
                           HA_STATUS_NO_LOCK |
3731
3731
                           HA_STATUS_TIME);
3732
3732
 
3740
3740
      table->field[9]->store(table_name->str, table_name->length, cs);
3741
3741
      table->field[2]->store(f_key_info->forein_id->str,
3742
3742
                             f_key_info->forein_id->length, cs);
3743
 
      table->field[4]->store(f_key_info->referenced_db->str, 
 
3743
      table->field[4]->store(f_key_info->referenced_db->str,
3744
3744
                             f_key_info->referenced_db->length, cs);
3745
 
      table->field[10]->store(f_key_info->referenced_table->str, 
 
3745
      table->field[10]->store(f_key_info->referenced_table->str,
3746
3746
                             f_key_info->referenced_table->length, cs);
3747
3747
      if (f_key_info->referenced_key_name)
3748
3748
      {
3749
 
        table->field[5]->store(f_key_info->referenced_key_name->str, 
 
3749
        table->field[5]->store(f_key_info->referenced_key_name->str,
3750
3750
                               f_key_info->referenced_key_name->length, cs);
3751
3751
        table->field[5]->set_notnull();
3752
3752
      }
3753
3753
      else
3754
3754
        table->field[5]->set_null();
3755
3755
      table->field[6]->store(STRING_WITH_LEN("NONE"), cs);
3756
 
      table->field[7]->store(f_key_info->update_method->str, 
 
3756
      table->field[7]->store(f_key_info->update_method->str,
3757
3757
                             f_key_info->update_method->length, cs);
3758
 
      table->field[8]->store(f_key_info->delete_method->str, 
 
3758
      table->field[8]->store(f_key_info->delete_method->str,
3759
3759
                             f_key_info->delete_method->length, cs);
3760
3760
      if (schema_table_store_record(session, table))
3761
3761
        return(1);
3765
3765
}
3766
3766
 
3767
3767
 
3768
 
struct schema_table_ref 
 
3768
struct schema_table_ref
3769
3769
{
3770
3770
  const char *table_name;
3771
3771
  ST_SCHEMA_TABLE *schema_table;
3830
3830
  }
3831
3831
 
3832
3832
  schema_table_a.table_name= table_name;
3833
 
  if (plugin_foreach(session, find_schema_table_in_plugin, 
 
3833
  if (plugin_foreach(session, find_schema_table_in_plugin,
3834
3834
                     DRIZZLE_INFORMATION_SCHEMA_PLUGIN, &schema_table_a))
3835
3835
    return(schema_table_a.schema_table);
3836
3836
 
3894
3894
      }
3895
3895
      break;
3896
3896
    case DRIZZLE_TYPE_DOUBLE:
3897
 
      if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC, 
 
3897
      if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC,
3898
3898
                           fields_info->field_length)) == NULL)
3899
3899
        return(NULL);
3900
3900
      break;
3941
3941
  tmp_table_param->schema_table= 1;
3942
3942
  SELECT_LEX *select_lex= session->lex->current_select;
3943
3943
  if (!(table= create_tmp_table(session, tmp_table_param,
3944
 
                                field_list, (order_st*) 0, 0, 0, 
 
3944
                                field_list, (order_st*) 0, 0, 0,
3945
3945
                                (select_lex->options | session->options |
3946
3946
                                 TMP_TABLE_ALL_COLUMNS),
3947
3947
                                HA_POS_ERROR, table_list->alias)))
4343
4343
  {"ROW_FORMAT", 10, DRIZZLE_TYPE_VARCHAR, 0, 1, "Row_format", OPEN_FULL_TABLE},
4344
4344
  {"TABLE_ROWS", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4345
4345
   (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Rows", OPEN_FULL_TABLE},
4346
 
  {"AVG_ROW_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0, 
 
4346
  {"AVG_ROW_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4347
4347
   (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Avg_row_length", OPEN_FULL_TABLE},
4348
 
  {"DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0, 
 
4348
  {"DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4349
4349
   (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_length", OPEN_FULL_TABLE},
4350
4350
  {"MAX_DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4351
4351
   (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_data_length", OPEN_FULL_TABLE},
4352
 
  {"INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0, 
 
4352
  {"INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4353
4353
   (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Index_length", OPEN_FULL_TABLE},
4354
4354
  {"DATA_FREE", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4355
4355
   (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_free", OPEN_FULL_TABLE},
4356
 
  {"AUTO_INCREMENT", MY_INT64_NUM_DECIMAL_DIGITS , DRIZZLE_TYPE_LONGLONG, 0, 
 
4356
  {"AUTO_INCREMENT", MY_INT64_NUM_DECIMAL_DIGITS , DRIZZLE_TYPE_LONGLONG, 0,
4357
4357
   (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Auto_increment", OPEN_FULL_TABLE},
4358
4358
  {"CREATE_TIME", 0, DRIZZLE_TYPE_DATETIME, 0, 1, "Create_time", OPEN_FULL_TABLE},
4359
4359
  {"UPDATE_TIME", 0, DRIZZLE_TYPE_DATETIME, 0, 1, "Update_time", OPEN_FULL_TABLE},
4552
4552
 
4553
4553
ST_FIELD_INFO plugin_fields_info[]=
4554
4554
{
4555
 
  {"PLUGIN_NAME", NAME_CHAR_LEN, DRIZZLE_TYPE_VARCHAR, 0, 0, "Name", 
 
4555
  {"PLUGIN_NAME", NAME_CHAR_LEN, DRIZZLE_TYPE_VARCHAR, 0, 0, "Name",
4556
4556
   SKIP_OPEN_TABLE},
4557
4557
  {"PLUGIN_VERSION", 20, DRIZZLE_TYPE_VARCHAR, 0, 0, 0, SKIP_OPEN_TABLE},
4558
4558
  {"PLUGIN_STATUS", 10, DRIZZLE_TYPE_VARCHAR, 0, 0, "Status", SKIP_OPEN_TABLE},
4597
4597
 
4598
4598
ST_SCHEMA_TABLE schema_tables[]=
4599
4599
{
4600
 
  {"CHARACTER_SETS", charsets_fields_info, create_schema_table, 
 
4600
  {"CHARACTER_SETS", charsets_fields_info, create_schema_table,
4601
4601
   fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
4602
 
  {"COLLATIONS", collation_fields_info, create_schema_table, 
 
4602
  {"COLLATIONS", collation_fields_info, create_schema_table,
4603
4603
   fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
4604
4604
  {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
4605
4605
   create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0, 0},
4606
 
  {"COLUMNS", columns_fields_info, create_schema_table, 
 
4606
  {"COLUMNS", columns_fields_info, create_schema_table,
4607
4607
   get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0,
4608
4608
   OPTIMIZE_I_S_TABLE},
4609
4609
  {"GLOBAL_STATUS", variables_fields_info, create_schema_table,
4628
4628
   fill_status, make_old_format, 0, -1, -1, 0, 0},
4629
4629
  {"SESSION_VARIABLES", variables_fields_info, create_schema_table,
4630
4630
   fill_variables, make_old_format, 0, -1, -1, 0, 0},
4631
 
  {"STATISTICS", stat_fields_info, create_schema_table, 
 
4631
  {"STATISTICS", stat_fields_info, create_schema_table,
4632
4632
   get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0,
4633
4633
   OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE},
4634
 
  {"STATUS", variables_fields_info, create_schema_table, fill_status, 
 
4634
  {"STATUS", variables_fields_info, create_schema_table, fill_status,
4635
4635
   make_old_format, 0, -1, -1, 1, 0},
4636
 
  {"TABLES", tables_fields_info, create_schema_table, 
 
4636
  {"TABLES", tables_fields_info, create_schema_table,
4637
4637
   get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0,
4638
4638
   OPTIMIZE_I_S_TABLE},
4639
4639
  {"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table,
4665
4665
  {
4666
4666
    schema_table->create_table= create_schema_table;
4667
4667
    schema_table->old_format= make_old_format;
4668
 
    schema_table->idx_field1= -1, 
4669
 
    schema_table->idx_field2= -1; 
 
4668
    schema_table->idx_field1= -1,
 
4669
    schema_table->idx_field2= -1;
4670
4670
 
4671
4671
    /* Make the name available to the init() function. */
4672
4672
    schema_table->table_name= plugin->name.str;
4677
4677
                      plugin->name.str);
4678
4678
      goto err;
4679
4679
    }
4680
 
    
 
4680
 
4681
4681
    /* Make sure the plugin name is not set inside the init() function. */
4682
4682
    schema_table->table_name= plugin->name.str;
4683
4683
  }