~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Mark Atwood
  • Date: 2011-08-12 04:08:33 UTC
  • mfrom: (2385.2.17 refactor5)
  • Revision ID: me@mark.atwood.name-20110812040833-u6j85nc6ahuc0dtz
mergeĀ lp:~olafvdspek/drizzle/refactor5

Show diffs side-by-side

added added

removed removed

Lines of Context:
861
861
                              instead of using lex_str value
862
862
  @return  NULL on failure, or pointer to the lex_string_t object
863
863
*/
864
 
lex_string_t *Session::make_lex_string(lex_string_t *lex_str,
865
 
                                     const std::string &str,
866
 
                                     bool allocate_lex_string)
867
 
{
868
 
  return make_lex_string(lex_str, str.c_str(), str.length(), allocate_lex_string);
869
 
}
870
 
 
871
 
lex_string_t *Session::make_lex_string(lex_string_t *lex_str,
872
 
                                     const char* str, uint32_t length,
873
 
                                     bool allocate_lex_string)
874
 
{
875
 
  if (allocate_lex_string)
 
864
lex_string_t* Session::make_lex_string(lex_string_t* lex_str, str_ref str)
 
865
{
 
866
  if (not lex_str)
876
867
    lex_str= new (mem) lex_string_t;
877
 
  lex_str->str= mem_root->strdup(str, length);
878
 
  lex_str->length= length;
 
868
  lex_str->str= mem_root->strdup(str);
 
869
  lex_str->length= str.size();
879
870
  return lex_str;
880
871
}
881
872
 
894
885
  item->maybe_null=1;
895
886
  field_list.push_back(item= new Item_empty_string("key", NAME_CHAR_LEN, cs));
896
887
  item->maybe_null=1;
897
 
  field_list.push_back(item=
898
 
    new Item_empty_string("key_len",
899
 
                          MAX_KEY *
900
 
                          (MAX_KEY_LENGTH_DECIMAL_WIDTH + 1 /* for comma */),
901
 
                          cs));
902
 
  item->maybe_null=1;
903
 
  field_list.push_back(item=new Item_empty_string("ref",
904
 
                                                  NAME_CHAR_LEN*MAX_REF_PARTS,
905
 
                                                  cs));
906
 
  item->maybe_null=1;
907
 
  field_list.push_back(item= new Item_return_int("rows", 10,
908
 
                                                 DRIZZLE_TYPE_LONGLONG));
 
888
  field_list.push_back(item= new Item_empty_string("key_len", MAX_KEY * (MAX_KEY_LENGTH_DECIMAL_WIDTH + 1 /* for comma */), cs));
 
889
  item->maybe_null=1;
 
890
  field_list.push_back(item= new Item_empty_string("ref", NAME_CHAR_LEN*MAX_REF_PARTS, cs));
 
891
  item->maybe_null=1;
 
892
  field_list.push_back(item= new Item_return_int("rows", 10, DRIZZLE_TYPE_LONGLONG));
909
893
  if (lex().describe & DESCRIBE_EXTENDED)
910
894
  {
911
895
    field_list.push_back(item= new Item_float("filtered", 0.1234, 2, 4));
1332
1316
  char buff[MAX_FIELD_WIDTH];
1333
1317
  String tmp(buff,sizeof(buff),&my_charset_bin),*res;
1334
1318
  tmp.length(0);
1335
 
  Item *item;
1336
1319
 
1337
1320
  if (unit->offset_limit_cnt)
1338
1321
  {                                             // using limit offset,count
1344
1327
    my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
1345
1328
    return 1;
1346
1329
  }
1347
 
  while ((item=li++))
 
1330
  while (Item* item=li++)
1348
1331
  {
1349
1332
    res=item->str_result(&tmp);
1350
1333
    if (!res)                                   // If NULL