~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:24:18 UTC
  • mfrom: (2159.1.1 remove-lint)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172418-vd210j88hiwk8jih
Removed the lint stuff.

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
 
 
33
 
#include <drizzled/statement/show.h>
34
 
#include <drizzled/statement/show_errors.h>
35
 
#include <drizzled/statement/show_warnings.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
36
 
37
37
 
38
38
#include <sys/stat.h>
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
  }
163
153
      return false;
164
154
  }
165
155
 
166
 
  Item_field *my_field= new Item_field(&session->getLex()->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
 
193
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
  }
219
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->getLex()->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
 
242
232
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_TEMPORARY_TABLES"))
243
233
    return false;
244
234
 
245
 
  if (session->add_item_to_list( new Item_field(&session->getLex()->current_select->context, NULL, NULL, "*")))
 
235
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
246
236
    return false;
247
237
 
248
 
  (session->getLex()->current_select->with_wild)++;
 
238
  (session->lex->current_select->with_wild)++;
249
239
 
250
240
  return true;
251
241
}
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, "");
284
274
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_TABLE_STATUS"))
285
275
    return false;
286
276
 
287
 
  if (session->add_item_to_list( new Item_field(&session->getLex()->current_select->
 
277
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->
288
278
                                                  context,
289
279
                                                  NULL, NULL, "*")))
290
280
    return false;
291
281
 
292
 
  (session->getLex()->current_select->with_wild)++;
 
282
  (session->lex->current_select->with_wild)++;
293
283
 
294
284
  return true;
295
285
}
341
331
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_COLUMNS"))
342
332
    return false;
343
333
 
344
 
  if (session->add_item_to_list( new Item_field(&session->getLex()->current_select->context, NULL, NULL, "*")))
 
334
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
345
335
    return false;
346
336
 
347
 
  (session->getLex()->current_select->with_wild)++;
 
337
  (session->lex->current_select->with_wild)++;
348
338
 
349
339
  return true;
350
340
}
407
397
  if (prepare_new_schema_table(session, session->getLex(), "SHOW_INDEXES"))
408
398
    return false;
409
399
 
410
 
  if (session->add_item_to_list( new Item_field(&session->getLex()->current_select->context, NULL, NULL, "*")))
 
400
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
411
401
    return false;
412
402
 
413
 
  (session->getLex()->current_select->with_wild)++;
 
403
  (session->lex->current_select->with_wild)++;
414
404
 
415
405
  return true;
416
406
}
434
424
  std::string key("Variable_name");
435
425
  std::string value("Value");
436
426
 
437
 
  Item_field *my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "VARIABLE_NAME");
 
427
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_NAME");
438
428
  my_field->is_autogenerated_name= false;
439
429
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
440
430
 
441
431
  if (session->add_item_to_list(my_field))
442
432
    return false;
443
433
 
444
 
  my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "VARIABLE_VALUE");
 
434
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_VALUE");
445
435
  my_field->is_autogenerated_name= false;
446
436
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
447
437
 
481
471
  std::string key("Table");
482
472
  std::string value("Create Table");
483
473
 
484
 
  Item_field *my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "TABLE_NAME");
 
474
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_NAME");
485
475
  my_field->is_autogenerated_name= false;
486
476
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
487
477
 
488
478
  if (session->add_item_to_list(my_field))
489
479
    return false;
490
480
 
491
 
  my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "TABLE_SQL_DEFINITION");
 
481
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "TABLE_SQL_DEFINITION");
492
482
  my_field->is_autogenerated_name= false;
493
483
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
494
484
 
506
496
  if (prepare_new_schema_table(session, session->getLex(), "PROCESSLIST"))
507
497
    return false;
508
498
 
509
 
  if (session->add_item_to_list( new Item_field(&session->getLex()->current_select->context, NULL, NULL, "*")))
 
499
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->context, NULL, NULL, "*")))
510
500
    return false;
511
501
 
512
 
  (session->getLex()->current_select->with_wild)++;
 
502
  (session->lex->current_select->with_wild)++;
513
503
 
514
504
  return true;
515
505
}
533
523
  std::string key("Variable_name");
534
524
  std::string value("Value");
535
525
 
536
 
  Item_field *my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "VARIABLE_NAME");
 
526
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_NAME");
537
527
  my_field->is_autogenerated_name= false;
538
528
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
539
529
 
540
530
  if (session->add_item_to_list(my_field))
541
531
    return false;
542
532
 
543
 
  my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "VARIABLE_VALUE");
 
533
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "VARIABLE_VALUE");
544
534
  my_field->is_autogenerated_name= false;
545
535
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
546
536
 
577
567
  std::string key("Database");
578
568
  std::string value("Create Database");
579
569
 
580
 
  Item_field *my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "SCHEMA_NAME");
 
570
  Item_field *my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_NAME");
581
571
  my_field->is_autogenerated_name= false;
582
572
  my_field->set_name(key.c_str(), key.length(), system_charset_info);
583
573
 
584
574
  if (session->add_item_to_list(my_field))
585
575
    return false;
586
576
 
587
 
  my_field= new Item_field(&session->getLex()->current_select->context, NULL, NULL, "SCHEMA_SQL_DEFINITION");
 
577
  my_field= new Item_field(&session->lex->current_select->context, NULL, NULL, "SCHEMA_SQL_DEFINITION");
588
578
  my_field->is_autogenerated_name= false;
589
579
  my_field->set_name(value.c_str(), value.length(), system_charset_info);
590
580
 
632
622
    return false;
633
623
  }
634
624
 
635
 
  if (session->add_item_to_list( new Item_field(&session->getLex()->current_select->
 
625
  if (session->add_item_to_list( new Item_field(&session->lex->current_select->
636
626
                                                  context,
637
627
                                                  NULL, NULL, "*")))
638
628
  {
639
629
    return false;
640
630
  }
641
631
 
642
 
  (session->getLex()->current_select->with_wild)++;
 
632
  (session->lex->current_select->with_wild)++;
643
633
 
644
634
  return true;
645
635
}