~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-10-20 20:41:00 UTC
  • mfrom: (1863 staging)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: barry.leslie@primebase.com-20101020204100-oyj6p5cfssjw3p62
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
368
368
                           const string& schema_table_name)
369
369
{
370
370
  LEX_STRING db, table;
 
371
  bitset<NUM_OF_TABLE_OPTIONS> table_options;
371
372
  /*
372
373
     We have to make non const db_name & table_name
373
374
     because of lower_case_table_names
376
377
  session->make_lex_string(&table, schema_table_name, false);
377
378
 
378
379
  if (! sel->add_table_to_list(session, new Table_ident(db, table),
379
 
                               NULL, 0, TL_READ))
 
380
                               NULL, table_options, TL_READ))
380
381
  {
381
382
    return true;
382
383
  }
903
904
*/
904
905
 
905
906
TableList *Select_Lex::add_table_to_list(Session *session,
906
 
                                             Table_ident *table,
907
 
                                             LEX_STRING *alias,
908
 
                                             uint32_t table_options,
909
 
                                             thr_lock_type lock_type,
910
 
                                             List<Index_hint> *index_hints_arg,
911
 
                                             LEX_STRING *option)
 
907
                                                             Table_ident *table,
 
908
                                                             LEX_STRING *alias,
 
909
                                                             const bitset<NUM_OF_TABLE_OPTIONS>& table_options,
 
910
                                                             thr_lock_type lock_type,
 
911
                                                             List<Index_hint> *index_hints_arg,
 
912
                                         LEX_STRING *option)
912
913
{
913
914
  register TableList *ptr;
914
915
  TableList *previous_table_ref; /* The table preceding the current one. */
918
919
  if (!table)
919
920
    return NULL;                                // End of memory
920
921
  alias_str= alias ? alias->str : table->table.str;
921
 
  if (!test(table_options & TL_OPTION_ALIAS) &&
 
922
  if (! table_options.test(TL_OPTION_ALIAS) &&
922
923
      check_table_name(table->table.str, table->table.length))
923
924
  {
924
925
    my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
970
971
  ptr->table_name=table->table.str;
971
972
  ptr->table_name_length=table->table.length;
972
973
  ptr->lock_type=   lock_type;
973
 
  ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX);
974
 
  ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES);
 
974
  ptr->force_index= table_options.test(TL_OPTION_FORCE_INDEX);
 
975
  ptr->ignore_leaves= table_options.test(TL_OPTION_IGNORE_LEAVES);
975
976
  ptr->derived=     table->sel;
976
977
  ptr->select_lex=  lex->current_select;
977
978
  ptr->index_hints= index_hints_arg;
1434
1435
*/
1435
1436
 
1436
1437
static unsigned int
1437
 
kill_one_thread(Session *, ulong id, bool only_kill_query)
 
1438
kill_one_thread(Session *, session_id_t id, bool only_kill_query)
1438
1439
{
1439
1440
  Session *tmp= NULL;
1440
1441
  uint32_t error= ER_NO_SUCH_THREAD;
1441
 
  LOCK_thread_count.lock(); // For unlink from list
1442
1442
  
1443
 
  for (SessionList::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it )
1444
1443
  {
1445
 
    if ((*it)->thread_id == id)
 
1444
    boost::mutex::scoped_lock scoped(LOCK_thread_count);
 
1445
    for (SessionList::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it )
1446
1446
    {
1447
 
      tmp= *it;
1448
 
      tmp->lockForDelete();
1449
 
      break;
 
1447
      if ((*it)->thread_id == id)
 
1448
      {
 
1449
        tmp= *it;
 
1450
        tmp->lockForDelete();
 
1451
        break;
 
1452
      }
1450
1453
    }
1451
1454
  }
1452
 
  LOCK_thread_count.unlock();
 
1455
 
1453
1456
  if (tmp)
1454
1457
  {
1455
1458
 
1475
1478
    only_kill_query     Should it kill the query or the connection
1476
1479
*/
1477
1480
 
1478
 
void sql_kill(Session *session, ulong id, bool only_kill_query)
 
1481
void sql_kill(Session *session, int64_t id, bool only_kill_query)
1479
1482
{
1480
1483
  uint32_t error;
1481
1484
  if (!(error= kill_one_thread(session, id, only_kill_query)))