View | Details | Raw Unified | Return to bug 22896 | Differences between
and this patch

Collapse All | Expand All

(-)umc/python/pkgdb/__init__.py (-2 / +29 lines)
 Lines 283-295    Link Here 
283
				what = 'fetching system roles'
283
				what = 'fetching system roles'
284
				sysroles = self._execute_query('sql_getall_systemroles');
284
				sysroles = self._execute_query('sql_getall_systemroles');
285
				PROPOSALS['sysrole'] = sysroles
285
				PROPOSALS['sysrole'] = sysroles
286
				MODULE.info("   ++ system roles: ['%s']" % "','".join(sysroles[0]))
286
				MODULE.info("   ++ system roles: ['%s']" % "','".join(sysroles))
287
	
287
	
288
			if not 'sysversion' in PROPOSALS:
288
			if not 'sysversion' in PROPOSALS:
289
				what = 'fetching system versions'
289
				what = 'fetching system versions'
290
				sysversions = self._execute_query('sql_getall_systemversions');
290
				sysversions = self._execute_query('sql_getall_systemversions');
291
				PROPOSALS['sysversion'] = sysversions
291
				PROPOSALS['sysversion'] = sysversions
292
				MODULE.info("   ++ system versions: ['%s']" % "','".join(sysversions[0]))
292
				MODULE.info("   ++ system versions: ['%s']" % "','".join(sysversions))
293
			
293
			
294
				# make 'systems not updated' pattern to a selection too
294
				# make 'systems not updated' pattern to a selection too
295
				PROPOSALS['systems_not_updated'] = PROPOSALS['sysversion']
295
				PROPOSALS['systems_not_updated'] = PROPOSALS['sysversion']
 Lines 725-730    Link Here 
725
			if result == None:
725
			if result == None:
726
				what = 'handling NONE result'
726
				what = 'handling NONE result'
727
				result = []
727
				result = []
728
			# DEBUG for #22896: the fetchall() call can return different data types.
729
			# Usually we expect an array of dictionaries:
730
			#
731
			#	result = [
732
			#				{ 'field1':'value1', 'field2':'value2' },
733
			#				{ ... }
734
			#			]
735
			#
736
			# but depending on the type of query, the fields are sometimes returned without names, as in:
737
			#
738
			#	result = [
739
			#				['one', 'two'], 
740
			#				['three', 'four']
741
			#			]
742
			#
743
			# For Grid-driven queries, this is not relevant. But for 'distinct' queries that are meant
744
			# for ComboBox data, we need one array containing all those values, so converting them here:
745
			#
746
			what = 'checking result type'
747
			
748
			if (len(result) > 0) and ("'list'" in str(type(result[0]))) and (len(result[0]) == 1):
749
				MODULE.info("   ++ Converting %d entries from single-element arrays to strings" % len(result))
750
				tmp = []
751
				for element in result:
752
					tmp.append(element[0])
753
				result = tmp
754
			 
728
			# Marshaler isn't able to handle too much data, so we limit the record count. Better SQL
755
			# Marshaler isn't able to handle too much data, so we limit the record count. Better SQL
729
			# execution should avoid returning too much data, but in the meantime, we work around here. 
756
			# execution should avoid returning too much data, but in the meantime, we work around here. 
730
			what = 'checking for record limit'
757
			what = 'checking for record limit'

Return to bug 22896