@@ -350,32 +350,7 @@ cdef class ConnectParamsImpl:
350350 # otherwise, see if the connect string is an EasyConnect string
351351 m = re.search(EASY_CONNECT_PATTERN, connect_string)
352352 if m is not None :
353-
354- # build up arguments
355- args = m.groupdict()
356- connect_string = connect_string[m.end():]
357- params_pos = connect_string.find(" ?" )
358- if params_pos >= 0 :
359- params = connect_string[params_pos + 1 :]
360- for part in params.split(" &" ):
361- name, value = [s.strip() for s in part.split(" =" , 1 )]
362- name = name.lower()
363- name = ALTERNATIVE_PARAM_NAMES.get(name, name)
364- if value.startswith(' "' ) and value.endswith(' "' ):
365- value = value[1 :- 1 ]
366- args[name] = value
367-
368- # create description list
369- address = self ._default_address.copy()
370- address.set_from_args(args)
371- description = self ._default_description.copy()
372- description.set_from_connect_data_args(args)
373- description.set_from_description_args(args)
374- description.set_from_security_args(args)
375- description.children = [AddressList()]
376- description.children[0 ].children.append(address)
377- self .description_list = DescriptionList()
378- self .description_list.children.append(description)
353+ self ._parse_easy_connect_string(connect_string, m)
379354
380355 # otherwise, see if the name is a connect alias in a tnsnames.ora
381356 # configuration file
@@ -386,8 +361,50 @@ cdef class ConnectParamsImpl:
386361 if connect_string is None :
387362 errors._raise_err(errors.ERR_TNS_ENTRY_NOT_FOUND, name = name,
388363 file_name = tnsnames_file.file_name)
389- _parse_connect_descriptor(connect_string, args)
390- self ._process_connect_descriptor(args)
364+ m = re.search(EASY_CONNECT_PATTERN, connect_string)
365+ if m is not None :
366+ self ._parse_easy_connect_string(connect_string, m)
367+ else :
368+ _parse_connect_descriptor(connect_string, args)
369+ self ._process_connect_descriptor(args)
370+
371+ cdef int _parse_easy_connect_string(self , str connect_string,
372+ object match) except - 1 :
373+ """
374+ Internal method for parsing an Easy Connect string.
375+ """
376+ cdef:
377+ str params, part, name, value, s
378+ Description description
379+ ssize_t params_pos
380+ Address address
381+ dict args
382+
383+ # determine arguments
384+ args = match.groupdict()
385+ connect_string = connect_string[match.end():]
386+ params_pos = connect_string.find(" ?" )
387+ if params_pos >= 0 :
388+ params = connect_string[params_pos + 1 :]
389+ for part in params.split(" &" ):
390+ name, value = [s.strip() for s in part.split(" =" , 1 )]
391+ name = name.lower()
392+ name = ALTERNATIVE_PARAM_NAMES.get(name, name)
393+ if value.startswith(' "' ) and value.endswith(' "' ):
394+ value = value[1 :- 1 ]
395+ args[name] = value
396+
397+ # create description list
398+ address = self ._default_address.copy()
399+ address.set_from_args(args)
400+ description = self ._default_description.copy()
401+ description.set_from_connect_data_args(args)
402+ description.set_from_description_args(args)
403+ description.set_from_security_args(args)
404+ description.children = [AddressList()]
405+ description.children[0 ].children.append(address)
406+ self .description_list = DescriptionList()
407+ self .description_list.children.append(description)
391408
392409 cdef int _process_connect_descriptor(self , dict args) except - 1 :
393410 """
0 commit comments