|
1 | 1 | # ----------------------------------------------------------------------------- |
2 | | -# Copyright (c) 2020, 2023, Oracle and/or its affiliates. |
| 2 | +# Copyright (c) 2020, 2024, 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 |
@@ -129,6 +129,40 @@ async def get_admin_connection_async(use_async=False): |
129 | 129 | return await get_admin_connection(use_async=True) |
130 | 130 |
|
131 | 131 |
|
| 132 | +def get_charset(): |
| 133 | + value = PARAMETERS.get("CHARSET") |
| 134 | + if value is None: |
| 135 | + with get_connection() as conn: |
| 136 | + with conn.cursor() as cursor: |
| 137 | + cursor.execute( |
| 138 | + """ |
| 139 | + select value |
| 140 | + from nls_database_parameters |
| 141 | + where parameter = 'NLS_CHARACTERSET' |
| 142 | + """ |
| 143 | + ) |
| 144 | + (value,) = cursor.fetchone() |
| 145 | + PARAMETERS["CHARSET"] = value |
| 146 | + return value |
| 147 | + |
| 148 | + |
| 149 | +async def get_charset_async(): |
| 150 | + value = PARAMETERS.get("CHARSET") |
| 151 | + if value is None: |
| 152 | + async with get_connection_async() as conn: |
| 153 | + with conn.cursor() as cursor: |
| 154 | + await cursor.execute( |
| 155 | + """ |
| 156 | + select value |
| 157 | + from nls_database_parameters |
| 158 | + where parameter = 'NLS_CHARACTERSET' |
| 159 | + """ |
| 160 | + ) |
| 161 | + (value,) = await cursor.fetchone() |
| 162 | + PARAMETERS["CHARSET"] = value |
| 163 | + return value |
| 164 | + |
| 165 | + |
132 | 166 | def get_charset_ratios(): |
133 | 167 | value = PARAMETERS.get("CS_RATIO") |
134 | 168 | if value is None: |
|
0 commit comments