Comments (17)
What happens if you use sql.WLongVarChar(value) .....
from node-sqlserver-v8.
That works perfectly, thanks!
from node-sqlserver-v8.
I was getting invalid precision type HY104 (msnodesql v0.1.46) I've since updated to v0.2.10 and now I'm getting this new error message 07002. How does one use the "WLongVarChar" in the above example?
Thanks,
Jeff
from node-sqlserver-v8.
if you are using a very large string as a parameter
sql.query(conn_str, q, [sql.WLongVarChar(value)], function (err, results) { if(err){ console.log(err); } });
should force the driver to use the correct type .... please provide the example you are trying if this does not work correctly.
from node-sqlserver-v8.
Thanks for explaining working great now. 👍
from node-sqlserver-v8.
Update: I think I might have found a possible cause of this issue.... it would appear that it may not be counting the whitespace/newline characters properly to determine if the type should be a WLongVarChar
I have been able to test this by preforming a count on the sting I'm passing in if it is under 2000 including whitespace then no problem, how ever if the character count is like 1800 + 300 whitespaces then it will error until the character count goes over 2000 then it will start working again.....
In my case I'm storing some html and js into the database for dynamic offline content those naturally have lots of white space from the editor..... and I have a base sql update/insert function so for now I'm checking if length is over 2000 during my query builder and parameterizing process
// data: {uuid: 'unique id', col1Name: 'string', col2Name: 'string', col3Name: 'string'};
// dataProps: ['uuid', 'col1Name', 'col2name'] // is an array of filtered propNames to update
var updateQuery = "UPDATE [dbo].[" + tableName + "] SET ";
var updateQueryPrams = [];
for (var i = 0; dataProps.length > i; i++) {
if (dataProps[i] != "uuid") { // exclude the uuid
updateQuery += dataProps[i] + "= ?,";
if (data[dataProps[i]] && data[dataProps[i]].length > 2000) {
updateQueryPrams.push(sql.WLongVarChar(data[dataProps[i]]));
} else {
updateQueryPrams.push(data[dataProps[i]]);
}
}
updateQuery += "lastUpdated = CURRENT_TIMESTAMP";
updateQuery += " where uuid= ?";
updateQueryPrams.push(data.uuid);
sql.query(connStr[database], updateQuery, updateQueryPrams, function (err) {........
Thanks,
Jeff
from node-sqlserver-v8.
I've had this problem when calling a stored procedure. No spaces in the text being stored, but if the text has between 2048 and 8192 characters long then the driver wouth throw an error and go into a completely non-responsive state.
I made sure that my input variables to the stored proc (TEXT) are cast like this:
sql.engine.Text(data.json, data.json.length)
Giving it the correct length right at the beginning makes it work
from node-sqlserver-v8.
I am having the same issue. This is how I'm calling my stored procedure
const sql = require("mssql/msnodesqlv8")
module.exports = (req, res, next) => {
var request = new sql.Request(connection)
request.input("id", sql.Int, req.params.id)
request.input("page_content", req.body.page_content)
request.execute("editpage", function(err, rs){
if (err) console.log(err)
next()
})
}
I tried adding:
request.input("page_content", sql.WLongVarChar(65000), req.body.page_content)
and:
request.query("UPDATE pages SET page_content = @page_content, WHERE id = @id", [sql.WLongVarChar(65000)], function(err, rs){
if (err) console.log(err)
next()
})
and I am getting "sql.WLongVarChar is not a function" error. Any adjustments I can make to get this to work? It appears the problem (like Jeff mentions above) happens only between 2000 and 8000 characters or so.
from node-sqlserver-v8.
from node-sqlserver-v8.
Awesome. Appreciate your help.
from node-sqlserver-v8.
I have the same problem, is there a fix coming?
from node-sqlserver-v8.
from node-sqlserver-v8.
this has been fixed please test on 0.6.3
https://github.com/TimelordUK/node-sqlserver-v8/releases/tag/0.6.3
from node-sqlserver-v8.
I believe this is now fixed so will close. Please reopen if still an issue.
from node-sqlserver-v8.
I have the same problem. on 0.6.6...
from node-sqlserver-v8.
from node-sqlserver-v8.
from node-sqlserver-v8.
Related Issues (20)
- Cannot use without 'require'? HOT 1
- Module not found: Can't resolve '../build/Release/sqlserverv8' HOT 10
- Module did not self-register: sqlserverv8.node HOT 7
- npm install --save msnodesqlv8 fails MSBuild.exe failed with exit code: 1 HOT 5
- import { SqlClient } from "msnodesqlv8/types"; Cannot find module 'msnodesqlv8/types' or its corresponding type declarations HOT 1
- Unable to initialize msnodesql during Hot Module Reload (HMR) HOT 2
- Security vulnerability detected in latest HOT 1
- uncaughtException: Cannot read properties of null (reading 'query') HOT 3
- `ConcreteColumnType.parseSS` method tampers with plain date strings HOT 3
- Cannot find module '../build/Release/sqlserverv8.node' - Windows 10 / node.js v20.11.0/v21.6.1 HOT 1
- npm install results in LNK1127: library is corrupt HOT 1
- Uncaught Exception: static Sybase = new ServerDialect("Sybase")
- Cannot find module 'msnodesqlv8/types' or its corresponding type declarations. HOT 1
- [Question] What is the authentication detail if set trustedConnection to be true? HOT 2
- Missing binaries for Electron v28 and v29 HOT 6
- Unable to find dialect at msnodesqlv8/lib/sequelize HOT 7
- Execute system stored procedure HOT 3
- Handling of queries that return BIGINT HOT 3
- Segmentation Fault after a few minutes of running .... HOT 1
- Cannot find module 'msnodesqlv8/types' or its corresponding type declarations. HOT 2
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.