Results 1 to 1 of 1
  1. #1
    Join Date
    Jun 2008
    Posts
    3

    Unanswered: PHP 5.2.5 + Sybase_ct + stored procedure + multiple return values = unsolved

    after hours of searching I still don't have a solution for THIS problem.
    it seems the PHP people don't give a $@%& about sybase.

    currently, if you have a sybase Stored Procedure with MULTIPLE return values (read: not FINAL results) PHP (5.2.5) will NOT understand this and so the stored procedure executes PERFECTLY, but does not return the final result at all...
    does anyone know a workaround/solution/fix/patch/anything for this
    so i can complete my school assignment?

    i owe you my future!

    thanks.

    P.S to be more specific, this is the stored procedure. in Interactive SQL it's final result is a number: BPRxx-xxxx (where x = 0-9) :



    create proc IP_get_DefaultProdHeaderOrdNr (
    @IsahUserCode T_Code_User =null ,
    @LogProgramCode T_Code_Program =0 ,
    @InitLogDate T_DateTime =null output ,
    @ProdHeaderOrdNr T_Nr_ProdHeadReq =null output
    )
    as
    begin
    /************************************************** ********
    *Procedure Name: IP_get_DefaultProdHeaderOrdNr
    *Database: IsahDevelopDB
    *Server: ASEONTWIKKELING
    *CAST SQL-Builder R3.7
    *
    *Business Function : Uit Numbering het productieordernummer ophalen
    *Author BF: HUI Date BF: 28/12/1999
    *
    *Author: WIL Date: 28/12/1999
    * Comment: IP_gen_Log ingebouwd
    *Author: MDW Date: 21/04/2004
    * Comment: Deze procedure leverrt voortaan een uniek nummer dat getest is op T_ProductionHeader
    Parameter @InitLogDate toegevoegd
    *File Path:
    * C:\SQL_Scripts\Cees de Volder\IP_get_DefaultOrdNr.sql
    ************************************************** *******/
    -- variables for errorhandling
    declare @err int
    , @proc varchar(30)
    , @ret int
    , @LastUpdatedOn T_LastUpdatedOn
    , @LogParamValues varchar(255)
    , @UniqueNumberInd T_Indicator
    -- Replicatie
    , @ReplicationNodeId int
    , @KeyPoolProdHeadOrdNr int
    , @KeyValue varchar(255)



    select @proc = object_name(@@procid)
    select @LastUpdatedOn = convert(varchar(30),getdate(),9)

    -- check valid IsahUserCode
    exec @ret = IP_chk_IsahUserCode
    @IsahUserCode = @IsahUserCode
    , @LogProgramCode = @LogProgramCode

    if (@ret != 0)
    begin
    return @ret
    end

    -- Opzoeken van het replicatie-info
    exec IP_get_ReplicationInfo
    @ReplicationNodeId = @ReplicationNodeId output
    , @KeyPoolProdHeadOrdNr = @KeyPoolProdHeadOrdNr output



    -- Willen we werken met een keypool voor het toekennen van @new_ProdHeaderDossierCode?
    if (@KeyPoolProdHeadOrdNr = 0)
    begin
    -- Geen replicatie, gebruikelijke toekenning
    select @UniqueNumberInd = 0

    begin tran

    while (@UniqueNumberInd = 0)
    begin
    -- Ophalen van een nieuw ordernummer
    exec @ret = IPX_get_Number
    @NumSelect = 8
    , @IsahUserCode = @IsahUserCode
    , @LogProgramCode = @LogProgramCode
    , @ProdHeaderOrdNr = @ProdHeaderOrdNr output

    if (@ret != 0)
    begin
    rollback tran
    select @LogParamValues = "IPX_get_Number|" + @proc + "|" + convert(varchar(6), @ret)
    exec @ret = IP_gen_Log
    @CallerDesc = @proc
    , @MessCode = 20007
    , @LogParamValues = @LogParamValues
    , @IsahUserCode = @IsahUserCode
    , @LogProgramCode = @LogProgramCode
    return @ret
    end

    /* Registreer dat dit nummer gebruikt gaat worden */
    update T_Numbering
    set ProdHeaderOrdNrNum = @ProdHeaderOrdNr
    , LastUpdatedOn = @LastUpdatedOn
    , LastUpdatedBy = @IsahUserCode

    select @err = @@error
    if (@err != 0)
    begin
    rollback tran
    exec @ret = IP_gen_Log
    @CallerDesc = @proc
    , @MessCode = 20088
    , @LogParamValues = 'T_Numbering|ProdHeaderOrdNrNum'
    , @IsahUserCode = @IsahUserCode
    , @LogProgramCode = @LogProgramCode
    return @ret
    end

    if exists ( select 1
    from T_ProductionHeader
    where ProdHeaderOrdNr = @ProdHeaderOrdNr
    )
    begin
    select @UniqueNumberInd = 0
    end
    else
    begin
    select @UniqueNumberInd = 1
    end
    end
    end
    else -- Waarde ophalen uit de keypool
    begin
    exec IP_get_KeyPoolValue
    @ReplicationNodeId = @ReplicationNodeId,
    @KeyPoolProdHeadOrdNr = 1,
    @Value = @KeyValue output

    select @ProdHeaderOrdNr = @KeyValue
    end

    commit tran

    return 0

    end





    ... and this is the result from calling this proc in php:

    web browser return: 0 or 1.

    PHP error: [error] [client 192.168.42.143] PHP Notice: sybase_query() [<a href='function.sybase-query'>function.sybase-query</a>]: Sybase: Unexpected results, cancelling current in test.php on line 28


    fyi: dont ask me questions about the proc, i'm just (desperately) trying to run it...
    Last edited by Supermaggel; 06-16-08 at 09:30.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •