~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

Merged trunk and use-std-unordred.

Show diffs side-by-side

added added

removed removed

Lines of Context:
458
458
  {
459
459
    char buff[160];
460
460
    if (ignore)
461
 
      sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
 
461
      snprintf(buff, sizeof(buff), ER(ER_INSERT_INFO), (ulong) info.records,
462
462
              (ulong) (info.records - info.copied), (ulong) session->cuted_fields);
463
463
    else
464
 
      sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
 
464
      snprintf(buff, sizeof(buff), ER(ER_INSERT_INFO), (ulong) info.records,
465
465
              (ulong) (info.deleted + info.updated), (ulong) session->cuted_fields);
466
466
    session->row_count_func= info.copied + info.deleted + info.updated;
467
467
    session->my_ok((ulong) session->row_count_func,
1343
1343
  }
1344
1344
  char buff[160];
1345
1345
  if (info.ignore)
1346
 
    sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
 
1346
    snprintf(buff, sizeof(buff), ER(ER_INSERT_INFO), (ulong) info.records,
1347
1347
            (ulong) (info.records - info.copied), (ulong) session->cuted_fields);
1348
1348
  else
1349
 
    sprintf(buff, ER(ER_INSERT_INFO), (ulong) info.records,
 
1349
    snprintf(buff, sizeof(buff), ER(ER_INSERT_INFO), (ulong) info.records,
1350
1350
            (ulong) (info.deleted+info.updated), (ulong) session->cuted_fields);
1351
1351
  session->row_count_func= info.copied + info.deleted + info.updated;
1352
1352
 
1471
1471
  Field *tmp_field;
1472
1472
  bool not_used;
1473
1473
 
1474
 
  bool lex_identified_temp_table= (table_proto.type() == message::Table::TEMPORARY);
1475
 
 
1476
 
  if (not (lex_identified_temp_table) &&
1477
 
      create_table->table->db_stat)
 
1474
  if (not (identifier.isTmp()) && create_table->table->db_stat)
1478
1475
  {
1479
1476
    /* Table already exists and was open at openTablesLock() stage. */
1480
1477
    if (is_if_not_exists)
1545
1542
                                       select_field_count,
1546
1543
                                       is_if_not_exists))
1547
1544
    {
1548
 
      if (create_info->table_existed &&
1549
 
          !(lex_identified_temp_table))
 
1545
      if (create_info->table_existed && not identifier.isTmp())
1550
1546
      {
1551
1547
        /*
1552
1548
          This means that someone created table underneath server
1557
1553
        return NULL;
1558
1554
      }
1559
1555
 
1560
 
      if (not lex_identified_temp_table)
 
1556
      if (not identifier.isTmp())
1561
1557
      {
1562
1558
        pthread_mutex_lock(&LOCK_open); /* CREATE TABLE... has found that the table already exists for insert and is adapting to use it */
1563
1559
        if (session->reopen_name_locked_table(create_table, false))
1609
1605
int
1610
1606
select_create::prepare(List<Item> &values, Select_Lex_Unit *u)
1611
1607
{
1612
 
  bool lex_identified_temp_table= (table_proto.type() == message::Table::TEMPORARY);
1613
 
 
1614
1608
  DRIZZLE_LOCK *extra_lock= NULL;
1615
1609
  /*
1616
1610
    For replication, the CREATE-SELECT statement is written
1635
1629
  {
1636
1630
    assert(m_plock == NULL);
1637
1631
 
1638
 
    if (lex_identified_temp_table)
 
1632
    if (identifier.isTmp())
1639
1633
      m_plock= &m_lock;
1640
1634
    else
1641
1635
      m_plock= &session->extra_lock;