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;
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))
1219
1214
restore_record(table,s->default_values); // Get empty record
1220
1215
table->next_number_field=table->found_next_number_field;
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))
1228
1220
session->cuted_fields=0;
1689
virtual int do_postlock(Table **tables, uint32_t count)
1681
virtual int do_postlock(Table **, uint32_t)
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)
1696
1684
ptr->binlog_show_create_table(tables, count);
1712
1700
row-based replication for the statement. If we are creating a
1713
1701
temporary table, we need to start a statement transaction.
1715
if ((session->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0
1716
&& drizzle_bin_log.is_open())
1720
1704
if (!(table= create_table_from_items(session, create_info, create_table,
1721
1705
alter_info, &values,
1772
select_create::binlog_show_create_table(Table **tables, uint32_t count)
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.
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.
1791
assert(tables && *tables && count > 0);
1794
String query(buf, sizeof(buf), system_charset_info);
1796
TableList tmp_table_list;
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
1802
result= store_create_info(session, &tmp_table_list, &query, create_info);
1803
assert(result == 0); /* store_create_info() always return 0 */
1806
1755
void select_create::store_values(List<Item> &values)
1808
1757
fill_record(session, field, values, 1);