~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Brian Aker
  • Date: 2010-03-20 01:00:13 UTC
  • Revision ID: brian@gaz-20100320010013-zltu3fa01ufi34m4
Small corrections.

Show diffs side-by-side

added added

removed removed

Lines of Context:
605
605
  {
606
606
    if (table->s->tmp_table == TEMP_TABLE)
607
607
    {
608
 
      if (not strcmp(identifier.getSchemaName().c_str(), table->s->getSchemaName()))
 
608
      if (not identifier.getSchemaName().compare(table->s->getSchemaName()))
609
609
      {
610
 
        if (not strcmp(identifier.getTableName().c_str(), table->s->table_name.str))
 
610
        if (not identifier.getTableName().compare(table->s->table_name.str))
611
611
        {
612
612
          return true;
613
613
        }
625
625
  {
626
626
    if (table->s->tmp_table == TEMP_TABLE)
627
627
    {
628
 
      if (not strcmp(identifier.getSchemaName().c_str(), table->s->getSchemaName()))
 
628
      if (not identifier.getSchemaName().compare(table->s->getSchemaName()))
629
629
      {
630
 
        if (not strcmp(identifier.getTableName().c_str(), table->s->table_name.str))
 
630
        if (not identifier.getTableName().compare(table->s->table_name.str))
631
631
        {
632
632
          table_proto.CopyFrom(*(table->s->getTableProto()));
633
633
 
644
644
{
645
645
  char  key[MAX_DBKEY_LENGTH];
646
646
  uint  key_length;
647
 
  Table *table;
648
647
 
649
648
  key_length= TableShare::createKey(key, new_db, table_name);
650
649
 
651
 
  for (table= temporary_tables ; table ; table= table->next)
 
650
  for (Table *table= temporary_tables ; table ; table= table->next)
652
651
  {
653
652
    if (table->s->table_cache_key.length == key_length &&
654
 
        !memcmp(table->s->table_cache_key.str, key, key_length))
 
653
        not memcmp(table->s->table_cache_key.str, key, key_length))
 
654
    {
655
655
      return table;
 
656
    }
656
657
  }
657
658
  return NULL;                               // Not a temporary table
658
659
}
664
665
 
665
666
Table *Session::find_temporary_table(TableIdentifier &identifier)
666
667
{
667
 
  return find_temporary_table(identifier.getSchemaName().c_str(), identifier.getTableName().c_str());
 
668
  char  key[MAX_DBKEY_LENGTH];
 
669
  uint  key_length;
 
670
 
 
671
  key_length= TableShare::createKey(key, identifier);
 
672
 
 
673
  for (Table *table= temporary_tables ; table ; table= table->next)
 
674
  {
 
675
    if (table->s->table_cache_key.length == key_length &&
 
676
        not memcmp(table->s->table_cache_key.str, key, key_length))
 
677
 
 
678
      return table;
 
679
  }
 
680
 
 
681
  return NULL;                               // Not a temporary table
668
682
}
669
683
 
670
684
 
760
774
    list= *prev;
761
775
 
762
776
    if (list->s->table_cache_key.length == key_length &&
763
 
        !memcmp(list->s->table_cache_key.str, key, key_length))
 
777
        not memcmp(list->s->table_cache_key.str, key, key_length))
764
778
    {
765
779
      /* Remove table from open_tables list. */
766
780
      *prev= list->next;
1046
1060
    *table= 0;
1047
1061
    return false;
1048
1062
  }
1049
 
  if (!(*table= table_cache_insert_placeholder(key, key_length)))
 
1063
  if (not (*table= table_cache_insert_placeholder(key, key_length)))
1050
1064
  {
1051
1065
    pthread_mutex_unlock(&LOCK_open);
1052
1066
    return true;
1934
1948
 
1935
1949
  safe_mutex_assert_owner(&LOCK_open);
1936
1950
retry:
1937
 
  if (!(share= TableShare::getShare(session, table_list, cache_key,
1938
 
                                    cache_key_length,
1939
 
                                    table_list->i_s_requested_object,
1940
 
                                    &error)))
 
1951
  if (not (share= TableShare::getShare(session, table_list, cache_key,
 
1952
                                       cache_key_length,
 
1953
                                       table_list->i_s_requested_object,
 
1954
                                       &error)))
1941
1955
    return 1;
1942
1956
 
1943
1957
  while ((error= open_table_from_share(session, share, alias,
4427
4441
  for (uint32_t idx=0 ; idx < open_cache.records ; idx++)
4428
4442
  {
4429
4443
    Table *table=(Table*) hash_element(&open_cache,idx);
4430
 
    if (not strcmp(table->s->getSchemaName(), schema_name.c_str()))
 
4444
    if (not schema_name.compare(table->s->getSchemaName()))
4431
4445
    {
4432
4446
      table->s->version= 0L;                    /* Free when thread is ready */
4433
4447
      if (not table->in_use)