Talk is cheap, show me the code
Ever wonder why you got “can’t return a result set in the given context” error? Well, the doc says you need to enable CLIENT_MULTI_RESULTS using mysqli_options. I got CLIENT_MULTI_RESULTS real value via google’s codesearch. This patch below will enable stored proc call and add port support in hostname (eg: 192.168.1.51:5015).
function _connect($argHostname = NULL,
$argUsername = NULL,
$argPassword = NULL,
$argDatabasename = NULL)
{
// @ means: error surpression on
$this->_connectionID = @mysqli_init();
if (is_null($this->_connectionID))
{
// mysqli_init only fails if insufficient memory
if ($this->debug)
ADOConnection::outp("mysqli_init() failed : " . $this->ErrorMsg());
return false;
}
// Set connection options
// Not implemented now
if (function_exists('mysqli_options')) {
mysqli_options($this->_connectionID, /*CLIENT_MULTI_RESULTS*/0x20000, 1);
}
if (preg_match('/(.*)?:(\d+)/', $argHostname, $matches)) {
$argHostPort = $matches[2];
$argHostname = $matches[1];
} else
$argHostPort = NULL;
if (mysqli_real_connect($this->_connectionID,
$argHostname,
$argUsername,
$argPassword,
$argDatabasename,
$argHostPort))
{
if ($argDatabasename)
{
return $this->SelectDB($argDatabasename);
}
return true;
}
else
{
if ($this->debug)
ADOConnection::outp(”Could’t connect : ” . $this->ErrorMsg());
return false;
}
}
PS: Watch out for nasty quotes
Sphere: Related Content
This section gives me most headache. But experience told me that this blog mostly contains personal ramblings related to daily life, open source, and web 2.0. Recently, it turns out to be an idea-box where you can found ideas you can execute in your new startup ;). My ideas and opinions are not bullet proof and never intended to be one way stream. Kindly participate to improve your and my perspective regarding any particular post. Welcome aboard and enjoy your stay
paydjo
November 25th, 2006 at 9:15 am
terima jadi aja dech :-”
[Reply]
DoD
November 25th, 2006 at 9:45 am
Problemnya udah resolved ya?
B-)
StoredProc-ku udah bisa dipake?
[Reply]
toni
November 25th, 2006 at 9:55 am
Iya, stored proc-nya udah bisa dipakai. Mudah2an patchnya tidak terlalu berimbas pada performance dan security. MULTI_RESULTS flag sama tidak ya dengan MULTI_STATEMENTS?
[Reply]
DoD
November 25th, 2006 at 10:59 am
Kalo MULTI_RESULT, sepertinya karena resultnya yang berupa recorset.
Nebak aja seeh. qiqiqiq….
[Reply]