Remove built-in binary int64 parser

This commit is contained in:
Brian Carlson 2013-07-30 13:15:31 -05:00
parent a17f44a4a1
commit fb5520bb8a
5 changed files with 15 additions and 32 deletions

View File

@ -1,9 +1,3 @@
try {
var ref = require('ref');
var endian = (ref.endianness === 'LE') ? 'BE' : 'LE';
} catch(e) {
}
var parseBits = function(data, bits, offset, invert, callback) {
offset = offset || 0;
invert = invert || false;
@ -111,13 +105,6 @@ var parseInt32 = function(value) {
return parseBits(value, 31, 1);
};
var parseInt64 = function(value) {
if(typeof ref == 'undefined') {
throw new Error("the ref module is not installed. npm install ref to use the binary parser on bigints");
}
return String(ref['readInt64' + endian](value, 0));
};
var parseFloat32 = function(value) {
return parseFloatFromBits(value, 23, 8);
};
@ -248,7 +235,6 @@ var parseBool = function(value) {
};
var init = function(register) {
register(20, parseInt64);
register(21, parseInt16);
register(23, parseInt32);
register(26, parseInt32);

View File

@ -25,9 +25,6 @@
"jshint": "1.1.0",
"semver": "~1.1.4"
},
"optionalDependencies": {
"ref": "0.1.3"
},
"scripts": {
"test": "make test-travis connectionString=postgres://postgres@localhost:5432/postgres",
"install": "node-gyp rebuild || (exit 0)"

View File

@ -82,8 +82,8 @@ test("named prepared statement", function() {
test("prepared statements on different clients", function() {
var statementName = "differ";
var statement1 = "select count(*) as count from person";
var statement2 = "select count(*) as count from person where age < $1";
var statement1 = "select count(*)::int4 as count from person";
var statement2 = "select count(*)::int4 as count from person where age < $1";
var client1Finished = false;
var client2Finished = false;

View File

@ -99,7 +99,7 @@ var types = [{
// ignore some tests in binary mode
if (helper.config.binary) {
types = types.filter(function(type) {
return !(type.name in {'real': 1, 'timetz':1, 'time':1, 'numeric': 1});
return !(type.name in {'real': 1, 'timetz':1, 'time':1, 'numeric': 1, 'bigint': 1});
});
}

View File

@ -218,18 +218,18 @@ test('typed results', function() {
actual: [0, 101],
expected: 101
},{
name: 'binary-bigint/int8',
format: 'binary',
dataTypeID: 20,
actual: [0, 0, 0, 0, 0, 0, 0, 102],
expected: '102'
},{
name: 'binary-bigint/int8-full',
format: 'binary',
dataTypeID: 20,
actual: [1, 0, 0, 0, 0, 0, 0, 102],
expected: '72057594037928038'
},{
// name: 'binary-bigint/int8',
// format: 'binary',
// dataTypeID: 20,
// actual: [0, 0, 0, 0, 0, 0, 0, 102],
// expected: '102'
// },{
// name: 'binary-bigint/int8-full',
// format: 'binary',
// dataTypeID: 20,
// actual: [1, 0, 0, 0, 0, 0, 0, 102],
// expected: '72057594037928038'
// },{
name: 'binary-oid',
format: 'binary',
dataTypeID: 26,