()
| 144 | |
| 145 | #[test] |
| 146 | fn test_update_delete_optimization() { |
| 147 | let conn = setup_test_db(); |
| 148 | |
| 149 | // UPDATE on non-decimal table - should not be rewritten |
| 150 | let sql = "UPDATE users SET age = age + 1 WHERE active = 1"; |
| 151 | let result = rewrite_query(&conn, sql).unwrap(); |
| 152 | assert_eq!(result, "UPDATE users SET age = age + 1 WHERE active = 1"); |
| 153 | |
| 154 | // UPDATE on decimal table - should be rewritten |
| 155 | let sql = "UPDATE products SET price = price * 1.05 WHERE cost < 50"; |
| 156 | let result = rewrite_query(&conn, sql).unwrap(); |
| 157 | assert!(result.contains("decimal_mul")); |
| 158 | assert!(result.contains("decimal_lt")); |
| 159 | |
| 160 | // DELETE on non-decimal table - should not be rewritten |
| 161 | let sql = "DELETE FROM users WHERE age < 18"; |
| 162 | let result = rewrite_query(&conn, sql).unwrap(); |
| 163 | assert_eq!(result, "DELETE FROM users WHERE age < 18"); |
| 164 | |
| 165 | // DELETE on decimal table - should be rewritten |
| 166 | let sql = "DELETE FROM products WHERE price > 1000"; |
| 167 | let result = rewrite_query(&conn, sql).unwrap(); |
| 168 | assert!(result.contains("decimal_gt")); |
| 169 | } |
| 170 | |
| 171 | #[test] |
| 172 | fn test_cte_optimization() { |
nothing calls this directly
no test coverage detected