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

Function rewrite_query

tests/subquery_cte_test.rs:83–95  ·  view source on GitHub ↗
(conn: &Connection, sql: &str)

Source from the content-addressed store, hash-verified

81}
82
83fn rewrite_query(conn: &Connection, sql: &str) -> Result<String, String> {
84 let dialect = PostgreSqlDialect {};
85 let mut statements = Parser::parse_sql(&dialect, sql)
86 .map_err(|e| format!("Parse error: {e}"))?;
87
88 if let Some(stmt) = statements.first_mut() {
89 let mut rewriter = DecimalQueryRewriter::new(conn);
90 rewriter.rewrite_statement(stmt)?;
91 Ok(stmt.to_string())
92 } else {
93 Err("No statement found".to_string())
94 }
95}
96
97#[test]
98fn test_simple_join_aggregate() {

Callers 15

test_cte_basicFunction · 0.70
test_multiple_ctesFunction · 0.70
test_nested_ctesFunction · 0.70
test_correlated_subqueryFunction · 0.70
test_exists_subqueryFunction · 0.70
test_in_subqueryFunction · 0.70

Calls 1

rewrite_statementMethod · 0.80

Tested by

no test coverage detected