in reply to DBI password

AFAIR but untested:
SELECT COUNT(*) AS is_authenticated WHERE PASSWORD(?) = table.passwd AND table.uid = ?