~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Mark Atwood
  • Date: 2011-11-11 18:23:18 UTC
  • mfrom: (2456.1.5 rf)
  • Revision ID: me@mark.atwood.name-20111111182318-skgcp9ce65fd2goa
mergeĀ lp:~olafvdspek/drizzle/refactor11

Show diffs side-by-side

added added

removed removed

Lines of Context:
348
348
                              const char *db_name,
349
349
                              const char *table_name)
350
350
{
351
 
  for (; table; table= table->*link )
 
351
  for (; table; table= table->*link)
352
352
  {
353
 
    if ((table->table == 0 || table->table->getShare()->getType() == message::Table::STANDARD) and
354
 
        my_strcasecmp(system_charset_info, table->getSchemaName(), db_name) == 0 and
355
 
        my_strcasecmp(system_charset_info, table->getTableName(), table_name) == 0)
 
353
    if ((table->table == 0 || table->table->getShare()->getType() == message::Table::STANDARD)
 
354
        && not system_charset_info->strcasecmp(table->getSchemaName(), db_name)
 
355
        && not system_charset_info->strcasecmp(table->getTableName(), table_name))
356
356
    {
357
357
      break;
358
358
    }
433
433
  {
434
434
    if ((! (res= find_table_in_global_list(table_list, d_name, t_name))) ||
435
435
        ((!res->table || res->table != table->table) &&
436
 
         (!check_alias || !(my_strcasecmp(files_charset_info, t_alias, res->alias))) &&
 
436
         (!check_alias || !(files_charset_info->strcasecmp(t_alias, res->alias))) &&
437
437
         res->select_lex && !res->select_lex->exclude_from_table_unique_test))
438
438
      break;
439
439
    /*
1792
1792
                           const char *name, uint32_t , Item **,
1793
1793
                           bool, TableList **actual_table)
1794
1794
{
1795
 
  List<Natural_join_column>::iterator
1796
 
    field_it(table_ref->join_columns->begin());
 
1795
  List<Natural_join_column>::iterator field_it(table_ref->join_columns->begin());
1797
1796
  Natural_join_column *nj_col, *curr_nj_col;
1798
1797
  Field *found_field;
1799
1798
 
1800
1799
  assert(table_ref->is_natural_join && table_ref->join_columns);
1801
1800
  assert(*actual_table == NULL);
1802
1801
 
1803
 
  for (nj_col= NULL, curr_nj_col= field_it++; curr_nj_col;
1804
 
       curr_nj_col= field_it++)
 
1802
  for (nj_col= NULL, curr_nj_col= field_it++; curr_nj_col; curr_nj_col= field_it++)
1805
1803
  {
1806
 
    if (!my_strcasecmp(system_charset_info, curr_nj_col->name(), name))
 
1804
    if (!system_charset_info->strcasecmp(curr_nj_col->name(), name))
1807
1805
    {
1808
1806
      if (nj_col)
1809
1807
      {
1854
1852
  uint32_t cached_field_index= *cached_field_index_ptr;
1855
1853
 
1856
1854
  /* We assume here that table->field < NO_CACHED_FIELD_INDEX = UINT_MAX */
1857
 
  if (cached_field_index < table->getShare()->sizeFields() &&
1858
 
      !my_strcasecmp(system_charset_info,
1859
 
                     table->getField(cached_field_index)->field_name, name))
 
1855
  if (cached_field_index < table->getShare()->sizeFields() 
 
1856
    && not system_charset_info->strcasecmp(table->getField(cached_field_index)->field_name, name))
1860
1857
  {
1861
1858
    field_ptr= table->getFields() + cached_field_index;
1862
1859
  }
1875
1872
  else
1876
1873
  {
1877
1874
    if (!(field_ptr= table->getFields()))
1878
 
      return((Field *)0);
 
1875
      return NULL;
1879
1876
    for (; *field_ptr; ++field_ptr)
1880
 
      if (!my_strcasecmp(system_charset_info, (*field_ptr)->field_name, name))
 
1877
      if (not system_charset_info->strcasecmp((*field_ptr)->field_name, name))
1881
1878
        break;
1882
1879
  }
1883
1880
 
1889
1886
  else
1890
1887
  {
1891
1888
    if (!allow_rowid ||
1892
 
        my_strcasecmp(system_charset_info, name, "_rowid") ||
 
1889
        system_charset_info->strcasecmp(name, "_rowid") ||
1893
1890
        table->getShare()->rowid_field_offset == 0)
1894
 
      return((Field*) 0);
 
1891
      return NULL;
1895
1892
    field= table->getField(table->getShare()->rowid_field_offset-1);
1896
1893
  }
1897
1894
 
1981
1978
        to search.
1982
1979
      */
1983
1980
      table_name && table_name[0] &&
1984
 
      (my_strcasecmp(table_alias_charset, table_list->alias, table_name) ||
 
1981
      (table_alias_charset->strcasecmp(table_list->alias, table_name) ||
1985
1982
       (db_name && db_name[0] && table_list->getSchemaName() && table_list->getSchemaName()[0] &&
1986
1983
        strcmp(db_name, table_list->getSchemaName()))))
1987
1984
    return 0;
2180
2177
      'name' of the item which may be used in the select list
2181
2178
    */
2182
2179
    strncpy(name_buff, db, sizeof(name_buff)-1);
2183
 
    my_casedn_str(files_charset_info, name_buff);
 
2180
    files_charset_info->casedn_str(name_buff);
2184
2181
    db= name_buff;
2185
2182
  }
2186
2183
 
2365
2362
          item is not fix_field()'ed yet.
2366
2363
        */
2367
2364
        if (item_field->field_name && item_field->table_name &&
2368
 
            !my_strcasecmp(system_charset_info, item_field->field_name,
2369
 
                           field_name) &&
2370
 
            !my_strcasecmp(table_alias_charset, item_field->table_name,
2371
 
                           table_name) &&
2372
 
            (!db_name || (item_field->db_name &&
2373
 
                          !strcmp(item_field->db_name, db_name))))
 
2365
            not system_charset_info->strcasecmp(item_field->field_name, field_name) &&
 
2366
            not table_alias_charset->strcasecmp(item_field->table_name, table_name) &&
 
2367
            (!db_name || (item_field->db_name && !strcmp(item_field->db_name, db_name))))
2374
2368
        {
2375
2369
          if (found_unaliased)
2376
2370
          {
2395
2389
      }
2396
2390
      else
2397
2391
      {
2398
 
        int fname_cmp= my_strcasecmp(system_charset_info,
2399
 
                                     item_field->field_name,
2400
 
                                     field_name);
2401
 
        if (!my_strcasecmp(system_charset_info,
2402
 
                           item_field->name,field_name))
 
2392
        int fname_cmp= system_charset_info->strcasecmp(item_field->field_name, field_name);
 
2393
        if (not system_charset_info->strcasecmp(item_field->name, field_name))
2403
2394
        {
2404
2395
          /*
2405
2396
            If table name was not given we should scan through aliases
2419
2410
          }
2420
2411
          found= li.ref();
2421
2412
          *counter= i;
2422
 
          *resolution= fname_cmp ? RESOLVED_AGAINST_ALIAS:
2423
 
            RESOLVED_WITH_NO_ALIAS;
 
2413
          *resolution= fname_cmp ? RESOLVED_AGAINST_ALIAS : RESOLVED_WITH_NO_ALIAS;
2424
2414
        }
2425
2415
        else if (!fname_cmp)
2426
2416
        {
2444
2434
    else if (!table_name)
2445
2435
    {
2446
2436
      if (is_ref_by_name && find->name && item->name &&
2447
 
          !my_strcasecmp(system_charset_info,item->name,find->name))
 
2437
          not system_charset_info->strcasecmp(item->name,find->name))
2448
2438
      {
2449
2439
        found= li.ref();
2450
2440
        *counter= i;
2517
2507
  {
2518
2508
    if (find_length != curr_str->length())
2519
2509
      continue;
2520
 
    if (!my_strcasecmp(system_charset_info, find, curr_str->ptr()))
 
2510
    if (not system_charset_info->strcasecmp(find, curr_str->ptr()))
2521
2511
      return true;
2522
2512
  }
2523
2513
  return false;
2642
2632
        here. These columns must be checked only on unqualified reference
2643
2633
        by name (e.g. in SELECT list).
2644
2634
      */
2645
 
      if (!my_strcasecmp(system_charset_info, field_name_1, cur_field_name_2))
 
2635
      if (!system_charset_info->strcasecmp(field_name_1, cur_field_name_2))
2646
2636
      {
2647
2637
        if (cur_nj_col_2->is_common ||
2648
2638
            (found && (!using_fields || is_using_column_1)))
2840
2830
          my_error(ER_BAD_FIELD_ERROR, MYF(0), using_field_name_ptr, session->where());
2841
2831
          return true;
2842
2832
        }
2843
 
        if (!my_strcasecmp(system_charset_info, common_field->name(), using_field_name_ptr))
 
2833
        if (!system_charset_info->strcasecmp(common_field->name(), using_field_name_ptr))
2844
2834
          break;                                // Found match
2845
2835
      }
2846
2836
    }
3392
3382
      'name' of the item which may be used in the select list
3393
3383
    */
3394
3384
    strncpy(name_buff, db_name, sizeof(name_buff)-1);
3395
 
    my_casedn_str(files_charset_info, name_buff);
 
3385
    files_charset_info->casedn_str(name_buff);
3396
3386
    db_name= name_buff;
3397
3387
  }
3398
3388
 
3415
3405
 
3416
3406
    assert(tables->is_leaf_for_name_resolution());
3417
3407
 
3418
 
    if ((table_name && my_strcasecmp(table_alias_charset, table_name, tables->alias)) ||
3419
 
        (db_name && my_strcasecmp(system_charset_info, tables->getSchemaName(),db_name)))
 
3408
    if ((table_name && table_alias_charset->strcasecmp(table_name, tables->alias)) ||
 
3409
        (db_name && system_charset_info->strcasecmp(tables->getSchemaName(),db_name)))
3420
3410
      continue;
3421
3411
 
3422
3412
    /*