This repository has been archived by the owner on Sep 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
148 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/target | ||
Cargo.lock | ||
.idea | ||
env_setup.ps1 | ||
env_setup.ps1 | ||
test_data.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//! Basic IMPORT/EXPORT tests. | ||
#[cfg(test)] | ||
#[allow(unused)] | ||
mod tests { | ||
use exasol::error::Result; | ||
use exasol::*; | ||
use std::env; | ||
|
||
#[test] | ||
#[allow(unused)] | ||
fn http_transport_tests() { | ||
let dsn = env::var("EXA_DSN").unwrap(); | ||
let schema = env::var("EXA_SCHEMA").unwrap(); | ||
let user = env::var("EXA_USER").unwrap(); | ||
let password = env::var("EXA_PASSWORD").unwrap(); | ||
|
||
let mut opts = ConOpts::new(); | ||
opts.set_login_kind(LoginKind::Credentials(Credentials::new(user, password))); | ||
opts.set_dsn(dsn); | ||
|
||
let mut exa_con = Connection::new(opts).unwrap(); | ||
let mut result = exa_con | ||
.execute("SELECT * FROM RUST.EXA_RUST_TEST LIMIT 2001;") | ||
.unwrap(); | ||
|
||
let rows: Vec<(String, String, u16)> = exa_con | ||
.iter_result(&mut result) | ||
.collect::<Result<_>>() | ||
.unwrap(); | ||
|
||
let mut http_opts = ExportOpts::new(); | ||
http_opts.set_encryption(false); | ||
http_opts.set_compression(false); | ||
http_opts.set_query("SELECT * FROM RUST.EXA_RUST_TEST LIMIT 2001"); | ||
let data: Vec<(String, String, u16)> = exa_con.export_to_vec(http_opts).unwrap(); | ||
|
||
let mut http_opts = ImportOpts::new(); | ||
http_opts.set_encryption(false); | ||
http_opts.set_compression(false); | ||
http_opts.set_table_name("RUST.EXA_RUST_TEST"); | ||
exa_con.import_from_iter(data, http_opts).unwrap(); | ||
|
||
let mut http_opts = ExportOpts::new(); | ||
http_opts.set_encryption(false); | ||
http_opts.set_compression(false); | ||
http_opts.set_column_separator(b'|'); | ||
http_opts.set_query("SELECT * FROM RUST.EXA_RUST_TEST LIMIT 2001"); | ||
exa_con.export_to_file("test_data.csv", http_opts).unwrap(); | ||
|
||
let mut http_opts = ImportOpts::new(); | ||
http_opts.set_encryption(false); | ||
http_opts.set_compression(false); | ||
http_opts.set_column_separator(b'|'); | ||
http_opts.set_table_name("RUST.EXA_RUST_TEST"); | ||
exa_con | ||
.import_from_file("test_data.csv", http_opts) | ||
.unwrap(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.