You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get a BITN type (id: 104) for a BIT data field (id: 50) in SQL Server 2017. The problem now is, that the delivered deprecated type cannot be used as a parameter in request.addParameter(), because BITN has no validation rules and leads to: TypeError: parameter.type.validate is not a function
This issue happens also with other types like DATEN, NUMERICN, etc.
From my point of view, it should be possible, that the same type can be used for parameters as we get from the metadata, if not, it's not possible to do automatic type validation.
my connection.option (if that makes a difference):
rowCollectionOnRequestCompletion: false,
rowCollectionOnDone: false,
useColumnNames : false,
useUTC: false,
encrypt: false
I also ran into this issue. I have created a script to reproduce the error. The output is 4 times 'IntN', whereas I expect the output to be ‘Int’, ‘SmallInt’, ‘TinyInt’ and ‘BigInt’.
function connect() {
const config = {
server: 'localhost',
options: { encrypt: false },
authentication: {
type: 'default',
options: {
userName: 'USERNAME',
password: 'PASSWORD',
},
},
};
return new Promise((resolve, reject) => {
const connection = new Connection(config);
connection.on('connect', err => {
if (err) {
reject(err);
} else {
resolve(connection);
}
});
});
}
async function runStatement() {
const connection = await connect();
return new Promise((resolve, reject) => {
const stmt = 'select cast(1 as int) int, cast(1 as smallint ) smallint, cast(1 as tinyint ) tinyint, cast(1 as bigint ) bigint';
const request = new Request(stmt, (error, rowCount) => {
if (error) {
reject(error);
} else {
resolve(rowCount);
}
});
request.on('columnMetadata', (columns) => {
for (const column of columns) {
console.log(column.type.name);
}
});
connection.execSql(request);
});
}
runStatement();
Activity
arthurschreiber commentedon Apr 7, 2019
Yeah, that's not great. 😞 We'll probabably have to properly implement and expose these types.
irgijs commentedon May 9, 2019
I also ran into this issue. I have created a script to reproduce the error. The output is 4 times 'IntN', whereas I expect the output to be ‘Int’, ‘SmallInt’, ‘TinyInt’ and ‘BigInt’.
IanChokS commentedon Aug 9, 2019
@irgijs I'm currently looking into this!
IanChokS commentedon Aug 23, 2019
#949 @glitzner @irgijs I've made a PR for this fix . It is currently under review, so take a look and see if this is the change you were hoping for! :)