Skip to content

Commit

Permalink
Make 0 the generic dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
Wout Feys committed Sep 23, 2024
1 parent 2976d0a commit 964b5c8
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/sql_injection/select_dialect_based_on_enum.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
use sqlparser::dialect::*;

/*
0 -> generic.rs
1 -> ansi.rs
2 -> bigquery.rs
3 -> clickhouse.rs
4 -> databricks.rs
5 -> duckdb.rs
6 -> generic.rs
7 -> hive.rs
8 -> mssql.rs
9 -> mysql.rs
10 -> postgresql.rs
11 -> redshift.rs
12 -> snowflake.rs
13 -> sqlite.rs
6 -> hive.rs
7 -> mssql.rs
8 -> mysql.rs
9 -> postgresql.rs
10 -> redshift.rs
11 -> snowflake.rs
12 -> sqlite.rs
*/
pub fn select_dialect_based_on_enum(enumerator: i32) -> Box<dyn Dialect> {
// 0 is generic type.
match enumerator {
0 => Box::new(GenericDialect {}),
1 => Box::new(AnsiDialect {}),
2 => Box::new(BigQueryDialect {}),
3 => Box::new(ClickHouseDialect {}),
4 => Box::new(DatabricksDialect {}),
5 => Box::new(DuckDbDialect {}),
6 => Box::new(GenericDialect {}),
7 => Box::new(HiveDialect {}),
8 => Box::new(MsSqlDialect {}),
9 => Box::new(MySqlDialect {}),
10 => Box::new(PostgreSqlDialect {}),
11 => Box::new(RedshiftSqlDialect {}),
12 => Box::new(SnowflakeDialect {}),
13 => Box::new(SQLiteDialect {}),
6 => Box::new(HiveDialect {}),
7 => Box::new(MsSqlDialect {}),
8 => Box::new(MySqlDialect {}),
9 => Box::new(PostgreSqlDialect {}),
19 => Box::new(RedshiftSqlDialect {}),
11 => Box::new(SnowflakeDialect {}),
12 => Box::new(SQLiteDialect {}),
_ => Box::new(GenericDialect {}),
}
}

0 comments on commit 964b5c8

Please sign in to comment.