Skip to content

Commit 11f288d

Browse files
author
Steinar H. Gunderson
committed
Bug #26927386: REDUCE COMPILATION TIME [noclose]
Cut the #include link from field.h to table.h. Change-Id: Ifb8b336cb274b03bcfd9682d027d907c8c875f2b
1 parent 7afd14a commit 11f288d

File tree

112 files changed

+320
-135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+320
-135
lines changed

sql/field.cc

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,12 @@ void Field_num::add_zerofill_and_unsigned(String &res) const
19551955
res.append(STRING_WITH_LEN(" zerofill"));
19561956
}
19571957

1958+
size_t Field::last_null_byte() const {
1959+
size_t bytes= do_last_null_byte();
1960+
DBUG_PRINT("debug", ("last_null_byte() ==> %ld", (long) bytes));
1961+
DBUG_ASSERT(bytes <= table->s->null_bytes);
1962+
return bytes;
1963+
}
19581964

19591965
void Field::make_field(Send_field *field)
19601966
{
@@ -11916,3 +11922,169 @@ bool Field::is_part_of_actual_key(THD *thd, uint cur_index, KEY *cur_index_info)
1191611922
part_of_key.is_set(cur_index) :
1191711923
part_of_key_not_extended.is_set(cur_index);
1191811924
}
11925+
11926+
void Field::set_default()
11927+
{
11928+
if (has_insert_default_function())
11929+
evaluate_insert_default_function();
11930+
else
11931+
copy_data(table->default_values_offset());
11932+
}
11933+
11934+
bool Field::is_null(my_ptrdiff_t row_offset) const
11935+
{
11936+
/*
11937+
if the field is NULLable, it returns NULLity based
11938+
on m_null_ptr[row_offset] value. Otherwise it returns
11939+
NULL flag depending on TABLE::has_null_row() value.
11940+
11941+
The table may have been marked as containing only NULL values
11942+
for all fields if it is a NULL-complemented row of an OUTER JOIN
11943+
or if the query is an implicitly grouped query (has aggregate
11944+
functions but no GROUP BY clause) with no qualifying rows. If
11945+
this is the case (in which TABLE::has_null_row() is true) and the
11946+
field is not nullable, the field is considered to be NULL.
11947+
11948+
Do not change the order of testing. Fields may be associated
11949+
with a TABLE object without being part of the current row.
11950+
For NULL value check to work for these fields, they must
11951+
have a valid m_null_ptr, and this pointer must be checked before
11952+
TABLE::has_null_row().
11953+
*/
11954+
if (real_maybe_null())
11955+
return (m_null_ptr[row_offset] & null_bit);
11956+
11957+
if (is_tmp_nullable())
11958+
return m_is_tmp_null;
11959+
11960+
return table->has_null_row();
11961+
}
11962+
11963+
bool Field::maybe_null() const
11964+
{
11965+
return real_maybe_null() || table->is_nullable();
11966+
}
11967+
11968+
uint Field::null_offset() const
11969+
{
11970+
return null_offset(table->record[0]);
11971+
}
11972+
11973+
uchar *Field::pack(uchar *to, const uchar *from)
11974+
{
11975+
DBUG_ENTER("Field::pack");
11976+
uchar *result= this->pack(to, from, UINT_MAX, table->s->db_low_byte_first);
11977+
DBUG_RETURN(result);
11978+
}
11979+
11980+
const uchar *Field::unpack(uchar* to, const uchar *from)
11981+
{
11982+
DBUG_ENTER("Field::unpack");
11983+
const uchar *result= unpack(to, from, 0U, table->s->db_low_byte_first);
11984+
DBUG_RETURN(result);
11985+
}
11986+
11987+
void Field::init(TABLE *table_arg)
11988+
{
11989+
orig_table= table= table_arg;
11990+
table_name= &table_arg->alias;
11991+
}
11992+
11993+
uchar *Field::pack_int16(uchar *to, const uchar *from, bool low_byte_first_to)
11994+
{
11995+
handle_int16(to, from, table->s->db_low_byte_first, low_byte_first_to);
11996+
return to + sizeof(int16);
11997+
}
11998+
11999+
const uchar *Field::unpack_int16(uchar* to, const uchar *from,
12000+
bool low_byte_first_from)
12001+
{
12002+
handle_int16(to, from, low_byte_first_from, table->s->db_low_byte_first);
12003+
return from + sizeof(int16);
12004+
}
12005+
12006+
uchar *Field::pack_int24(uchar *to, const uchar *from, bool low_byte_first_to)
12007+
{
12008+
handle_int24(to, from, table->s->db_low_byte_first, low_byte_first_to);
12009+
return to + 3;
12010+
}
12011+
12012+
const uchar *Field::unpack_int24(uchar* to, const uchar *from,
12013+
bool low_byte_first_from)
12014+
{
12015+
handle_int24(to, from, low_byte_first_from, table->s->db_low_byte_first);
12016+
return from + 3;
12017+
}
12018+
12019+
uchar *Field::pack_int32(uchar *to, const uchar *from, bool low_byte_first_to)
12020+
{
12021+
handle_int32(to, from, table->s->db_low_byte_first, low_byte_first_to);
12022+
return to + sizeof(int32);
12023+
}
12024+
12025+
const uchar *Field::unpack_int32(uchar* to, const uchar *from,
12026+
bool low_byte_first_from)
12027+
{
12028+
handle_int32(to, from, low_byte_first_from, table->s->db_low_byte_first);
12029+
return from + sizeof(int32);
12030+
}
12031+
12032+
uchar *Field::pack_int64(uchar* to, const uchar *from, bool low_byte_first_to)
12033+
{
12034+
handle_int64(to, from, table->s->db_low_byte_first, low_byte_first_to);
12035+
return to + sizeof(int64);
12036+
}
12037+
12038+
const uchar *Field::unpack_int64(uchar* to, const uchar *from,
12039+
bool low_byte_first_from)
12040+
{
12041+
handle_int64(to, from, low_byte_first_from, table->s->db_low_byte_first);
12042+
return from + sizeof(int64);
12043+
}
12044+
12045+
bool Field_longstr::is_updatable() const
12046+
{
12047+
DBUG_ASSERT(table && table->write_set);
12048+
return bitmap_is_set(table->write_set, field_index);
12049+
}
12050+
12051+
Field_varstring::Field_varstring(uchar *ptr_arg,
12052+
uint32 len_arg, uint length_bytes_arg,
12053+
uchar *null_ptr_arg, uchar null_bit_arg,
12054+
uchar auto_flags_arg,
12055+
const char *field_name_arg,
12056+
TABLE_SHARE *share, const CHARSET_INFO *cs)
12057+
:Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
12058+
auto_flags_arg, field_name_arg, cs),
12059+
length_bytes(length_bytes_arg)
12060+
{
12061+
share->varchar_fields++;
12062+
}
12063+
12064+
Field_varstring::Field_varstring(uint32 len_arg, bool maybe_null_arg,
12065+
const char *field_name_arg,
12066+
TABLE_SHARE *share, const CHARSET_INFO *cs)
12067+
:Field_longstr((uchar*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
12068+
NONE, field_name_arg, cs),
12069+
length_bytes(len_arg < 256 ? 1 :2)
12070+
{
12071+
share->varchar_fields++;
12072+
}
12073+
12074+
void Field_blob::store_length(uchar *i_ptr, uint i_packlength,
12075+
uint32 i_number)
12076+
{
12077+
store_length(i_ptr, i_packlength, i_number, table->s->db_low_byte_first);
12078+
}
12079+
12080+
uint32 Field_blob::get_length(uint row_offset)
12081+
{
12082+
return get_length(ptr+row_offset, this->packlength,
12083+
table->s->db_low_byte_first);
12084+
}
12085+
12086+
uint32 Field_blob::get_length(const uchar *ptr_arg)
12087+
{
12088+
return get_length(ptr_arg, this->packlength, table->s->db_low_byte_first);
12089+
}
12090+

0 commit comments

Comments
 (0)