@@ -458,44 +458,64 @@ END$$;
458
458
459
459
460
460
461
-
462
461
463
462
-- =================
464
- -- for adding typdef into the database
465
- -- SP__insert_typdef_actual_definition
463
+ -- for adding idnet into the database
464
+ -- SP__insert_ident_formal_definition
466
465
-- IN
467
- -- p_obj_id integer - metadata id of this SBR
466
+ -- p_obj_id integer - metadata id of this ident
468
467
-- p_use_desc varchar - human readable description
469
- -- p_data_type_id - data type for the typdef
468
+ -- p_data_type_id - data type for the idnet
470
469
-- OUT
471
470
-- r_definition_id integer - id of the start
472
471
-- ====================================
473
472
473
+ CREATE OR REPLACE PROCEDURE SP__insert_ident_formal_definition(IN p_obj_id integer , p_use_desc varchar , p_fp_spec_id integer , INOUT r_definition_id integer )
474
+ LANGUAGE plpgsql
475
+ AS $$ BEGIN
476
+ CALL SP__insert_obj_formal_definition(p_obj_id, p_use_desc, r_definition_id);
477
+ INSERT INTO ident_formal_definition(obj_formal_definition_id, fp_spec_id) VALUES (r_definition_id, p_fp_spec_id);
478
+ end$$;
479
+
474
480
475
- CREATE OR REPLACE PROCEDURE SP__insert_typdef_actual_definition(IN p_obj_id integer , p_use_desc varchar , p_data_type_id integer , INOUT r_definition_id integer )
481
+ -- =================
482
+ -- for adding idnet into the database
483
+ -- SP__insert_ident_actual_definition
484
+ -- IN
485
+ -- p_obj_id integer - metadata id of this ident
486
+ -- p_use_desc varchar - human readable description
487
+ -- p_data_type_id - data type for the idnet
488
+ -- OUT
489
+ -- r_definition_id integer - id of the start
490
+ -- ====================================
491
+
492
+ CREATE OR REPLACE PROCEDURE SP__insert_ident_actual_definition(IN p_obj_id integer , p_use_desc varchar , p_ap_spec_id integer , INOUT r_definition_id integer )
476
493
LANGUAGE plpgsql
477
494
AS $$ BEGIN
478
495
CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id);
479
- INSERT INTO ident_actual_definition(obj_actual_definition_id, data_type_id ) VALUES (r_definition_id, p_data_type_id );
496
+ INSERT INTO ident_actual_definition(obj_actual_definition_id, ap_spec_id ) VALUES (r_definition_id, p_ap_spec_id );
480
497
end$$;
481
498
482
- -- STORED PROCEDURE(S)
483
499
484
- --
485
- --
486
- -- CREATE OR REPLACE PROCEDURE SP__insert_data_value(IN p_value_converted varchar, p_value_string varchar, INOUT r_value_id integer)
487
500
488
- -- INSERT INTO data_value(value_converted, value_string) VALUES(p_value_converted, p_value_string) RETURNING INTO_id INTO ;
489
- -- end$$;
490
- --
501
+ -- =================
502
+ -- for adding typdef into the database
503
+ -- SP__insert_typdef_actual_definition
504
+ -- IN
505
+ -- p_obj_id integer - metadata id of this typdef
506
+ -- p_use_desc varchar - human readable description
507
+ -- p_data_type_id - data type for the typdef
508
+ -- OUT
509
+ -- r_definition_id integer - id of the typdef
510
+ -- ====================================
511
+
512
+ CREATE OR REPLACE PROCEDURE SP__insert_typdef_actual_definition(IN p_obj_id integer , p_use_desc varchar , p_data_type_id integer , INOUT r_definition_id integer )
513
+ LANGUAGE plpgsql
514
+ AS $$ BEGIN
515
+ CALL SP__insert_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id);
516
+ INSERT INTO typedef_actual_definition(obj_actual_definition_id, data_type_id) VALUES (r_definition_id, p_data_type_id);
517
+ end$$;
491
518
492
- -- ==================================================================
493
- -- Author: David Linko
494
- --
495
- -- Description: inserting, updating and removing EDD formal and actual definitions
496
- -- using the obj routines
497
- --
498
- -- ==================================================================
499
519
500
520
-- ==================================================================
501
521
-- SP__insert_edd_formal_definition;
@@ -1210,6 +1230,54 @@ end$$;
1210
1230
1211
1231
1212
1232
1233
+
1234
+
1235
+
1236
+
1237
+ -- STORED PROCEDURE(S) for the creating updating and deleting reports and report templates
1238
+
1239
+
1240
+ -- auto adds ac which can be troublesome
1241
+ -- user has to make ac first
1242
+ /*
1243
+
1244
+ CREATE OR REPLACE PROCEDURE SP__insert_report_template_metadata_format(IN p_metadata_count integer, p_metadata_types_list varchar, p_metadata_names_list varchar, p_metadata_desc varchar, INOUT r_tnvc_id integer)
1245
+ LANGUAGE plpgsql
1246
+ AS $$ BEGIN
1247
+ INSERT INTO type_name_value_collection(num_entries, use_desc) VALUES(p_metadata_count, p_metadata_desc) RETURNING type_name_value_collection_id INTO r_tnvc_id;
1248
+ @s := 'INSERT INTO type_name_value(tnvc_id, data_type, data_name, order_num) VALUES';
1249
+ @loops := 1;
1250
+ WHILE @loops < p_metadata_count DO
1251
+ LANGUAGE plpgsql
1252
+ AS $$ BEGIN
1253
+ -- @metadata_type
1254
+ @metadata_type := TRIM(SUBSTRING_INDEX(p_metadata_types_list, ',', 1));
1255
+ SELECT REPLACE(p_metadata_types_list, CONCAT(@metadata_type, ','), '') into p_metadata_types_list
1256
+
1257
+ -- @metadata_name
1258
+ @metadata_name := TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1));
1259
+ SELECT REPLACE(p_metadata_names_list, CONCAT(@metadata_name, ','), '') into p_metadata_names_list;
1260
+
1261
+ @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM data_type where type_name = metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, '),');
1262
+ @loops := loops + 1;
1263
+ END;
1264
+ END WHILE;
1265
+
1266
+ -- @metadata_type
1267
+ @metadata_type := TRIM((SUBSTRING_INDEX(p_metadata_types_list, ',', 1)));
1268
+
1269
+ -- @metadata_name
1270
+ @metadata_name := TRIM(SUBSTRING_INDEX(p_metadata_names_list, ',', 1));
1271
+
1272
+ @s = CONCAT(@s, '(', r_tnvc_id, ',', (SELECT enum_id FROM data_type where type_name = metadata_type), ',', '\'', @metadata_name, '\'', ',', @loops, ');');
1273
+ PREPARE stmt FROM @s;
1274
+ EXECUTE stmt;
1275
+
1276
+ end$$;
1277
+
1278
+ */
1279
+
1280
+
1213
1281
-- ==================================================================
1214
1282
-- create a report template formal def
1215
1283
-- SP__insert_report_template_metadata_format
@@ -1403,6 +1471,21 @@ end$$;
1403
1471
1404
1472
1405
1473
1474
+
1475
+ --
1476
+ --
1477
+ -- -- table_definition_id, use_desc,
1478
+ -- CREATE OR REPLACE PROCEDURE SP__insert_table_instance(IN p_obj_definition_id integer, p_use_desc varchar, p_row_values_list varchar(10000), INOUT r_instance_id integer)
1479
+
1480
+ --
1481
+ -- -- have to visit how to store multiple rows is is just one long value collection splitting at every num_colmns?
1482
+ -- CALL SP__insert_obj_instance(p_obj_definition_id, p_use_desc, r_instance_id);
1483
+ -- @n_rows = (select num_entries from type_name_value_collection where tnvc_id =(select columns_list from table_template_definition where definition_id = p_obj_definition_id));
1484
+ -- CALL SP__insert_tnv_collection(@num_rows, null, null, p_row_values_list , @tnvc_id);
1485
+ -- INSERT INTO table_instance(instance_id, ap_spec_id) VALUES(r_instance_id, p_ap_spec_id);
1486
+ -- end$$;
1487
+ --
1488
+
1406
1489
-- STORED PROCEDURE(S) for adding updating and deleting time base rule defintions and instances
1407
1490
-- need type checking for actions, they need to be Macros or controls
1408
1491
@@ -1463,6 +1546,8 @@ end$$;
1463
1546
1464
1547
1465
1548
1549
+
1550
+
1466
1551
--
1467
1552
1468
1553
@@ -1540,3 +1625,43 @@ exp_id int;
1540
1625
CALL SP__delete_obj_actual_definition(p_obj_id, p_use_desc, r_definition_id);
1541
1626
1542
1627
end$$;
1628
+
1629
+
1630
+ CREATE OR REPLACE PROCEDURE SP__add_agent_parameter_received(IN p_manager_id INTEGER , p_registered_agents_id INTEGER , p_agent_parameter_id int , p_command_parameters VARCHAR )
1631
+ LANGUAGE plpgsql
1632
+ as $$ BEGIN
1633
+ INSERT INTO agent_parameter_received(manager_id, registered_agents_id, agent_parameter_id, command_parameters) VALUES (p_manager_id, p_registered_agents_id, p_agent_parameter_id, p_command_parameters);
1634
+ END$$;
1635
+
1636
+
1637
+ CREATE OR REPLACE PROCEDURE SP__add_agent_parameter(IN p_command_name VARCHAR , p_command_parameters VARCHAR )
1638
+ LANGUAGE plpgsql
1639
+ as $$ BEGIN
1640
+ INSERT INTO agent_parameter(command_name, command_parameters) VALUES (p_command_name, p_command_parameters);
1641
+ END$$;
1642
+
1643
+
1644
+ -- # for testing the delete function
1645
+
1646
+
1647
+ -- p_obj_name := 'bundles_by_priority';
1648
+ -- select * from obj_definition join obj_identifier on obj_definition.obj_id = obj_identifier.obj_id;
1649
+ -- -- select definition_id from obj_definition where obj_id = (SELECT obj_id FROM obj_identifier WHERE obj_name = p_obj_name);
1650
+
1651
+ -- -- set @fp_spec_id_control_definitionobj_definitionformal_parmspecedd1 = (select fp_spec_id from edd_definition where definition_id = (select definition_id from obj_definition where obj_id = (SELECT obj_id FROM obj_identifier WHERE obj_name = p_obj_name)));
1652
+ -- -- CALL SP__insert_actual_parms_set(1, @fp_spec_id_edd1, 'UINT', '1', @ap_spec_id);
1653
+ -- -- CALL SP__insert_edd_instance(@edd_definition_id_9, @ap_spec_id,NULL, @edd_inst_id_1);
1654
+
1655
+
1656
+ -- -- Select * from obj_definition;
1657
+ -- -- SELECT obj_id FROM obj_identifier WHERE obj_name = p_obj_name;
1658
+ -- -- SELECT * from obj_definition where obj_id = (SELECT obj_id FROM obj_identifier WHERE obj_name = p_obj_name);
1659
+
1660
+ -- SELECT * FROM vw_edd_instance;
1661
+ -- -- CALL SP__delete_obj_definition(0, null, @p_obj_name);
1662
+ -- call SP__delete_edd_instance(null, 'bundles_by_priority');
1663
+ -- -- CALL SP__delete_edd_instance(null, @p_o-- bj_name);
1664
+
1665
+ -- SELECT * FROM vw_edd_instance;
1666
+
1667
+
0 commit comments