~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_insert.cc

  • Committer: Monty Taylor
  • Date: 2008-12-08 10:42:44 UTC
  • mfrom: (667 drizzle)
  • mto: This revision was merged to the branch mainline in revision 670.
  • Revision ID: monty@inaugust.com-20081208104244-fan1pe90li9df3ym
MergedĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
456
456
    }
457
457
    if ((changed && error <= 0) || session->transaction.stmt.modified_non_trans_table || was_insert_delayed)
458
458
    {
459
 
      if (drizzle_bin_log.is_open())
460
 
      {
461
 
        if (error <= 0)
462
 
        {
463
 
          /*
464
 
            [Guilhem wrote] Temporary errors may have filled
465
 
            session->net.last_error/errno.  For example if there has
466
 
            been a disk full error when writing the row, and it was
467
 
            MyISAM, then session->net.last_error/errno will be set to
468
 
            "disk full"... and the my_pwrite() will wait until free
469
 
            space appears, and so when it finishes then the
470
 
            write_row() was entirely successful
471
 
          */
472
 
          /* todo: consider removing */
473
 
          session->clear_error();
474
 
        }
475
 
        /* bug#22725:
476
 
 
477
 
        A query which per-row-loop can not be interrupted with
478
 
        KILLED, like INSERT, and that does not invoke stored
479
 
        routines can be binlogged with neglecting the KILLED error.
480
 
 
481
 
        If there was no error (error == zero) until after the end of
482
 
        inserting loop the KILLED flag that appeared later can be
483
 
        disregarded since previously possible invocation of stored
484
 
        routines did not result in any error due to the KILLED.  In
485
 
        such case the flag is ignored for constructing binlog event.
486
 
        */
487
 
        assert(session->killed != Session::KILL_BAD_DATA || error > 0);
488
 
        if (session->binlog_query(Session::ROW_QUERY_TYPE,
489
 
                              session->query, session->query_length,
490
 
                              transactional_table, false,
491
 
                              (error>0) ? session->killed : Session::NOT_KILLED) &&
492
 
            transactional_table)
493
 
        {
494
 
          error=1;
495
 
        }
496
 
      }
497
459
      if (session->transaction.stmt.modified_non_trans_table)
498
460
        session->transaction.all.modified_non_trans_table= true;
499
461
    }
1387
1349
  bool const trans_table= table->file->has_transactions();
1388
1350
  uint64_t id;
1389
1351
  bool changed;
1390
 
  Session::killed_state killed_status= session->killed;
1391
1352
 
1392
1353
  error= table->file->ha_end_bulk_insert();
1393
1354
  table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
1405
1366
  assert(trans_table || !changed ||
1406
1367
              session->transaction.stmt.modified_non_trans_table);
1407
1368
 
1408
 
  /*
1409
 
    Write to binlog before commiting transaction.  No statement will
1410
 
    be written by the binlog_query() below in RBR mode.  All the
1411
 
    events are in the transaction cache and will be written when
1412
 
    ha_autocommit_or_rollback() is issued below.
1413
 
  */
1414
 
  if (drizzle_bin_log.is_open())
1415
 
  {
1416
 
    if (!error)
1417
 
      session->clear_error();
1418
 
    session->binlog_query(Session::ROW_QUERY_TYPE,
1419
 
                      session->query, session->query_length,
1420
 
                      trans_table, false, killed_status);
1421
 
  }
1422
1369
  table->file->ha_release_auto_increment();
1423
1370
 
1424
1371
  if (error)
1477
1424
    */
1478
1425
    changed= (info.copied || info.deleted || info.updated);
1479
1426
    transactional_table= table->file->has_transactions();
1480
 
    if (session->transaction.stmt.modified_non_trans_table)
1481
 
    {
1482
 
        if (drizzle_bin_log.is_open())
1483
 
          session->binlog_query(Session::ROW_QUERY_TYPE, session->query, session->query_length,
1484
 
                            transactional_table, false);
1485
 
    }
1486
1427
    assert(transactional_table || !changed ||
1487
1428
                session->transaction.stmt.modified_non_trans_table);
1488
1429
    table->file->ha_release_auto_increment();
1846
1787
 
1847
1788
  result= store_create_info(session, &tmp_table_list, &query, create_info);
1848
1789
  assert(result == 0); /* store_create_info() always return 0 */
1849
 
 
1850
 
  session->binlog_query(Session::STMT_QUERY_TYPE,
1851
 
                    query.ptr(), query.length(),
1852
 
                    /* is_trans */ true,
1853
 
                    /* suppress_use */ false);
1854
1790
}
1855
1791
 
1856
1792
void select_create::store_values(List<Item> &values)