zoukankan      html  css  js  c++  java
  • procedure can't return a result set in the given context

    调用存储过程失败!出现如下错误:PROCEDURE ipbx.qu_ery can't return a result set in the given context,
    
    ipbx是数据库,
    qu_ery是自己写的存储过程的名字;
    
     
    
    原因:连接数据库的方式不正确。
    
    导致报错的连接方式: 
    
    <?php   
    if(!mysql_real_connect(&mysql,"localhost","root","123456","ipbx",0,NULL,0))
            {
                    printf("mysql_real_connect() failed!/n");
                    mysql_close(&mysql);
                    return 0;
            }
    正确的连接方式:
    
           
    <?php
    if(!mysql_real_connect(&mysql,"localhost","root","123456","ipbx",0,NULL,CLIENT_MULTI_STATEMENTS))
             {
                    printf("mysql_real_connect() failed!/n");
                    mysql_close(&mysql);
                    return 0;
            }
    修改一下连接数据库的方式的参数就OK了!

    FROM: http://blog.csdn.net/huichengongzi/article/details/5571346

    你修改一下
    system/database/drivers/mysql/mysql_driver.php
    
    function db_connect()
        {
        define("CLIENT_MULTI_RESULTS",131072);//Enable/disable multi-results
        define("CLIENT_MULTI_STATEMENTS",65536);//Enable/disable multi-statement support
            
        return @mysql_connect($this->hostname, $this->username, $this->password, TRUE,CLIENT_MULTI_STATEMENTS);
        } 

    FROM: http://ellislab.com/forums/viewthread/71141#476251

    To retrieve multiple resultsets from the stored procs, you should use a client which supports multiple queries.

    If you use PHP, use MySQLi extension and call the procedure using mysqli_multi_query.

    MySQL extension is only able to retrieve the first recordset returned by the proc. To be able to use ti, you should set CLIENT_MULTI_RESULTS (decimal 131072) in the parameter $client_flags tomysql_connect

    FROM: http://stackoverflow.com/questions/5447930/stored-procedure-mysql-fails-with-cant-return-a-result-set-in-the-given-cont#5447952

    codeigniter 调用存储过程出错 
    
    关键就是两点
      1)define('CLIENT_MULTI_RESULTS', 131072);
      2)$link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());

    FROM: http://codeigniter.org.cn/forums/thread-6129-1-1.html

  • 相关阅读:
    linux 杂类
    set
    C++ 基础 杂类
    linux 添加samba账户
    git 常用命令
    git 设置bitbucket 邮箱、用户
    C++ shared_ptr
    git 免密码配置
    2014的新目标
    为/Date(1332919782070)/转时间2013-09-23
  • 原文地址:https://www.cnblogs.com/blogsme/p/3421206.html
Copyright © 2011-2022 走看看