~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2008-12-06 23:57:32 UTC
  • mfrom: (656.1.10 devel)
  • Revision ID: brian@tangent.org-20081206235732-jx228bczpvmxu8ww
Merge from Monty

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
*/
690
690
 
691
691
void Session::init_for_queries()
692
692
{
693
 
  set_time(); 
 
693
  set_time();
694
694
  ha_enable_transaction(this,true);
695
695
 
696
696
  reset_root_defaults(mem_root, variables.query_alloc_block_size,
732
732
  free((char*) variables.time_format);
733
733
  free((char*) variables.date_format);
734
734
  free((char*) variables.datetime_format);
735
 
  
 
735
 
736
736
  if (global_read_lock)
737
737
    unlock_global_read_lock(this);
738
738
 
776
776
    delete rli_fake;
777
777
    rli_fake= NULL;
778
778
  }
779
 
  
 
779
 
780
780
  free_root(&main_mem_root, MYF(0));
781
781
  return;
782
782
}
815
815
    to_var       add to this array
816
816
    from_var     from this array
817
817
    dec_var      minus this array
818
 
  
 
818
 
819
819
  NOTE
820
820
    This function assumes that all variables are long/ulong.
821
821
*/
836
836
void Session::awake(Session::killed_state state_to_set)
837
837
{
838
838
  Session_CHECK_SENTRY(this);
839
 
  safe_mutex_assert_owner(&LOCK_delete); 
 
839
  safe_mutex_assert_owner(&LOCK_delete);
840
840
 
841
841
  killed= state_to_set;
842
842
  if (state_to_set != Session::KILL_QUERY)
932
932
void Session::cleanup_after_query()
933
933
{
934
934
  /*
935
 
    Reset rand_used so that detection of calls to rand() will save random 
 
935
    Reset rand_used so that detection of calls to rand() will save random
936
936
    seeds if needed by the slave.
937
937
  */
938
938
  {
942
942
  if (first_successful_insert_id_in_cur_stmt > 0)
943
943
  {
944
944
    /* set what LAST_INSERT_ID() will return */
945
 
    first_successful_insert_id_in_prev_stmt= 
 
945
    first_successful_insert_id_in_prev_stmt=
946
946
      first_successful_insert_id_in_cur_stmt;
947
947
    first_successful_insert_id_in_cur_stmt= 0;
948
948
    substitute_null_with_insert_id= true;
1024
1024
    Session::convert_string
1025
1025
 
1026
1026
  DESCRIPTION
1027
 
    Convert string using convert_buffer - buffer for character set 
 
1027
    Convert string using convert_buffer - buffer for character set
1028
1028
    conversion shared between all protocols.
1029
1029
 
1030
1030
  RETURN
1059
1059
  charset_is_system_charset= !String::needs_conversion(0,charset(),
1060
1060
                                                       system_charset_info,
1061
1061
                                                       &not_used);
1062
 
  charset_is_collation_connection= 
 
1062
  charset_is_collation_connection=
1063
1063
    !String::needs_conversion(0,charset(),variables.collation_connection,
1064
1064
                              &not_used);
1065
 
  charset_is_character_set_filesystem= 
 
1065
  charset_is_character_set_filesystem=
1066
1066
    !String::needs_conversion(0, charset(),
1067
1067
                              variables.character_set_filesystem, &not_used);
1068
1068
}
1127
1127
 
1128
1128
CHANGED_TableList* Session::changed_table_dup(const char *key, long key_length)
1129
1129
{
1130
 
  CHANGED_TableList* new_table = 
 
1130
  CHANGED_TableList* new_table =
1131
1131
    (CHANGED_TableList*) trans_alloc(ALIGN_SIZE(sizeof(CHANGED_TableList))+
1132
1132
                                      key_length + 1);
1133
1133
  if (!new_table)
1304
1304
}
1305
1305
 
1306
1306
 
1307
 
/** 
 
1307
/**
1308
1308
  Cleanup an instance of this class for re-use
1309
1309
  at next execution of a prepared statement/
1310
1310
  stored procedure statement.
1361
1361
 
1362
1362
bool select_send::send_eof()
1363
1363
{
1364
 
  /* 
 
1364
  /*
1365
1365
    We may be passing the control from mysqld to the client: release the
1366
1366
    InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
1367
 
    by session 
 
1367
    by session
1368
1368
  */
1369
1369
  ha_release_temporary_latches(session);
1370
1370
 
1510
1510
  if (init_io_cache(cache, file, 0L, WRITE_CACHE, 0L, 1, MYF(MY_WME)))
1511
1511
  {
1512
1512
    my_close(file, MYF(0));
1513
 
    my_delete(path, MYF(0));  // Delete file on error, it was just created 
 
1513
    my_delete(path, MYF(0));  // Delete file on error, it was just created
1514
1514
    return -1;
1515
1515
  }
1516
1516
  return file;
1676
1676
            for the clients with character sets big5, cp932, gbk and sjis,
1677
1677
            which can have the escape character (0x5C "\" by default)
1678
1678
            as the second byte of a multi-byte sequence.
1679
 
            
 
1679
 
1680
1680
            If
1681
1681
            - pos[0] is a valid multi-byte head (e.g 0xEE) and
1682
1682
            - pos[1] is 0x00, which will be escaped as "\0",
1683
 
            
 
1683
 
1684
1684
            then we'll get "0xEE + 0x5C + 0x30" in the output file.
1685
 
            
 
1685
 
1686
1686
            If this file is later loaded using this sequence of commands:
1687
 
            
 
1687
 
1688
1688
            mysql> create table t1 (a varchar(128)) character set big5;
1689
1689
            mysql> LOAD DATA INFILE 'dump.txt' INTO Table t1;
1690
 
            
 
1690
 
1691
1691
            then 0x5C will be misinterpreted as the second byte
1692
1692
            of a multi-byte character "0xEE + 0x5C", instead of
1693
1693
            escape character for 0x00.
1694
 
            
 
1694
 
1695
1695
            To avoid this confusion, we'll escape the multi-byte
1696
1696
            head character too, so the sequence "0xEE + 0x00" will be
1697
1697
            dumped as "0x5C + 0xEE + 0x5C + 0x30".
1698
 
            
 
1698
 
1699
1699
            Note, in the condition below we only check if
1700
1700
            mbcharlen is equal to 2, because there are no
1701
1701
            character sets with mbmaxlen longer than 2
1801
1801
    unit->offset_limit_cnt--;
1802
1802
    return(0);
1803
1803
  }
1804
 
  if (row_count++ > 1) 
 
1804
  if (row_count++ > 1)
1805
1805
  {
1806
1806
    my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
1807
1807
    goto err;
1985
1985
int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
1986
1986
{
1987
1987
  unit= u;
1988
 
  
 
1988
 
1989
1989
  if (var_list.elements != list.elements)
1990
1990
  {
1991
1991
    my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
1992
1992
               ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
1993
1993
    return 1;
1994
 
  }               
 
1994
  }
1995
1995
  return 0;
1996
1996
}
1997
1997
 
2076
2076
    unit->offset_limit_cnt--;
2077
2077
    return(0);
2078
2078
  }
2079
 
  if (row_count++) 
 
2079
  if (row_count++)
2080
2080
  {
2081
2081
    my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
2082
2082
    return(1);
2398
2398
 
2399
2399
  PRE CONDITION:
2400
2400
    - Events of type 'RowEventT' have the type code 'type_code'.
2401
 
    
 
2401
 
2402
2402
  POST CONDITION:
2403
2403
    If a non-NULL pointer is returned, the pending event for thread 'session' will
2404
2404
    be an event of type 'RowEventT' (which have the type code 'type_code')
2413
2413
    If error, NULL.
2414
2414
 */
2415
2415
 
2416
 
template <class RowsEventT> Rows_log_event* 
 
2416
template <class RowsEventT> Rows_log_event*
2417
2417
Session::binlog_prepare_pending_rows_event(Table* table, uint32_t serv_id,
2418
2418
                                       size_t needed,
2419
2419
                                       bool is_transactional,
2456
2456
    TODO: Fix the code so that the last test can be removed.
2457
2457
  */
2458
2458
  if (!pending ||
2459
 
      pending->server_id != serv_id || 
 
2459
      pending->server_id != serv_id ||
2460
2460
      pending->get_table_id() != table->s->table_map_id ||
2461
 
      pending->get_type_code() != type_code || 
 
2461
      pending->get_type_code() != type_code ||
2462
2462
      pending->get_data_size() + needed > opt_binlog_rows_event_max_size ||
2463
2463
      !bitmap_cmp(pending->get_cols(), table->write_set))
2464
2464
    {
2497
2497
Session::binlog_prepare_pending_rows_event(Table*, uint32_t, size_t, bool,
2498
2498
                                       Delete_rows_log_event *);
2499
2499
 
2500
 
template Rows_log_event* 
 
2500
template Rows_log_event*
2501
2501
Session::binlog_prepare_pending_rows_event(Table*, uint32_t, size_t, bool,
2502
2502
                                       Update_rows_log_event *);
2503
2503
#endif