You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.execute(format!("DROP TABLE IF EXISTS sqlpage_files; {create_table_sql}").as_str())
722
+
.execute(format!("DROP TABLE IF EXISTS sqlpage_files; {create_table_sql}").as_ref())
723
723
.await
724
724
.unwrap();
725
725
726
726
// Insert test file into database using database-specific syntax
727
-
let db_kind = state.db.connection.any_kind();
728
-
let insert_sql = match db_kind {
729
-
sqlx::any::AnyKind::Mssql => {
730
-
"INSERT INTO sqlpage_files(path, contents) VALUES (?, CONVERT(VARBINARY(MAX), ?))"
731
-
}
732
-
_ => "INSERT INTO sqlpage_files(path, contents) VALUES (?, ?)",
727
+
let insert_sql = match state.db.connection.any_kind(){
728
+
sqlx::any::AnyKind::Mssql => "INSERT INTO sqlpage_files(path, contents) VALUES ('on_db.sql', CONVERT(VARBINARY(MAX), 'select ''text'' as component, ''Hi from db !'' AS contents;'))",
729
+
_ => "INSERT INTO sqlpage_files(path, contents) VALUES ('on_db.sql', 'select ''text'' as component, ''Hi from db !'' AS contents;')"
733
730
};
734
-
735
-
sqlx::query(insert_sql)
736
-
.bind("tests/sql_test_files/it_works_simple.sql")
737
-
.bind("SELECT 'It works !' as message;")
738
-
.execute(&state.db.connection)
731
+
state
732
+
.db
733
+
.connection
734
+
.execute(insert_sql)
739
735
.await
740
736
.unwrap();
741
737
742
738
let app_data = actix_web::web::Data::new(state);
743
739
740
+
// Test on_db.sql
741
+
let resp = req_path_with_app_data("/prefix/on_db.sql", app_data.clone())
742
+
.await
743
+
.unwrap();
744
+
assert_eq!(resp.status(), http::StatusCode::OK);
745
+
let body = test::read_body(resp).await;
746
+
let body_str = String::from_utf8(body.to_vec()).unwrap();
0 commit comments