MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_update_with_numeric_operations

Function test_update_with_numeric_operations

tests/decimal_rewriter_test.rs:198–214  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

196
197#[test]
198fn test_update_with_numeric_operations() {
199 let conn = setup_test_db();
200
201 // UPDATE with arithmetic
202 let sql = "UPDATE products SET price = price * 1.05 WHERE discount > 0";
203 let result = rewrite_query(&conn, sql).unwrap();
204 println!("UPDATE query rewritten to: {result}");
205 assert!(result.contains("decimal_mul"));
206 assert!(result.contains("decimal_gt"));
207
208 // UPDATE with complex expression
209 let sql = "UPDATE transactions SET amount = amount + (amount * tax_rate / 100)";
210 let result = rewrite_query(&conn, sql).unwrap();
211 assert!(result.contains("decimal_add"));
212 assert!(result.contains("decimal_mul"));
213 assert!(result.contains("decimal_div"));
214}
215
216#[test]
217fn test_delete_with_numeric_condition() {

Callers

nothing calls this directly

Calls 2

setup_test_dbFunction · 0.70
rewrite_queryFunction · 0.70

Tested by

no test coverage detected