~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/field.cc

  • Committer: Lee Bieber
  • Date: 2011-01-12 02:31:03 UTC
  • mfrom: (2068.7.5 session-fix)
  • mto: This revision was merged to the branch mainline in revision 2076.
  • Revision ID: kalebral@gmail.com-20110112023103-nmz26cv1j32jc6n3
Merge Brian - fix bug 527084 - DROP TABLE: getTableDefiniton returns EEXIST but doDropTable returns ENOENT leads to SIGSEGV

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
   have_privileges(0),
166
166
   any_privileges(0)
167
167
{
168
 
  Select_Lex *select= getSession().getLex()->current_select;
 
168
  Select_Lex *select= current_session->lex->current_select;
169
169
  collation.set(DERIVATION_IMPLICIT);
170
170
 
171
171
  if (select && select->parsing_place != IN_HAVING)
262
262
  return result_field->val_str(str,&str_value);
263
263
}
264
264
 
265
 
bool Item_field::get_date(type::Time &ltime,uint32_t fuzzydate)
 
265
bool Item_field::get_date(type::Time *ltime,uint32_t fuzzydate)
266
266
{
267
267
  if ((null_value=field->is_null()) || field->get_date(ltime,fuzzydate))
268
268
  {
269
 
    ltime.reset();
 
269
    memset(ltime, 0, sizeof(*ltime));
270
270
    return 1;
271
271
  }
272
272
  return 0;
273
273
}
274
274
 
275
 
bool Item_field::get_date_result(type::Time &ltime,uint32_t fuzzydate)
 
275
bool Item_field::get_date_result(type::Time *ltime,uint32_t fuzzydate)
276
276
{
277
277
  if ((null_value=result_field->is_null()) ||
278
278
      result_field->get_date(ltime,fuzzydate))
279
279
  {
280
 
    ltime.reset();
 
280
    memset(ltime, 0, sizeof(*ltime));
281
281
    return 1;
282
282
  }
283
283
  return 0;
284
284
}
285
285
 
286
 
bool Item_field::get_time(type::Time &ltime)
 
286
bool Item_field::get_time(type::Time *ltime)
287
287
{
288
288
  if ((null_value=field->is_null()) || field->get_time(ltime))
289
289
  {
290
 
    ltime.reset();
 
290
    memset(ltime, 0, sizeof(*ltime));
291
291
    return 1;
292
292
  }
293
293
  return 0;
319
319
bool Item_field::val_bool_result()
320
320
{
321
321
  if ((null_value= result_field->is_null()))
322
 
  {
323
322
    return false;
324
 
  }
325
 
 
326
323
  switch (result_field->result_type()) {
327
324
  case INT_RESULT:
328
325
    return result_field->val_int() != 0;
332
329
      type::Decimal decimal_value;
333
330
      type::Decimal *val= result_field->val_decimal(&decimal_value);
334
331
      if (val)
335
 
        return not val->isZero();
 
332
        return not val->is_zero();
336
333
      return 0;
337
334
    }
338
335
 
369
366
    (In cases where we would choose wrong we would have to generate a
370
367
    ER_NON_UNIQ_ERROR).
371
368
  */
372
 
  return (not my_strcasecmp(system_charset_info, item_field->name, field_name) &&
373
 
          (not item_field->table_name || not table_name ||
374
 
           (not my_strcasecmp(table_alias_charset, item_field->table_name, table_name) &&
375
 
            (not item_field->db_name || not db_name ||
376
 
             (item_field->db_name && not my_strcasecmp(system_charset_info, item_field->db_name, db_name))))));
 
369
  return (!my_strcasecmp(system_charset_info, item_field->name,
 
370
                         field_name) &&
 
371
          (!item_field->table_name || !table_name ||
 
372
           (!my_strcasecmp(table_alias_charset, item_field->table_name,
 
373
                           table_name) &&
 
374
            (!item_field->db_name || !db_name ||
 
375
             (item_field->db_name && !strcasecmp(item_field->db_name,
 
376
                                             db_name))))));
377
377
}
378
378
 
379
379
 
380
380
table_map Item_field::used_tables() const
381
381
{
382
382
  if (field->getTable()->const_table)
383
 
  {
384
383
    return 0;                                   // const item
385
 
  }
386
 
 
387
384
  return (depended_from ? OUTER_REF_TABLE_BIT : field->getTable()->map);
388
385
}
389
386
 
640
637
    if (upward_lookup)
641
638
    {
642
639
      // We can't say exactly what absent table or field
643
 
      my_error(ER_BAD_FIELD_ERROR, MYF(0), full_name(), session->where());
 
640
      my_error(ER_BAD_FIELD_ERROR, MYF(0), full_name(), session->where);
644
641
    }
645
642
    else
646
643
    {
824
821
            {
825
822
              /* The column to which we link isn't valid. */
826
823
              my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name,
827
 
                       session->where());
 
824
                       current_session->where);
828
825
              return(1);
829
826
            }
830
827