~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
 
22
22
/* Function with list databases, tables or fields */
23
 
#include <config.h>
24
 
 
25
 
#include <drizzled/data_home.h>
26
 
#include <drizzled/error.h>
27
 
#include <drizzled/internal/my_sys.h>
28
 
#include <drizzled/plugin/storage_engine.h>
29
 
#include <drizzled/session.h>
30
 
#include <drizzled/show.h>
31
 
#include <drizzled/sql_select.h>
32
 
#include <drizzled/statement/show.h>
33
 
#include <drizzled/statement/show_errors.h>
34
 
#include <drizzled/statement/show_warnings.h>
35
 
#include <drizzled/sql_lex.h>
36
 
#include <drizzled/table_ident.h>
 
23
#include "config.h"
 
24
 
 
25
#include "drizzled/data_home.h"
 
26
#include "drizzled/error.h"
 
27
#include "drizzled/internal/my_sys.h"
 
28
#include "drizzled/plugin/storage_engine.h"
 
29
#include "drizzled/session.h"
 
30
#include "drizzled/show.h"
 
31
#include "drizzled/sql_select.h"
 
32
 
 
33
#include "drizzled/statement/show.h"
 
34
#include "drizzled/statement/show_errors.h"
 
35
#include "drizzled/statement/show_warnings.h"
 
36
 
37
37
 
38
38
#include <sys/stat.h>
39
39
 
56
56
 
