Giter Site home page Giter Site logo

Comments (8)

baoshan avatar baoshan commented on June 20, 2024

Looking forward to that feature ^_^

from tedious.

pekim avatar pekim commented on June 20, 2024

Basic support for parameters has been added. Add parameters to the request, and call execSql as usual.

var TYPES = require('tedious').TYPES;

var request = new Request('select @param1, @anotherParam', function(err) {
    ....
});

request.addParameter(TYPES.VarChar, 'param1', 'qwerty');
request.addParameter(TYPES.Int, anotherParam', 42);

connection.execSql(request);

Output parameters can be added too. See issue #16 for an example.

Note: I am not convinced that the API is quite right. There's a good chance that it will change.

from tedious.

zachaller avatar zachaller commented on June 20, 2024

same looking forward to this however on master or anything above this commit 5765a3d seems to break the request events 'row' and 'done'

from tedious.

pekim avatar pekim commented on June 20, 2024

The done event I might have an idea about, but a problem with row event would be puzzling. If it wasn't being emitted I'd expect a number of the integration tests to fail.

I'll take a look tomorrow, and try and recreate the problem.

from tedious.

zachaller avatar zachaller commented on June 20, 2024

Ok also a bit more information, we are using it in a system of ours and the first statement that is running was an insert statement so that may be why the row event was not firing and so if that the expected behavior that is fine, the done event should still work though i would think.

from tedious.

pekim avatar pekim commented on June 20, 2024

Please note, the first two arguments to the Request.addParameter and Request.addOutputParameter functions have been swapped around. The first argument is now the parameter name.

request.addParameter('parameterName', TYPES.VarChar, string);
request.addParameter('anotherParameterName', TYPES.Int, number);

from tedious.

pekim avatar pekim commented on June 20, 2024

The parameterisation support was achieved using the sp_executesql procedure. This means that the doneProc event is emitted, when previously the done event would typically have been emitted. I suspect that trying to subvert TDS and hide this, would probably be difficult, and give rise to a never ending stream of edge case bugs.

Instead, I've added a row count parameter to the Request callback. So in many use cases the done, doneInProc and doneProc event can probably be ignored.

from tedious.

pekim avatar pekim commented on June 20, 2024

Included in v0.0.4.

from tedious.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.