Comments (6)
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.
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.
@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.
@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.
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.
Ok great thanks for the update. I will close the issue if it's working.
from node-sqlserver-v8.
Related Issues (20)
- Can I do a PR to remove prebuild-install as dependency HOT 2
- msnodesqlv8 implementation using TypeOrm HOT 19
- Install msnodesqlv8 offline system HOT 2
- ERROR: queryObj.pause is not a function HOT 4
- Parameters defaulting to invalid sizes for Always on Encryption HOT 11
- Package not working on Node 16 HOT 5
- Module did not self-register in Visual Studio Code HOT 1
- SIGSEGV (Address boundary error) while atempting to open connection HOT 18
- Segmentation fault on node:16-alpine HOT 1
- Kerberos Auth: Not Using Instance Name While Looking For SPN HOT 2
- Not catching results generated after PRINT or warning from stored procedures with NOCOUNT on HOT 3
- Error: Module did not self-register HOT 9
- More code samples for Multiple Result Sets (like issue 113) HOT 1
- Change node-gyp path to download nodejs headers from msnodesqlv8 installation HOT 2
- Why are database field names garbled when using Chinese fields? HOT 3
- msnodesqlv8 can't find sqltypes.h HOT 2
- install msnodesqlv8 through npm failed HOT 2
- Keep saying Module not found of sqlserverv8 HOT 6
- Question: Using prepared query with Pool
- unable to build on CentOS7 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-sqlserver-v8.