~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: Brian Aker
  • Date: 2010-03-03 05:02:36 UTC
  • mfrom: (1309.2.19 build)
  • Revision ID: brian@gaz-20100303050236-y7dotibgwks12gyp
Merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1527
1527
  TableIdentifier identifier(create_table->db,
1528
1528
                             create_table->table_name,
1529
1529
                             lex_identified_temp_table ?  TEMP_TABLE :
1530
 
                             NO_TMP_TABLE);
 
1530
                             STANDARD_TABLE);
1531
1531
 
1532
1532
 
1533
1533
  /*
1615
1615
 
1616
1616
  DRIZZLE_LOCK *extra_lock= NULL;
1617
1617
  /*
1618
 
    For row-based replication, the CREATE-SELECT statement is written
1619
 
    in two pieces: the first one contain the CREATE TABLE statement
1620
 
    necessary to create the table and the second part contain the rows
1621
 
    that should go into the table.
1622
 
 
1623
 
    For non-temporary tables, the start of the CREATE-SELECT
1624
 
    implicitly commits the previous transaction, and all events
1625
 
    forming the statement will be stored the transaction cache. At end
1626
 
    of the statement, the entire statement is committed as a
1627
 
    transaction, and all events are written to the binary log.
1628
 
 
1629
 
    On the master, the table is locked for the duration of the
1630
 
    statement, but since the CREATE part is replicated as a simple
1631
 
    statement, there is no way to lock the table for accesses on the
1632
 
    slave.  Hence, we have to hold on to the CREATE part of the
1633
 
    statement until the statement has finished.
 
1618
    For replication, the CREATE-SELECT statement is written
 
1619
    in two pieces: the first transaction messsage contains 
 
1620
    the CREATE TABLE statement as a CreateTableStatement message
 
1621
    necessary to create the table.
 
1622
    
 
1623
    The second transaction message contains all the InsertStatement
 
1624
    and associated InsertRecords that should go into the table.
1634
1625
   */
1635
1626
 
1636
1627
  unit= u;
1637
1628
 
1638
 
  /*
1639
 
    Start a statement transaction before the create if we are using
1640
 
    row-based replication for the statement.  If we are creating a
1641
 
    temporary table, we need to start a statement transaction.
1642
 
  */
1643
 
 
1644
1629
  if (!(table= create_table_from_items(session, create_info, create_table,
1645
1630
                                       table_proto,
1646
1631
                                       alter_info, &values,