DB_common::getAll fix
| From: | (Oleg Rekutin) | Date: | Sun, 22 Jul 2001 21:28:22 +0000 |
| Subject: | DB_common::getAll fix | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-988@lists.php.net to get a copy of this message | ||
Ok, I updated my copy of PEAR DB component w/ the latest from CVS and it
broke my application.
Turns out, for some reason, getAll had its parameters switched. However, the
compat check failed to work properly. It checked whether $fetchmode (the 3rd
parameter) is an array. Well, all of my getAll calls never passed in an
array, they just passed in $sql, DB_FETCHMODE_ASSOC. The compat check failed
to detect an array as the third parameter (since it defaulted to
DB_FETCHMODE_blah) and things broke down from then on.
I changed the logic to check whether the 2nd parameter is an array. If it is
not an array, then it's old-style parameter order, either getAll($sql,
DB_FETCHMODE_X) or getAll($sql, DB_FETCHMODE_X, $array).
Also if the user decides to skip specifying an array by calling getAll($sql,
null, DB_FETCHMODE_X), it detects that as well and does not swap
parameters...
Hope it works... BTW, it would be nice to have such API changes documented
somewhere.
begin 644 COMMON-Diff.TXT
M+2TM(&-O;6UO;BUO;&0N<&AP"5-U;B!*=6P@,C(@,3,Z,S@Z,#0@,C`P,0T*
M*RLK(&-O;6UO;BYP:'
)4W5N($IU;"R,BQ-SHR-CHP-BR,#Q#0I0"`M
M-CDW+#<@*S8Y-RPW($!#0H@("@('L-"B@("@("`@("\O(&-O;7!A="!C
M:&5C:RP@=&AE('!A<F%M<R!A;F0@9F5T8VAM;V1E('!A<F%M971E<G,@=7-E
M9"!T;PT*("@("@("`@+R\@:&%V92!T:&4@;W!P;W-I=&4@;W)D97(-"BT@
M("@("@(&EF("AI<U]A<G)A>2@D9F5T8VAM;V1E*2D@>PT**R@("@("`@
M:68@*"%I<U]A<G)A>2@D<&%R86US*2F)BD<&%R86US("$](&YU;&PI('L-
M"B@("@("@("@("`D=&UP(#T@)'!A<F%M<SL@+R\@=&AI<R!I<R!O=7(@
M;F5W(&9E=&-H;6]D90T*("@("@("@("@("1P87)A;7,@/2`D9F5T8VAM
G;V1E.PT*("@("@("@("@("1F971C:&UO9&4@/2`D=&UP.PT*
`
end