"Error: Unrecognized type: 0" thrown while selecting ID column from a table #8

Closed
baoshan opened this Issue Jan 19, 2012 · 5 comments

Projects

None yet

3 participants

@baoshan
baoshan commented Jan 19, 2012
var stmt = conn.createStatement('select id from cities');
stmt.on('row', function(row) {
  console.log('Received row: ', row.getValue(0));
});
stmt.execute();

Output

Received row:  310120
Received row:  310230
Received row:  67428864

Error: Unrecognized type: 0
    at TokenStreamPacket._getTokenFromType (/Users/Baoshan/Project/node-tds/lib/tokenstream.packet.js:67:15)

Actually, the row below 310230 is 320000, not 67428864.

@cretz
Owner
cretz commented Jan 19, 2012

Thanks for the report. I will write a test for identity columns and see what's up.

@baoshan
baoshan commented Jan 20, 2012

Great!

If it takes you more time to reproduce the issue, I would like to provide a minimal bootstrap sql script and my original server.js.

@cretz cretz was assigned Jan 22, 2012
@KillWil
KillWil commented Feb 2, 2012

Don't know if this is the same error but type 1 :
My current version of TDS is the master one.

    var stmt = conn.createStatement('SELECT MyId from DB.dbo.TABLE');
    stmt.on('row', function(row) {
        console.log(row.getValue('MyId'));
    });
    stmt.execute();

   with MyId is an autonumber field

67109416 (??)

/usr/local/lib/node_modules/tds/lib/tds-client.js:210
throw err;
^
Error: Unrecognized type: 1
at TokenStreamPacket._getTokenFromType (/usr/local/lib/node_modules/tds/lib/tokenstream.packet.js:67:15)
at TokenStreamPacket.nextToken (/usr/local/lib/node_modules/tds/lib/tokenstream.packet.js:75:18)
at TdsClient._handleToken (/usr/local/lib/node_modules/tds/lib/tds-client.js:197:35)
at TdsClient. (/usr/local/lib/node_modules/tds/lib/tds-client.js:167:19)
at Socket. (/usr/local/lib/node_modules/tds/lib/tds-client.js:2:59)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:347:14)

@cretz cretz added a commit that referenced this issue Mar 20, 2012
@cretz Added test case for issue #8 17b8191
@cretz
Owner
cretz commented Mar 20, 2012

I have added a test case for this that shows identities working properly in master (see commit above). It is possible that I fixed this with another issue or that my test case in inadequate. Can someone test with master or at least put a simple test case (including schema) here in the comments for me to replicate? Thanks.

@baoshan
baoshan commented Mar 22, 2012

Hi Chad,

I've test the master with my original use case. Passed :P

I think I should close the issue.

Great work! Thanks.

@baoshan baoshan closed this Mar 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment