Zend_Db_Table准备通过MSSQL存储过程不使用长字符串数据

时间:2014-11-28 12:33:38

标签: php sql-server zend-framework

当我在数据库字段中使用小字符串值时,我的代码正常工作,但它不适用于长字符串值

我的代码包含小字符串,对我有用:

$legal_restrictions = "TEST DATA";
$detail = "TEST DATA DETAIL";
$db = Zend_Db_Table::getDefaultAdapter();
$sql = "exec usp_add_offer '$legal_restrictions' ,'$detail'";
try{
    $calPro = $db->prepare($sql);
} catch(Zend_Exception $e) {
    print_r($e);
} 
$calPro = $db->prepare($sql);
$calPro->execute();
$data = $calPro->fetch();

代码无法使用长字符串值

$legal_restrictions = "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing.If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing";
$detail = "TEST DATA DETAIL";
$db = Zend_Db_Table::getDefaultAdapter();
$sql = "exec usp_add_offer '$legal_restrictions' ,'$detail'";
try{
    $calPro = $db->prepare($sql);
} catch(Zend_Exception $e) {
    print_r($e);
} 
$calPro = $db->prepare($sql);
$calPro->execute();

$data = $calPro->fetch();

我的商店程序:

USE [pnp]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_test]
@test varchar(max),
@description varchar(max)
AS
BEGIN
    SET NOCOUNT ON;
    insert into tbltest
     (
    test,
    description)
    values
    (
    @test,
    @description)
    select 1
END

请为我提供此问题的最佳解决方案

0 个答案:

没有答案