From:             john dot navratil at sbcglobal dot net
Operating system: Fedora Core 5
PHP version:      5.2.1
PHP Bug Type:     Feature/Change Request
Bug description:  mysqli_stmt_bind_param should accept array of parameters to 
bind

Description:
------------
I've read bug #31096 and this is a variant of the same bug, but I beseech
you to reconsider.

The C API to mysql defines my_bool mysql_stmt_bind_param(MYSQL_STMT *stmt,
MYSQL_BIND *bind) to accept an array of parameters to bind to a prepared
statement.  PHP 5.2.1 does not and requires the number of parameters to
match both the number of characters in the type string (essentially an
array of types) and the number of parameters in the prepared statement. 
This works well for static statements but makes dynamic statements
impossible to prepare unless one resorts to something like:

$arr = <array-of-values-to-be-bound>
array_unshift($arr, $typeString);
call_user_func_array(array(& $mysqli, "stmt_bind_param"), $arr);
array_shift($arr);

One can argue that this is sufficient (a point which I will concede), but
the beauty of PHP is not in its sufficiency (machine code is sufficient,
ultimately) but in its expressivity.  The foregoing is not very expressive,
is tightly bound to the mysqli_stmt_bind_result signature, and does not
mirror the underlying API (which is another PHP strong point).

Would you please consider a variant which accepts two arguments with the
second being an array of values to bind to the prepared statement?

Thanks!


-- 
Edit bug report at http://bugs.php.net/?id=40891&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40891&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40891&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40891&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40891&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40891&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40891&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40891&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40891&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40891&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40891&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40891&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40891&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40891&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40891&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40891&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40891&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40891&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40891&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40891&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40891&r=mysqlcfg

Reply via email to