~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: Brian Aker
  • Date: 2009-01-23 02:15:04 UTC
  • mfrom: (798.2.32 drizzle)
  • Revision ID: brian@tangent.org-20090123021504-2j99e6hxab1ew601
Merge for replication removal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <drizzled/server_includes.h>
26
26
#include <drizzled/sql_select.h>
27
27
#include <drizzled/show.h>
28
 
#include <drizzled/replication/mi.h>
29
28
#include <drizzled/error.h>
30
29
#include <drizzled/name_resolution_context_state.h>
31
 
#include <drizzled/slave.h>
32
30
#include <drizzled/sql_parse.h>
33
31
#include <drizzled/probes.h>
34
32
#include <drizzled/tableop_hooks.h>
349
347
  session->cuted_fields = 0L;
350
348
  table->next_number_field=table->found_next_number_field;
351
349
 
352
 
  if (session->slave_thread &&
353
 
      (info.handle_duplicates == DUP_UPDATE) &&
354
 
      (table->next_number_field != NULL) &&
355
 
      rpl_master_has_bug(&active_mi->rli, 24432))
 
350
  if (session->slave_thread && (info.handle_duplicates == DUP_UPDATE) && (table->next_number_field != NULL))
356
351
    goto abort;
357
352
 
358
353
  error=0;
1219
1214
  restore_record(table,s->default_values);              // Get empty record
1220
1215
  table->next_number_field=table->found_next_number_field;
1221
1216
 
1222
 
  if (session->slave_thread &&
1223
 
      (info.handle_duplicates == DUP_UPDATE) &&
1224
 
      (table->next_number_field != NULL) &&
1225
 
      rpl_master_has_bug(&active_mi->rli, 24432))
 
1217
  if (session->slave_thread && (info.handle_duplicates == DUP_UPDATE))
1226
1218
    return(1);
1227
1219
 
1228
1220
  session->cuted_fields=0;
1686
1678
      }
1687
1679
 
1688
1680
  private:
1689
 
    virtual int do_postlock(Table **tables, uint32_t count)
 
1681
    virtual int do_postlock(Table **, uint32_t)
1690
1682
    {
1691
 
      Table const *const table = *tables;
1692
 
      if (drizzle_bin_log.is_open()
1693
 
          && !table->s->tmp_table
1694
 
          && !ptr->get_create_info()->table_existed)
1695
 
      {
 
1683
      /*
1696
1684
        ptr->binlog_show_create_table(tables, count);
1697
 
      }
 
1685
      */
1698
1686
      return 0;
1699
1687
    }
1700
1688
 
1712
1700
    row-based replication for the statement.  If we are creating a
1713
1701
    temporary table, we need to start a statement transaction.
1714
1702
  */
1715
 
  if ((session->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0
1716
 
      && drizzle_bin_log.is_open())
1717
 
  {
1718
 
  }
1719
1703
 
1720
1704
  if (!(table= create_table_from_items(session, create_info, create_table,
1721
1705
                                       alter_info, &values,
1768
1752
  return(0);
1769
1753
}
1770
1754
 
1771
 
void
1772
 
select_create::binlog_show_create_table(Table **tables, uint32_t count)
1773
 
{
1774
 
  /*
1775
 
    Note 1: In RBR mode, we generate a CREATE TABLE statement for the
1776
 
    created table by calling store_create_info() (behaves as SHOW
1777
 
    CREATE TABLE).  In the event of an error, nothing should be
1778
 
    written to the binary log, even if the table is non-transactional;
1779
 
    therefore we pretend that the generated CREATE TABLE statement is
1780
 
    for a transactional table.  The event will then be put in the
1781
 
    transaction cache, and any subsequent events (e.g., table-map
1782
 
    events and binrow events) will also be put there.  We can then use
1783
 
    ha_autocommit_or_rollback() to either throw away the entire
1784
 
    kaboodle of events, or write them to the binary log.
1785
 
 
1786
 
    We write the CREATE TABLE statement here and not in prepare()
1787
 
    since there potentially are sub-selects or accesses to information
1788
 
    schema that will do a close_thread_tables(), destroying the
1789
 
    statement transaction cache.
1790
 
  */
1791
 
  assert(tables && *tables && count > 0);
1792
 
 
1793
 
  char buf[2048];
1794
 
  String query(buf, sizeof(buf), system_charset_info);
1795
 
  int result;
1796
 
  TableList tmp_table_list;
1797
 
 
1798
 
  memset(&tmp_table_list, 0, sizeof(tmp_table_list));
1799
 
  tmp_table_list.table = *tables;
1800
 
  query.length(0);      // Have to zero it since constructor doesn't
1801
 
 
1802
 
  result= store_create_info(session, &tmp_table_list, &query, create_info);
1803
 
  assert(result == 0); /* store_create_info() always return 0 */
1804
 
}
1805
 
 
1806
1755
void select_create::store_values(List<Item> &values)
1807
1756
{
1808
1757
  fill_record(session, field, values, 1);