~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
    {
223
223
      if (delete_opt == FK_OPTION_SET_NULL)
224
224
      {
225
 
        my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0), 
 
225
        my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0),
226
226
                 "ON DELETE SET NULL");
227
227
        return true;
228
228
      }
229
229
      if (update_opt == FK_OPTION_SET_NULL)
230
230
      {
231
 
        my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0), 
 
231
        my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0),
232
232
                 "ON UPDATE SET NULL");
233
233
        return true;
234
234
      }
235
235
      if (update_opt == FK_OPTION_CASCADE)
236
236
      {
237
 
        my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0), 
 
237
        my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0),
238
238
                 "ON UPDATE CASCADE");
239
239
        return true;
240
240
      }
337
337
}
338
338
 
339
339
/**
340
 
  Clear this diagnostics area. 
 
340
  Clear this diagnostics area.
341
341
 
342
342
  Normally called at the end of a statement.
343
343
*/
689
689
 
690
690
void Session::init_for_queries()
691
691
{
692
 
  set_time(); 
 
692
  set_time();
693
693
  ha_enable_transaction(this,true);
694
694
 
695
695
  reset_root_defaults(mem_root, variables.query_alloc_block_size,
731
731
  free((char*) variables.time_format);
732
732
  free((char*) variables.date_format);
733
733
  free((char*) variables.datetime_format);
734
 
  
 
734
 
735
735
  if (global_read_lock)
736
736
    unlock_global_read_lock(this);
737
737
 
775
775
    delete rli_fake;
776
776
    rli_fake= NULL;
777
777
  }
778
 
  
 
778
 
779
779
  free_root(&main_mem_root, MYF(0));
780
780
  return;
781
781
}
814
814
    to_var       add to this array
815
815
    from_var     from this array
816
816
    dec_var      minus this array
817
 
  
 
817
 
818
818
  NOTE
819
819
    This function assumes that all variables are long/ulong.
