Don't attempt to render binary data in the query tool result grid. Fixes #2080. Fixes #2074.

This commit is contained in:
Harshal Dhumal
2017-07-20 13:09:47 +01:00
committed by Dave Page
parent 2eb151c2d9
commit 54882e061c
7 changed files with 63 additions and 11 deletions

View File

@@ -257,7 +257,8 @@ def check_transaction_status(trans_id):
try:
manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(trans_obj.sid)
conn = manager.connection(did=trans_obj.did, conn_id=trans_obj.conn_id)
conn = manager.connection(did=trans_obj.did, conn_id=trans_obj.conn_id,
use_binary_placeholder=True)
except Exception as e:
return False, internal_server_error(errormsg=str(e)), None, None, None
@@ -396,7 +397,8 @@ def start_query_tool(trans_id):
try:
manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(trans_obj.sid)
conn = manager.connection(did=trans_obj.did, conn_id=conn_id)
conn = manager.connection(did=trans_obj.did, conn_id=conn_id,
use_binary_placeholder=True)
except Exception as e:
return internal_server_error(errormsg=str(e))

View File

@@ -578,6 +578,7 @@ define('tools.querytool', [
name: c.label,
display_name: c.display_name,
column_type: c.column_type,
column_type_internal: c.column_type_internal,
not_null: c.not_null,
has_default_val: c.has_default_val
};
@@ -744,6 +745,11 @@ define('tools.querytool', [
// Listener function which will be called before user updates existing cell
// This will be used to collect primary key for that row
grid.onBeforeEditCell.subscribe(function (e, args) {
if (args.column.column_type_internal == 'bytea' ||
args.column.column_type_internal == 'bytea[]') {
return false;
}
var before_data = args.item;
// If newly added row is saved but grid is not refreshed,
@@ -2074,9 +2080,9 @@ define('tools.querytool', [
pg_types[pg_types.length - 1][0] : 'unknown';
if (!is_primary_key)
col_type += ' ' + type;
col_type += type;
else
col_type += ' [PK] ' + type;
col_type += '[PK] ' + type;
if (c.precision && c.precision >= 0 && c.precision != 65535) {
col_type += ' (' + c.precision;
@@ -2125,6 +2131,7 @@ define('tools.querytool', [
'name': c.name,
'display_name': c.display_name,
'column_type': col_type,
'column_type_internal': type,
'pos': c.pos,
'label': column_label,
'cell': col_cell,