php - Can PDO::FETCH_CLASS mode be used for one row (not fetchAll)? -
i sense little dirty asking here, since sense should've been able google it, well... didn't find anything.
is there way utilize fetchmode pdo::fetch_class
in normal fetch
function? want retrieve single row, using fetchall
out of question (performance issues).
i know utilize setfetchmode(pdo::fetch_class, "myclass")
, ideally prefer not alter default fetch mode. realise manually set pdo::fetch_both
afterwards, it's not quite neat i'd (extra function calls, code clutter, etc.).
if isn't possible or function calls don't matter @ fine too. wondering since seems such obvious thing want do.
p.s. pdo::fetch()
seem take pdo::fetch_class
it's first argument, can't find way pass class-identifier string in...
the reply seems no. no there no such function.
use either setfetchmode(pdo::fetch_class, "myclass")
statement, or utilize fetchall((pdo::fetch_class, "myclass")
.
php mysql pdo
No comments:
Post a Comment