MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / parse_rename

Function parse_rename

nodedb-sql/src/ddl_ast/parse/database/alter.rs:61–77  ·  view source on GitHub ↗
(parts: &[&str])

Source from the content-addressed store, hash-verified

59}
60
61fn parse_rename(parts: &[&str]) -> Result<AlterDatabaseOperation, SqlError> {
62 let to_kw = parts.get(4).map(|w| w.to_uppercase()).unwrap_or_default();
63 if to_kw != "TO" {
64 return Err(SqlError::Parse {
65 detail: format!("ALTER DATABASE RENAME requires keyword 'TO', got '{to_kw}'"),
66 });
67 }
68 let new_name = parts
69 .get(5)
70 .copied()
71 .ok_or_else(|| SqlError::Parse {
72 detail: "ALTER DATABASE RENAME TO requires a new name".into(),
73 })?
74 .trim_matches('"')
75 .to_string();
76 Ok(AlterDatabaseOperation::Rename { new_name })
77}
78
79fn parse_set(parts: &[&str], original: &str) -> Result<AlterDatabaseOperation, SqlError> {
80 let target = parts.get(4).map(|w| w.to_uppercase()).unwrap_or_default();

Callers 1

parse_alter_databaseFunction · 0.85

Calls 2

to_stringMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected