-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'hasPrecision' #381
Comments
Using tedious straight:
|
You should include a complete code example which demonstrates this error. |
I am using minimal.js. var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
var config = {
server: 'DMIRT108',
userName: 'xxx',
password: 'yyy',
options: {
debug: {
packet: true,
data: true,
payload: true,
token: false,
log: true
},
database: 'zzz'
// ,encrypt: true // for Azure
}
};
var q = "SELECT * FROM VU_TABLE_INFO WHERE [table_name] = 'STORAGE_ITEM'";
var connection = new Connection(config);
connection.on('connect', function(err) {
// If no error, then good to go...
executeStatement();
}
);
connection.on('debug', function(text) {
//console.log(text);
}
);
function executeStatement() {
request = new Request(q, function(err, rowCount) {
if (err) {
console.log(err);
} else {
console.log(rowCount + ' rows');
}
connection.close();
});
request.on('row', function(columns) {
columns.forEach(function(column) {
if (column.value === null) {
console.log('NULL');
} else {
console.log(column.value);
}
});
});
request.on('done', function(rowCount, more) {
console.log(rowCount + ' rows returned');
});
// In SQL Server 2000 you may need: connection.execSqlBatch(request);
connection.execSql(request);
} |
BTW, mssql works fine for a string query, but gives this error using inputs on queries |
I reformatted your posts for you, but in the future, please use proper markdown so the code is actually readable. If you're not familiar, see https://guides.github.com/features/mastering-markdown/ |
I was not aware, thanks. :} |
For sake of completeness, here is MSSQL code: var sql = require('mssql');
sql.connect("mssql://xxx:yyy@DMIRT108/zzz").then(function() {
new sql
.Request()
.input("table_name", sql.VarChar(128), "STORAGE_ITEM")
.query("SELECT * FROM VU_TABLE_INFO WHERE [table_name] = @table_name")
.then(function(recordset) {
console.dir(recordset);
conn.close();
}).catch(function(err) {
// ... query error checks
});
}).catch(function(err) {
// ... connect error checks
}); |
What's the schema of |
What version of mssql/tedious do you use? |
mssql@3.2.1 |
You are correct, |
Actually the support was added in 1.14 (PR). I need to figure out which value causes this exception. |
@patriksimek if it's supported, it should be added to https://pekim.github.io/tedious/api-datatypes.html |
I agree, fixed (docs). |
Well, I don't have a good recommendation on where to fix it yet, but it is most definitely |
In |
I was getting this error using the mssql module so I switched to just tedious code, and I am getting the same error using minimal.js. I am guessing that there is a SQL Server setting that I need here. My DB is SQL Server 12.0.4422. I just upgraded node to v4.4.3 and upgraded all packages.
The query produces 10 records. Using mssql, it just bombs. Using the minimal.js code, it bombs after the first record is written to console.
Thanks!
The text was updated successfully, but these errors were encountered: