827
827
unsigned char *null_ptr_arg,
828
828
unsigned char null_bit_arg,
829
829
utype unireg_check_arg,
830
const char *field_name_arg) :
830
const char *field_name_arg)
832
833
null_ptr(null_ptr_arg),
834
835
orig_table(NULL),
835
836
field_name(field_name_arg),
836
comment(NULL_LEX_STRING),
839
839
part_of_key_not_clustered(0),
840
840
part_of_sortkey(0),
841
841
unireg_check(unireg_check_arg),
842
842
field_length(length_arg),
843
flags(null_ptr ? 0: NOT_NULL_FLAG),
845
843
null_bit(null_bit_arg),
846
844
is_created_from_null_item(false)
846
flags= null_ptr ? 0: NOT_NULL_FLAG;
847
comment.str= (char*) "";
850
852
void Field::hash(uint32_t *nr, uint32_t *nr2)
1008
1010
return copy->length+ store_length;
1011
bool Field::get_date(type::Time <ime, uint32_t fuzzydate)
1013
char buff[type::Time::MAX_STRING_LENGTH];
1014
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
1016
assert(getTable() and getTable()->getSession());
1018
if (not (res=val_str_internal(&tmp)) or
1019
str_to_datetime_with_warn(getTable()->getSession(),
1020
res->ptr(), res->length(),
1021
<ime, fuzzydate) <= type::DRIZZLE_TIMESTAMP_ERROR)
1029
bool Field::get_time(type::Time <ime)
1031
char buff[type::Time::MAX_STRING_LENGTH];
1032
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
1034
if (not (res= val_str_internal(&tmp)) or
1035
str_to_time_with_warn(getTable()->getSession(), res->ptr(), res->length(), <ime))
1043
int Field::store_time(type::Time <ime, type::timestamp_t)
1049
return store(tmp.ptr(), tmp.length(), &my_charset_bin);
1013
bool Field::get_date(type::Time *ltime,uint32_t fuzzydate)
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) <= DRIZZLE_TIMESTAMP_ERROR)
1026
bool Field::get_time(type::Time *ltime)
1029
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
1031
if (!(res=val_str_internal(&tmp)) || str_to_time_with_warn(res->ptr(), res->length(), ltime))
1039
int Field::store_time(type::Time *ltime, enum enum_drizzle_timestamp_type)
1041
char buff[MAX_DATE_STRING_REP_LENGTH];
1042
uint32_t length= (uint32_t) my_TIME_to_str(ltime, buff);
1043
return store(buff, length, &my_charset_bin);
1052
1046
bool Field::optimize_range(uint32_t idx, uint32_t)
1201
1195
drizzled::error_t code,
1202
1196
const char *str,
1203
1197
uint32_t str_length,
1204
type::timestamp_t ts_type,
1198
enum enum_drizzle_timestamp_type ts_type,
1205
1199
int cuted_increment)
1207
Session *session= (getTable() and getTable()->getSession()) ? getTable()->getSession() : current_session;
1209
if ((session->abortOnWarning() and
1201
Session *session= table ? table->in_use : current_session;
1202
if ((session->really_abort_on_warning() &&
1210
1203
level >= DRIZZLE_ERROR::WARN_LEVEL_WARN) ||
1211
1204
set_warning(level, code, cuted_increment))
1212
1205
make_truncated_value_warning(session, level, str, str_length, ts_type,
1216
1209
void Field::set_datetime_warning(DRIZZLE_ERROR::enum_warning_level level,
1217
1210
drizzled::error_t code,
1219
type::timestamp_t ts_type,
1212
enum enum_drizzle_timestamp_type ts_type,
1220
1213
int cuted_increment)
1222
Session *session= (getTable() and getTable()->getSession()) ? getTable()->getSession() : current_session;
1224
if (session->abortOnWarning() or
1215
Session *session= table ? table->in_use : current_session;
1216
if (session->really_abort_on_warning() ||
1225
1217
set_warning(level, code, cuted_increment))
1227
char str_nr[DECIMAL_LONGLONG_DIGITS];
1228
1220
char *str_end= internal::int64_t10_to_str(nr, str_nr, -10);
1229
1221
make_truncated_value_warning(session, level, str_nr, (uint32_t) (str_end - str_nr),
1230
1222
ts_type, field_name);
1234
1226
void Field::set_datetime_warning(DRIZZLE_ERROR::enum_warning_level level,
1235
1227
const drizzled::error_t code,
1237
type::timestamp_t ts_type)
1229
enum enum_drizzle_timestamp_type ts_type)
1239
Session *session= (getTable() and getTable()->getSession()) ? getTable()->getSession() : current_session;
1241
if (session->abortOnWarning() or
1231
Session *session= table ? table->in_use : current_session;
1232
if (session->really_abort_on_warning() ||
1242
1233
set_warning(level, code, 1))
1244
1235
/* DBL_DIG is enough to print '-[digits].E+###' */