如何在kohana 3.1中调用过程 [英] How to call procedure in kohana 3.1
问题描述
Kohana是一个php框架. 这是文件. 如何在此框架中调用过程. 我已经搜索了关于这个问题的问题. 喜欢 : insert_id在Kohana 3中
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
这是我的代码:
$conn = Database::instance();
$queryStr = "call sp_createUser('$nick_name','$email','$password','127.0.0.1')";
$query = DB::query(Database::SELECT, $queryStr);
$query->execute($conn);
但是有一些例外.
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..
推荐答案
在查询之前使用$query->compile(Database::instance);
检查您的查询字符串并查找错误.
Use $query->compile(Database::instance);
before querying to inspect your query string and find it's bugs.
也给我们您的程序正文.就像PROCEDURE那样以不兼容的格式将数据返回到Kohana.
Also give us your PROCEDURE body. It semms like PROCEDURE returns data in incompatible format to Kohana.
您的$query->compile(Database::instance);
返回字符串是否直接在mysql中执行?
Is your $query->compile(Database::instance);
return string executes in mysql directly?
这篇关于如何在kohana 3.1中调用过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!