()
| 64 | |
| 65 | #[tokio::test] |
| 66 | async fn test_result_cache_invalidation_on_ddl() { |
| 67 | let test_server = setup_test_server_with_init(|db| { |
| 68 | Box::pin(async move { |
| 69 | // Create initial table |
| 70 | db.execute("CREATE TABLE ddl_test (id INTEGER PRIMARY KEY, data TEXT)").await?; |
| 71 | db.execute("INSERT INTO ddl_test VALUES (1, 'original')").await?; |
| 72 | Ok(()) |
| 73 | }) |
| 74 | }).await; |
| 75 | |
| 76 | let client = &test_server.client; |
| 77 | |
| 78 | // Execute a query that should be cached |
| 79 | let query = "SELECT * FROM ddl_test"; |
| 80 | let rows1 = client.query(query, &[]).await.unwrap(); |
| 81 | assert_eq!(rows1.len(), 1); |
| 82 | assert_eq!(rows1[0].get::<_, String>(1), "original"); |
| 83 | |
| 84 | // Execute DDL which should clear the cache |
| 85 | client.execute("ALTER TABLE ddl_test ADD COLUMN extra INTEGER DEFAULT 0", &[]).await.unwrap(); |
| 86 | |
| 87 | // Insert new data |
| 88 | client.execute("INSERT INTO ddl_test (id, data) VALUES (2, 'new')", &[]).await.unwrap(); |
| 89 | |
| 90 | // Execute the same query - should not use cached result |
| 91 | let rows2 = client.query(query, &[]).await.unwrap(); |
| 92 | assert_eq!(rows2.len(), 2); // Should see both rows, not cached single row |
| 93 | |
| 94 | test_server.abort(); |
| 95 | } |
| 96 | |
| 97 | #[tokio::test] |
| 98 | async fn test_result_cache_not_used_for_dml() { |
nothing calls this directly
no test coverage detected