1 parent
48f4fac89e
commit
bd7ed63468
5 files changed
+63
-27
No files matched your search
@@ -3123,22 +3123,9 @@ pub(crate) fn qualified_table_name(
|
||||
crate::sql_dialect::qualified_table_name(database_type, schema, table_name)
|
||||
}
|
||||
|
||||
fn iris_data_grid_identifier(name: &str, identifier_quote: Option<&str>) -> String {
|
||||
let mut chars = name.chars();
|
||||
let ordinary = chars.next().is_some_and(|first| first == '_' || first == '%' || first.is_alphabetic())
|
||||
&& chars.all(|ch| ch == '_' || ch.is_alphanumeric());
|
||||
if ordinary {
|
||||
// Caché metadata names are case-insensitive. Quoting every ordinary
|
||||
// name breaks Caché 2016 when delimited identifiers are disabled.
|
||||
return name.to_string();
|
||||
}
|
||||
let quote = identifier_quote.map(str::trim).filter(|quote| !quote.is_empty()).unwrap_or("\"");
|
||||
format!("{quote}{}{quote}", name.replace(quote, &format!("{quote}{quote}")))
|
||||
}
|
||||
|
||||
fn data_grid_identifier(database_type: Option<DatabaseType>, name: &str, identifier_quote: Option<&str>) -> String {
|
||||
if database_type == Some(DatabaseType::Iris) {
|
||||
return iris_data_grid_identifier(name, identifier_quote);
|
||||
return crate::sql_dialect::quote_iris_identifier(name, identifier_quote);
|
||||
}
|
||||
crate::sql_dialect::quote_table_data_identifier(database_type, name, identifier_quote)
|
||||
}
|
||||
@@ -3152,11 +3139,11 @@ pub(crate) fn data_grid_qualified_table_name(
|
||||
identifier_quote: Option<&str>,
|
||||
) -> String {
|
||||
if database_type == Some(DatabaseType::Iris) {
|
||||
let table = iris_data_grid_identifier(table_name, identifier_quote);
|
||||
let table = crate::sql_dialect::quote_iris_identifier(table_name, identifier_quote);
|
||||
return schema
|
||||
.map(str::trim)
|
||||
.filter(|schema| !schema.is_empty())
|
||||
.map(|schema| format!("{}.{table}", iris_data_grid_identifier(schema, identifier_quote)))
|
||||
.map(|schema| format!("{}.{table}", crate::sql_dialect::quote_iris_identifier(schema, identifier_quote)))
|
||||
.unwrap_or(table);
|
||||
}
|
||||
if crate::sql_dialect::uses_connection_identifier_quote(database_type, identifier_quote) {
|
||||
|
||||
Reference in new issue
Block a user