~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log_event.cc

  • Committer: Monty Taylor
  • Date: 2008-08-18 23:04:17 UTC
  • mfrom: (327.1.12 drizzle)
  • Revision ID: monty@inaugust.com-20080818230417-442rhihpahnout34
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
*/
120
120
static void inline slave_rows_error_report(enum loglevel level, int ha_error,
121
121
                                           Relay_log_info const *rli, THD *thd,
122
 
                                           TABLE *table, const char * type,
 
122
                                           Table *table, const char * type,
123
123
                                           const char *log_name, ulong pos)
124
124
{
125
125
  const char *handler_error= HA_ERR(ha_error);
2369
2369
    probably, so data_buf will be freed, so the thd->... listed above will be
2370
2370
    pointers to freed memory. 
2371
2371
    So we must set them to 0, so that those bad pointers values are not later
2372
 
    used. Note that "cleanup" queries like automatic DROP TEMPORARY TABLE
 
2372
    used. Note that "cleanup" queries like automatic DROP TEMPORARY Table
2373
2373
    don't suffer from these assignments to 0 as DROP TEMPORARY
2374
 
    TABLE uses the db.table syntax.
 
2374
    Table uses the db.table syntax.
2375
2375
  */
2376
2376
  thd->catalog= 0;
2377
2377
  thd->set_db(NULL, 0);                 /* will free the current database */
2563
2563
 
2564
2564
    IMPLEMENTATION
2565
2565
    - To handle the case where the master died without having time to write
2566
 
    DROP TEMPORARY TABLE, DO RELEASE_LOCK (prepared statements' deletion is
 
2566
    DROP TEMPORARY Table, DO RELEASE_LOCK (prepared statements' deletion is
2567
2567
    TODO), we clean up all temporary tables that we got, if we are sure we
2568
2568
    can (see below).
2569
2569
 
3032
3032
    18 + fname_len + 2 +                    // "LOAD DATA INFILE 'file''"
3033
3033
    7 +                                     // LOCAL
3034
3034
    9 +                                     // " REPLACE or IGNORE "
3035
 
    13 + table_name_len*2 +                 // "INTO TABLE `table`"
 
3035
    13 + table_name_len*2 +                 // "INTO Table `table`"
3036
3036
    21 + sql_ex.field_term_len*4 + 2 +      // " FIELDS TERMINATED BY 'str'"
3037
3037
    23 + sql_ex.enclosed_len*4 + 2 +        // " OPTIONALLY ENCLOSED BY 'str'"
3038
3038
    12 + sql_ex.escaped_len*4 + 2 +         // " ESCAPED BY 'str'"
3076
3076
  if (fn_end)
3077
3077
    *fn_end= pos;
3078
3078
 
3079
 
  pos= stpcpy(pos ," TABLE `");
 
3079
  pos= stpcpy(pos ," Table `");
3080
3080
  memcpy(pos, table_name, table_name_len);
3081
3081
  pos+= table_name_len;
3082
3082
 
3401
3401
  else if (sql_ex.opt_flags & IGNORE_FLAG)
3402
3402
    my_b_printf(&cache," IGNORE ");
3403
3403
  
3404
 
  my_b_printf(&cache, "INTO TABLE `%s`", table_name);
 
3404
  my_b_printf(&cache, "INTO Table `%s`", table_name);
3405
3405
  my_b_printf(&cache, " FIELDS TERMINATED BY ");
3406
3406
  pretty_print_str(&cache, sql_ex.field_term, sql_ex.field_term_len);
3407
3407
 
4847
4847
/*
4848
4848
  The master stopped.  We used to clean up all temporary tables but
4849
4849
  this is useless as, as the master has shut down properly, it has
4850
 
  written all DROP TEMPORARY TABLE (prepared statements' deletion is
 
4850
  written all DROP TEMPORARY Table (prepared statements' deletion is
4851
4851
  TODO only when we binlog prep stmts).  We used to clean up
4852
4852
  slave_load_tmpdir, but this is useless as it has been cleared at the
4853
4853
  end of LOAD DATA INFILE.  So we have nothing to do here.  The place
5886
5886
**************************************************************************/
5887
5887
 
5888
5888
#ifndef DRIZZLE_CLIENT
5889
 
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
 
5889
Rows_log_event::Rows_log_event(THD *thd_arg, Table *tbl_arg, ulong tid,
5890
5890
                               MY_BITMAP const *cols, bool is_transactional)
5891
5891
  : Log_event(thd_arg, 0, is_transactional),
5892
5892
    m_row_count(0),
6291
6291
    }
6292
6292
  }
