Skip to content

Commit

Permalink
replace usage of setup empty table
Browse files Browse the repository at this point in the history
  • Loading branch information
pacman82 committed Apr 11, 2024
1 parent 6a8f279 commit 65aa1c9
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions odbc-api/tests/integration.rs
Expand Up @@ -1798,11 +1798,13 @@ fn heterogenous_parameters_in_array(profile: &Profile) {
#[test_case(POSTGRES; "PostgreSQL")]
fn column_names_iterator(profile: &Profile) {
let table_name = table_name!();
let conn = profile
.setup_empty_table(&table_name, &["INTEGER", "VARCHAR(13)"])
let (conn, table) = Given::new(&table_name)
.column_types(&["INTEGER", "VARCHAR(13)"])
.build(profile)
.unwrap();
let sql = format!("SELECT a, b FROM {table_name};");
let sql = table.sql_all_ordered_by_id();
let mut cursor = conn.execute(&sql, ()).unwrap().unwrap();

let names: Vec<_> = cursor
.column_names()
.unwrap()
Expand All @@ -1818,10 +1820,11 @@ fn column_names_iterator(profile: &Profile) {
#[test_case(POSTGRES; "PostgreSQL")]
fn column_names_from_prepared_query(profile: &Profile) {
let table_name = table_name!();
let conn = profile
.setup_empty_table(&table_name, &["INTEGER", "VARCHAR(13)"])
let (conn, table) = Given::new(&table_name)
.column_types(&["INTEGER", "VARCHAR(13)"])
.build(profile)
.unwrap();
let sql = format!("SELECT a, b FROM {table_name};");
let sql = table.sql_all_ordered_by_id();
let mut prepared = conn.prepare(&sql).unwrap();
let names: Vec<_> = prepared
.column_names()
Expand All @@ -1838,10 +1841,11 @@ fn column_names_from_prepared_query(profile: &Profile) {
#[test_case(POSTGRES; "PostgreSQL")]
fn metadata_from_prepared_insert_query(profile: &Profile) {
let table_name = table_name!();
let conn = profile
.setup_empty_table(&table_name, &["INTEGER", "VARCHAR(13)"])
let (conn, table) = Given::new(&table_name)
.column_types(&["INTEGER", "VARCHAR(13)"])
.build(profile)
.unwrap();
let sql = format!("INSERT INTO {table_name} (a, b) VALUES (42, 'Hello');");
let sql = table.sql_insert();
let mut prepared = conn.prepare(&sql).unwrap();
assert_eq!(0, prepared.num_result_cols().unwrap());
}
Expand Down Expand Up @@ -1869,8 +1873,9 @@ fn describe_parameters_of_prepared_statement(
expected: &[ParameterDescription; 2],
) {
let table_name = table_name!();
let conn = profile
.setup_empty_table(&table_name, &["INTEGER", "VARCHAR(13)"])
let (conn, _table) = Given::new(&table_name)
.column_types(&["INTEGER", "VARCHAR(13)"])
.build(profile)
.unwrap();
let sql = format!("SELECT a, b FROM {table_name} WHERE a=? AND b=?;");
let mut prepared = conn.prepare(&sql).unwrap();
Expand Down

0 comments on commit 65aa1c9

Please sign in to comment.