820
820
*/
835
835
void Session::awake(Session::killed_state state_to_set)
836
836
{
837
837
  Session_CHECK_SENTRY(this);
838
 
  safe_mutex_assert_owner(&LOCK_delete); 
 
838
  safe_mutex_assert_owner(&LOCK_delete);
839
839
 
840
840
  killed= state_to_set;
841
841
  if (state_to_set != Session::KILL_QUERY)
931
931
void Session::cleanup_after_query()
932
932
{
933
933
  /*
934
 
    Reset rand_used so that detection of calls to rand() will save random 
 
934
    Reset rand_used so that detection of calls to rand() will save random
935
935
    seeds if needed by the slave.
936
936
  */
937
937
  {
941
941
  if (first_successful_insert_id_in_cur_stmt > 0)
942
942
  {
943
943
    /* set what LAST_INSERT_ID() will return */
944
 
    first_successful_insert_id_in_prev_stmt= 
 
944
    first_successful_insert_id_in_prev_stmt=
945
945
      first_successful_insert_id_in_cur_stmt;
946
946
    first_successful_insert_id_in_cur_stmt= 0;
947
947
    substitute_null_with_insert_id= true;
1023
1023
    Session::convert_string
1024
1024
 
1025
1025
  DESCRIPTION
1026
 
    Convert string using convert_buffer - buffer for character set 
 
1026
    Convert string using convert_buffer - buffer for character set
1027
1027
    conversion shared between all protocols.
1028
1028
 
1029
1029
  RETURN
1058
1058
  charset_is_system_charset= !String::needs_conversion(0,charset(),
1059
1059
                                                       system_charset_info,
1060
1060
                                                       &not_used);
1061
 
  charset_is_collation_connection= 
 
1061
  charset_is_collation_connection=
1062
1062
    !String::needs_conversion(0,charset(),variables.collation_connection,
1063
1063
                              &not_used);
1064
 
  charset_is_character_set_filesystem= 
 
1064
  charset_is_character_set_filesystem=
1065
1065
    !String::needs_conversion(0, charset(),
1066
1066
                              variables.character_set_filesystem, &not_used);
1067
1067
}
1126
1126
 
1127
1127
CHANGED_TableList* Session::changed_table_dup(const char *key, long key_length)
1128
1128
{
1129
 
  CHANGED_TableList* new_table = 
 
1129
  CHANGED_TableList* new_table =
1130
1130
    (CHANGED_TableList*) trans_alloc(ALIGN_SIZE(sizeof(CHANGED_TableList))+
1131
1131
                                      key_length + 1);
1132
1132
  if (!new_table)
1303
1303
}
1304
1304
 
1305
1305
 
1306
 
/** 
 
1306
/**
1307
1307
  Cleanup an instance of this class for re-use
1308
1308
  at next execution of a prepared statement/
1309
1309
  stored procedure statement.
1360
1360
 
1361
1361
bool select_send::send_eof()
1362
1362
{
1363
 
  /* 
 
1363
  /*
1364
1364
    We may be passing the control from mysqld to the client: release the
1365
1365
    InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
1366
 
    by session 
 
1366
    by session
1367
1367
  */
1368
1368
  ha_release_temporary_latches(session);
1369
1369
 
1509
1509
  if (init_io_cache(cache, file, 0L, WRITE_CACHE, 0L, 1, MYF(MY_WME)))
1510
1510
  {
1511
1511
    my_close(file, MYF(0));
1512
 
    my_delete(path, MYF(0));  // Delete file on error, it was just created 
 
1512
    my_delete(path, MYF(0));  // Delete file on error, it was just created
1513
1513
    return -1;
1514
1514
  }
1515
1515
  return file;
1675
1675
            for the clients with character sets big5, cp932, gbk and sjis,
1676
1676
            which can have the escape character (0x5C "\" by default)
1677
1677
            as the second byte of a multi-byte sequence.
1678
 
            
 
1678
 
1679
1679
            If
1680
1680
            - pos[0] is a valid multi-byte head (e.g 0xEE) and
1681
1681
            - pos[1] is 0x00, which will be escaped as "\0",
1682
 
            
 
1682
 
1683
1683
            then we'll get "0xEE + 0x5C + 0x30" in the output file.
1684
 
            
 
1684
 
1685
1685
            If this file is later loaded using this sequence of commands:
1686
 
            
 
1686
 
1687
1687
            mysql> create table t1 (a varchar(128)) character set big5;
1688
1688
            mysql> LOAD DATA INFILE 'dump.txt' INTO Table t1;
1689
 
            
 
1689
 
1690
1690
            then 0x5C will be misinterpreted as the second byte
1691
1691
            of a multi-byte character "0xEE + 0x5C", instead of
1692
1692
            escape character for 0x00.
1693
 
            
 
1693
 
1694
1694
            To avoid this confusion, we'll escape the multi-byte
1695
1695
            head character too, so the sequence "0xEE + 0x00" will be
1696
1696
            dumped as "0x5C + 0xEE + 0x5C + 0x30".
1697
 
            
 
1697
 
1698
1698
            Note, in the condition below we only check if
1699
1699
            mbcharlen is equal to 2, because there are no
1700
1700
            character sets with mbmaxlen longer than 2
1800
1800
    unit->offset_limit_cnt--;
1801
1801
    return(0);
1802
1802
  }
1803
 
  if (row_count++ > 1) 
 
1803
  if (row_count++ > 1)
1804
1804
  {
1805
1805
    my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
1806
1806
    goto err;
1984
1984
int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
1985
1985
{
1986
1986
  unit= u;
1987
 
  
 
1987
 
1988
1988
  if (var_list.elements != list.elements)
1989
1989
  {
1990
1990
    my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
1991
1991
               ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
1992
1992
    return 1;
1993
 
  }               
 
1993
  }
1994
1994
  return 0;
1995
1995
}
1996
1996
 
2075
2075
    unit->offset_limit_cnt--;
2076
2076
    return(0);
2077
2077
  }
2078
 
  if (row_count++) 
 
2078
  if (row_count++)
2079
2079
  {
2080
2080
    my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
2081
2081
    return(1);
2397
2397
 
2398
2398
  PRE CONDITION:
2399
2399
    - Events of type 'RowEventT' have the type code 'type_code'.
2400
 
    
 
2400
 
2401
2401
  POST CONDITION:
2402
2402
    If a non-NULL pointer is returned, the pending event for thread 'session' will
2403
2403
    be an event of type 'RowEventT' (which have the type code 'type_code')
2412
2412
    If error, NULL.
2413
2413
 */
2414
2414
 
2415
 
template <class RowsEventT> Rows_log_event* 
 
2415
template <class RowsEventT> Rows_log_event*
2416
2416
Session::binlog_prepare_pending_rows_event(Table* table, uint32_t serv_id,
2417
2417
                                       size_t needed,
2418
2418
                                       bool is_transactional,
2455
2455
    TODO: Fix the code so that the last test can be removed.
2456
2456
  */
2457
2457
  if (!pending ||
2458
 
      pending->server_id != serv_id || 
 
2458
      pending->server_id != serv_id ||
2459
2459
      pending->get_table_id() != table->s->table_map_id ||
2460
 
      pending->get_type_code() != type_code || 
 
2460
      pending->get_type_code() != type_code ||
2461
2461
      pending->get_data_size() + needed > opt_binlog_rows_event_max_size ||
2462
2462
      !bitmap_cmp(pending->get_cols(), table->write_set))
2463
2463
    {
2496
2496
Session::binlog_prepare_pending_rows_event(Table*, uint32_t, size_t, bool,
2497
2497
                                       Delete_rows_log_event *);
2498
2498
 
2499
 
template Rows_log_event* 
 
2499
template Rows_log_event*
2500
2500
Session::binlog_prepare_pending_rows_event(Table*, uint32_t, size_t, bool,
2501
2501
                                       Update_rows_log_event *);
2502
2502
#endif
2615
2615
}
2616
2616
 
2617
2617
 
2618
 
int Session::binlog_write_row(Table* table, bool is_trans, 
2619
 
                          unsigned char const *record) 
2620
 
 
2618
int Session::binlog_write_row(Table* table, bool is_trans,
 
2619
                          unsigned char const *record)
 
2620
{
2621
2621
  assert(drizzle_bin_log.is_open());
2622
2622
 
2623
2623
  /*
2645
2645
int Session::binlog_update_row(Table* table, bool is_trans,
2646
2646
                           const unsigned char *before_record,
2647
2647
                           const unsigned char *after_record)
2648
 
 
2648
{
2649
2649
  assert(drizzle_bin_log.is_open());
2650
2650
 
2651
2651
  size_t const before_maxlen = table->max_row_length(before_record);
2676
2676
    ev->add_row_data(after_row, after_size);
2677
2677
}
2678
2678
 
2679
 
int Session::binlog_delete_row(Table* table, bool is_trans, 
 
2679
int Session::binlog_delete_row(Table* table, bool is_trans,
2680
2680
                           unsigned char const *record)
2681
 
 
2681
{
2682
2682
  assert(drizzle_bin_log.is_open());
2683
2683
 
2684
 
  /* 
 
2684
  /*
2685
2685
     Pack records into format for transfer. We are allocating more
2686
2686
     memory than needed, but that doesn't matter.
2687
2687
  */