问题
Kohana is a php framework. this is the documention . how to call procedure in this framework. i have searched and questions about this question. like : insert_id in Kohana 3
this is my code :
$conn = Database::instance();
$queryStr = "call sp_createUser('$nick_name','$email','$password','127.0.0.1')";
$query = DB::query(Database::SELECT, $queryStr);
$query->execute($conn);
but there's some exception..
Database_Exception [ 1312 ]: PROCEDURE sp_createUser can't return a result set in the given context [ call sp_createUser('1','1','1','127.0.0.1') ]
it seems that something wrong with the db connection..
how can i fix it ...ask some help..
回答1:
Use $query->compile(Database::instance);
before querying to inspect your query string and find it's bugs.
Also give us your PROCEDURE body. It semms like PROCEDURE returns data in incompatible format to Kohana.
Is your $query->compile(Database::instance);
return string executes in mysql directly?
回答2:
try replacing call with SELECT...
$queryStr = "SELECT sp_createUser('$nick_name','$email','$password','127.0.0.1')";
来源:https://stackoverflow.com/questions/10169472/how-to-call-procedure-in-kohana-3-1