57
57
int wild_case_compare(const charset_info_st * const cs, const char *str, const char *wildstr)
58
58
{
59
 
  int flag;
 
59
  register int flag;
60
60
 
61
61
  while (*wildstr)
62
62
  {
64
64
    {
65
65
      if (*wildstr == internal::wild_prefix && wildstr[1])
66
66
        wildstr++;
67
 
 
68
67
      if (my_toupper(cs, *wildstr++) != my_toupper(cs, *str++))
69
68
        return (1);
70
69
    }
71
 
 
72
70
    if (! *wildstr )
73
71
      return (*str != 0);
74
 
 
75
72
    if (*wildstr++ == internal::wild_one)
76
73
    {
77
74
      if (! *str++)
81
78
    {                                           /* Found '*' */
82
79
      if (! *wildstr)
83
80
        return (0);             /* '*' as last char: OK */
84
 
 
85
81
      flag=(*wildstr != internal::wild_many && *wildstr != internal::wild_one);
86
82
      do
87
83
      {
90
86
          char cmp;
91
87
          if ((cmp= *wildstr) == internal::wild_prefix && wildstr[1])
92
88
            cmp= wildstr[1];
93
 
 
94
89
          cmp= my_toupper(cs, cmp);
95
 
 
96
90
          while (*str && my_toupper(cs, *str) != cmp)
97
91
            str++;
98
 
 
99
92
          if (! *str)
100
93
            return (1);
101
94
        }
102
 
 
103
95
        if (wild_case_compare(cs, str, wildstr) == 0)
104
96
          return (0);
105
 
 
106
97
      } while (*str++);
107
 
 
108
98
      return (1);
109
99
    }
110
100
  }
141
131
 
142
132
bool buildScemas(Session *session)
143
133
{
144
 
  session->lex().sql_command= SQLCOM_SELECT;
145
 
  session->lex().statement= new statement::Show(session);
 
134
  session->getLex()->sql_command= SQLCOM_SELECT;
 
135
  session->getLex()->statement= new statement::Show(session);
146
136
 
147
137
  std::string column_name= "Database";
148
 
  if (session->lex().wild)
 
138
  if (session->getLex()->wild)
149
139
  {
150
140
    column_name.append(" (");
151
 
    column_name.append(session->lex().wild->ptr());
 
141
    column_name.append(session->getLex()->wild->ptr());
152
142
    column_name.append(")");
153
143
  }
154
144
 
155
 
  if (session->lex().current_select->where)
 
145
  if (session->getLex()->current_select->where)
156
146
  {
157
 
    if (prepare_new_schema_table(session, session->lex(), "SCHEMAS"))
 
147
    if (prepare_new_schema_table(session, session->getLex(), "SCHEMAS"))
158
148
      return false;
159
149
  }
160
150
  else
161
151
  {
162
 
    if (prepare_new_schema_table(session, session->lex(), "SHOW_SCHEMAS"))
 
152
    if (prepare_new_schema_table(session, session->getLex(), "SHOW_SCHEMAS"))
163
153
      return false;
164
154
  }
165
155
 
166
 
  Item_field *my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "SCHEMA_NAME");
 
156
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_NAME");
167
157
  my_field->is_autogenerated_name= false;
168
158
  my_field->set_name(column_name.c_str(), column_name.length(), system_charset_info);
169
159
 
178
168
 
179
169
bool buildTables(Session *session, const char *ident)
180
170
{
181
 
  session->lex().sql_command= SQLCOM_SELECT;
 
171
  session->getLex()->sql_command= SQLCOM_SELECT;
182
172
 
183
173
  drizzled::statement::Show *select= new statement::Show(session);
184
 
  session->lex().statement= select;
 
174
  session->getLex()->statement= select;
185
175
 
186
176
  std::string column_name= "Tables_in_";
187
177
 
188
 
  util::string::ptr schema(session->schema());
 
178
  util::string::const_shared_ptr schema(session->schema());
189
179
  if (ident)
190
180
  {
191
181
    identifier::Schema identifier(ident);
192
182
    column_name.append(ident);
193
 
    session->lex().select_lex.db= const_cast<char *>(ident);
 
183
    session->getLex()->select_lex.db= const_cast<char *>(ident);
194
184
    if (not plugin::StorageEngine::doesSchemaExist(identifier))
195
185
    {
196
 
      my_error(ER_BAD_DB_ERROR, identifier);
 
186
      my_error(ER_BAD_DB_ERROR, MYF(0), ident);
197
187
    }
198
188
    select->setShowPredicate(ident, "");
199
189
  }
209
199
  }
210
200
 
211
201
 
212
 
  if (session->lex().wild)
 
202
  if (session->getLex()->wild)
213
203
  {
214
204
    column_name.append(" (");
215
 
    column_name.append(session->lex().wild->ptr());
 
205
    column_name.append(session->getLex()->wild->ptr());
216
206
    column_name.append(")");
217
207
  }
218
208
 
219
 
  if (prepare_new_schema_table(session, session->lex(), "SHOW_TABLES"))
 
209
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_TABLES"))
220
210
    return false;
221
211
 
222
 
  Item_field *my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "TABLE_NAME");
 
212
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
223
213
  my_field->is_autogenerated_name= false;
224
214
  my_field->set_name(column_name.c_str(), column_name.length(), system_charset_info);
225
215
 
234
224
 
235
225
bool buildTemporaryTables(Session *session)
236
226
{
237
 
  session->lex().sql_command= SQLCOM_SELECT;
238
 
 
239
 
  session->lex().statement= new statement::Show(session);
240
 
 
241
 
 
242
 
  if (prepare_new_schema_table(session, session->lex(), "SHOW_TEMPORARY_TABLES"))
243
 
    return false;
244
 
 
245
 
  if (session->add_item_to_list( new Item_field(&session->lex().current_select->context, NULL, NULL, "*")))
246
 
    return false;
247
 
 
248
 
  (session->lex().current_select->with_wild)++;
 
227
  session->getLex()->sql_command= SQLCOM_SELECT;
 
228
 
 
229
  session->getLex()->statement= new statement::Show(session);
 
230
 
 
231
 
 
232
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_TEMPORARY_TABLES"))
 
233
    return false;
 
234
 
 
235
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
 
236
    return false;
 
237
 
 
238
  (session->lex->current_select->with_wild)++;
249
239
 
250
240
  return true;
251
241
}
252
242
 
