How to call procedure in kohana 3.1

左心房为你撑大大i 提交于 2019-12-08 09:41:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!