I have this table schema at the moment:
CREATE TABLE MCP_VIEWS_ARGUMENTS (
id BIGINT UNSIGNED NOT NULL auto_increment
,parent_id BIGINT UNSIGNED NULL
,view_id BIGINT UNSIGNED NOT NULL
,arg_name VARCHAR(128) NOT NULL
,value_get VARCHAR(128) NULL
,value_post VARCHAR(128) NULL
,value_args TINYINT UNSIGNED NULL
,value_args_absolute TINYINT UNSIGNED NULL
,value_func VARCHAR(128) NULL
,value_func_args LONGTEXT NULL
,value_dao VARCHAR(255) NULL
,value_dao_method VARCHAR(255) NULL
,value_dao_args LONGTEXT NULL
,value_eval LONGTEXT NULL
,required TINYINT UNSIGNED NOT NULL DEFAULT '0'
,PRIMARY KEY(id)
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
I’m not happy with it really.
The idea is that an argument, represented by a single row can be resolved to one of several places.
- get array
- post array
- internal URL arguments; ie. /1/2/3/4
- function w/ serialized arguments being passed
- dao method call w/ arguments being passed
- php snippet to be evaled
So I am attempting to figure out the best to support all those possible scenarios, though only a single one will ever exist. Preferably without adding a whole bunch of extra tables per each scenario as that will get messy real quick.
Similarly I have another table:
CREATE TABLE MCP_VIEWS_FILTER_VALUES (
id BIGINT UNSIGNED NOT NULL auto_increment
,filters_id BIGINT UNSIGNED NOT NULL
,value_static TEXT NULL
,value_argument_id BIGINT UNSIGNED NULL
,value_field_id BIGINT UNSIGNED NULL
,wildcard ENUM('%s%','%s','s%') NULL
,regex VARCHAR(255) NULL
,PRIMARY KEY(id)
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
Which is a little similar though a little less messy. In that case there are three possible scenarios for value_*.
- static text string
- foreign key reference to the argument table above
- foreign key reference to a field (another table in the system)
Perhaps there is a a better way to do this also. Though the same concept here is shared across several tables.
The SQL posted above it pseudo code at this point, to be refined once a proper design is established for what I’m trying to accomplish.
thanks