Fix for edit tables declare, add return function for DB IO

DB IO return functions for inserted primary key and extended RETURNING
data

Add dev set for html options grouping addition for nested arrays/object
lists

Fix edit tables edit access uid declaration
This commit is contained in:
Clemens Schwaighofer
2020-09-07 07:09:23 +09:00
parent 7165a50b4d
commit 0ec0007569
4 changed files with 52 additions and 11 deletions

View File

@@ -43,6 +43,5 @@ trigger/trg_edit_scheme.sql
trigger/trg_edit_user.sql
trigger/trg_edit_visible_group.sql
trigger/trg_edit_menu_group.sql
trigger/trg_set_edit_access_uid.sql
# insert data
data/edit_tables.sql

View File

@@ -1,4 +0,0 @@
-- DROP TRIGGER trg_set_edit_access_uid ON edit_access;
CREATE TRIGGER trg_set_edit_access_uid
BEFORE INSERT OR UPDATE ON edit_access
FOR EACH ROW EXECUTE PROCEDURE set_edit_access_uid();

View File

@@ -1049,6 +1049,35 @@ function html_options_block(name, data, selected = '', multiple = 0, options_onl
element_option = cel('option', '', value, '', options);
// attach it to the select element
ael(element_select, element_option);
/*
// get the original data for this key
var opt_value = r_value[opt_key];
// if it is an object, we assume a sub group [original data]
if (isObject(opt_value)) {
element_group = document.createElement('optgroup');
element_group.label = opt_key;
// loop through attached sub key elements in order (key is orignal)
$.each(data.form_reference_order[key][opt_key], function(opt_group_pos, opt_group_key) {
var opt_group_value = r_value[opt_key][opt_group_key];
element_sub = document.createElement('option');
// check if w is object, if yes, the element is a subset drop down
element_sub.label = opt_group_value;
element_sub.value = opt_group_key;
element_sub.innerHTML = opt_group_value;
element_group.appendChild(element_sub);
});
element.appendChild(element_group);
} else if (!isObject(opt_key)) {
// if this is a plain element, attach as is
// we also skip any objects in the reference order group as they are handled different
element_sub = document.createElement('option');
element_sub.label = opt_value;
element_sub.value = opt_key;
element_sub.innerHTML = opt_value;
element.appendChild(element_sub);
}
*/
}
// if with select part, convert to text
if (!options_only) {

View File

@@ -1992,12 +1992,6 @@ class IO extends \CoreLibs\Basic
return $this->db_functions->__dbArrayParse($text, $output);
}
// METHOD: dbSqlEscape
// WAS : db_sql_escape
// PARAMS: value -> to escape data
// kbn -> escape trigger type
// RETURN: escaped value
// DESC : clear up any data for valid DB insert
/**
* clear up any data for valid DB insert
* @param int|float|string $value to escape data
@@ -2025,6 +2019,29 @@ class IO extends \CoreLibs\Basic
}
return $value;
}
/**
* return current set insert_id as is
* @return string|int|null Primary key value, most likely int
* Empty string for unset
* Null for error
*/
public function getInsertPK()
{
return $this->insert_id;
}
/**
* return the extended insert return string set
* Most likely Array
* @return array|string|null RETURNING values as array
* Empty string for unset
* Null for error
*/
public function getInsertReturn()
{
return $this->insert_id_ext;
}
} // end if db class
// __END__