TP调用MSSQL存储过程问题

浏览:3186 发布日期:2013/08/16 分类:求助交流 关键字: 存储过程 TP调用存储过程
本人从ASP.NET转到PHP时间不长,接触TP框架时间有限,如有不周到的地方还请给位手下留情。
伴随使用的深入,现在遇到一个较深入的问题:TP调用MSSQL存储过程问题,通过网上查阅相关资料,发现TP3.1.3貌似对存储过程支持有限,甚至可以说有点小不足,但还是有一些解决方案。 但还是没有成功,闲话少叙上代码:
采纳的解决方案链接 http://blog.csdn.net/cyd1919/article/details/8859898
修改了:
 public function query($str) {
        $this->initConnect(false);
        //if ( !$this->_linkID ) return false;
        $this->queryStr = $str;
        //释放前次的查询结果
        if ( $this->queryID ) $this->free();
        $this->Q(1);
        $this->queryID = mssql_query($str, $this->_linkID);
        $this->debug();
        if ( false === $this->queryID ) {
            $this->error();
            return false;
        } else {
            $this->numRows = mssql_num_rows($this->queryID);
            return $this->getAll();
        }
    }
action:
             $sys=M();
         $sql = iconv("utf-8", "gbk//ignore", $sql);
             $sql='CALL proc_GetSystemParameter()';
         $arr=$sys->query($sql);
         var_dump(auto_charset($arr,gb2312, utf8));
  
该存储过程返回相应列表:
R_RSID B_InfoC
HeatingSeasonstartTime 10-15
HeatingSeasonTimeState true
HeatingSeasonEndTime 04-15
AlarmTotalShortMessageSendTime 0:00
AlarmTotalShortMessageReceivePerson SA00001
HeatingSeasonstartTime 2012-11-15
HeatingSeasonEndTime 2013-03-15
之前使用T-Sql语句执行成功,但使用存储过程返回flase。

控制台调试信息:
[2] mssql_query() [<a href='function.mssql-query'>function.mssql-query</a>]: Query failed C:\wamp\www\ThinkPhP\ThinkPHP\Extend\Driver\Db\DbMssql.class.php 第 88 行.
[8] Use of undefined constant gb2312 - assumed 'gb2312' C:\wamp\www\ThinkPhP\App\Lib\Action\IndexAction.class.php 第 24 行.
[8] Use of undefined constant utf8 - assumed 'utf8' C:\wamp\www\ThinkPhP\App\Lib\Action\IndexAction.class.php 第 24 行.
不知哪位同僚有好的Idea分享一下。
最佳答案
评论( 相关
后面还有条评论,点击查看>>