315
304
if (values->elements != value_count)
317
306
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
320
table->cursor->ha_release_auto_increment();
322
free_underlaid_joins(session, &session->lex->select_lex);
323
session->abort_on_warning= 0;
324
DRIZZLE_INSERT_DONE(1, 0);
328
309
if (setup_fields(session, 0, *values, MARK_COLUMNS_READ, 0, 0))
331
table->cursor->ha_release_auto_increment();
333
free_underlaid_joins(session, &session->lex->select_lex);
334
session->abort_on_warning= 0;
335
DRIZZLE_INSERT_DONE(1, 0);
1503
1478
create_info->table_existed= 1; // Mark that table existed
1504
1479
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
1505
1480
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
1506
create_table->getTableName());
1481
create_table->table_name);
1507
1482
return create_table->table;
1510
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->getTableName());
1485
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->table_name);
1489
tmp_table.timestamp_field= 0;
1490
tmp_table.setShare(&share);
1492
tmp_table.getMutableShare()->db_create_options= 0;
1493
tmp_table.getMutableShare()->blob_ptr_size= portable_sizeof_char_ptr;
1495
if (not table_proto.engine().name().compare("MyISAM"))
1496
tmp_table.getMutableShare()->db_low_byte_first= true;
1497
else if (not table_proto.engine().name().compare("MEMORY"))
1498
tmp_table.getMutableShare()->db_low_byte_first= true;
1500
tmp_table.null_row= false;
1501
tmp_table.maybe_null= false;
1515
table::Shell tmp_table(share); // Used during 'CreateField()'
1516
tmp_table.timestamp_field= 0;
1518
tmp_table.getMutableShare()->db_create_options= 0;
1519
tmp_table.getMutableShare()->blob_ptr_size= portable_sizeof_char_ptr;
1521
if (not table_proto.engine().name().compare("MyISAM"))
1522
tmp_table.getMutableShare()->db_low_byte_first= true;
1523
else if (not table_proto.engine().name().compare("MEMORY"))
1524
tmp_table.getMutableShare()->db_low_byte_first= true;
1526
tmp_table.null_row= false;
1527
tmp_table.maybe_null= false;
1529
tmp_table.in_use= session;
1533
CreateField *cr_field;
1534
Field *field, *def_field;
1535
if (item->type() == Item::FUNC_ITEM)
1537
if (item->result_type() != STRING_RESULT)
1539
field= item->tmp_table_field(&tmp_table);
1543
field= item->tmp_table_field_from_field_type(&tmp_table, 0);
1505
CreateField *cr_field;
1506
Field *field, *def_field;
1507
if (item->type() == Item::FUNC_ITEM)
1508
if (item->result_type() != STRING_RESULT)
1509
field= item->tmp_table_field(&tmp_table);
1548
field= create_tmp_field(session, &tmp_table, item, item->type(),
1549
(Item ***) 0, &tmp_field, &def_field, false,
1554
!(cr_field=new CreateField(field,(item->type() == Item::FIELD_ITEM ?
1555
((Item_field *)item)->field :
1561
if (item->maybe_null)
1563
cr_field->flags &= ~NOT_NULL_FLAG;
1566
alter_info->create_list.push_back(cr_field);
1511
field= item->tmp_table_field_from_field_type(&tmp_table, 0);
1513
field= create_tmp_field(session, &tmp_table, item, item->type(),
1514
(Item ***) 0, &tmp_field, &def_field, false,
1517
!(cr_field=new CreateField(field,(item->type() == Item::FIELD_ITEM ?
1518
((Item_field *)item)->field :
1521
if (item->maybe_null)
1522
cr_field->flags &= ~NOT_NULL_FLAG;
1523
alter_info->create_list.push_back(cr_field);
1592
1547
or it was created via different mysqld front-end to the
1593
1548
cluster. We don't have much options but throw an error.
1595
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->getTableName());
1550
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), create_table->table_name);
1599
1554
if (not identifier.isTmp())
1601
/* CREATE TABLE... has found that the table already exists for insert and is adapting to use it */
1602
boost::mutex::scoped_lock scopedLock(table::Cache::singleton().mutex());
1604
if (create_table->table)
1556
LOCK_open.lock(); /* CREATE TABLE... has found that the table already exists for insert and is adapting to use it */
1557
if (session->reopen_name_locked_table(create_table, false))
1606
table::Concurrent *concurrent_table= static_cast<table::Concurrent *>(create_table->table);
1608
if (concurrent_table->reopen_name_locked_table(create_table, session))
1610
plugin::StorageEngine::dropTable(*session, identifier);
1614
table= create_table->table;
1559
quick_rm_table(*session, identifier);
1619
plugin::StorageEngine::dropTable(*session, identifier);
1562
table= create_table->table;
1630
1573
it preparable for open. But let us do close_temporary_table() here
1633
session->drop_temporary_table(identifier);
1576
session->drop_temporary_table(create_table);
1637
if (not table) // open failed
1580
if (!table) // open failed
1641
1584
table->reginfo.lock_type=TL_WRITE;
1642
if (! ((*lock)= session->lockTables(&table, 1, DRIZZLE_LOCK_IGNORE_FLUSH, ¬_used)))
1585
if (! ((*lock)= mysql_lock_tables(session, &table, 1,
1586
DRIZZLE_LOCK_IGNORE_FLUSH, ¬_used)))
1646
session->unlockTables(*lock);
1590
mysql_unlock_tables(session, *lock);