mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-11-03 08:32:52 +00:00
parent
46b7c03788
commit
e951cd5278
5 changed files with 42 additions and 2 deletions
|
|
@ -53,6 +53,14 @@ pub enum DataType {
|
|||
SmallInt(Option<u64>),
|
||||
/// Unsigned small integer with optional display width e.g. SMALLINT UNSIGNED or SMALLINT(5) UNSIGNED
|
||||
UnsignedSmallInt(Option<u64>),
|
||||
/// MySQL medium integer ([1]) with optional display width e.g. MEDIUMINT or MEDIUMINT(5)
|
||||
///
|
||||
/// [1]: https://dev.mysql.com/doc/refman/8.0/en/integer-types.html
|
||||
MediumInt(Option<u64>),
|
||||
/// Unsigned medium integer ([1]) with optional display width e.g. MEDIUMINT UNSIGNED or MEDIUMINT(5) UNSIGNED
|
||||
///
|
||||
/// [1]: https://dev.mysql.com/doc/refman/8.0/en/integer-types.html
|
||||
UnsignedMediumInt(Option<u64>),
|
||||
/// Integer with optional display width e.g. INT or INT(11)
|
||||
Int(Option<u64>),
|
||||
/// Integer with optional display width e.g. INTEGER or INTEGER(11)
|
||||
|
|
@ -141,6 +149,12 @@ impl fmt::Display for DataType {
|
|||
DataType::UnsignedSmallInt(zerofill) => {
|
||||
format_type_with_optional_length(f, "SMALLINT", zerofill, true)
|
||||
}
|
||||
DataType::MediumInt(zerofill) => {
|
||||
format_type_with_optional_length(f, "MEDIUMINT", zerofill, false)
|
||||
}
|
||||
DataType::UnsignedMediumInt(zerofill) => {
|
||||
format_type_with_optional_length(f, "MEDIUMINT", zerofill, true)
|
||||
}
|
||||
DataType::Int(zerofill) => format_type_with_optional_length(f, "INT", zerofill, false),
|
||||
DataType::UnsignedInt(zerofill) => {
|
||||
format_type_with_optional_length(f, "INT", zerofill, true)
|
||||
|
|
|
|||
|
|
@ -325,6 +325,7 @@ define_keywords!(
|
|||
MATCHED,
|
||||
MATERIALIZED,
|
||||
MAX,
|
||||
MEDIUMINT,
|
||||
MEMBER,
|
||||
MERGE,
|
||||
METADATA,
|
||||
|
|
|
|||
|
|
@ -3360,6 +3360,14 @@ impl<'a> Parser<'a> {
|
|||
Ok(DataType::SmallInt(optional_precision?))
|
||||
}
|
||||
}
|
||||
Keyword::MEDIUMINT => {
|
||||
let optional_precision = self.parse_optional_precision();
|
||||
if self.parse_keyword(Keyword::UNSIGNED) {
|
||||
Ok(DataType::UnsignedMediumInt(optional_precision?))
|
||||
} else {
|
||||
Ok(DataType::MediumInt(optional_precision?))
|
||||
}
|
||||
}
|
||||
Keyword::INT => {
|
||||
let optional_precision = self.parse_optional_precision();
|
||||
if self.parse_keyword(Keyword::UNSIGNED) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue