~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

Merge (with fix for dangling bit in merge)

Show diffs side-by-side

added added

removed removed

Lines of Context:
190
190
}
191
191
 
192
192
 
193
 
bool drizzled_show_create(Session *session, TableList *table_list)
 
193
bool drizzled_show_create(Session *session, TableList *table_list, bool is_if_not_exists)
194
194
{
195
195
  char buff[2048];
196
196
  String buffer(buff, sizeof(buff), system_charset_info);
212
212
 
213
213
  buffer.length(0);
214
214
 
215
 
  if (store_create_info(table_list, &buffer, NULL))
 
215
  if (store_create_info(table_list, &buffer, NULL, is_if_not_exists))
216
216
    return true;
217
217
 
218
218
  List<Item> field_list;
250
250
  Resulting statement is stored in the string pointed by @c buffer. The string
251
251
  is emptied first and its character set is set to the system character set.
252
252
 
253
 
  If HA_LEX_CREATE_IF_NOT_EXISTS flag is set in @c create_info->options, then
 
253
  If is_if_not_exists is set, then
254
254
  the resulting CREATE statement contains "IF NOT EXISTS" clause. Other flags
255
255
  in @c create_options are ignored.
256
256
 
431
431
    0       OK
432
432
 */
433
433
 
434
 
int store_create_info(TableList *table_list, String *packet, HA_CREATE_INFO *create_info_arg)
 
434
int store_create_info(TableList *table_list, String *packet, HA_CREATE_INFO *create_info_arg, bool is_if_not_exists)
435
435
{
436
436
  List<Item> field_list;
437
437
  char tmp[MAX_FIELD_WIDTH], *for_str, def_value_buf[MAX_FIELD_WIDTH];
455
455
    packet->append(STRING_WITH_LEN("CREATE TEMPORARY TABLE "));
456
456
  else
457
457
    packet->append(STRING_WITH_LEN("CREATE TABLE "));
458
 
  if (create_info_arg &&
459
 
      (create_info_arg->options & HA_LEX_CREATE_IF_NOT_EXISTS))
 
458
  if (is_if_not_exists)
460
459
    packet->append(STRING_WITH_LEN("IF NOT EXISTS "));
461
460
  if (table_list->schema_table)
462
461
    alias= table_list->schema_table->getTableName().c_str();