253
243
bool buildTableStatus(Session *session, const char *ident)
254
244
{
255
 
  session->lex().sql_command= SQLCOM_SELECT;
 
245
  session->getLex()->sql_command= SQLCOM_SELECT;
256
246
  drizzled::statement::Show *select= new statement::Show(session);
257
 
  session->lex().statement= select;
 
247
  session->getLex()->statement= select;
258
248
 
259
249
  std::string column_name= "Tables_in_";
260
250
 
261
 
  util::string::ptr schema(session->schema());
 
251
  util::string::const_shared_ptr schema(session->schema());
262
252
  if (ident)
263
253
  {
264
 
    session->lex().select_lex.db= const_cast<char *>(ident);
 
254
    session->getLex()->select_lex.db= const_cast<char *>(ident);
265
255
 
266
256
    identifier::Schema identifier(ident);
267
257
    if (not plugin::StorageEngine::doesSchemaExist(identifier))
268
258
    {
269
 
      my_error(ER_BAD_DB_ERROR, identifier);
 
259
      my_error(ER_BAD_DB_ERROR, MYF(0), ident);
270
260
    }
271
261
 
272
262
    select->setShowPredicate(ident, "");
281
271
    return false;
282
272
  }
283
273
 
284
 
  if (prepare_new_schema_table(session, session->lex(), "SHOW_TABLE_STATUS"))
285
 
    return false;
286
 
 
287
 
  if (session->add_item_to_list( new Item_field(&session->lex().current_select->context, NULL, NULL, "*")))
288
 
    return false;
289
 
 
290
 
  (session->lex().current_select->with_wild)++;
 
274
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_TABLE_STATUS"))
 
275
    return false;
 
276
 
 
277
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->
 
278
                                                  context,
 
279
                                                  NULL, NULL, "*")))
 
280
    return false;
 
281
 
 
282
  (session->lex->current_select->with_wild)++;
291
283
 
292
284
  return true;
293
285
}
294
286
 
295
287
bool buildEngineStatus(Session *session, LEX_STRING)
296
288
{
297
 
  session->lex().sql_command= SQLCOM_SELECT;
 
289
  session->getLex()->sql_command= SQLCOM_SELECT;
298
290
  drizzled::statement::Show *select= new statement::Show(session);
299
 
  session->lex().statement= select;
 
291
  session->getLex()->statement= select;
300
292
 
301
293
  my_error(ER_USE_DATA_DICTIONARY);
302
294
  return false;
304
296
 
305
297
bool buildColumns(Session *session, const char *schema_ident, Table_ident *table_ident)
306
298
{
307
 
  session->lex().sql_command= SQLCOM_SELECT;
 
299
  session->getLex()->sql_command= SQLCOM_SELECT;
308
300
 
309
301
  drizzled::statement::Show *select= new statement::Show(session);
310
 
  session->lex().statement= select;
 
302
  session->getLex()->statement= select;
311
303
 
312
 
  util::string::ptr schema(session->schema());
 
304
  util::string::const_shared_ptr schema(session->schema());
313
305
  if (schema_ident)
314
306
  {
315
307
    select->setShowPredicate(schema_ident, table_ident->table.str);
336
328
    }
337
329
  }
338
330
 
339
 
  if (prepare_new_schema_table(session, session->lex(), "SHOW_COLUMNS"))
340
 
    return false;
341
 
 
342
 
  if (session->add_item_to_list( new Item_field(&session->lex().current_select->context, NULL, NULL, "*")))
343
 
    return false;
344
 
 
345
 
  (session->lex().current_select->with_wild)++;
 
331
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_COLUMNS"))
 
332
    return false;
 
333
 
 
334
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
 
335
    return false;
 
336
 
 
337
  (session->lex->current_select->with_wild)++;
346
338
 
347
339
  return true;
348
340
}
350
342
void buildSelectWarning(Session *session)
351
343
{
352
344
  (void) create_select_for_variable(session, "warning_count");
353
 
  session->lex().statement= new statement::Show(session);
 
345
  session->getLex()->statement= new statement::Show(session);
354
346
}
355
347
 
