Git Product home page Git Product logo

Comments (6)

TimelordUK avatar TimelordUK commented on September 23, 2024

yes, I have just tested a tentative fix - binding to SQL_WLONGVARCHAR does seem to work. I will add a user defined binding function sql.WLongVarChar(s) to manually bind a long string and I guess the driver can switch to this automatically for long strings. I will release a fix in next day or so/

conn.query("declare @s NVARCHAR(MAX) = ?; select @s as s", [sql.WLongVarChar(s)], function (err, res) {

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on September 23, 2024

can you update and try the user binding method above which forces the driver to use SQL_WLONGVARCHAR . I have added any code to select automatically as I need to check further what is going on - there is a unit test case already which seems to do exactly as you require and this test passes.

use [sql.WLongVarChar(s)] as the param binding in the insert statement.

from node-sqlserver-v8.

NoelAbrahams avatar NoelAbrahams commented on September 23, 2024

@TimelordUK, does this only affect parametrised queries or all queries?

e.g.

conn.query("declare @s nvarchar(max); SELECT @s = '...'; exec dbo.foo @s ");

from node-sqlserver-v8.

nikoraisu avatar nikoraisu commented on September 23, 2024

@TimelordUK Great - yes that fixes it; thanks! I can also confirm that without the custom binding, it falls over on exactly 2001 characters (2000 chars is fine).

Oddly I also have a similar issue to you in that I'm failing to reproduce the problem on a small testbed I rigged up, so I'm currently digging around to try and find out what is different between that and my main project/database.

from node-sqlserver-v8.

nikoraisu avatar nikoraisu commented on September 23, 2024

Ah OK - now it is happening in my testbed, so it seems to be intermittent (which doesn't make a lot of sense to me, admittedly). The bottom answer in this thread suggests that the default binding logic can end up rearranging the query and basing its decisions on all manner of things, so I suppose it's possible that circumstantial factors could influence it (although I'm surprised that it can come up with two outcomes for the same query).

In any case, the fix is good, so I'm sorted. It seems strange that sometimes it's fine and sometimes it isn't, but then again I know I'm storing a very large string, so it's seems reasonable for me to specify the binding function. Unless you want to keep it open, I'd be very happy to close this issue as resolved.

from node-sqlserver-v8.

TimelordUK avatar TimelordUK commented on September 23, 2024

Ok great thanks for the update. I will close the issue if it's working.

from node-sqlserver-v8.

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.