|
1 | 1 | #------------------------------------------------------------------------------ |
2 | | -# Copyright (c) 2022, Oracle and/or its affiliates. |
| 2 | +# Copyright (c) 2022, 2023, Oracle and/or its affiliates. |
3 | 3 | # |
4 | 4 | # This software is dual-licensed to you under the Universal Permissive License |
5 | 5 | # (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License |
@@ -719,23 +719,35 @@ cdef class ThinDbObjectTypeCache: |
719 | 719 | t_SuperTypeOwner varchar2(128); |
720 | 720 | t_SuperTypeName varchar2(128); |
721 | 721 | t_SubTypeRefCursor sys_refcursor; |
| 722 | + t_Pos pls_integer; |
722 | 723 | begin |
723 | 724 | :ret_val := dbms_pickler.get_type_shape(:full_name, :oid, |
724 | 725 | :version, :tds, t_Instantiable, t_SuperTypeOwner, |
725 | 726 | t_SuperTypeName, :attrs_rc, t_SubTypeRefCursor); |
726 | 727 | :package_name := null; |
727 | | - begin |
728 | | - select owner, type_name |
729 | | - into :schema, :name |
730 | | - from all_types |
731 | | - where type_oid = :oid; |
732 | | - exception |
733 | | - when no_data_found then |
734 | | - select owner, package_name, type_name |
735 | | - into :schema, :package_name, :name |
736 | | - from all_plsql_types |
737 | | - where type_oid = :oid; |
738 | | - end; |
| 728 | + if substr(:full_name, length(:full_name) - 7) = '%ROWTYPE' then |
| 729 | + t_Pos := instr(:full_name, '.'); |
| 730 | + :schema := substr(:full_name, 1, t_Pos - 1); |
| 731 | + :name := substr(:full_name, t_Pos + 1); |
| 732 | + else |
| 733 | + begin |
| 734 | + select owner, type_name |
| 735 | + into :schema, :name |
| 736 | + from all_types |
| 737 | + where type_oid = :oid; |
| 738 | + exception |
| 739 | + when no_data_found then |
| 740 | + begin |
| 741 | + select owner, package_name, type_name |
| 742 | + into :schema, :package_name, :name |
| 743 | + from all_plsql_types |
| 744 | + where type_oid = :oid; |
| 745 | + exception |
| 746 | + when no_data_found then |
| 747 | + null; |
| 748 | + end; |
| 749 | + end; |
| 750 | + end if; |
739 | 751 | end;""") |
740 | 752 | self.meta_cursor = cursor |
741 | 753 |
|
@@ -939,17 +951,23 @@ cdef class ThinDbObjectTypeCache: |
939 | 951 | """ |
940 | 952 | cdef: |
941 | 953 | ThinDbObjectTypeImpl typ_impl |
942 | | - str full_name |
| 954 | + str full_name, name, suffix |
943 | 955 | while self.partial_types: |
944 | 956 | typ_impl = self.partial_types.pop() |
945 | 957 | if self.meta_cursor is None: |
946 | 958 | self._init_meta_cursor(conn) |
| 959 | + suffix = "%ROWTYPE" |
| 960 | + if typ_impl.name.endswith(suffix): |
| 961 | + name = typ_impl.name[:-len(suffix)] |
| 962 | + else: |
| 963 | + name = typ_impl.name |
| 964 | + suffix = "" |
947 | 965 | if typ_impl.package_name is not None: |
948 | 966 | full_name = f'"{typ_impl.schema}".' + \ |
949 | 967 | f'"{typ_impl.package_name}".' + \ |
950 | | - f'"{typ_impl.name}"' |
| 968 | + f'"{name}"{suffix}' |
951 | 969 | else: |
952 | | - full_name = f'"{typ_impl.schema}"."{typ_impl.name}"' |
| 970 | + full_name = f'"{typ_impl.schema}"."{name}"{suffix}' |
953 | 971 | self._populate_type_info(full_name, typ_impl) |
954 | 972 |
|
955 | 973 |
|
|
0 commit comments