356
348
void buildSelectError(Session *session)
357
349
{
358
350
  (void) create_select_for_variable(session, "error_count");
359
 
  session->lex().statement= new statement::Show(session);
 
351
  session->getLex()->statement= new statement::Show(session);
360
352
}
361
353
 
362
354
void buildWarnings(Session *session)
363
355
{
364
 
  session->lex().statement= new statement::ShowWarnings(session);
 
356
  session->getLex()->statement= new statement::ShowWarnings(session);
365
357
}
366
358
 
367
359
void buildErrors(Session *session)
368
360
{
369
 
  session->lex().statement= new statement::ShowErrors(session);
 
361
  session->getLex()->statement= new statement::ShowErrors(session);
370
362
}
371
363
 
372
364
bool buildIndex(Session *session, const char *schema_ident, Table_ident *table_ident)
373
365
{
374
 
  session->lex().sql_command= SQLCOM_SELECT;
 
366
  session->getLex()->sql_command= SQLCOM_SELECT;
375
367
  drizzled::statement::Show *select= new statement::Show(session);
376
 
  session->lex().statement= select;
 
368
  session->getLex()->statement= select;
377
369
 
378
 
  util::string::ptr schema(session->schema());
 
370
  util::string::const_shared_ptr schema(session->schema());
379
371
  if (schema_ident)
380
372
  {
381
373
    select->setShowPredicate(schema_ident, table_ident->table.str);
402
394
    }
403
395
  }
404
396
 
405
 
  if (prepare_new_schema_table(session, session->lex(), "SHOW_INDEXES"))
406
 
    return false;
407
 
 
408
 
  if (session->add_item_to_list( new Item_field(&session->lex().current_select->context, NULL, NULL, "*")))
409
 
    return false;
410
 
 
411
 
  (session->lex().current_select->with_wild)++;
 
397
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_INDEXES"))
 
398
    return false;
 
399
 
 
400
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
 
401
    return false;
 
402
 
 
403
  (session->lex->current_select->with_wild)++;
412
404
 
413
405
  return true;
414
406
}
415
407
 
416
408
bool buildStatus(Session *session, const drizzled::sql_var_t is_global)
417
409
{
418
 
  session->lex().sql_command= SQLCOM_SELECT;
419
 
  session->lex().statement= new statement::Show(session);
 
410
  session->getLex()->sql_command= SQLCOM_SELECT;
 
411
  session->getLex()->statement= new statement::Show(session);
420
412
 
421
413
  if (is_global == OPT_GLOBAL)
422
414
  {
423
 
    if (prepare_new_schema_table(session, session->lex(), "GLOBAL_STATUS"))
 
415
    if (prepare_new_schema_table(session, session->getLex(), "GLOBAL_STATUS"))
424
416
      return false;
425
417
  }
426
418
  else
427
419
  {
428
 
    if (prepare_new_schema_table(session, session->lex(), "SESSION_STATUS"))
 
420
    if (prepare_new_schema_table(session, session->getLex(), "SESSION_STATUS"))
429
421
      return false;
430
422
  }
431
423
 
432
424
  std::string key("Variable_name");
433
425
  std::string value("Value");
434
426
 
435
 
  Item_field *my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "VARIABLE_NAME");
 
427
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_NAME");
436
428
  my_field->is_autogenerated_name= false;
437
429
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
438
430
 
439
431
  if (session->add_item_to_list(my_field))
440
432
    return false;
441
433
 
442
 
  my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "VARIABLE_VALUE");
 
434
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_VALUE");
443
435
  my_field->is_autogenerated_name= false;
444
436
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
445
437
 
451
443
 
