Alpha Video Training
Results 1 to 3 of 3

Thread: MySQL Stored procedure

  1. #1
    Member
    Real Name
    Samuel Ezeala
    Join Date
    Jan 2016
    Posts
    9

    Default MySQL Stored procedure

    Hello Guys,
    Please i am having an issue with mysql stored procedures and xbasic, i think this xbasics is not flexible. Ok this is what i am trying to achieve:
    Make an Ajax call to a Stored procedure with three parameters (two input and one output), the get the out and use the output to populate a div tag.
    the code is below.
    Code:
    selectargs.set("arg1",sessionc)
    			selectargs.set("arg2",item)
    			selectargs.set("arg3","@name")
    			dim flags as L = conn.Execute("CALL SelectTrans(:arg1,:arg2,:arg3)",selectargs) ' This is the stored procedure
    			?flags
    			flags = conn.Execute("SELECT @name as t") ' trying to select the output parameter which works fine if i try it on mysql or heidi sql
    			flags = result.NextRow()
    			?result.Data("t")
    all the output return false when i used firebug to check them....

    Please any better solution to this . thanks in anticipation

  2. #2
    Member
    Real Name
    pieter cremers
    Join Date
    Nov 2009
    Location
    Netherlands
    Posts
    146

    Default Re: MySQL Stored procedure

    Hi Samuel,

    I use this syntax
    'we will call a mysql procedure to do the work
    dim strsql as c
    strsql = <<%sql%
    CALL `Procedure_F_ProeffacturenVerwerken`(:whatfaktruns_nummer,'', :whatuser);
    %sql%

    flag = cn.execute(strsql, args)

    if flag = .f. then
    'there was an error - close the connection and exit
    cn.Close()
    dim msg as c
    msg = "Could not create testinvoices. Error reported was: " + cn.CallResult.text
    msg = js_escape(msg)
    dim jscmd as c
    jscmd = "alert('" + msg + "');"
    ProcessTestInvoices= jscmd
    exit function
    end if
    dim rs as sql::ResultSet
    rs = cn.ResultSet

  3. #3
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,595

    Default Re: MySQL Stored procedure

    I had some issues with the OUT parameter having the @ at the beginning, so I ended up doing this:

    vCall = "CALL calc_lines_display_values( :argJobno, @rslt, @kount )"
    cnx.execute(vCall,args)
    crs = cnx.ResultSet
    vPLResult = crs.data(1)
    vPLineCount = round(crs.data(2),0)

    in this case, Xbasic would not accept crs.data("@kount"), but crs.data(2) works just fine.
    Pat Bremkamp
    MindKicks Consulting

Similar Threads

  1. MySQL Stored Procedure
    By Tasos in forum Application Server Version 11 - Web/Browser Applications
    Replies: 7
    Last Post: 07-22-2013, 02:08 PM
  2. Using Cursor in MySQL stored procedure
    By Pat Bremkamp in forum Application Server Version 10 - Web/Browser Applications
    Replies: 3
    Last Post: 12-16-2010, 01:28 PM
  3. mysql stored procedure
    By nlok888 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 7
    Last Post: 09-05-2010, 03:19 AM
  4. MySQL script/stored procedure runner
    By alanc in forum Archived Wishlist
    Replies: 2
    Last Post: 05-09-2008, 02:41 AM
  5. MYSQL stored procedure
    By asawyer13 in forum Web Application Server v7
    Replies: 1
    Last Post: 06-28-2006, 01:07 PM

Bookmarks

Posting Permissions

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