16 #include "table_session_connect.h"
21 { C_STRING_WITH_LEN(
"PROCESSLIST_ID") },
22 { C_STRING_WITH_LEN(
"int(11)") },
26 { C_STRING_WITH_LEN(
"ATTR_NAME") },
27 { C_STRING_WITH_LEN(
"varchar(32)") },
31 { C_STRING_WITH_LEN(
"ATTR_VALUE") },
32 { C_STRING_WITH_LEN(
"varchar(1024)") },
36 { C_STRING_WITH_LEN(
"ORDINAL_POSITION") },
37 { C_STRING_WITH_LEN(
"int(11)") },
65 bool parse_length_encoded_string(
const char **ptr,
66 char *dest, uint dest_size,
68 const char *start_ptr, uint input_length,
73 ulong copy_length, data_length;
74 const char *well_formed_error_pos= NULL, *cannot_convert_error_pos= NULL,
77 copy_length= data_length= net_field_length((uchar **) ptr);
80 if (data_length == NULL_LENGTH)
83 if (*ptr - start_ptr + data_length > input_length)
86 copy_length= well_formed_copy_nchars(&my_charset_utf8_bin, dest, dest_size,
87 from_cs, *ptr, data_length, nchars_max,
88 &well_formed_error_pos,
89 &cannot_convert_error_pos,
91 *copied_len= copy_length;
121 bool read_nth_attr(
const char *connect_attrs,
122 uint connect_attrs_length,
125 char *attr_name, uint max_attr_name,
126 uint *attr_name_length,
127 char *attr_value, uint max_attr_value,
128 uint *attr_value_length)
133 for (ptr= connect_attrs, idx= 0;
134 (uint)(ptr - connect_attrs) < connect_attrs_length && idx <= ordinal;
139 bool fill_in_attr_name= idx == ordinal;
140 bool fill_in_attr_value= idx == ordinal;
143 if (parse_length_encoded_string(&ptr,
144 attr_name, max_attr_name, ©_length,
146 connect_attrs_length,
148 connect_attrs_cs, 32) ||
154 *attr_name_length= copy_length;
157 if (parse_length_encoded_string(&ptr,
158 attr_value, max_attr_value, ©_length,
160 connect_attrs_length,
162 connect_attrs_cs, 1024))
166 *attr_value_length= copy_length;
175 void table_session_connect::make_row(
PFS_thread *pfs, uint ordinal)
184 safe_class= sanitize_thread_class(pfs->
m_class);
185 if (unlikely(safe_class == NULL))
189 if (! thread_fits(pfs))
223 return HA_ERR_RECORD_DELETED;
226 DBUG_ASSERT(table->s->null_bytes == 1);
229 for (; (f= *fields) ; fields++)
231 if (read_all || bitmap_is_set(table->read_set, f->field_index))
233 switch(f->field_index)
252 case FO_ORDINAL_POSITION:
264 table_session_connect::thread_fits(
PFS_thread *thread)