mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 06:18:17 +00:00
Encapsulate CreateTable
, CreateIndex
into specific structs (#1291)
This commit is contained in:
parent
f3f5de51e5
commit
a0f511cb21
10 changed files with 387 additions and 400 deletions
|
@ -122,11 +122,11 @@ fn pragma_eq_placeholder_style() {
|
|||
fn parse_create_table_without_rowid() {
|
||||
let sql = "CREATE TABLE t (a INT) WITHOUT ROWID";
|
||||
match sqlite_and_generic().verified_stmt(sql) {
|
||||
Statement::CreateTable {
|
||||
Statement::CreateTable(CreateTable {
|
||||
name,
|
||||
without_rowid: true,
|
||||
..
|
||||
} => {
|
||||
}) => {
|
||||
assert_eq!("t", name.to_string());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
|
@ -200,7 +200,7 @@ fn double_equality_operator() {
|
|||
fn parse_create_table_auto_increment() {
|
||||
let sql = "CREATE TABLE foo (bar INT PRIMARY KEY AUTOINCREMENT)";
|
||||
match sqlite_and_generic().verified_stmt(sql) {
|
||||
Statement::CreateTable { name, columns, .. } => {
|
||||
Statement::CreateTable(CreateTable { name, columns, .. }) => {
|
||||
assert_eq!(name.to_string(), "foo");
|
||||
assert_eq!(
|
||||
vec![ColumnDef {
|
||||
|
@ -234,7 +234,7 @@ fn parse_create_table_auto_increment() {
|
|||
fn parse_create_sqlite_quote() {
|
||||
let sql = "CREATE TABLE `PRIMARY` (\"KEY\" INT, [INDEX] INT)";
|
||||
match sqlite().verified_stmt(sql) {
|
||||
Statement::CreateTable { name, columns, .. } => {
|
||||
Statement::CreateTable(CreateTable { name, columns, .. }) => {
|
||||
assert_eq!(name.to_string(), "`PRIMARY`");
|
||||
assert_eq!(
|
||||
vec![
|
||||
|
@ -295,7 +295,7 @@ fn test_placeholder() {
|
|||
#[test]
|
||||
fn parse_create_table_with_strict() {
|
||||
let sql = "CREATE TABLE Fruits (id TEXT NOT NULL PRIMARY KEY) STRICT";
|
||||
if let Statement::CreateTable { name, strict, .. } = sqlite().verified_stmt(sql) {
|
||||
if let Statement::CreateTable(CreateTable { name, strict, .. }) = sqlite().verified_stmt(sql) {
|
||||
assert_eq!(name.to_string(), "Fruits");
|
||||
assert!(strict);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue