Using the correct type name (along with the internal name) while

generating the query for update/insert table data (Data grid).

Modified by Ashesh for array support.

Fixes #2830
This commit is contained in:
Akshay Joshi
2017-11-30 12:49:09 +05:30
committed by Ashesh Vashi
parent f10733e8d4
commit 281b6c91b5

View File

@@ -708,6 +708,7 @@ def poll(trans_id):
col_type = dict()
col_type['type_code'] = col['type_code']
col_type['type_name'] = None
col_type['internal_size'] = col['internal_size']
columns[col['name']] = col_type
if rset:
@@ -727,7 +728,29 @@ def poll(trans_id):
for col_info in columns.values():
for col_type in types:
if col_type['oid'] == col_info['type_code']:
col_info['type_name'] = col_type['typname']
typname = col_type['typname']
# If column is of type character, character[],
# character varying and character varying[]
# then add internal size to it's name for the
# correct sql query.
if col_info['internal_size'] >= 0:
if (
typname == 'character' or
typname == 'character varying'
):
typname = typname + '(' + \
str(col_info['internal_size']) + \
')'
elif (
typname == 'character[]' or
typname == 'character varying[]'
):
typname = typname[:-2] + '(' + \
str(col_info['internal_size']) + \
')[]'
col_info['type_name'] = typname
session_obj['columns_info'] = columns
# status of async_fetchmany_2darray is True and result is none