mysql-native
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -5,2 +5,3 @@ // websql example adapted from http://html5demos.com/database-rollback | ||
var webdb = require('../lib/mysql-native/wrappers/websql'); | ||
var util = require('util'); | ||
@@ -7,0 +8,0 @@ var db = webdb.openDatabase('test'); |
var net = require('net'); | ||
var util = require('util'); | ||
var SocketClient = require('./socketclient') | ||
exports.createTCPClient = function(host, port) | ||
exports.createTCPClient = function(host, port, connectListener) | ||
{ | ||
var host = host ? host : '127.0.0.1'; | ||
var port = port ? port : 3306; | ||
var connection = net.createConnection(port, host); | ||
var connection = net.createConnection(port, host, connectListener); | ||
@@ -29,2 +30,2 @@ return new SocketClient(connection); | ||
} | ||
} | ||
} |
// expose api methods | ||
exports.auth = require('./commands/auth') | ||
exports.end = exports.close = require('./commands/close') | ||
exports.query = require('./commands/query') | ||
exports.prepare = require('./commands/prepare') | ||
exports.execute = require('./commands/execute') | ||
exports.debug = require('./commands/debug') | ||
exports.auth = require('./commands/auth'); | ||
exports.end = exports.close = require('./commands/close'); | ||
exports.query = require('./commands/query'); | ||
exports.prepare = require('./commands/prepare'); | ||
exports.execute = require('./commands/execute'); | ||
exports.debug = require('./commands/debug'); | ||
exports.ping = require('./commands/ping'); |
var constants = require('../constants'); | ||
var util = require('util'); | ||
@@ -92,16 +93,26 @@ function reader(data) | ||
function parseIEEE754Double(data) | ||
function parseIEEE754Double(data, pos) | ||
{ | ||
// debug | ||
/* | ||
var bytes = []; | ||
for (var i = 0; i < data.length; i++) { | ||
bytes[i] = data.charCodeAt(i); | ||
} | ||
console.log('bytes', JSON.stringify(bytes), 'pos', pos); | ||
*/ | ||
// end debug | ||
var fraction = 0.0; | ||
fraction += data.charCodeAt(2) / ( 16 * 256 * 256 * 256 * 256 * 256 * 256); | ||
fraction += data.charCodeAt(3) / ( 16 * 256 * 256 * 256 * 256 * 256 ); | ||
fraction += data.charCodeAt(4) / ( 16 * 256 * 256 * 256 * 256 ); | ||
fraction += data.charCodeAt(5) / ( 16 * 256 * 256 * 256); | ||
fraction += data.charCodeAt(pos + 0) / ( 16 * 256 * 256 * 256 * 256 * 256 * 256); | ||
fraction += data.charCodeAt(pos + 1) / ( 16 * 256 * 256 * 256 * 256 * 256 ); | ||
fraction += data.charCodeAt(pos + 2) / ( 16 * 256 * 256 * 256 * 256 ); | ||
fraction += data.charCodeAt(pos + 3) / ( 16 * 256 * 256 * 256); | ||
fraction += data.charCodeAt(6) / ( 16 * 256 * 256 ); | ||
fraction += data.charCodeAt(7) / ( 16 * 256 ); | ||
fraction += (data.charCodeAt(8) & 0x0f) / 16.0; | ||
fraction += data.charCodeAt(pos + 4) / ( 16 * 256 * 256 ); | ||
fraction += data.charCodeAt(pos + 5) / ( 16 * 256 ); | ||
fraction += (data.charCodeAt(pos + 6) & 0x0f) / 16.0; | ||
var signbit = data.charCodeAt(9) & 128; | ||
var exponent = ((data.charCodeAt(8) & 0xf0) >> 4) + ((data.charCodeAt(9) & 127) << 4); | ||
var signbit = data.charCodeAt(pos + 7) & 128; | ||
var exponent = ((data.charCodeAt(pos + 6) & 0xf0) >> 4) + ((data.charCodeAt(pos + 7) & 127) << 4); | ||
@@ -147,3 +158,3 @@ var factor = Math.pow(2,exponent-1023); | ||
case constants.types.MYSQL_TYPE_DOUBLE: | ||
result = parseIEEE754Double(this.data); | ||
result = parseIEEE754Double(this.data, this.pos); | ||
break; | ||
@@ -150,0 +161,0 @@ case constants.types.MYSQL_TYPE_BIT: |
// wrappers to provide WebSql-alike interface to mysql | ||
var createTCPClient = require('./client').createTCPClient; | ||
var util = require('util'); | ||
@@ -5,0 +6,0 @@ function transaction(connection) |
@@ -5,3 +5,3 @@ { "name" : "mysql-native" | ||
, "homepage" : "http://github.com/sidorares/nodejs-mysql-native" | ||
, "version" : "0.4.5" | ||
, "version" : "0.4.6" | ||
, "author": "Andrey Sidorov <sidorares@yandex.ru>" | ||
@@ -8,0 +8,0 @@ , "bugs" : { "url" : "http://github.com/sidorares/nodejs-mysql-native/issues" } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96389
45
2624