~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-19 14:57:31 UTC
  • mto: This revision was merged to the branch mainline in revision 2445.
  • Revision ID: olafvdspek@gmail.com-20111019145731-y8ycpcinn2pkp3vg
Use str_ref

Show diffs side-by-side

added added

removed removed

Lines of Context:
1080
1080
  assert(getTable() and getTable()->getSession());
1081
1081
 
1082
1082
  String* res= val_str_internal(&tmp);
1083
 
  return not res or str_to_datetime_with_warn(getTable()->getSession(), res->ptr(), res->length(), &ltime, fuzzydate) <= type::DRIZZLE_TIMESTAMP_ERROR;
 
1083
  return not res or str_to_datetime_with_warn(*getTable()->getSession(), *res, ltime, fuzzydate) <= type::DRIZZLE_TIMESTAMP_ERROR;
1084
1084
}
1085
1085
 
1086
1086
bool Field::get_time(type::Time &ltime) const
1089
1089
  String tmp(buff,sizeof(buff),&my_charset_bin);
1090
1090
 
1091
1091
  String* res= val_str_internal(&tmp);
1092
 
  return not res or str_to_time_with_warn(getTable()->getSession(), res->ptr(), res->length(), &ltime);
 
1092
  return not res or str_to_time_with_warn(*getTable()->getSession(), *res, ltime);
1093
1093
}
1094
1094
 
1095
1095
int Field::store_time(type::Time &ltime, type::timestamp_t)
1247
1247
  if ((session->abortOnWarning() and
1248
1248
       level >= DRIZZLE_ERROR::WARN_LEVEL_WARN) ||
1249
1249
      set_warning(level, code, cuted_increment))
1250
 
    make_truncated_value_warning(session, level, str, str_length, ts_type,
1251
 
                                 field_name);
 
1250
    make_truncated_value_warning(*session, level, str_ref(str, str_length), ts_type, field_name);
1252
1251
}
1253
1252
 
1254
1253
void Field::set_datetime_warning(DRIZZLE_ERROR::enum_warning_level level, 
1264
1263
  {
1265
1264
    char str_nr[DECIMAL_LONGLONG_DIGITS];
1266
1265
    char *str_end= internal::int64_t10_to_str(nr, str_nr, -10);
1267
 
    make_truncated_value_warning(session, level, str_nr, (uint32_t) (str_end - str_nr),
1268
 
                                 ts_type, field_name);
 
1266
    make_truncated_value_warning(*session, level, str_ref(str_nr, (uint32_t) (str_end - str_nr)), ts_type, field_name);
1269
1267
  }
1270
1268
}
1271
1269
 
1282
1280
    /* DBL_DIG is enough to print '-[digits].E+###' */
1283
1281
    char str_nr[DBL_DIG + 8];
1284
1282
    uint32_t str_len= snprintf(str_nr, sizeof(str_nr), "%g", nr);
1285
 
    make_truncated_value_warning(session, level, str_nr, str_len, ts_type,
1286
 
                                 field_name);
 
1283
    make_truncated_value_warning(*session, level, str_ref(str_nr, str_len), ts_type, field_name);
1287
1284
  }
1288
1285
}
1289
1286