452
444
bool buildCreateTable(Session *session, Table_ident *ident)
453
445
{
454
 
  session->lex().sql_command= SQLCOM_SELECT;
 
446
  session->getLex()->sql_command= SQLCOM_SELECT;
455
447
  statement::Show *select= new statement::Show(session);
456
 
  session->lex().statement= select;
457
 
 
458
 
  if (session->lex().statement == NULL)
459
 
    return false;
460
 
 
461
 
  if (prepare_new_schema_table(session, session->lex(), "TABLE_SQL_DEFINITION"))
462
 
    return false;
463
 
 
464
 
  util::string::ptr schema(session->schema());
 
448
  session->getLex()->statement= select;
 
449
 
 
450
  if (session->getLex()->statement == NULL)
 
451
    return false;
 
452
 
 
453
  if (prepare_new_schema_table(session, session->getLex(), "TABLE_SQL_DEFINITION"))
 
454
    return false;
 
455
 
 
456
  util::string::const_shared_ptr schema(session->schema());
465
457
  if (ident->db.str)
466
458
  {
467
459
    select->setShowPredicate(ident->db.str, ident->table.str);
479
471
  std::string key("Table");
480
472
  std::string value("Create Table");
481
473
 
482
 
  Item_field *my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "TABLE_NAME");
 
474
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
483
475
  my_field->is_autogenerated_name= false;
484
476
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
485
477
 
486
478
  if (session->add_item_to_list(my_field))
487
479
    return false;
488
480
 
489
 
  my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "TABLE_SQL_DEFINITION");
 
481
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_SQL_DEFINITION");
490
482
  my_field->is_autogenerated_name= false;
491
483
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
492
484
 
498
490
 
499
491
bool buildProcesslist(Session *session)
500
492
{
501
 
  session->lex().sql_command= SQLCOM_SELECT;
502
 
  session->lex().statement= new statement::Show(session);
503
 
 
504
 
  if (prepare_new_schema_table(session, session->lex(), "PROCESSLIST"))
505
 
    return false;
506
 
 
507
 
  if (session->add_item_to_list( new Item_field(&session->lex().current_select->context, NULL, NULL, "*")))
508
 
    return false;
509
 
 
510
 
  (session->lex().current_select->with_wild)++;
 
493
  session->getLex()->sql_command= SQLCOM_SELECT;
 
494
  session->getLex()->statement= new statement::Show(session);
 
495
 
 
496
  if (prepare_new_schema_table(session, session->getLex(), "PROCESSLIST"))
 
497
    return false;
 
498
 
 
499
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
 
500
    return false;
 
501
 
 
502
  (session->lex->current_select->with_wild)++;
511
503
 
512
504
  return true;
513
505
}
514
506
 
515
507
bool buildVariables(Session *session, const drizzled::sql_var_t is_global)
516
508
{
517
 
  session->lex().sql_command= SQLCOM_SELECT;
518
 
  session->lex().statement= new statement::Show(session);
 
509
  session->getLex()->sql_command= SQLCOM_SELECT;
 
510
  session->getLex()->statement= new statement::Show(session);
519
511
 
520
512
  if (is_global == OPT_GLOBAL)
521
513
  {
522
 
    if (prepare_new_schema_table(session, session->lex(), "GLOBAL_VARIABLES"))
 
514
    if (prepare_new_schema_table(session, session->getLex(), "GLOBAL_VARIABLES"))
523
515
      return false;
524
516
  }
525
517
  else
526
518
  {
527
 
    if (prepare_new_schema_table(session, session->lex(), "SESSION_VARIABLES"))
 
519
    if (prepare_new_schema_table(session, session->getLex(), "SESSION_VARIABLES"))
528
520
      return false;
529
521
  }
530
522
 
531
523
  std::string key("Variable_name");
532
524
  std::string value("Value");
533
525
 
534
 
  Item_field *my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "VARIABLE_NAME");
 
