Repository navigation
Description
Hi, I have found a strange error when retrieving select results. The error happens only when I select all the columns of the test table - if you select a subset of these columns there's no error. I think it's not linked to any particular data type as I didn't find any column that would cause the problem alone.
Environment:
MS SQL Server Express 12.0.2269.0
nodejs v0.12.2
[email protected] node_modules\tedious
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], string_dec
[email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected])
Windows 8 64 bit
The error is
TypeError: Cannot read property 'useUTC' of undefined
typeerror: Cannot read property 'useUTC' of undefined
at callee$0$0$ (C:\devs\unitech\terminal_nw\node_modules\tedious\lib\value-p
arser.js:498:70)
at tryCatch (C:\devs\unitech\terminal_nw\node_modules\tedious\node_modules\b
abel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\devs\unitech\terminal_
nw\node_modules\tedious\node_modules\babel-runtime\regenerator\runtime.js:315:22
)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\d
evs\unitech\terminal_nw\node_modules\tedious\node_modules\babel-runtime\regenera
tor\runtime.js:100:21)
at tryCatch (C:\devs\unitech\terminal_nw\node_modules\tedious\node_modules\b
abel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\devs\unitech\terminal_
nw\node_modules\tedious\node_modules\babel-runtime\regenerator\runtime.js:261:24
)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\d
evs\unitech\terminal_nw\node_modules\tedious\node_modules\babel-runtime\regenera
tor\runtime.js:100:21)
at tryCatch (C:\devs\unitech\terminal_nw\node_modules\tedious\node_modules\b
abel-runtime\regenerator\runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (C:\devs\unitech\terminal_
nw\node_modules\tedious\node_modules\babel-runtime\regenerator\runtime.js:261:24
)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (C:\d
evs\unitech\terminal_nw\node_modules\tedious\node_modules\babel-runtime\regenera
tor\runtime.js:100:21)
Test script that reproduces the error:
var td = require('tedious');
var cfg = {
userName: 'zewil',
password: 'PASS',
server: 'WYPAS3',
options: {database: 'testdb', useUTC: true}
};
var cn = new td.Connection(cfg);
console.log('connecting');
cn.on('connect', function(err) {
if (err) {
console.log('connection error', arguments);
process.exit();
}
console.log('connected - OK');
var sql = "SELECT [Id],[OrderDate],[TotalNr] ,[ClientId], ClientName, Amount, ArtNr, ProductGroup from TestTable";
var rq = new td.Request(sql, function(err, rows) {
if (err) {
console.log('request error', arguments);
process.exit();
};
console.log('request executed, rows: ', rows);
});
var cnt = 0;
rq.on('row', function(r) {
cnt++;
console.log('got row', cnt);
});
cn.execSql(rq);
});
and finally, test table creation script:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TestTable](
[Id] [int] IDENTITY(1,1) NOT NULL,
[OrderDate] [datetime] NULL,
[TotalNr] [int] NULL,
[ClientId] [int] NULL,
[ClientName] [nvarchar](50) NULL,
[Amount] [float] NULL,
[ArtNr] [nvarchar](50) NULL,
[ProductGroup] [nvarchar](50) NULL
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[TestTable] ON
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40573, NULL, NULL, 123, N'some client', 1, N'ABC123', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40584, CAST(N'2015-07-09 00:00:00.000' AS DateTime), NULL, 67, N' SPRINTER W RADZIEWICZS ŁEPE G BIALIC M BOBA', 3, N'bb34567c', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40585, CAST(N'2015-07-31 00:00:00.000' AS DateTime), NULL, 66, N'RAFAŁ ANTOSZAK Przedsiębiorstwo H-U "ANMAR"', 1, N'aaaaa', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40574, NULL, NULL, 123, N'some client', 1, N'ABC123', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40575, CAST(N'2015-07-30 21:58:59.807' AS DateTime), NULL, 123, N'some client', 1, N'ABC123', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40576, CAST(N'2015-07-30 22:02:19.510' AS DateTime), NULL, 123, N'some client', 1, N'ABC123', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40577, CAST(N'2015-07-30 22:02:22.173' AS DateTime), NULL, 123, N'some client', 1, N'ABC123', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40578, CAST(N'2015-07-30 23:38:44.560' AS DateTime), NULL, 123, N'some client', 1, N'ABC123', NULL)
GO
INSERT [dbo].[TestTable] ([Id], [OrderDate], [TotalNr], [ClientId], [ClientName], [Amount], [ArtNr], [ProductGroup]) VALUES (40572, CAST(N'2015-01-01 00:00:00.000' AS DateTime), 103002, NULL, N'Nerli', 2, N'123', N'Screen')
GO
SET IDENTITY_INSERT [dbo].[TestTable] OFF
GO
Activity
lafar6502 commentedon Aug 1, 2015
UPDATE
just one row in this table is enough to repeat the issue:
and BTW my timezone is Poland (CEST) - in case this is some timezone issue.
arthurschreiber commentedon Aug 1, 2015
Ha, this is an issue I seem to have introduced with #285 in the 0.12.0 release. Let me fix that up and push a new release.
Fix #291.
arthurschreiber commentedon Aug 1, 2015
I prepared 1.12.1 over at #292. As soon as the travis and appveyor builds finish succesfully, I'll push out a new release.
I'm really sorry about causing this problem for you. Some areas of the
tediouscodebase are not covered by our unit or integration tests, which causes issues like this to creep up. I'll make it a priority to extend the coverage in the future to keep another problem like this from happening.Fix #291.
arthurschreiber commentedon Aug 1, 2015
I just pushed
1.12.1. Please try that version.lafar6502 commentedon Aug 1, 2015
Looks promising - error is gone in my test case. Thanks!