#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    39
    Rep Power
    12

    MFC and return values of stored procedures


    Hello,

    In my application I'm using the MFC Recordset as a base class to obtain data from my firebird database (in MSVC++).

    I know CRecordset returns field values from tables, but what I'm trying to do is the following:

    Code:
    Call a stored procedure to insert a record.
    The stored procedure updates a table and returns the identifier for this record.
    Call other stored procedures to store data that is related to the first record using the identifier.
    When there is a 1:1 relationship between tables then a stored procedure which holds data to update all tables at once could be used. In a 1:n relationship however I need the identifier for each update.

    I don't want my application to generate identifiers.

    Any ideas on how to accomplish this are appreciated.
  2. #2
  3. Bug Hunter
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Transylvania (Romania)
    Posts
    309
    Rep Power
    24
    i think you need some trigers and generators
    (take a look in the docs )
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    39
    Rep Power
    12
    Thanks for your input, but I don't think I will be needing triggers. Have to look up generators in the documentation though for generators though. I set up my stored procedures to return an identifier. Header (in Dutch, but that is not important in this case):

    Code:
    CREATE PROCEDURE MAAKVERKOOP(DATUM INT, OMZET FLOAT, VERKOPERID INT,
                                 KORTING FLOAT) RETURNS (ID INT)
    According to the documentation, after execution the value stored in ID will be returned.

    How can I set up a class so I can read this identifier in my program?

    (I realize this may be more of a C++ question, but there must be more coders out there)
  6. #4
  7. Bug Hunter
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Transylvania (Romania)
    Posts
    309
    Rep Power
    24
    i don't know to much mfc

    I think is better to use ibpp for avanced firebird features : procedures, transactions, administration tasks ...

    What is IBPP ?

    IBPP, where 'PP' stands for '++', is a C++ client interface for Firebird Server versions 1.0, 1.5 and further. It also works with InterBaseŽ 6.0, though it is expected it might only support Firebird in the future. It is a class library, free of any specific development tool dependancies. It is not tied to any 'visual' or 'RAD' tool. It was indeed developed to add Firebird access in any C++ application. Those applications using IBPP can be non-visual (CORBA/COM objects, other libraries of classes and functions, procedural 'legacy' code, for instance). But it can of course also be used in visual or RAD environments. IBPP is indeed purely a dynamic SQL interface to Firebird. In some easy (we think so :-) to use C++ classes, you will find nearly all what is needed to access a Firebird database, and manipulate the data. IBPP also offers access to most of the administrations tasks : creating a database, modifying its structure, performing online backups, administering user accounts on the server and so on.
    http://www.ibpp.org/
    Last edited by mariuz; January 28th, 2004 at 03:34 PM.
    My home page: http://www.firebirdsql.org and work place :http://www.reea.net

IMN logo majestic logo threadwatch logo seochat tools logo