526
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_NAME");
535
527
  my_field->is_autogenerated_name= false;
536
528
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
537
529
 
538
530
  if (session->add_item_to_list(my_field))
539
531
    return false;
540
532
 
541
 
  my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "VARIABLE_VALUE");
 
533
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_VALUE");
542
534
  my_field->is_autogenerated_name= false;
543
535
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
544
536
 
550
542
 
551
543
bool buildCreateSchema(Session *session, LEX_STRING &ident)
552
544
{
553
 
  session->lex().sql_command= SQLCOM_SELECT;
 
545
  session->getLex()->sql_command= SQLCOM_SELECT;
554
546
  drizzled::statement::Show *select= new statement::Show(session);
555
 
  session->lex().statement= select;
 
547
  session->getLex()->statement= select;
556
548
 
557
 
  if (prepare_new_schema_table(session, session->lex(), "SCHEMA_SQL_DEFINITION"))
 
549
  if (prepare_new_schema_table(session, session->getLex(), "SCHEMA_SQL_DEFINITION"))
558
550
    return false;
559
551
 
560
 
  util::string::ptr schema(session->schema());
 
552
  util::string::const_shared_ptr schema(session->schema());
561
553
  if (ident.str)
562
554
  {
563
555
    select->setShowPredicate(ident.str);
575
567
  std::string key("Database");
576
568
  std::string value("Create Database");
577
569
 
578
 
  Item_field *my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "SCHEMA_NAME");
 
570
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_NAME");
579
571
  my_field->is_autogenerated_name= false;
580
572
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
581
573
 
582
574
  if (session->add_item_to_list(my_field))
583
575
    return false;
584
576
 
585
 
  my_field= new Item_field(&session->lex().current_select->context, NULL, NULL, "SCHEMA_SQL_DEFINITION");
 
577
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_SQL_DEFINITION");
586
578
  my_field->is_autogenerated_name= false;
587
579
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
588
580
 
594
586
 
595
587
bool buildDescribe(Session *session, Table_ident *ident)
596
588
{
597
 
  session->lex().lock_option= TL_READ;
598
 
  init_select(&session->lex());
599
 
  session->lex().current_select->parsing_place= SELECT_LIST;
600
 
  session->lex().sql_command= SQLCOM_SELECT;
 
589
  session->getLex()->lock_option= TL_READ;
 
590
  init_select(session->getLex());
 
591
  session->getLex()->current_select->parsing_place= SELECT_LIST;
 
592
  session->getLex()->sql_command= SQLCOM_SELECT;
601
593
  drizzled::statement::Show *select= new statement::Show(session);
602
 
  session->lex().statement= select;
603
 
  session->lex().select_lex.db= 0;
 
594
  session->getLex()->statement= select;
 
595
  session->getLex()->select_lex.db= 0;
604
596
 
605
 
  util::string::ptr schema(session->schema());
 
597
  util::string::const_shared_ptr schema(session->schema());
606
598
  if (ident->db.str)
607
599
  {
608
600
    select->setShowPredicate(ident->db.str, ident->table.str);
625
617
    }
626
618
  }
627
619
 
628
 
  if (prepare_new_schema_table(session, session->lex(), "SHOW_COLUMNS"))
629
 
  {
630
 
    return false;
631
 
  }
632
 
 
633
 
  if (session->add_item_to_list( new Item_field(&session->lex().current_select->context, NULL, NULL, "*")))
634
 
  {
635
 
    return false;
636
 
  }
637
 
 
638
 
  (session->lex().current_select->with_wild)++;
 
620
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_COLUMNS"))
 
621
  {
 
622
    return false;
 
623
  }
 
624
 
 
625
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->
 
626
                                                  context,
 
627
                                                  NULL, NULL, "*")))
 
628
  {
 
629
    return false;
 
630
  }
 
631
 
 
632
  (session->lex->current_select->with_wild)++;
639
633
 
640
634
  return true;
641
635
}