~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field.cc

  • Committer: Brian Aker
  • Date: 2011-01-26 06:48:39 UTC
  • mfrom: (2114.5.2 timestamp)
  • Revision ID: brian@tangent.org-20110126064839-nfcmqoqu08x22pdo
Merge in time tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1014
1014
{
1015
1015
  char buff[40];
1016
1016
  String tmp(buff,sizeof(buff),&my_charset_bin),*res;
1017
 
  if (!(res=val_str_internal(&tmp)) || str_to_datetime_with_warn(res->ptr(), res->length(),
1018
 
                                                                 &ltime, fuzzydate) <= type::DRIZZLE_TIMESTAMP_ERROR)
 
1017
 
 
1018
  assert(getTable() and getTable()->getSession());
 
1019
 
 
1020
  if (not (res=val_str_internal(&tmp)) or
 
1021
      str_to_datetime_with_warn(getTable()->getSession(),
 
1022
                                res->ptr(), res->length(),
 
1023
                                &ltime, fuzzydate) <= type::DRIZZLE_TIMESTAMP_ERROR)
1019
1024
  {
1020
 
    return 1;
 
1025
    return true;
1021
1026
  }
1022
1027
 
1023
 
  return 0;
 
1028
  return false;
1024
1029
}
1025
1030
 
1026
1031
bool Field::get_time(type::Time &ltime)
1030
1035
 
1031
1036
  if (!(res=val_str_internal(&tmp)) || str_to_time_with_warn(res->ptr(), res->length(), &ltime))
1032
1037
  {
1033
 
    return 1;
 
1038
    return true;
1034
1039
  }
1035
1040
 
1036
 
  return 0;
 
1041
  return false;
1037
1042
}
1038
1043
 
1039
1044
int Field::store_time(type::Time &ltime, type::timestamp_t)
1200
1205
                                 type::timestamp_t ts_type, 
1201
1206
                                 int cuted_increment)
1202
1207
{
1203
 
  Session *session= table ? table->in_use : current_session;
1204
 
  if ((session->really_abort_on_warning() &&
 
1208
  Session *session= (getTable() and getTable()->getSession()) ? getTable()->getSession() : current_session;
 
1209
 
 
1210
  if ((session->abortOnWarning() and
1205
1211
       level >= DRIZZLE_ERROR::WARN_LEVEL_WARN) ||
1206
1212
      set_warning(level, code, cuted_increment))
1207
1213
    make_truncated_value_warning(session, level, str, str_length, ts_type,
1214
1220
                                 type::timestamp_t ts_type,
1215
1221
                                 int cuted_increment)
1216
1222
{
1217
 
  Session *session= table ? table->in_use : current_session;
1218
 
  if (session->really_abort_on_warning() ||
 
1223
  Session *session= (getTable() and getTable()->getSession()) ? getTable()->getSession() : current_session;
 
1224
 
 
1225
  if (session->abortOnWarning() or
1219
1226
      set_warning(level, code, cuted_increment))
1220
1227
  {
1221
1228
    char str_nr[22];
1230
1237
                                 double nr, 
1231
1238
                                 type::timestamp_t ts_type)
1232
1239
{
1233
 
  Session *session= table ? table->in_use : current_session;
1234
 
  if (session->really_abort_on_warning() ||
 
1240
  Session *session= (getTable() and getTable()->getSession()) ? getTable()->getSession() : current_session;
 
1241
 
 
1242
  if (session->abortOnWarning() or
1235
1243
      set_warning(level, code, 1))
1236
1244
  {
1237
1245
    /* DBL_DIG is enough to print '-[digits].E+###' */