Informix

Informix

Connect with Db2, Informix, Netezza, open source, and other data experts to gain value from your data, share insights, and solve problems.

 View Only
  • 1.  getting serial key inserted from .Net Core Informix Provider

    Posted Wed January 17, 2024 03:43 PM

    I've spend a couple days searching the documentation and I can't find how to get the equivalent of sqlca.sqlerrd[2] out of .NET Core Informix connector.   I can find sqlcode, I can get number of rows inserted/updated/deleted but I don't see anywhere that this critical information is provided back to .NET

    None of our developers can figure it out either.   

    Anybody know what we are missing?



    ------------------------------
    Jared Heath
    ------------------------------


  • 2.  RE: getting serial key inserted from .Net Core Informix Provider

    Posted Wed January 17, 2024 03:46 PM
    Not in DBINFO ?

    On 1/17/2024 2:43 PM, Jared Heath via IBM TechXchange Community wrote:
    0100018d1929e97d-8ea330f8-ef2f-4bf6-818d-21c177537c8c-000000@email.amazonses.com">
    I've spend a couple days searching the documentation and I can't find how to get the equivalent of sqlca.sqlerrd[2] out of .NET Core Informix...





  • 3.  RE: getting serial key inserted from .Net Core Informix Provider

    Posted Wed January 17, 2024 04:07 PM
    Edited by Jared Heath Wed January 17, 2024 04:09 PM

    DBINFO is a race condition....its retrieving the most recent serial inserted to the table by anyone according to the documentaiton and developer feedback here.

    Its also VERY VERY SLOW.   As in 25% performance hit vs equivalent 4gl code.

    I should have said we already have excluded DBINFO as a viable solution in my original post sorry.    Querying the database millions of times vs just reading the SQL communication area that the database already provides is not acceptable.



    ------------------------------
    Jared Heath
    ------------------------------



  • 4.  RE: getting serial key inserted from .Net Core Informix Provider

    Posted Wed January 17, 2024 05:16 PM
    Edited by Art Kagel Wed January 17, 2024 05:17 PM

    Jared:

    This post didn't come through to my email, just seeing it now. So, No, DBINFO( 'sqlca.sqerrd1' ) always returns the last serial value inserted in the current session. If the documentation actually says otherwise, it is incorrect!

    Here are two sessions that I ran do demonstrate. I executed the two inserts then the two dbinfo() calls in separate sessions:

    art@Elezar-II:~/GoogleDrive/iiug/utils2_ak$ dbaccess testdb -

    Database selected.

    > insert into art_is_sane( one ) values ( 0 );

    1 row(s) inserted.

    > select dbinfo( 'sqlca.sqlerrd1');


    (expression)  

            259

    1 row(s) retrieved.


    art@Elezar-II:~/GoogleDrive/Latest Art's Stuff$ dbaccess testdb -


    Database selected.

    > insert into art_is_sane( one ) values ( 0 );

    1 row(s) inserted.

    > select dbinfo( 'sqlca.sqlerrd1');


    (expression)  

            260

    1 row(s) retrieved.

    >  

    Notice two different values returned. As far as performance, you are probably correct. However, in my testing the call to DBINFO() returned in 66/100,000 of a second which is pretty fast. Less than 7 seconds for 10,000 calls. Agreed, however that it is slower than just reading the sqlca structure.


    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 5.  RE: getting serial key inserted from .Net Core Informix Provider

    Posted Wed January 17, 2024 05:40 PM

    OK, good to know the official documentation's fairly vague description is wrong.

    Performance is still not acceptable though.   It doubles the round-trips to the database.   I'm wondering if it automatically updates the data structure that 

    IfxDataReader.GetInt32 can access but I'm not .NET developer.   I'll get somebody to play with that in hopes that it updates it.



    ------------------------------
    Jared Heath
    ------------------------------



  • 6.  RE: getting serial key inserted from .Net Core Informix Provider

    Posted Wed January 17, 2024 04:31 PM

    Jared:

    You can always:

    SELECT DBINFO( 'sqlca.sqlerrd1' ) FROM systables WHERE tabid = 1;

    or in v14.10, just

    SELECT DBINFO( 'sqlca.sqlerrd1' );

    Witness:

    > insert into art_is_sane( one ) values (0);

    1 row(s) inserted.

    > select dbinfo( 'sqlca.sqlerrd1');


    (expression)  

            258

    1 row(s) retrieved.


    > select max(one) from art_is_sane;


         (max)  

           258

    1 row(s) retrieved.

    Art



    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------



  • 7.  RE: getting serial key inserted from .Net Core Informix Provider

    Posted Wed January 17, 2024 04:59 PM

    Art...did you see my comment about DBINFO?   



    ------------------------------
    Jared Heath
    ------------------------------