Don't cast data when saving in the edit grid, so errors are seen and data doesn't get silently modified. Fixes #1994

pull/3/head
Akshay Joshi 2016-12-09 12:05:46 +00:00 committed by Dave Page
parent 81841cdb3c
commit b8d03d5dc2
3 changed files with 14 additions and 4 deletions

View File

@ -1980,8 +1980,6 @@ define(
')';
}
column_label = c.display_name + '<br>' + col_type;
// Identify cell type of column.
switch(type) {
case "json":
@ -2002,10 +2000,22 @@ define(
case "boolean":
col_cell = 'boolean';
break;
case "character":
case "character[]":
case "character varying":
case "character varying[]":
if (c.internal_size && c.internal_size != 65535) {
// Update column type to display length on column header
col_type += ' (' + c.internal_size + ')';
}
col_cell = 'string';
break;
default:
col_cell = 'string';
}
column_label = c.display_name + '<br>' + col_type;
var col = {
'name': c.name,
'label': column_label,

View File

@ -12,5 +12,5 @@ INSERT INTO {{ conn|qtIdent(nsp_name, object_name) }} (
{% set col_value = data_to_be_saved[col]|qtLiteral %}
{% endif %}
{########################################################}
{% if not loop.first %}, {% endif %}{{ col_value }}::{{data_type[col]}}{% endfor %}
{% if not loop.first %}, {% endif %}{{ col_value }}{% endfor %}
);

View File

@ -9,7 +9,7 @@ UPDATE {{ conn|qtIdent(nsp_name, object_name) }} SET
{% set col_value = data_to_be_saved[col]|qtLiteral %}
{% endif %}
{########################################################}
{% if not loop.first %}, {% endif %}{{ conn|qtIdent(col) }} = {{ col_value }}::{{data_type[col]}}{% endfor %}
{% if not loop.first %}, {% endif %}{{ conn|qtIdent(col) }} = {{ col_value }}{% endfor %}
WHERE
{% for pk in primary_keys %}
{% if not loop.first %} AND {% endif %}{{ conn|qtIdent(pk) }} = {{ primary_keys[pk]|qtLiteral }}{% endfor %};