6293
6293
 
6294
 
  TABLE* 
 
6294
  Table* 
6295
6295
    table= 
6296
6296
    m_table= const_cast<Relay_log_info*>(rli)->m_table_map.get_table(m_table_id);
6297
6297
 
6762
6762
  (tbl->s->db etc) and not pointer content.
6763
6763
 */
6764
6764
#if !defined(DRIZZLE_CLIENT)
6765
 
Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
 
6765
Table_map_log_event::Table_map_log_event(THD *thd, Table *tbl, ulong tid,
6766
6766
                                         bool is_transactional __attribute__((unused)),
6767
6767
                                         uint16_t flags)
6768
6768
  : Log_event(thd, 0, true),
7198
7198
  Constructor used to build an event for writing to the binary log.
7199
7199
 */
7200
7200
#if !defined(DRIZZLE_CLIENT)
7201
 
Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
 
7201
Write_rows_log_event::Write_rows_log_event(THD *thd_arg, Table *tbl_arg,
7202
7202
                                           ulong tid_arg,
7203
7203
                                           bool is_transactional)
7204
7204
  : Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->write_set, is_transactional)
7302
7302
  Check if there are more UNIQUE keys after the given key.
7303
7303
*/
7304
7304
static int
7305
 
last_uniq_key(TABLE *table, uint keyno)
 
7305
last_uniq_key(Table *table, uint keyno)
7306
7306
{
7307
7307
  while (++keyno < table->s->keys)
7308
7308
    if (table->key_info[keyno].flags & HA_NOSAME)
7376
7376
{
7377
7377
  assert(m_table != NULL && thd != NULL);
7378
7378
 
7379
 
  TABLE *table= m_table;  // pointer to event's table
 
7379
  Table *table= m_table;  // pointer to event's table
7380
7380
  int error;
7381
7381
  int keynum;
7382
7382
  auto_afree_ptr<char> key(NULL);
7583
7583
 
7584
7584
  Returns TRUE if different.
7585
7585
*/
7586
 
static bool record_compare(TABLE *table)
 
7586
static bool record_compare(Table *table)
7587
7587
{
7588
7588
  /*
7589
7589
    Need to set the X bit and the filler bits in both records since
7686
7686
{
7687
7687
  assert(m_table && m_table->in_use != NULL);
7688
7688
 
7689
 
  TABLE *table= m_table;
 
7689
  Table *table= m_table;
7690
7690
  int error;
7691
7691
 
7692
7692
  /* unpack row - missing fields get default values */
7881
7881
 */
7882
7882
 
7883
7883
#ifndef DRIZZLE_CLIENT
7884
 
Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
 
7884
Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, Table *tbl_arg,
7885
7885
                                             ulong tid,
7886
7886
                                             bool is_transactional)
7887
7887
  : Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional)
7972
7972
  Constructor used to build an event for writing to the binary log.
7973
7973
 */
7974
7974
#if !defined(DRIZZLE_CLIENT)
7975
 
Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
 
7975
Update_rows_log_event::Update_rows_log_event(THD *thd_arg, Table *tbl_arg,
7976
7976
                                             ulong tid,
7977
7977
                                             bool is_transactional)
7978
7978
: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional)