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

Function test_insert_select_with_decimal

tests/decimal_integration_test.rs:215–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213
214#[tokio::test]
215async fn test_insert_select_with_decimal() {
216 let ctx = setup_test_db().await;
217
218 // Create source data
219 ctx.execute(
220 "INSERT INTO accounts (id, name, balance, credit_limit) VALUES
221 (1, 'Source', '1000.00', '5000.00')"
222 ).await.unwrap();
223
224 // Insert with calculations
225 let result = ctx.execute(
226 "INSERT INTO accounts (name, balance, credit_limit)
227 SELECT name || '_copy', balance * 0.5, credit_limit * 0.5
228 FROM accounts WHERE id = 1"
229 ).await.unwrap();
230
231 assert_eq!(result.rows_affected, 1);
232
233 // Verify the insert
234 let result = ctx.query("SELECT COUNT(*) FROM accounts").await.unwrap();
235 assert_eq!(result.rows.len(), 1);
236}
237
238#[tokio::test]
239async fn test_decimal_precision_preservation() {

Callers

nothing calls this directly

Calls 3

setup_test_dbFunction · 0.70
executeMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected