26 #include <drizzled/plugin.h>
27 #include <drizzled/plugin/plugin.h>
28 #include <drizzled/identifier.h>
29 #include <drizzled/message/table.pb.h>
30 #include <drizzled/charset.h>
31 #include <drizzled/field.h>
42 #define TABLE_FUNCTION_BLOB_SIZE 2049
46 static const char *local_string_append(
const char *arg1,
const char *arg2)
48 static char buffer[1024];
49 char *buffer_ptr= buffer;
50 strcpy(buffer_ptr, arg1);
51 buffer_ptr+= strlen(arg1);
54 strcpy(buffer_ptr, arg2);
63 std::string local_path;
64 std::string original_table_label;
70 TableFunction(
const char *schema_arg,
const char *table_arg) :
71 Plugin(local_string_append(schema_arg, table_arg) ,
"TableFunction"),
72 identifier(schema_arg, table_arg),
73 original_table_label(table_arg)
82 static void getNames(
const std::string &arg,
83 std::set<std::string> &set_of_names);
96 Field **columns_iterator;
118 bool sub_populate(uint32_t field_size);
120 virtual bool populate()
125 void push(uint64_t arg);
126 void push(int64_t arg);
127 void push(
const char *arg, uint32_t length= 0);
132 bool isWild(
const std::string &predicate);
140 const std::string &getTableLabel()
142 return original_table_label;
145 const std::string &getIdentifierTableName()
147 return identifier.getTableName();
150 const std::string &getSchemaHome()
152 return identifier.getSchemaName();
155 const std::string &getPath()
157 return identifier.getPath();
160 virtual Generator *generator(Field **arg);
162 void add_field(
const char *label,
163 message::Table::Field::FieldType type,
166 void add_field(
const char *label,
167 uint32_t field_length= MAXIMUM_IDENTIFIER_LENGTH);
169 void add_field(
const char *label,
170 TableFunction::ColumnType type,
171 bool is_default_null=
true);
173 void add_field(
const char *label,
174 TableFunction::ColumnType type,
175 uint32_t field_length,
176 bool is_default_null=
false);
178 virtual bool visible()
const {
return true; }