diff --git a/lib/src/sql/statements/define/event.rs b/lib/src/sql/statements/define/event.rs index 418a6c64..c27837b3 100644 --- a/lib/src/sql/statements/define/event.rs +++ b/lib/src/sql/statements/define/event.rs @@ -66,7 +66,11 @@ impl Display for DefineEventStatement { f, "DEFINE EVENT {} ON {} WHEN {} THEN {}", self.name, self.what, self.when, self.then - ) + )?; + if let Some(ref v) = self.comment { + write!(f, " COMMENT {v}")? + } + Ok(()) } } diff --git a/lib/src/sql/statements/define/field.rs b/lib/src/sql/statements/define/field.rs index 41d4852b..ebd596a4 100644 --- a/lib/src/sql/statements/define/field.rs +++ b/lib/src/sql/statements/define/field.rs @@ -84,6 +84,9 @@ impl Display for DefineFieldStatement { if let Some(ref v) = self.assert { write!(f, " ASSERT {v}")? } + if let Some(ref v) = self.comment { + write!(f, " COMMENT {v}")? + } if !self.permissions.is_full() { write!(f, " {}", self.permissions)?; } diff --git a/lib/src/sql/statements/define/index.rs b/lib/src/sql/statements/define/index.rs index 0aa5b04f..418937d8 100644 --- a/lib/src/sql/statements/define/index.rs +++ b/lib/src/sql/statements/define/index.rs @@ -90,6 +90,9 @@ impl Display for DefineIndexStatement { if Index::Idx != self.index { write!(f, " {}", self.index)?; } + if let Some(ref v) = self.comment { + write!(f, " COMMENT {v}")? + } Ok(()) } } diff --git a/lib/src/sql/statements/define/param.rs b/lib/src/sql/statements/define/param.rs index 045a4482..2221de89 100644 --- a/lib/src/sql/statements/define/param.rs +++ b/lib/src/sql/statements/define/param.rs @@ -55,7 +55,11 @@ impl DefineParamStatement { impl Display for DefineParamStatement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "DEFINE PARAM ${} VALUE {}", self.name, self.value) + write!(f, "DEFINE PARAM ${} VALUE {}", self.name, self.value)?; + if let Some(ref v) = self.comment { + write!(f, " COMMENT {v}")? + } + Ok(()) } } diff --git a/lib/src/sql/statements/define/scope.rs b/lib/src/sql/statements/define/scope.rs index 50718639..82d81af8 100644 --- a/lib/src/sql/statements/define/scope.rs +++ b/lib/src/sql/statements/define/scope.rs @@ -70,6 +70,9 @@ impl Display for DefineScopeStatement { if let Some(ref v) = self.signin { write!(f, " SIGNIN {v}")? } + if let Some(ref v) = self.comment { + write!(f, " COMMENT {v}")? + } Ok(()) } } diff --git a/lib/src/sql/statements/define/table.rs b/lib/src/sql/statements/define/table.rs index 98d68cc8..348fe72d 100644 --- a/lib/src/sql/statements/define/table.rs +++ b/lib/src/sql/statements/define/table.rs @@ -113,6 +113,9 @@ impl Display for DefineTableStatement { } else { " SCHEMALESS" })?; + if let Some(ref v) = self.comment { + write!(f, " COMMENT {v}")? + } if let Some(ref v) = self.view { write!(f, " {v}")? } diff --git a/lib/src/sql/statements/define/user.rs b/lib/src/sql/statements/define/user.rs index 7f193707..50e48195 100644 --- a/lib/src/sql/statements/define/user.rs +++ b/lib/src/sql/statements/define/user.rs @@ -128,7 +128,11 @@ impl Display for DefineUserStatement { Fmt::comma_separated( &self.roles.iter().map(|r| r.to_string().to_uppercase()).collect::>() ) - ) + )?; + if let Some(ref v) = self.comment { + write!(f, " COMMENT {v}")? + } + Ok(()) } }