~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to sql/sql_show.cc

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.0.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
287
287
  {"Alter", "Tables",  "To alter the table"},
288
288
  {"Alter routine", "Functions,Procedures",  "To alter or drop stored functions/procedures"},
289
289
  {"Create", "Databases,Tables,Indexes",  "To create new databases and tables"},
290
 
  {"Create routine","Functions,Procedures","To use CREATE FUNCTION/PROCEDURE"},
 
290
  {"Create routine","Databases","To use CREATE FUNCTION/PROCEDURE"},
291
291
  {"Create temporary tables","Databases","To use CREATE TEMPORARY TABLE"},
292
292
  {"Create view", "Tables",  "To create new views"},
293
293
  {"Create user", "Server Admin",  "To create new users"},
468
468
#ifndef NO_EMBEDDED_ACCESS_CHECKS
469
469
  uint col_access=thd->col_access;
470
470
#endif
 
471
  uint wild_length= 0;
471
472
  TABLE_LIST table_list;
472
473
  DBUG_ENTER("find_files");
473
474
 
474
 
  if (wild && !wild[0])
475
 
    wild=0;
 
475
  if (wild)
 
476
  {
 
477
    if (!wild[0])
 
478
      wild= 0;
 
479
    else
 
480
      wild_length= strlen(wild);
 
481
  }
 
482
 
476
483
 
477
484
 
478
485
  bzero((char*) &table_list,sizeof(table_list));
537
544
      {
538
545
        if (lower_case_table_names)
539
546
        {
540
 
          if (wild_case_compare(files_charset_info, uname, wild))
541
 
            continue;
 
547
          if (my_wildcmp(files_charset_info,
 
548
                         uname, uname + file_name_len,
 
549
                         wild, wild + wild_length,
 
550
                         wild_prefix, wild_one,wild_many))
 
551
            continue;
542
552
        }
543
553
        else if (wild_compare(uname, wild, 0))
544
554
          continue;
1588
1598
int
1589
1599
view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
1590
1600
{
 
1601
  my_bool compact_view_name= TRUE;
1591
1602
  my_bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
1592
1603
                                                       MODE_ORACLE |
1593
1604
                                                       MODE_MSSQL |
1594
1605
                                                       MODE_DB2 |
1595
1606
                                                       MODE_MAXDB |
1596
1607
                                                       MODE_ANSI)) != 0;
1597
 
  /*
1598
 
     Compact output format for view can be used
1599
 
     - if user has db of this view as current db
1600
 
     - if this view only references table inside it's own db
1601
 
  */
 
1608
 
1602
1609
  if (!thd->db || strcmp(thd->db, table->view_db.str))
1603
 
    table->compact_view_format= FALSE;
 
1610
    /*
 
1611
      print compact view name if the view belongs to the current database
 
1612
    */
 
1613
    compact_view_name= table->compact_view_format= FALSE;
1604
1614
  else
1605
1615
  {
 
1616
    /*
 
1617
      Compact output format for view body can be used
 
1618
      if this view only references table inside it's own db
 
1619
    */
1606
1620
    TABLE_LIST *tbl;
1607
1621
    table->compact_view_format= TRUE;
1608
1622
    for (tbl= thd->lex->query_tables;
1623
1637
    view_store_options(thd, table, buff);
1624
1638
  }
1625
1639
  buff->append(STRING_WITH_LEN("VIEW "));
1626
 
  if (!table->compact_view_format)
 
1640
  if (!compact_view_name)
1627
1641
  {
1628
1642
    append_identifier(thd, buff, table->view_db.str, table->view_db.length);
1629
1643
    buff->append('.');
1690
1704
  field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
1691
1705
  field->maybe_null=1;
1692
1706
  field_list.push_back(new Item_empty_string("Command",16));
1693
 
  field_list.push_back(new Item_return_int("Time",7, MYSQL_TYPE_LONG));
 
1707
  field_list.push_back(field= new Item_return_int("Time",7, MYSQL_TYPE_LONG));
 
1708
  field->unsigned_flag= 0;
1694
1709
  field_list.push_back(field=new Item_empty_string("State",30));
1695
1710
  field->maybe_null=1;
1696
1711
  field_list.push_back(field=new Item_empty_string("Info",max_query_length));
1783
1798
    else
1784
1799
      protocol->store(command_name[thd_info->command].str, system_charset_info);
1785
1800
    if (thd_info->start_time)
1786
 
      protocol->store((uint32) (now - thd_info->start_time));
 
1801
      protocol->store_long ((longlong) (now - thd_info->start_time));
1787
1802
    else
1788
1803
      protocol->store_null();
1789
1804
    protocol->store(thd_info->state_info, system_charset_info);
1858
1873
        table->field[4]->store(command_name[tmp->command].str,
1859
1874
                               command_name[tmp->command].length, cs);
1860
1875
      /* MYSQL_TIME */
1861
 
      table->field[5]->store((uint32)(tmp->start_time ?
1862
 
                                      now - tmp->start_time : 0), TRUE);
 
1876
      table->field[5]->store((longlong)(tmp->start_time ?
 
1877
                                      now - tmp->start_time : 0), FALSE);
1863
1878
      /* STATE */
1864
1879
#ifndef EMBEDDED_LIBRARY
1865
1880
      val= (char*) (tmp->locked ? "Locked" :
3782
3797
                           cs);
3783
3798
    table->field[4]->store((longlong) count, TRUE);
3784
3799
    field->sql_type(type);
3785
 
    table->field[14]->store(type.ptr(), type.length(), cs);             
 
3800
    table->field[14]->store(type.ptr(), type.length(), cs);
 
3801
    /*
 
3802
      MySQL column type has the following format:
 
3803
      base_type [(dimension)] [unsigned] [zerofill].
 
3804
      For DATA_TYPE column we extract only base type.
 
3805
    */
3786
3806
    tmp_buff= strchr(type.ptr(), '(');
 
3807
    if (!tmp_buff)
 
3808
      /*
 
3809
        if there is no dimention part then check the presence of
 
3810
        [unsigned] [zerofill] attributes and cut them of if exist.
 
3811
      */
 
3812
      tmp_buff= strchr(type.ptr(), ' ');
3787
3813
    table->field[7]->store(type.ptr(),
3788
3814
                           (tmp_buff ? tmp_buff - type.ptr() :
3789
3815
                            type.length()), cs);
6533
6559
   SKIP_OPEN_TABLE},
6534
6560
  {"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN_TABLE},
6535
6561
  {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", SKIP_OPEN_TABLE},
6536
 
  {"TIME", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Time", SKIP_OPEN_TABLE},
 
6562
  {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", SKIP_OPEN_TABLE},
6537
6563
  {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE},
6538
6564
  {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info",
6539
6565
   SKIP_OPEN_TABLE},