~skinny.moey/drizzle/innodb-replication

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Brian Aker
  • Date: 2010-11-08 22:35:57 UTC
  • mfrom: (1802.1.114 trunk)
  • Revision ID: brian@tangent.org-20101108223557-w3xzwp9hjjtjhtc1
MergeĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
851
851
    - the found item on success
852
852
    - NULL if find_item is not in group_list
853
853
*/
854
 
static Item** find_field_in_group_list(Item *find_item, order_st *group_list)
 
854
static Item** find_field_in_group_list(Item *find_item, Order *group_list)
855
855
{
856
856
  const char *db_name;
857
857
  const char *table_name;
858
858
  const char *field_name;
859
 
  order_st *found_group= NULL;
 
859
  Order *found_group= NULL;
860
860
  int found_match_degree= 0;
861
861
  Item_ident *cur_field;
862
862
  int cur_match_degree= 0;
882
882
 
883
883
  assert(field_name != 0);
884
884
 
885
 
  for (order_st *cur_group= group_list ; cur_group ; cur_group= cur_group->next)
 
885
  for (Order *cur_group= group_list ; cur_group ; cur_group= cur_group->next)
886
886
  {
887
887
    if ((*(cur_group->item))->real_item()->type() == Item::FIELD_ITEM)
888
888
    {
944
944
{
945
945
  Item **group_by_ref= NULL;
946
946
  Item **select_ref= NULL;
947
 
  order_st *group_list= (order_st*) select->group_list.first;
 
947
  Order *group_list= (Order*) select->group_list.first;
948
948
  bool ambiguous_fields= false;
949
949
  uint32_t counter;
950
950
  enum_resolution_type resolution;
1124
1124
  Field *field;
1125
1125
  assert(collation.collation);
1126
1126
  if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
 
1127
  {
1127
1128
    field= new Field_blob(max_length, maybe_null, name,
1128
1129
                          collation.collation);
 
1130
  }
1129
1131
  else
1130
 
    field= new Field_varstring(max_length, maybe_null, name, table->getMutableShare(),
 
1132
  {
 
1133
    table->setVariableWidth();
 
1134
    field= new Field_varstring(max_length, maybe_null, name,
1131
1135
                               collation.collation);
 
1136
  }
1132
1137
 
1133
1138
  if (field)
1134
1139
    field->init(table);
1187
1192
  case DRIZZLE_TYPE_VARCHAR:
1188
1193
    return make_string_field(table);
1189
1194
  case DRIZZLE_TYPE_BLOB:
1190
 
    if (this->type() == Item::TYPE_HOLDER)
1191
 
      field= new Field_blob(max_length, maybe_null, name, collation.collation,
1192
 
                            1);
1193
 
    else
1194
1195
      field= new Field_blob(max_length, maybe_null, name, collation.collation);
1195
1196
    break;                                      // Blob handled outside of case
1196
1197
  }
1588
1589
    if ((type= item->field_type()) == DRIZZLE_TYPE_DATETIME ||
1589
1590
        type == DRIZZLE_TYPE_DATE ||
1590
1591
        type == DRIZZLE_TYPE_TIMESTAMP)
 
1592
    {
1591
1593
      new_field= item->tmp_table_field_from_field_type(table, 1);
1592
 
    /*
1593
 
      Make sure that the blob fits into a Field_varstring which has
1594
 
      2-byte lenght.
1595
 
    */
 
1594
      /*
 
1595
        Make sure that the blob fits into a Field_varstring which has
 
1596
        2-byte lenght.
 
1597
      */
 
1598
    }
1596
1599
    else if (item->max_length/item->collation.collation->mbmaxlen > 255 &&
1597
1600
             convert_blob_length <= Field_varstring::MAX_SIZE &&
1598
1601
             convert_blob_length)
 
1602
    {
 
1603
      table->setVariableWidth();
1599
1604
      new_field= new Field_varstring(convert_blob_length, maybe_null,
1600
 
                                     item->name, table->getMutableShare(),
1601
 
                                     item->collation.collation);
 
1605
                                     item->name, item->collation.collation);
 
1606
    }
1602
1607
    else
 
1608
    {
1603
1609
      new_field= item->make_string_field(table);
 
1610
    }
1604
1611
    new_field->set_derivation(item->collation.derivation);
1605
1612
    break;
1606
1613
  case DECIMAL_RESULT: