@@ -283,7 +283,10 @@ def to_python(value):
283283 elif is_list (value .type ):
284284 return list_out_converter (value )
285285 return dict_out_coverter (value )
286- return value
286+ try :
287+ return value .getvalue (0 )
288+ except AttributeError :
289+ return value
287290
288291
289292def to_record (value , record ):
@@ -345,19 +348,19 @@ def convert(object_type, value):
345348def make_in_converter (object_type ):
346349 def _in_converter (value ):
347350 var = object_type .newobject ()
348-
349- if object_type .iscollection :
350- if is_list (object_type ):
351- for val in value :
352- var .append (convert (object_type .elementType , val ))
351+ if value :
352+ if object_type .iscollection :
353+ if is_list (object_type ):
354+ for val in value :
355+ var .append (convert (object_type .elementType , val ))
356+ else :
357+ for key , val in value .items ():
358+ var .setelement (key , convert (object_type .elementType , val ))
353359 else :
354- for key , val in value .items ():
355- var .setelement (key , convert (object_type .elementType , val ))
356- else :
357- for attribute , val in zip (object_type .attributes , value ):
358- # todo: self made change to ObjectAttr.c (cx_Oracle should implement this)
359- # type is not accessible by default..
360- setattr (var , attribute .name , convert (attribute .type , val ))
360+ for attribute , val in zip (object_type .attributes , value ):
361+ # todo: self made change to ObjectAttr.c (cx_Oracle should implement this)
362+ # type is not accessible by default..
363+ setattr (var , attribute .name , convert (attribute .type , val ))
361364
362365 return var
363366
@@ -477,6 +480,29 @@ def wrap_named(match, plsql, resolved, cursor, named):
477480 return wrapped_named
478481
479482
483+ def in_out_parameters (positional , named , match : Overload ):
484+ in_out = []
485+ for pos , argument in zip (positional , match .arguments ):
486+ if argument .in_out in {Direction .out , Direction .in_out }:
487+ in_out .append ((pos , argument .argument_name .lower ()))
488+
489+ for argument in match .arguments :
490+ if argument .in_out in {Direction .out , Direction .in_out }:
491+ try :
492+ in_out .append (
493+ (
494+ named [argument .argument_name .lower ()],
495+ argument .argument_name .lower (),
496+ )
497+ )
498+ except KeyError :
499+ pass
500+
501+ in_out_rec = namedtuple ("InOutParams" , map (itemgetter (1 ), in_out ))
502+
503+ return in_out_rec (* map (to_python , map (itemgetter (0 ), in_out )))
504+
505+
480506def translate_arguments (match_filter ):
481507 def decorator (func ):
482508 @wraps (func )
@@ -495,9 +521,16 @@ def wrapper(self: Subprogram, *positional, **named):
495521
496522 result = func (self , match , cursor , wrapped_positional , wrapped_named )
497523
524+ in_out = in_out_parameters (wrapped_positional , wrapped_named , match )
525+
498526 if match .is_function :
527+ if in_out :
528+ return result , in_out
499529 return result
500530
531+ if in_out :
532+ return in_out
533+
501534 return wrapper
502535
503536 return decorator
@@ -543,8 +576,6 @@ def __call__(self, *args, **kwargs):
543576
544577 @property
545578 def overloaded (self ) -> bool :
546- """returns true if exists multiple definitions of the same subprogram in a package
547- only applicable for package procedures/functions where overloading is possible"""
548579 return len (self .overloads ) > 1
549580
550581 @property
@@ -557,7 +588,6 @@ def is_procedure(self) -> bool:
557588
558589 @property
559590 def standalone (self ) -> bool :
560- """returns true if procedure/function is not part of a package"""
561591 return self .resolved .object_type in {
562592 ObjectTypes .procedure ,
563593 ObjectTypes .function ,
0 commit comments