Reputation: 1975
I am fairly new to database programming and am trying to get a basic CRUD app going. Using Cruddy! I have a very limited application that reads the data dictionary and creates forms based on each table.
As several tables have extensive foreign key entries, I want my app to perform the join operations that would be necessary for each foreign key column to be displayed as the entries to which the key refers. Cruddy! claims to have this ability - it uses CGI::AutoForm
for the form creation. To get a form up and running, you have to provide entries on a column-by-column basis to a reference table ui_table_column
.
Rather than writing SQL statements for all of my tables and their affiliated columns, I'm trying to get the process right for a single column.
From my DDL for this table:
CONSTRAINT `fk_Holder_Sample1`
FOREIGN KEY (`sample_id`)
REFERENCES `sample` (`sample_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
And my attempts at setting up the AutoForm SQL entries:
INSERT INTO ui_table_column (
table_name, field_name, appear_order, heading, searchable, updatable, insertable, input_control_type, multi_insert_delimiter,
search_control_type, search_mult_select, use_data_dict, datatype, default_value, required, input_size, input_maxlength, brief_heading,
alt_mask_field, mask_table_name, mask_field_name, id_field_name, no_cache, radio_checkbox_cols, field_group, element_attrs, help_summary)
VALUES (
'SAMPLE', 'SAMPLE_ID', 10, 'ID', 'Y', 'N', 'N', 'TEXT', NULL,
'SELECT', 4, 'Y', NULL, NULL, NULL, NULL, NULL, NULL,
NULL, 'sample', 'name', 'sample_id', 'Y', NULL, NULL, NULL, NULL);
INSERT INTO ui_table_column (
table_name, field_name, appear_order, heading, searchable, updatable, insertable, input_control_type, multi_insert_delimiter,
search_control_type, search_mult_select, use_data_dict, datatype, default_value, required, input_size, input_maxlength, brief_heading,
alt_mask_field, mask_table_name, mask_field_name, id_field_name, no_cache, radio_checkbox_cols, field_group, element_attrs, help_summary)
VALUES (
'SAMPLE', 'SAMPLE_NAME', 20, 'Name', 'Y', 'Y', 'Y', 'TEXT', NULL,
'MATCH TEXT', NULL, 'Y', NULL, NULL, NULL, NULL, NULL, 'Name',
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO ui_table_column (
table_name, field_name, appear_order, heading, searchable, updatable, insertable, input_control_type, multi_insert_delimiter,
search_control_type, search_mult_select, use_data_dict, datatype, default_value, required, input_size, input_maxlength, brief_heading,
alt_mask_field, mask_table_name, mask_field_name, id_field_name, no_cache, radio_checkbox_cols, field_group, element_attrs, help_summary)
VALUES (
'HOLDER', 'SAMPLE_ID', 30, 'sample', 'Y', 'Y', 'Y', 'SELECT', NULL,
'SELECT', 4, 'Y', NULL, NULL, NULL, NULL, NULL, 'Sample',
NULL, 'sample', 'NAME', 'SAMPLE_ID', 'Y', NULL, NULL, NULL, NULL);
When I refresh my app page (both just refreshing the broswer and calling apachectl
) there is no change - that is, I still see Sample ID as a field in the Holder page.
Has anyone had success with this or can advise me on what I'm doing wrong?
EDIT: The silence from SO I take as indicative that this particular framework has not seen widespread use. I would like to open my question up a little, then, and ask what solutions have you used? I am actually experimenting with Catalyst::Plugin::AutoCRUD.
Upvotes: 1
Views: 381
Reputation: 731
Answered after learner concluded with another framework but for future reference these fields must be in UPPER CASE.
For the example above, the first and third insert statements would have: (alt_mask_field, mask_table_name, mask_field_name, id_field_name) = (NULL,'SAMPLE','NAME','SAMPLE_ID').
Upvotes: 2
Reputation: 1975
I wound up using the module in my edit. I will flag this as closed tomorrow.
Upvotes: 0