amitkr / nodejs-db-informix

Infomix bindings for nodejs
MIT License
3 stars 3 forks source link

Segmentations fault on stored proc with insert or update statements #5

Closed amitkr closed 11 years ago

amitkr commented 11 years ago

Issue reported by Muhamed

Hi once again - sorry for bothering you.

Question: I successfully managed to reuse the code you've given me to run stored procedure. However when running a procedure which does update or insert

info: START: "execute procedure ins_cat(39,1,'Design','Design desc','System','2006-11-02 20:14:24.000','System','2006-11-02 20:14:24.000',15,1,1,'0')" MI_LIB_USAGE: XIX000:-7520:Argument (client library error) is NULL. Segmentation fault (core dumped)

On stackoverflow I found these links: http://stackoverflow.com/questions/5079639/informix-oic-query-yields-error-mi-lib-usage-argument-client-library-erro

http://www.oninit.com/manual/informix/english/docs/dbdk/is40/dapi/15dberr17.html

http://stackoverflow.com/questions/5079639/informix-oic-query-yields-error-mi-lib-usage-argument-client-library-erro

http://stackoverflow.com/questions/5095519/how-to-use-transactions-in-informix-csdk-and-oic

Here is my final method, reused from yours:

function runStoredProcedure(sprocedure, spparams, res, callback, next) {
    logger.log("info", "Running Stored procedure");
    logger.log("info", "SP: " + sprocedure);

    var connection = new bindings.Informix(settings);
    connection.on('error', function(error) {
        logger.log("error", "Error: " + error);
    }).on('ready', function(server) {
        logger.log("info", "Connection ready to: " + JSON.stringify(server));
    }).connect(function(err) {
        if(err) {
            logger.log("error", "Could not connect to DB");
            throw new Error('Could not connect to DB');
        }
        logger.log("info", "Connected to db with: " + JSON.stringify(settings));
        logger.log("info", "isConnected() == " + connection.isConnected());
        var rs;

        rs = this.query("execute procedure " + sprocedure, spparams, callback, {
            start: function(q) {
                logger.log("info", "START: " + JSON.stringify(q));
            },
            finish: function(f) {
                logger.log("info", "FINISH: " + JSON.stringify(f));
            },
            async: false,
            cast: true
        }).execute();
        logger.log("info", "SQL query finished.");
        this.disconnect();
        logger.log("info", "Disconnected from db.");
    });
}

Muhamed Halilovic

reuf commented 11 years ago

Hello - I am the one who reported the issue. Here is the core dump download link: https://docs.google.com/file/d/0B3TYHdEDoVIbTTZrc3BXU04yV3c/edit Regards.

amitkr commented 11 years ago

i can reproduce this issue.

amitkr commented 11 years ago

this should be fixed now.