Add fu->redirect, change $st->row behavior on 0 results, minor fixes

And with this, I have a working rewrite of the manned.org backend into
FU. \o/

The $st->row methods are very useful even for queries that may not
return anything, so their old behavior was unhelpful. Interestingly
enough, the error-on-multiple-rows did catch an actual bug in
Manned.org, so I'm keeping that behavior.
This commit is contained in:
Yorhel 2025-02-24 15:54:32 +01:00
parent fbbaa23842
commit 06e2f950fe
9 changed files with 62 additions and 34 deletions

View file

@ -62,11 +62,11 @@ t VALUES([1, $x, 'NOW()', RAW 'NOW()']), 'VALUES ( ? , ? , ? , NOW() )', [1, $x,
t VALUES(P {}), 'VALUES ( ? )', [{}];
t VALUES(P []), 'VALUES ( ? )', [[]];
t IN([1,2,'a',undef,$x]), 'IN(?,?,?,?,?)', [1,2,'a',undef,$x];
t IN([1,2,'a',undef,$x]), '= ANY(?)', [[1,2,'a',undef,$x]], in_style => 'pg';
t IN([]), '= ANY($1)', [[]], in_style => 'pg', placeholder_style => 'pg';
t IN [1,2,'a',undef,$x], 'IN(?,?,?,?,?)', [1,2,'a',undef,$x];
t IN [1,2,'a',undef,$x], '= ANY(?)', [[1,2,'a',undef,$x]], in_style => 'pg';
t IN [], '= ANY($1)', [[]], in_style => 'pg', placeholder_style => 'pg';
t WHERE({ id => IN([1,2]) }), 'WHERE ( id IN(?,?) )', [1,2];
t WHERE({ id => IN [1,2] }), 'WHERE ( id IN(?,?) )', [1,2];
sub somefunc { 'not actually const' }
t SQL(somefunc), '?', [somefunc];