~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log.cc

  • Committer: Brian Aker
  • Date: 2008-11-12 01:27:19 UTC
  • Revision ID: brian@tangent.org-20081112012719-rz97qt34iii2f73o
Next pass in removing/standardizing replication

Show diffs side-by-side

added added

removed removed

Lines of Context:
2310
2310
  int error;
2311
2311
 
2312
2312
  /* Pre-conditions */
2313
 
  assert(current_stmt_binlog_row_based && mysql_bin_log.is_open());
2314
2313
  assert(table->s->table_map_id != UINT32_MAX);
2315
2314
 
2316
2315
  Table_map_log_event::flag_set const
2531
2530
    }
2532
2531
 
2533
2532
    /*
2534
 
      No check for auto events flag here - this write method should
2535
 
      never be called if auto-events are enabled
2536
 
    */
2537
 
 
2538
 
    /*
2539
 
      1. Write first log events which describe the 'run environment'
2540
 
      of the SQL command
2541
 
    */
2542
 
 
2543
 
    /*
2544
 
      If row-based binlogging, Insert_id, Rand and other kind of "setting
2545
 
      context" events are not needed.
2546
 
    */
2547
 
    if (session)
2548
 
    {
2549
 
      if (!session->current_stmt_binlog_row_based)
2550
 
      {
2551
 
        if (session->stmt_depends_on_first_successful_insert_id_in_prev_stmt)
2552
 
        {
2553
 
          Intvar_log_event e(session,(unsigned char) LAST_INSERT_ID_EVENT,
2554
 
                             session->first_successful_insert_id_in_prev_stmt_for_binlog);
2555
 
          if (e.write(file))
2556
 
            goto err;
2557
 
        }
2558
 
        if (session->auto_inc_intervals_in_cur_stmt_for_binlog.nb_elements() > 0)
2559
 
        {
2560
 
          /*
2561
 
            If the auto_increment was second in a table's index (possible with
2562
 
            MyISAM or BDB) (table->next_number_keypart != 0), such event is
2563
 
            in fact not necessary. We could avoid logging it.
2564
 
          */
2565
 
          Intvar_log_event e(session, (unsigned char) INSERT_ID_EVENT,
2566
 
                             session->auto_inc_intervals_in_cur_stmt_for_binlog.
2567
 
                             minimum());
2568
 
          if (e.write(file))
2569
 
            goto err;
2570
 
        }
2571
 
        if (session->rand_used)
2572
 
        {
2573
 
          Rand_log_event e(session,session->rand_saved_seed1,session->rand_saved_seed2);
2574
 
          if (e.write(file))
2575
 
            goto err;
2576
 
        }
2577
 
        if (session->user_var_events.elements)
2578
 
        {
2579
 
          for (uint32_t i= 0; i < session->user_var_events.elements; i++)
2580
 
          {
2581
 
            BINLOG_USER_VAR_EVENT *user_var_event;
2582
 
            get_dynamic(&session->user_var_events,(unsigned char*) &user_var_event, i);
2583
 
            User_var_log_event e(session, user_var_event->user_var_event->name.str,
2584
 
                                 user_var_event->user_var_event->name.length,
2585
 
                                 user_var_event->value,
2586
 
                                 user_var_event->length,
2587
 
                                 user_var_event->type,
2588
 
                                 user_var_event->charset_number);
2589
 
            if (e.write(file))
2590
 
              goto err;
2591
 
          }
2592
 
        }
2593
 
      }
2594
 
    }
2595
 
 
2596
 
    /*
2597
2533
       Write the SQL command
2598
2534
     */
2599
2535