Skip to content

Commit 22c7db9

Browse files
committed
Use more precise naming
1 parent 485b511 commit 22c7db9

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/dialect/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,13 @@ pub trait Dialect: Debug + Any {
591591
false
592592
}
593593

594-
/// Returns true if the dialect supports `listen` clause
595-
fn supports_listen_clause(&self) -> bool {
594+
/// Returns true if the dialect supports the `LISTEN` statement
595+
fn supports_listen(&self) -> bool {
596596
false
597597
}
598598

599-
/// Returns true if the dialect supports `notify` clause
600-
fn supports_notify_clause(&self) -> bool {
599+
/// Returns true if the dialect supports the `NOTIFY` statement
600+
fn supports_notify(&self) -> bool {
601601
false
602602
}
603603
}

src/dialect/postgresql.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ impl Dialect for PostgreSqlDialect {
193193
}
194194

195195
/// see <https://www.postgresql.org/docs/current/sql-listen.html>
196-
fn supports_listen_clause(&self) -> bool {
196+
fn supports_listen(&self) -> bool {
197197
true
198198
}
199199

200200
/// see <https://www.postgresql.org/docs/current/sql-notify.html>
201-
fn supports_notify_clause(&self) -> bool {
201+
fn supports_notify(&self) -> bool {
202202
true
203203
}
204204
}

src/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ impl<'a> Parser<'a> {
534534
Keyword::MERGE => self.parse_merge(),
535535
// `LISTEN` and `NOTIFY` are Postgres-specific
536536
// syntaxes. They are used for Postgres statement.
537-
Keyword::LISTEN if self.dialect.supports_listen_clause() => self.parse_listen(),
538-
Keyword::NOTIFY if self.dialect.supports_notify_clause() => self.parse_notify(),
537+
Keyword::LISTEN if self.dialect.supports_listen() => self.parse_listen(),
538+
Keyword::NOTIFY if self.dialect.supports_notify() => self.parse_notify(),
539539
// `PRAGMA` is sqlite specific https://www.sqlite.org/pragma.html
540540
Keyword::PRAGMA => self.parse_pragma(),
541541
Keyword::UNLOAD => self.parse_unload(),

tests/sqlparser_common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11463,7 +11463,7 @@ fn test_try_convert() {
1146311463

1146411464
#[test]
1146511465
fn parse_listen_channel() {
11466-
let dialects = all_dialects_where(|d| d.supports_listen_clause());
11466+
let dialects = all_dialects_where(|d| d.supports_listen());
1146711467

1146811468
match dialects.verified_stmt("LISTEN test1") {
1146911469
Statement::LISTEN { channel } => {
@@ -11477,7 +11477,7 @@ fn parse_listen_channel() {
1147711477
ParserError::ParserError("Expected: identifier, found: *".to_string())
1147811478
);
1147911479

11480-
let dialects = all_dialects_where(|d| !d.supports_listen_clause());
11480+
let dialects = all_dialects_where(|d| !d.supports_listen());
1148111481

1148211482
assert_eq!(
1148311483
dialects.parse_sql_statements("LISTEN test1").unwrap_err(),
@@ -11487,7 +11487,7 @@ fn parse_listen_channel() {
1148711487

1148811488
#[test]
1148911489
fn parse_notify_channel() {
11490-
let dialects = all_dialects_where(|d| d.supports_notify_clause());
11490+
let dialects = all_dialects_where(|d| d.supports_notify());
1149111491

1149211492
match dialects.verified_stmt("NOTIFY test1") {
1149311493
Statement::NOTIFY { channel, payload } => {
@@ -11523,7 +11523,7 @@ fn parse_notify_channel() {
1152311523
"NOTIFY test1",
1152411524
"NOTIFY test1, 'this is a test notification'",
1152511525
];
11526-
let dialects = all_dialects_where(|d| !d.supports_notify_clause());
11526+
let dialects = all_dialects_where(|d| !d.supports_notify());
1152711527

1152811528
for &sql in &sql_statements {
1152911529
assert_eq!(

0 commit comments

Comments
 (0)