Menu

OCI_Statement object

2010-02-02
2012-09-26
  • Josemi Antelo

    Josemi Antelo - 2010-02-02

    I just read your manual and have read that a OCI_Statement can be reused more
    than once. I want to know if I understood well. Can I use the same object
    OCI_Statement for different queries? I have to reset or to do somewhat
    Thank you very much, really

    Yours sincerely
    Josemi

     
  • Vincent Rogier

    Vincent Rogier - 2010-02-02

    Hi,

    You can reuse an OCI_Statement object as many times you want.
    There no reset to do !
    Any call to OCI_Prepare(), OCI_PrepareFmt(), OCI_ExecuteStmt() and
    OCI_ExecuteStmtFtmt() internally reset the given statement handle and frees
    its current resultset if any.

    By example, you can do :

    int main(void)
    {
        OCI_Connection   *con;
        OCI_Statement    *st;
    
        if (!OCI_Initialize(error_handler, NULL, OCI_ENV_EVENTS))
            return EXIT_FAILURE;
    
        con = OCI_ConnectionCreate("db", "test", "test", OCI_SESSION_DEFAULT);
    
        st  = OCI_StatementCreate(con);
    
        OCI_ExecuteStmt(st, "select sysdate from dual");
        /* ... code to retrieve data here ... */
    
        OCI_ExecuteStmt(st, "select 1.2 from dual");
        /* ... code to retrieve data here ... */
    
        OCI_ExecuteStmt(st, "select 'toto from dual");
        /* ... code to retrieve data here ... */
    
        OCI_Prepare(st, "update john set salary = null");
        OCI_Execute(st);
    
        /*... */
    
        OCI_Commit(con);
    
        OCI_StatementFree(st);
        OCI_ConnectionFree(con);
    
        OCI_Cleanup();
    
        return EXIT_SUCCESS;
    }
    

    btw, how did you find the manual ?

    Regards,

    Vicnent

     
  • Vincent Rogier

    Vincent Rogier - 2010-02-03

    hi,

    In fact, i didn't mean where did you find it but what did you think of it :)

    Regards,

    vincent

     
  • Nobody/Anonymous

    Ah, now I understand you :-).
    I think that your work is perfect, yes, really. I like very much your library
    (well I think that you must use MFC, but I understand because you use standar
    C). And your manual, is clear, with many examples. I liked much the difference
    between to program with OCI and OCIlib, is clear.

    Really, I'm grateful for your project.
    Many thanks

    Yours sincerely
    Josemi

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.