21 #include "my_global.h"
22 #include "my_pthread.h"
30 THR_LOCK table_setup_actors::m_table_lock;
35 { C_STRING_WITH_LEN(
"HOST") },
36 { C_STRING_WITH_LEN(
"char(60)") },
40 { C_STRING_WITH_LEN(
"USER") },
41 { C_STRING_WITH_LEN(
"char(16)") },
45 { C_STRING_WITH_LEN(
"ROLE") },
46 { C_STRING_WITH_LEN(
"char(16)") },
52 table_setup_actors::m_field_def=
58 { C_STRING_WITH_LEN(
"setup_actors") },
61 table_setup_actors::write_row,
62 table_setup_actors::delete_all_rows,
63 table_setup_actors::get_row_count,
76 int table_setup_actors::write_row(
TABLE *
table,
unsigned char *
buf,
80 String user_data(
"%", 1, &my_charset_utf8_bin);
81 String host_data(
"%", 1, &my_charset_utf8_bin);
82 String role_data(
"%", 1, &my_charset_utf8_bin);
87 for (; (f= *fields) ; fields++)
89 if (bitmap_is_set(table->write_set, f->field_index))
91 switch(f->field_index)
108 if (user->length() == 0 || host->length() == 0 || role->length() == 0)
109 return HA_ERR_WRONG_COMMAND;
111 return insert_setup_actor(user, host, role);
114 int table_setup_actors::delete_all_rows(
void)
116 return reset_setup_actor();
119 ha_rows table_setup_actors::get_row_count(
void)
121 return setup_actor_count();
124 table_setup_actors::table_setup_actors()
126 m_row_exists(false), m_pos(0), m_next_pos(0)
139 for (m_pos.
set_at(&m_next_pos);
152 return HA_ERR_END_OF_FILE;
169 return HA_ERR_RECORD_DELETED;
209 if (unlikely(! m_row_exists))
210 return HA_ERR_RECORD_DELETED;
213 DBUG_ASSERT(table->s->null_bytes == 1);
215 for (; (f= *fields) ; fields++)
217 if (read_all || bitmap_is_set(table->read_set, f->field_index))
219 switch(f->field_index)
240 const unsigned char *old_buf,
241 unsigned char *new_buf,
246 for (; (f= *fields) ; fields++)
248 if (bitmap_is_set(table->write_set, f->field_index))
250 switch(f->field_index)
255 return HA_ERR_WRONG_COMMAND;
267 const unsigned char *buf,
270 DBUG_ASSERT(m_row_exists);
277 return delete_setup_actor(&user, &host, &role);