~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: Nathan Williams
  • Date: 2009-06-13 21:21:13 UTC
  • mfrom: (1062 staging)
  • mto: This revision was merged to the branch mainline in revision 1063.
  • Revision ID: nathanlws@gmail.com-20090613212113-liz01ojh1wxutgqx
Merged trunk and resolved conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
347
347
  String buffer(buff, sizeof(buff), system_charset_info);
348
348
 
349
349
  /* Only one table for now, but VIEW can involve several tables */
350
 
  if (open_normal_and_derived_tables(session, table_list, 0))
 
350
  if (session->open_normal_and_derived_tables(table_list, 0))
351
351
  {
352
352
    if (session->is_error())
353
353
      return true;
382
382
  protocol->prepareForResend();
383
383
  {
384
384
    if (table_list->schema_table)
385
 
      protocol->store(table_list->schema_table->table_name,
386
 
                      system_charset_info);
 
385
      protocol->store(table_list->schema_table->table_name);
387
386
    else
388
 
      protocol->store(table_list->table->alias, system_charset_info);
 
387
      protocol->store(table_list->table->alias);
389
388
  }
390
389
 
391
 
  protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
 
390
  protocol->store(buffer.ptr(), buffer.length());
392
391
 
393
392
  if (protocol->write())
394
393
    return true;
423
422
    return true;
424
423
 
425
424
  protocol->prepareForResend();
426
 
  protocol->store(dbname, strlen(dbname), system_charset_info);
427
 
  protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
 
425
  protocol->store(dbname, strlen(dbname));
 
426
  protocol->store(buffer.ptr(), buffer.length());
428
427
 
429
428
  if (protocol->write())
430
429
    return true;
444
443
{
445
444
  Table *table;
446
445
 
447
 
  if (open_normal_and_derived_tables(session, table_list, 0))
 
446
  if (session->open_normal_and_derived_tables(table_list, 0))
448
447
    return;
449
448
  table= table_list->table;
450
449
 
1068
1067
  {
1069
1068
    protocol->prepareForResend();
1070
1069
    protocol->store((uint64_t) session_info->thread_id);
1071
 
    protocol->store(session_info->user, system_charset_info);
1072
 
    protocol->store(session_info->host, system_charset_info);
1073
 
    protocol->store(session_info->db, system_charset_info);
1074
 
    protocol->store(session_info->proc_info, system_charset_info);
 
1070
    protocol->store(session_info->user);
 
1071
    protocol->store(session_info->host);
 
1072
    protocol->store(session_info->db);
 
1073
    protocol->store(session_info->proc_info);
1075
1074
 
1076
1075
    if (session_info->start_time)
1077
1076
      protocol->store((uint32_t) (now - session_info->start_time));
1078
1077
    else
1079
1078
      protocol->store();
1080
1079
 
1081
 
    protocol->store(session_info->state_info, system_charset_info);
1082
 
    protocol->store(session_info->query, system_charset_info);
 
1080
    protocol->store(session_info->state_info);
 
1081
    protocol->store(session_info->query);
1083
1082
 
1084
1083
    if (protocol->write())
1085
1084
      break; /* purecov: inspected */
2158
2157
    SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
2159
2158
  */
2160
2159
  lex->sql_command= SQLCOM_SHOW_FIELDS;
2161
 
  res= open_normal_and_derived_tables(session, show_table_list,
2162
 
                                      DRIZZLE_LOCK_IGNORE_FLUSH);
 
2160
  res= session->open_normal_and_derived_tables(show_table_list, DRIZZLE_LOCK_IGNORE_FLUSH);
2163
2161
  lex->sql_command= save_sql_command;
2164
2162
  /*
2165
2163
    get_all_tables() returns 1 on failure and 0 on success thus
2309
2307
  table_list.table_name= table_name->str;
2310
2308
  table_list.db= db_name->str;
2311
2309
 
2312
 
  key_length= create_table_def_key(key, &table_list);
 
2310
  key_length= table_list.create_table_def_key(key);
2313
2311
  pthread_mutex_lock(&LOCK_open); /* Locking to get table share when filling schema table from FRM */
2314
2312
  share= get_table_share(session, &table_list, key,
2315
2313
                         key_length, 0, &error);
2517
2515
            lex->sql_command= SQLCOM_SHOW_FIELDS;
2518
2516
            show_table_list->i_s_requested_object=
2519
2517
              schema_table->i_s_requested_object;
2520
 
            res= open_normal_and_derived_tables(session, show_table_list,
2521
 
                                                DRIZZLE_LOCK_IGNORE_FLUSH);
 
2518
            res= session->open_normal_and_derived_tables(show_table_list, DRIZZLE_LOCK_IGNORE_FLUSH);
2522
2519
            lex->sql_command= save_sql_command;
2523
2520
            /*
2524
 
XXX:  show_table_list has a flag i_is_requested,
2525
 
and when it's set, open_normal_and_derived_tables()
2526
 
can return an error without setting an error message
2527
 
in Session, which is a hack. This is why we have to
2528
 
check for res, then for session->is_error() only then
2529
 
for session->main_da.sql_errno().
 
2521
              XXX->  show_table_list has a flag i_is_requested,
 
2522
              and when it's set, open_normal_and_derived_tables()
 
2523
              can return an error without setting an error message
 
2524
              in Session, which is a hack. This is why we have to
 
2525
              check for res, then for session->is_error() only then
 
2526
              for session->main_da.sql_errno().
2530
2527
            */
2531
2528
            if (res && session->is_error() &&
2532
2529
                session->main_da.sql_errno() == ER_NO_SUCH_TABLE)