ID: 37925
Updated by: [EMAIL PROTECTED]
Reported By: batataw at gmail dot com
Status: Bogus
Bug Type: Output Control
Operating System: Linux Fedora
PHP Version: 5.1.4
New Comment:
I don't have your database and your tables, including "user" table.
Please provide COMPLETE reproduce script that doesn't require any
nonexistent tables, database and stored procedures.
You can create them in the script itself, btw.
Previous Comments:
------------------------------------------------------------------------
[2006-06-30 11:18:07] batataw at gmail dot com
Below, the store procedure.
BEGIN
#declare local variables
DECLARE sp_userId BIGINT(30) DEFAULT 0;
#declare copies of incoming variables
DECLARE sp_username VARCHAR(30);
DECLARE sp_passwd VARCHAR(20);
#tidy input and apply initial transformations
SET sp_username = TRIM(in_username);
SET sp_passwd = TRIM(in_passwd);
#the insert
INSERT INTO user
(username, passwd)
VALUES
(sp_username, sp_passwd);
#get the new userId
SELECT LAST_INSERT_ID() INTO sp_userId;
#set the output variable
SET out_userId = sp_userId;
END
------------------------------------------------------------------------
[2006-06-30 11:06:55] [EMAIL PROTECTED]
42000:1305:PROCEDURE test.user_insert does not exist
------------------------------------------------------------------------
[2006-06-30 10:56:55] batataw at gmail dot com
<?php
define ('DRM_DMDB_DEV', 'dev');
$GLOBALS[DRM_DMDB_DEV]['db_dsn'] =
"mysql:dbname=mydatabase;host=localhost";
$GLOBALS[DRM_DMDB_DEV]['db_user'] = "root";
$GLOBALS[DRM_DMDB_DEV]['db_passwd'] = "";
$conf = DRM_DMDB_DEV;
try{
$db = new PDO($GLOBALS[$conf]['db_dsn'],
$GLOBALS[$conf]['db_user'],
$GLOBALS[$conf]['db_passwd']);
$db->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
}
catch(PDOException $e){
$errmsg = "connection failed: ".$e->getMessage();
echo $errmsg;
exit;
}
//call the stored procedure
$sql = "CALL user_insert(@userId,:username,:passwd);";
//Prepare request
try{
$sth = $db->prepare($sql);
}
catch(PDOException $e){
$errmsg = implode(":",$sth->errorInfo());
Error::userErrorHandler(E_USER_WARNING, $errmsg,
__FILE__, __LINE__,
DRM_ERROR_DB_CALL);
}
$sth->bindParam(":username",
$user["username"],PDO::PARAM_STR);
$sth->bindParam(":passwd",
$user["passwd"],PDO::PARAM_STR);
//Execute Request
try{
$sth->execute();
}
catch(PDOException $e){
$errmsg = implode(":",$sth->errorInfo());
echo $errmsg;
exit;
}
echo "OK !";
?>
------------------------------------------------------------------------
[2006-06-27 11:53:50] [EMAIL PROTECTED]
Please provide SHORT AND COMPLETE reproduce script, which I can
copy/paste and run to reproduce your problem.
Until then -> bogus.
------------------------------------------------------------------------
[2006-06-27 11:52:05] [EMAIL PROTECTED]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/37925
--
Edit this bug report at http://bugs.php.net/?id=37925&edit=1