├── .gitignore ├── Readme.md ├── index.js ├── lib ├── index.js ├── module_test_case.js ├── str.js ├── test.js └── test_case.js ├── package.json └── test ├── common.js ├── fixture └── mysql_client.js └── system └── test-mysql-client-example.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # microtest 2 | 3 | A node.js unit testing framework with great support for using and injecting 4 | test doubles. 5 | 6 | ## 7 | 8 | ## Todo 9 | 10 | * Create own assert module? 11 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib'); 2 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | var ModuleTestCase = require('./module_test_case'); 2 | 3 | exports.module = function(file) { 4 | return ModuleTestCase.fromFile(file); 5 | }; 6 | -------------------------------------------------------------------------------- /lib/module_test_case.js: -------------------------------------------------------------------------------- 1 | var oop = require('oop'); 2 | var path = require('path'); 3 | var TestCase = require('./test_case'); 4 | 5 | function ModuleTestCase(properties) { 6 | TestCase.call(this); 7 | 8 | this.required = {}; 9 | 10 | for (var property in properties) { 11 | this[property] = properties[property]; 12 | } 13 | } 14 | oop.extend(ModuleTestCase, TestCase); 15 | module.exports = ModuleTestCase; 16 | 17 | ModuleTestCase.prototype.compile = function() { 18 | this._fakeModuleSystem(); 19 | TestCase.prototype.compile.call(this); 20 | return this.getExports(); 21 | }; 22 | 23 | ModuleTestCase.prototype.getExports = function() { 24 | return this.context.module.exports; 25 | }; 26 | 27 | ModuleTestCase.prototype._fakeModuleSystem = function() { 28 | var context = this.context; 29 | if (context.require) { 30 | return; 31 | } 32 | 33 | var exports = {}; 34 | 35 | context.global = context; 36 | context.exports = exports; 37 | context.module = {exports: exports}; 38 | 39 | context.require = this.function('require'); 40 | 41 | this.stub(context.require, Infinity, function(path) { 42 | return this.required[path] = this.object(path); 43 | }.bind(this)); 44 | 45 | // Inject a few selected "real" things for convenience 46 | context.console = console; 47 | context.__filename = this._path; 48 | context.__dirname = path.dirname(this._path); 49 | }; 50 | 51 | ModuleTestCase.prototype.requires = function(path, objects) { 52 | this._fakeModuleSystem(); 53 | 54 | var multipleObjects = objects instanceof Array; 55 | objects = [].concat(objects || {}); 56 | var exports = {}; 57 | 58 | objects.forEach(function(object) { 59 | object.name = object.name || object.class || path; 60 | 61 | var value = (object.class) 62 | ? this.class(object.name) 63 | : this.object(object.name); 64 | 65 | if (multipleObjects) { 66 | exports[object.name] = value; 67 | } else { 68 | exports = value; 69 | } 70 | 71 | this.required[object.name] = value; 72 | }.bind(this)); 73 | 74 | this.expect(this.context, 'require') 75 | .withArgs(path) 76 | .andReturn(exports); 77 | }; 78 | -------------------------------------------------------------------------------- /lib/str.js: -------------------------------------------------------------------------------- 1 | var str = exports; 2 | 3 | str.repeat = function(string, times) { 4 | if (times === undefined) { 5 | times = 1; 6 | } 7 | 8 | var repeatedString = ''; 9 | for (var i = 0; i < times; i++) { 10 | repeatedString += string; 11 | } 12 | 13 | return repeatedString; 14 | }; 15 | 16 | str.indent = function(string, indent, times) { 17 | var lines = string.split('\n'); 18 | indent = str.repeat(indent, times); 19 | 20 | return lines 21 | .map(function(line) { 22 | return indent + line; 23 | }) 24 | .join('\n'); 25 | }; 26 | -------------------------------------------------------------------------------- /lib/test.js: -------------------------------------------------------------------------------- 1 | var str = require('./str'); 2 | 3 | function Test(properties) { 4 | this._case = null; 5 | this._name = null; 6 | this._function = null; 7 | 8 | this._errors = []; 9 | 10 | for (var property in properties) { 11 | this[property] = properties[property]; 12 | } 13 | } 14 | module.exports = Test; 15 | 16 | Test.create = function(testCase, name, fn) { 17 | if (arguments.length === 2) { 18 | fn = arguments[0]; 19 | name = fn.name; 20 | } 21 | 22 | return new Test({ 23 | _case: testCase, 24 | _name: name, 25 | _function: fn 26 | }); 27 | }; 28 | 29 | Test.prototype.execute = function() { 30 | try { 31 | var args = this._case.executeBefore(this); 32 | if (args && !(args instanceof Array)) { 33 | args = [args]; 34 | } 35 | 36 | this._function.apply(this, args); 37 | this._case.executeAfter(this); 38 | } catch (error) { 39 | this._handleError(error); 40 | } 41 | 42 | return args; 43 | }; 44 | 45 | Test.prototype._handleError = function(error) { 46 | this._errors.push(error); 47 | 48 | var stack = this._simplifyStack(error.stack); 49 | this._case.printException(stack); 50 | }; 51 | 52 | Test.prototype._simplifyStack = function(stack) { 53 | var lines = stack.split('\n'); 54 | 55 | for (var i = 1; i < lines.length; i++) { 56 | var line = lines[i]; 57 | 58 | var isTestFunction = line.indexOf(__filename) > 0; 59 | if (isTestFunction) { 60 | break; 61 | } 62 | } 63 | 64 | stack = lines 65 | .slice(0, i) 66 | .join('\n'); 67 | 68 | return stack; 69 | }; 70 | 71 | Test.prototype.getErrorCount = function() { 72 | return this._errors.length; 73 | }; 74 | 75 | Test.prototype.getName = function() { 76 | return this._name; 77 | }; 78 | -------------------------------------------------------------------------------- /lib/test_case.js: -------------------------------------------------------------------------------- 1 | var oop = require('oop'); 2 | var fs = require('fs'); 3 | var vm = require('vm'); 4 | var str = require('./str'); 5 | var path = require('path'); 6 | var Fake = require('fake'); 7 | var Test = require('./test'); 8 | var str = require('./str'); 9 | 10 | var noop = function() {}; 11 | 12 | function TestCase() { 13 | this._path = null; 14 | this._source = null; 15 | this._compiled = null; 16 | 17 | this._tests = []; 18 | this._testStack = []; 19 | this._before = noop; 20 | this._after = noop; 21 | 22 | this.context = {}; 23 | this.injected = {}; 24 | 25 | oop.mixin(this, Fake); 26 | } 27 | module.exports = TestCase; 28 | 29 | TestCase._start = new Date; 30 | TestCase._cases = []; 31 | 32 | TestCase.register = function(microTest) { 33 | this._cases.push(microTest); 34 | }; 35 | 36 | TestCase._printReportAndExit = function() { 37 | var stats = this._getStats(); 38 | 39 | // No tests executed? Bail out, the user probably just included this lib 40 | // by accident, but did not mean to run a test. 41 | if (stats.tests === 0) { 42 | return; 43 | } 44 | 45 | console.error( 46 | '%d error%s in %d test%s (took %d ms)', 47 | stats.errors, 48 | (stats.errors !== 1) ? 's' : '', 49 | stats.tests, 50 | (stats.tests !== 1) ? 's' : '', 51 | stats.duration 52 | ); 53 | 54 | if (stats.errors > 0) { 55 | process.reallyExit(1); 56 | } 57 | }; 58 | process.on('exit', TestCase._printReportAndExit.bind(TestCase)); 59 | 60 | TestCase._getStats = function() { 61 | var stats = { 62 | cases: 0, 63 | tests: 0, 64 | errors: 0, 65 | duration: new Date - this._start, 66 | }; 67 | 68 | this._cases.forEach(function(testCase) { 69 | stats.cases++; 70 | stats.tests += testCase.getTestCount(); 71 | stats.errors += testCase.getErrorCount(); 72 | }); 73 | 74 | return stats; 75 | }; 76 | 77 | TestCase.fromFile = function(path) { 78 | var test = new this(); 79 | 80 | this.register(test); 81 | test.load(path); 82 | 83 | return test; 84 | }; 85 | 86 | TestCase.prototype.load = function(path) { 87 | this._path = path; 88 | try { 89 | this._source = fs.readFileSync(path, 'utf-8'); 90 | } catch (e) { 91 | throw new Error('File not found: ' + this._path); 92 | } 93 | }; 94 | 95 | TestCase.prototype.compile = function() { 96 | this._compiled = vm.runInNewContext(this._source, this.context, this._path); 97 | this.verify(); 98 | this.reset(); 99 | return this._compiled; 100 | }; 101 | 102 | TestCase.prototype._guessLine = function(source) { 103 | // This function tries to locate the line of a given piece of source code 104 | // within our file. So far it seems like the heuristics here work great, but 105 | // in the worst case line number reportings for recompileWithInjections may 106 | // not be accurate. 107 | 108 | var offset = this._source.indexOf(source); 109 | if (offset === -1) { 110 | // If we don't find our source as is, lets try to remove the space after 111 | // the first function definition. That seems to be the only thing v8 messes 112 | // with when doing a Function.toString() call. 113 | source = source.replace(/(function) \(/, '$1('); 114 | offset = this._source.indexOf(source); 115 | } 116 | 117 | if (offset === -1) { 118 | return 0; 119 | } 120 | 121 | var line = this._source 122 | .substr(0, offset) 123 | .split('\n') 124 | .length; 125 | 126 | return line - 1; 127 | }; 128 | 129 | TestCase.prototype.before = function(fn) { 130 | this._before = fn; 131 | return this; 132 | }; 133 | 134 | TestCase.prototype.after = function(fn) { 135 | this._after = fn; 136 | return this; 137 | }; 138 | 139 | TestCase.prototype.executeBefore = function(test) { 140 | return this._before.apply(this); 141 | }; 142 | 143 | TestCase.prototype.executeAfter = function(test) { 144 | this._after.apply(this); 145 | 146 | this.verify(); 147 | }; 148 | 149 | TestCase.prototype.injects = function(globalVariable) { 150 | var value = this.class(globalVariable); 151 | this.context[globalVariable] = value; 152 | this.injected[globalVariable] = value; 153 | }; 154 | 155 | TestCase.prototype.describe = function(name, fn) { 156 | var test = Test.create(this, name, fn); 157 | 158 | this._tests.push(test); 159 | this._testStack.push(test); 160 | 161 | test.execute(); 162 | 163 | this._testStack.pop(); 164 | 165 | this.reset(); 166 | 167 | return this; 168 | }; 169 | 170 | TestCase.prototype.getTestCount = function() { 171 | return this._tests.length; 172 | }; 173 | 174 | TestCase.prototype.getErrorCount = function() { 175 | var errors = 0; 176 | this._tests.forEach(function(test) { 177 | errors += test.getErrorCount(); 178 | }); 179 | return errors; 180 | }; 181 | 182 | TestCase.prototype.getDepth = function() { 183 | return this._testStack.length; 184 | }; 185 | 186 | TestCase.prototype.printException = function(stack) { 187 | var trail = []; 188 | this._testStack.forEach(function(test, i) { 189 | var name = test.getName(); 190 | trail.push('"' + name + '"'); 191 | }); 192 | 193 | console.error( 194 | 'Exception in test: %s:\n\n%s\n', 195 | trail.join(' -> '), 196 | str.indent(stack, ' ') 197 | ); 198 | }; 199 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microtest", 3 | "description": "Unit testing done right.", 4 | "version": "0.2.1", 5 | "repository": { 6 | "type": "git", 7 | "url": "git@github.com:felixge/node-microtest.git" 8 | }, 9 | "author": "Felix Geisendörfer (http://debuggable.com/)", 10 | "main": "./lib/microtest.js", 11 | "directories": { 12 | "lib": "node_modules" 13 | }, 14 | "engines": { 15 | "node": "*" 16 | }, 17 | "dependencies": { 18 | "oop": "0.0.3", 19 | "fake": "~0.2.0" 20 | }, 21 | "devDependencies": {} 22 | } -------------------------------------------------------------------------------- /test/common.js: -------------------------------------------------------------------------------- 1 | var common = exports; 2 | var path = require('path'); 3 | 4 | common.dir = { 5 | fixture: path.join(__dirname, 'fixture') 6 | }; 7 | 8 | common.assert = require('assert'); 9 | common.microtest = require('../lib'); 10 | -------------------------------------------------------------------------------- /test/fixture/mysql_client.js: -------------------------------------------------------------------------------- 1 | var util = require('util'), 2 | Stream = require('net').Stream, 3 | auth = require('./auth'), 4 | Parser = require('./parser'), 5 | OutgoingPacket = require('./outgoing_packet'), 6 | Query = require('./query'), 7 | EventEmitter = require('events').EventEmitter; 8 | 9 | module.exports = Client; 10 | 11 | function Client(properties) { 12 | if (!(this instanceof Client)) { 13 | return new Client(properties); 14 | } 15 | 16 | EventEmitter.call(this); 17 | 18 | this.host = 'localhost'; 19 | this.port = 3306; 20 | this.user = null; 21 | this.password = null; 22 | this.database = ''; 23 | 24 | this.typeCast = true; 25 | this.flags = Client.defaultFlags; 26 | this.maxPacketSize = 0x01000000; 27 | this.charsetNumber = Client.UTF8_UNICODE_CI; 28 | this.debug = false; 29 | this.ending = false; 30 | this.connected = false; 31 | 32 | this._greeting = null; 33 | this._queue = []; 34 | this._connection = null; 35 | this._parser = null; 36 | 37 | for (var key in properties) { 38 | this[key] = properties[key]; 39 | } 40 | }; 41 | util.inherits(Client, EventEmitter); 42 | 43 | Client.prototype.connect = function(cb) { 44 | var self = this; 45 | this._enqueue(function connect() { 46 | var connection = self._connection = new Stream(), 47 | parser = self._parser = new Parser(); 48 | 49 | connection 50 | .on('error', function(err) { 51 | var connectionError = err.code && err.code.match(/ECONNREFUSED|ENOTFOUND/); 52 | if (connectionError) { 53 | if (cb) { 54 | cb(err); 55 | return; 56 | } 57 | } 58 | 59 | self.emit('error', err); 60 | }) 61 | .on('data', function(b) { 62 | parser.write(b); 63 | }) 64 | .on('end', function() { 65 | if (self.ending) { 66 | self.connected = false; 67 | self.ending = false; 68 | return; 69 | } 70 | 71 | if (!self.connected) { 72 | return; 73 | } 74 | 75 | self.connected = false; 76 | self._prequeue(connect); 77 | }); 78 | connection.connect(self.port, self.host); 79 | 80 | parser 81 | .on('packet', function(packet) { 82 | self._handlePacket(packet); 83 | }); 84 | }, cb); 85 | }; 86 | 87 | Client.prototype.query = function(sql, params, cb) { 88 | var self = this; 89 | 90 | if (Array.isArray(params)) { 91 | sql = this.format(sql, params); 92 | } else { 93 | cb = arguments[1]; 94 | } 95 | 96 | var query = new Query({ 97 | typeCast: this.typeCast, 98 | sql: sql 99 | }); 100 | 101 | if (cb) { 102 | var rows = [], fields = {}; 103 | query 104 | .on('error', function(err) { 105 | cb(err); 106 | self._dequeue(); 107 | }) 108 | .on('field', function(field) { 109 | fields[field.name] = field; 110 | }) 111 | .on('row', function(row) { 112 | rows.push(row); 113 | }) 114 | .on('end', function(result) { 115 | if (result) { 116 | cb(null, result); 117 | } else { 118 | cb(null, rows, fields); 119 | } 120 | 121 | self._dequeue(); 122 | }); 123 | } else { 124 | query 125 | .on('error', function(err) { 126 | if (query.listeners('error').length <= 1) { 127 | self.emit('error', err); 128 | } 129 | self._dequeue(); 130 | }) 131 | .on('end', function(result) { 132 | self._dequeue(); 133 | }); 134 | } 135 | 136 | this._enqueue(function query() { 137 | var packet = new OutgoingPacket(1 + Buffer.byteLength(sql, 'utf-8')); 138 | 139 | packet.writeNumber(1, Client.COM_QUERY); 140 | packet.write(sql, 'utf-8'); 141 | self.write(packet); 142 | }, query); 143 | 144 | return query; 145 | }; 146 | 147 | Client.prototype.write = function(packet) { 148 | if (this.debug) { 149 | console.log('-> %s', packet.buffer.inspect()); 150 | } 151 | 152 | this._connection.write(packet.buffer); 153 | }; 154 | 155 | Client.prototype.format = function(sql, params) { 156 | var escape = this.escape; 157 | sql = sql.replace(/\?/g, function() { 158 | if (params.length == 0) { 159 | throw new Error('too few parameters given'); 160 | } 161 | 162 | return escape(params.shift()); 163 | }); 164 | 165 | if (params.length) { 166 | throw new Error('too many parameters given'); 167 | } 168 | 169 | return sql; 170 | }; 171 | 172 | Client.prototype.escape = function(val) { 173 | if (val === undefined || val === null) { 174 | return 'NULL'; 175 | } 176 | 177 | switch (typeof val) { 178 | case 'boolean': return (val) ? 'true' : 'false'; 179 | case 'number': return val+''; 180 | } 181 | 182 | if (typeof val === 'object') { 183 | val = val.toString(); 184 | } 185 | 186 | val = val.replace(/[\0\n\r\b\t\\\'\"\x1a]/g, function(s) { 187 | switch(s) { 188 | case "\0": return "\\0"; 189 | case "\n": return "\\n"; 190 | case "\r": return "\\r"; 191 | case "\b": return "\\b"; 192 | case "\t": return "\\t"; 193 | case "\x1a": return "\\Z"; 194 | default: return "\\"+s; 195 | } 196 | }); 197 | return "'"+val+"'"; 198 | }; 199 | 200 | Client.prototype.ping = function(cb) { 201 | var self = this; 202 | this._enqueue(function ping() { 203 | var packet = new OutgoingPacket(1); 204 | packet.writeNumber(1, Client.COM_PING); 205 | self.write(packet); 206 | }, cb); 207 | }; 208 | 209 | Client.prototype.statistics = function(cb) { 210 | var self = this; 211 | this._enqueue(function statistics() { 212 | var packet = new OutgoingPacket(1); 213 | packet.writeNumber(1, Client.COM_STATISTICS); 214 | self.write(packet); 215 | }, cb); 216 | }; 217 | 218 | Client.prototype.useDatabase = function(database, cb) { 219 | var self = this; 220 | this._enqueue(function useDatabase() { 221 | var packet = new OutgoingPacket(1 + Buffer.byteLength(database, 'utf-8')); 222 | packet.writeNumber(1, Client.COM_INIT_DB); 223 | packet.write(database, 'utf-8'); 224 | self.write(packet); 225 | }, cb); 226 | }; 227 | 228 | Client.prototype.destroy = function() { 229 | this._connection.destroy(); 230 | } 231 | 232 | Client.prototype.end = function(cb) { 233 | var self = this; 234 | 235 | this.ending = true; 236 | 237 | this._enqueue(function end() { 238 | var packet = new OutgoingPacket(1); 239 | packet.writeNumber(1, Client.COM_QUIT); 240 | self.write(packet); 241 | if (cb) { 242 | self._connection.on('end', cb); 243 | } 244 | 245 | self._dequeue(); 246 | }); 247 | }; 248 | 249 | Client.prototype._prequeue = function(fn, delegate) { 250 | this._queue.unshift({fn: fn, delegate: delegate}); 251 | fn(); 252 | }; 253 | 254 | Client.prototype._enqueue = function(fn, delegate) { 255 | this._queue.push({fn: fn, delegate: delegate}); 256 | if (this._queue.length == 1) { 257 | fn(); 258 | } 259 | }; 260 | 261 | Client.prototype._dequeue = function() { 262 | this._queue.shift(); 263 | 264 | if (!this._queue.length) { 265 | return; 266 | } 267 | 268 | this._queue[0].fn(); 269 | }; 270 | 271 | Client.prototype._handlePacket = function(packet) { 272 | if (this.debug) { 273 | this._debugPacket(packet); 274 | } 275 | 276 | if (packet.type == Parser.GREETING_PACKET) { 277 | this._sendAuth(packet); 278 | return; 279 | } 280 | 281 | if (packet.type == Parser.USE_OLD_PASSWORD_PROTOCOL_PACKET) { 282 | this._sendOldAuth(this._greeting); 283 | return; 284 | } 285 | 286 | var type = packet.type, 287 | task = this._queue[0], 288 | delegate = (task) 289 | ? task.delegate 290 | : null; 291 | 292 | if (delegate instanceof Query) { 293 | delegate._handlePacket(packet); 294 | return; 295 | } 296 | 297 | if (type != Parser.ERROR_PACKET) { 298 | this.connected = true; 299 | if (delegate) { 300 | delegate(null, Client._packetToUserObject(packet)); 301 | } 302 | } else { 303 | packet = Client._packetToUserObject(packet); 304 | if (delegate) { 305 | delegate(packet); 306 | } else { 307 | this.emit('error', packet); 308 | } 309 | } 310 | this._dequeue(); 311 | }; 312 | 313 | Client.prototype._sendAuth = function(greeting) { 314 | var token = auth.token(this.password, greeting.scrambleBuffer), 315 | packetSize = ( 316 | 4 + 4 + 1 + 23 + 317 | this.user.length + 1 + 318 | token.length + 1 + 319 | this.database.length + 1 320 | ), 321 | packet = new OutgoingPacket(packetSize, greeting.number+1); 322 | 323 | packet.writeNumber(4, this.flags); 324 | packet.writeNumber(4, this.maxPacketSize); 325 | packet.writeNumber(1, this.charsetNumber); 326 | packet.writeFiller(23); 327 | packet.writeNullTerminated(this.user); 328 | packet.writeLengthCoded(token); 329 | packet.writeNullTerminated(this.database); 330 | 331 | this.write(packet); 332 | 333 | // Keep a reference to the greeting packet. We might receive a 334 | // USE_OLD_PASSWORD_PROTOCOL_PACKET as a response, in which case we will need 335 | // the greeting packet again. See _sendOldAuth() 336 | this._greeting = greeting; 337 | }; 338 | 339 | Client._packetToUserObject = function(packet) { 340 | var userObject = (packet.type == Parser.ERROR_PACKET) 341 | ? new Error() 342 | : {}; 343 | 344 | for (var key in packet) { 345 | var newKey = key; 346 | if (key == 'type' || key == 'number' || key == 'length' || key == 'received') { 347 | continue; 348 | } 349 | 350 | if (key == 'errorMessage') { 351 | newKey = 'message'; 352 | } else if (key == 'errorNumber') { 353 | newKey = 'number'; 354 | } 355 | 356 | userObject[newKey] = packet[key]; 357 | } 358 | 359 | return userObject; 360 | }; 361 | 362 | Client.prototype._debugPacket = function(packet) { 363 | var packetName = null; 364 | for (var key in Parser) { 365 | if (!key.match(/_PACKET$/)) { 366 | continue; 367 | } 368 | 369 | if (Parser[key] == packet.type) { 370 | packetName = key; 371 | break; 372 | } 373 | } 374 | console.log('<- %s: %j', packetName, packet); 375 | }; 376 | 377 | Client.prototype._sendOldAuth = function(greeting) { 378 | var token = auth.scramble323(greeting.scrambleBuffer, this.password), 379 | packetSize = ( 380 | token.length + 1 381 | ), 382 | packet = new OutgoingPacket(packetSize, greeting.number+3); 383 | 384 | // I could not find any official documentation for this, but from sniffing 385 | // the mysql command line client, I think this is the right way to send the 386 | // scrambled token after receiving the USE_OLD_PASSWORD_PROTOCOL_PACKET. 387 | packet.write(token); 388 | packet.writeFiller(1); 389 | 390 | this.write(packet); 391 | }; 392 | 393 | // Client Flags 394 | Client.LONG_PASSWORD = 1; 395 | Client.FOUND_ROWS = 2; 396 | Client.LONG_FLAG = 4; 397 | Client.CONNECT_WITH_DB = 8; 398 | Client.NO_SCHEMA = 16; 399 | Client.COMPRESS = 32; 400 | Client.ODBC = 64; 401 | Client.LOCAL_FILES = 128; 402 | Client.IGNORE_SPACE = 256; 403 | Client.PROTOCOL_41 = 512; 404 | Client.INTERACTIVE = 1024; 405 | Client.SSL = 2048; 406 | Client.IGNORE_SIGPIPE = 4096; 407 | Client.TRANSACTIONS = 8192; 408 | Client.RESERVED = 16384; 409 | Client.SECURE_CONNECTION = 32768; 410 | Client.MULTI_STATEMENTS = 65536; 411 | Client.MULTI_RESULTS = 131072; 412 | 413 | Client.defaultFlags = 414 | Client.LONG_PASSWORD 415 | | Client.FOUND_ROWS 416 | | Client.LONG_FLAG 417 | | Client.CONNECT_WITH_DB 418 | | Client.ODBC 419 | | Client.LOCAL_FILES 420 | | Client.IGNORE_SPACE 421 | | Client.PROTOCOL_41 422 | | Client.INTERACTIVE 423 | | Client.IGNORE_SIGPIPE 424 | | Client.TRANSACTIONS 425 | | Client.RESERVED 426 | | Client.SECURE_CONNECTION 427 | | Client.MULTI_STATEMENTS 428 | | Client.MULTI_RESULTS; 429 | 430 | // Commands 431 | Client.COM_SLEEP = 0x00; 432 | Client.COM_QUIT = 0x01; 433 | Client.COM_INIT_DB = 0x02; 434 | Client.COM_QUERY = 0x03; 435 | Client.COM_FIELD_LIST = 0x04; 436 | Client.COM_CREATE_DB = 0x05; 437 | Client.COM_DROP_DB = 0x06; 438 | Client.COM_REFRESH = 0x07; 439 | Client.COM_SHUTDOWN = 0x08; 440 | Client.COM_STATISTICS = 0x09; 441 | Client.COM_PROCESS_INFO = 0x0a; 442 | Client.COM_CONNECT = 0x0b; 443 | Client.COM_PROCESS_KILL = 0x0c; 444 | Client.COM_DEBUG = 0x0d; 445 | Client.COM_PING = 0x0e; 446 | Client.COM_TIME = 0x0f; 447 | Client.COM_DELAYED_INSERT = 0x10; 448 | Client.COM_CHANGE_USER = 0x11; 449 | Client.COM_BINLOG_DUMP = 0x12; 450 | Client.COM_TABLE_DUMP = 0x13; 451 | Client.COM_CONNECT_OUT = 0x14; 452 | Client.COM_REGISTER_SLAVE = 0x15; 453 | Client.COM_STMT_PREPARE = 0x16; 454 | Client.COM_STMT_EXECUTE = 0x17; 455 | Client.COM_STMT_SEND_LONG_DATA = 0x18; 456 | Client.COM_STMT_CLOSE = 0x19; 457 | Client.COM_STMT_RESET = 0x1a; 458 | Client.COM_SET_OPTION = 0x1b; 459 | Client.COM_STMT_FETCH = 0x1c; 460 | 461 | // Collations / Charsets 462 | Client.BIG5_CHINESE_CI = 1; 463 | Client.LATIN2_CZECH_CS = 2; 464 | Client.DEC8_SWEDISH_CI = 3; 465 | Client.CP850_GENERAL_CI = 4; 466 | Client.LATIN1_GERMAN1_CI = 5; 467 | Client.HP8_ENGLISH_CI = 6; 468 | Client.KOI8R_GENERAL_CI = 7; 469 | Client.LATIN1_SWEDISH_CI = 8; 470 | Client.LATIN2_GENERAL_CI = 9; 471 | Client.SWE7_SWEDISH_CI = 10; 472 | Client.ASCII_GENERAL_CI = 11; 473 | Client.UJIS_JAPANESE_CI = 12; 474 | Client.SJIS_JAPANESE_CI = 13; 475 | Client.CP1251_BULGARIAN_CI = 14; 476 | Client.LATIN1_DANISH_CI = 15; 477 | Client.HEBREW_GENERAL_CI = 16; 478 | Client.TIS620_THAI_CI = 18; 479 | Client.EUCKR_KOREAN_CI = 19; 480 | Client.LATIN7_ESTONIAN_CS = 20; 481 | Client.LATIN2_HUNGARIAN_CI = 21; 482 | Client.KOI8U_GENERAL_CI = 22; 483 | Client.CP1251_UKRAINIAN_CI = 23; 484 | Client.GB2312_CHINESE_CI = 24; 485 | Client.GREEK_GENERAL_CI = 25; 486 | Client.CP1250_GENERAL_CI = 26; 487 | Client.LATIN2_CROATIAN_CI = 27; 488 | Client.GBK_CHINESE_CI = 28; 489 | Client.CP1257_LITHUANIAN_CI = 29; 490 | Client.LATIN5_TURKISH_CI = 30; 491 | Client.LATIN1_GERMAN2_CI = 31; 492 | Client.ARMSCII8_GENERAL_CI = 32; 493 | Client.UTF8_GENERAL_CI = 33; 494 | Client.CP1250_CZECH_CS = 34; 495 | Client.UCS2_GENERAL_CI = 35; 496 | Client.CP866_GENERAL_CI = 36; 497 | Client.KEYBCS2_GENERAL_CI = 37; 498 | Client.MACCE_GENERAL_CI = 38; 499 | Client.MACROMAN_GENERAL_CI = 39; 500 | Client.CP852_GENERAL_CI = 40; 501 | Client.LATIN7_GENERAL_CI = 41; 502 | Client.LATIN7_GENERAL_CS = 42; 503 | Client.MACCE_BIN = 43; 504 | Client.CP1250_CROATIAN_CI = 44; 505 | Client.LATIN1_BIN = 47; 506 | Client.LATIN1_GENERAL_CI = 48; 507 | Client.LATIN1_GENERAL_CS = 49; 508 | Client.CP1251_BIN = 50; 509 | Client.CP1251_GENERAL_CI = 51; 510 | Client.CP1251_GENERAL_CS = 52; 511 | Client.MACROMAN_BIN = 53; 512 | Client.CP1256_GENERAL_CI = 57; 513 | Client.CP1257_BIN = 58; 514 | Client.CP1257_GENERAL_CI = 59; 515 | Client.BINARY = 63; 516 | Client.ARMSCII8_BIN = 64; 517 | Client.ASCII_BIN = 65; 518 | Client.CP1250_BIN = 66; 519 | Client.CP1256_BIN = 67; 520 | Client.CP866_BIN = 68; 521 | Client.DEC8_BIN = 69; 522 | Client.GREEK_BIN = 70; 523 | Client.HEBREW_BIN = 71; 524 | Client.HP8_BIN = 72; 525 | Client.KEYBCS2_BIN = 73; 526 | Client.KOI8R_BIN = 74; 527 | Client.KOI8U_BIN = 75; 528 | Client.LATIN2_BIN = 77; 529 | Client.LATIN5_BIN = 78; 530 | Client.LATIN7_BIN = 79; 531 | Client.CP850_BIN = 80; 532 | Client.CP852_BIN = 81; 533 | Client.SWE7_BIN = 82; 534 | Client.UTF8_BIN = 83; 535 | Client.BIG5_BIN = 84; 536 | Client.EUCKR_BIN = 85; 537 | Client.GB2312_BIN = 86; 538 | Client.GBK_BIN = 87; 539 | Client.SJIS_BIN = 88; 540 | Client.TIS620_BIN = 89; 541 | Client.UCS2_BIN = 90; 542 | Client.UJIS_BIN = 91; 543 | Client.GEOSTD8_GENERAL_CI = 92; 544 | Client.GEOSTD8_BIN = 93; 545 | Client.LATIN1_SPANISH_CI = 94; 546 | Client.CP932_JAPANESE_CI = 95; 547 | Client.CP932_BIN = 96; 548 | Client.EUCJPMS_JAPANESE_CI = 97; 549 | Client.EUCJPMS_BIN = 98; 550 | Client.CP1250_POLISH_CI = 99; 551 | Client.UCS2_UNICODE_CI = 128; 552 | Client.UCS2_ICELANDIC_CI = 129; 553 | Client.UCS2_LATVIAN_CI = 130; 554 | Client.UCS2_ROMANIAN_CI = 131; 555 | Client.UCS2_SLOVENIAN_CI = 132; 556 | Client.UCS2_POLISH_CI = 133; 557 | Client.UCS2_ESTONIAN_CI = 134; 558 | Client.UCS2_SPANISH_CI = 135; 559 | Client.UCS2_SWEDISH_CI = 136; 560 | Client.UCS2_TURKISH_CI = 137; 561 | Client.UCS2_CZECH_CI = 138; 562 | Client.UCS2_DANISH_CI = 139; 563 | Client.UCS2_LITHUANIAN_CI = 140; 564 | Client.UCS2_SLOVAK_CI = 141; 565 | Client.UCS2_SPANISH2_CI = 142; 566 | Client.UCS2_ROMAN_CI = 143; 567 | Client.UCS2_PERSIAN_CI = 144; 568 | Client.UCS2_ESPERANTO_CI = 145; 569 | Client.UCS2_HUNGARIAN_CI = 146; 570 | Client.UTF8_UNICODE_CI = 192; 571 | Client.UTF8_ICELANDIC_CI = 193; 572 | Client.UTF8_LATVIAN_CI = 194; 573 | Client.UTF8_ROMANIAN_CI = 195; 574 | Client.UTF8_SLOVENIAN_CI = 196; 575 | Client.UTF8_POLISH_CI = 197; 576 | Client.UTF8_ESTONIAN_CI = 198; 577 | Client.UTF8_SPANISH_CI = 199; 578 | Client.UTF8_SWEDISH_CI = 200; 579 | Client.UTF8_TURKISH_CI = 201; 580 | Client.UTF8_CZECH_CI = 202; 581 | Client.UTF8_DANISH_CI = 203; 582 | Client.UTF8_LITHUANIAN_CI = 204; 583 | Client.UTF8_SLOVAK_CI = 205; 584 | Client.UTF8_SPANISH2_CI = 206; 585 | Client.UTF8_ROMAN_CI = 207; 586 | Client.UTF8_PERSIAN_CI = 208; 587 | Client.UTF8_ESPERANTO_CI = 209; 588 | Client.UTF8_HUNGARIAN_CI = 210; 589 | 590 | // Error numbers 591 | // from: http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html 592 | Client.ERROR_HASHCHK = 1000; 593 | Client.ERROR_NISAMCHK = 1001; 594 | Client.ERROR_NO = 1002; 595 | Client.ERROR_YES = 1003; 596 | Client.ERROR_CANT_CREATE_FILE = 1004; 597 | Client.ERROR_CANT_CREATE_TABLE = 1005; 598 | Client.ERROR_CANT_CREATE_DB = 1006; 599 | Client.ERROR_DB_CREATE_EXISTS = 1007; 600 | Client.ERROR_DB_DROP_EXISTS = 1008; 601 | Client.ERROR_DB_DROP_DELETE = 1009; 602 | Client.ERROR_DB_DROP_RMDIR = 1010; 603 | Client.ERROR_CANT_DELETE_FILE = 1011; 604 | Client.ERROR_CANT_FIND_SYSTEM_REC = 1012; 605 | Client.ERROR_CANT_GET_STAT = 1013; 606 | Client.ERROR_CANT_GET_WD = 1014; 607 | Client.ERROR_CANT_LOCK = 1015; 608 | Client.ERROR_CANT_OPEN_FILE = 1016; 609 | Client.ERROR_FILE_NOT_FOUND = 1017; 610 | Client.ERROR_CANT_READ_DIR = 1018; 611 | Client.ERROR_CANT_SET_WD = 1019; 612 | Client.ERROR_CHECKREAD = 1020; 613 | Client.ERROR_DISK_FULL = 1021; 614 | Client.ERROR_DUP_KEY = 1022; 615 | Client.ERROR_ERROR_ON_CLOSE = 1023; 616 | Client.ERROR_ERROR_ON_READ = 1024; 617 | Client.ERROR_ERROR_ON_RENAME = 1025; 618 | Client.ERROR_ERROR_ON_WRITE = 1026; 619 | Client.ERROR_FILE_USED = 1027; 620 | Client.ERROR_FILSORT_ABORT = 1028; 621 | Client.ERROR_FORM_NOT_FOUND = 1029; 622 | Client.ERROR_GET_ERRNO = 1030; 623 | Client.ERROR_ILLEGAL_HA = 1031; 624 | Client.ERROR_KEY_NOT_FOUND = 1032; 625 | Client.ERROR_NOT_FORM_FILE = 1033; 626 | Client.ERROR_NOT_KEYFILE = 1034; 627 | Client.ERROR_OLD_KEYFILE = 1035; 628 | Client.ERROR_OPEN_AS_READONLY = 1036; 629 | Client.ERROR_OUTOFMEMORY = 1037; 630 | Client.ERROR_OUT_OF_SORTMEMORY = 1038; 631 | Client.ERROR_UNEXPECTED_EOF = 1039; 632 | Client.ERROR_CON_COUNT_ERROR = 1040; 633 | Client.ERROR_OUT_OF_RESOURCES = 1041; 634 | Client.ERROR_BAD_HOST_ERROR = 1042; 635 | Client.ERROR_HANDSHAKE_ERROR = 1043; 636 | Client.ERROR_DBACCESS_DENIED_ERROR = 1044; 637 | Client.ERROR_ACCESS_DENIED_ERROR = 1045; 638 | Client.ERROR_NO_DB_ERROR = 1046; 639 | Client.ERROR_UNKNOWN_COM_ERROR = 1047; 640 | Client.ERROR_BAD_NULL_ERROR = 1048; 641 | Client.ERROR_BAD_DB_ERROR = 1049; 642 | Client.ERROR_TABLE_EXISTS_ERROR = 1050; 643 | Client.ERROR_BAD_TABLE_ERROR = 1051; 644 | Client.ERROR_NON_UNIQ_ERROR = 1052; 645 | Client.ERROR_SERVERROR_SHUTDOWN = 1053; 646 | Client.ERROR_BAD_FIELD_ERROR = 1054; 647 | Client.ERROR_WRONG_FIELD_WITH_GROUP = 1055; 648 | Client.ERROR_WRONG_GROUP_FIELD = 1056; 649 | Client.ERROR_WRONG_SUM_SELECT = 1057; 650 | Client.ERROR_WRONG_VALUE_COUNT = 1058; 651 | Client.ERROR_TOO_LONG_IDENT = 1059; 652 | Client.ERROR_DUP_FIELDNAME = 1060; 653 | Client.ERROR_DUP_KEYNAME = 1061; 654 | Client.ERROR_DUP_ENTRY = 1062; 655 | Client.ERROR_WRONG_FIELD_SPEC = 1063; 656 | Client.ERROR_PARSE_ERROR = 1064; 657 | Client.ERROR_EMPTY_QUERY = 1065; 658 | Client.ERROR_NONUNIQ_TABLE = 1066; 659 | Client.ERROR_INVALID_DEFAULT = 1067; 660 | Client.ERROR_MULTIPLE_PRI_KEY = 1068; 661 | Client.ERROR_TOO_MANY_KEYS = 1069; 662 | Client.ERROR_TOO_MANY_KEY_PARTS = 1070; 663 | Client.ERROR_TOO_LONG_KEY = 1071; 664 | Client.ERROR_KEY_COLUMN_DOES_NOT_EXITS = 1072; 665 | Client.ERROR_BLOB_USED_AS_KEY = 1073; 666 | Client.ERROR_TOO_BIG_FIELDLENGTH = 1074; 667 | Client.ERROR_WRONG_AUTO_KEY = 1075; 668 | Client.ERROR_READY = 1076; 669 | Client.ERROR_NORMAL_SHUTDOWN = 1077; 670 | Client.ERROR_GOT_SIGNAL = 1078; 671 | Client.ERROR_SHUTDOWN_COMPLETE = 1079; 672 | Client.ERROR_FORCING_CLOSE = 1080; 673 | Client.ERROR_IPSOCK_ERROR = 1081; 674 | Client.ERROR_NO_SUCH_INDEX = 1082; 675 | Client.ERROR_WRONG_FIELD_TERMINATORS = 1083; 676 | Client.ERROR_BLOBS_AND_NO_TERMINATED = 1084; 677 | Client.ERROR_TEXTFILE_NOT_READABLE = 1085; 678 | Client.ERROR_FILE_EXISTS_ERROR = 1086; 679 | Client.ERROR_LOAD_INFO = 1087; 680 | Client.ERROR_ALTERROR_INFO = 1088; 681 | Client.ERROR_WRONG_SUB_KEY = 1089; 682 | Client.ERROR_CANT_REMOVE_ALL_FIELDS = 1090; 683 | Client.ERROR_CANT_DROP_FIELD_OR_KEY = 1091; 684 | Client.ERROR_INSERT_INFO = 1092; 685 | Client.ERROR_UPDATE_TABLE_USED = 1093; 686 | Client.ERROR_NO_SUCH_THREAD = 1094; 687 | Client.ERROR_KILL_DENIED_ERROR = 1095; 688 | Client.ERROR_NO_TABLES_USED = 1096; 689 | Client.ERROR_TOO_BIG_SET = 1097; 690 | Client.ERROR_NO_UNIQUE_LOGFILE = 1098; 691 | Client.ERROR_TABLE_NOT_LOCKED_FOR_WRITE = 1099; 692 | Client.ERROR_TABLE_NOT_LOCKED = 1100; 693 | Client.ERROR_BLOB_CANT_HAVE_DEFAULT = 1101; 694 | Client.ERROR_WRONG_DB_NAME = 1102; 695 | Client.ERROR_WRONG_TABLE_NAME = 1103; 696 | Client.ERROR_TOO_BIG_SELECT = 1104; 697 | Client.ERROR_UNKNOWN_ERROR = 1105; 698 | Client.ERROR_UNKNOWN_PROCEDURE = 1106; 699 | Client.ERROR_WRONG_PARAMCOUNT_TO_PROCEDURE = 1107; 700 | Client.ERROR_WRONG_PARAMETERS_TO_PROCEDURE = 1108; 701 | Client.ERROR_UNKNOWN_TABLE = 1109; 702 | Client.ERROR_FIELD_SPECIFIED_TWICE = 1110; 703 | Client.ERROR_INVALID_GROUP_FUNC_USE = 1111; 704 | Client.ERROR_UNSUPPORTED_EXTENSION = 1112; 705 | Client.ERROR_TABLE_MUST_HAVE_COLUMNS = 1113; 706 | Client.ERROR_RECORD_FILE_FULL = 1114; 707 | Client.ERROR_UNKNOWN_CHARACTERROR_SET = 1115; 708 | Client.ERROR_TOO_MANY_TABLES = 1116; 709 | Client.ERROR_TOO_MANY_FIELDS = 1117; 710 | Client.ERROR_TOO_BIG_ROWSIZE = 1118; 711 | Client.ERROR_STACK_OVERRUN = 1119; 712 | Client.ERROR_WRONG_OUTERROR_JOIN = 1120; 713 | Client.ERROR_NULL_COLUMN_IN_INDEX = 1121; 714 | Client.ERROR_CANT_FIND_UDF = 1122; 715 | Client.ERROR_CANT_INITIALIZE_UDF = 1123; 716 | Client.ERROR_UDF_NO_PATHS = 1124; 717 | Client.ERROR_UDF_EXISTS = 1125; 718 | Client.ERROR_CANT_OPEN_LIBRARY = 1126; 719 | Client.ERROR_CANT_FIND_DL_ENTRY = 1127; 720 | Client.ERROR_FUNCTION_NOT_DEFINED = 1128; 721 | Client.ERROR_HOST_IS_BLOCKED = 1129; 722 | Client.ERROR_HOST_NOT_PRIVILEGED = 1130; 723 | Client.ERROR_PASSWORD_ANONYMOUS_USER = 1131; 724 | Client.ERROR_PASSWORD_NOT_ALLOWED = 1132; 725 | Client.ERROR_PASSWORD_NO_MATCH = 1133; 726 | Client.ERROR_UPDATE_INFO = 1134; 727 | Client.ERROR_CANT_CREATE_THREAD = 1135; 728 | Client.ERROR_WRONG_VALUE_COUNT_ON_ROW = 1136; 729 | Client.ERROR_CANT_REOPEN_TABLE = 1137; 730 | Client.ERROR_INVALID_USE_OF_NULL = 1138; 731 | Client.ERROR_REGEXP_ERROR = 1139; 732 | Client.ERROR_MIX_OF_GROUP_FUNC_AND_FIELDS = 1140; 733 | Client.ERROR_NONEXISTING_GRANT = 1141; 734 | Client.ERROR_TABLEACCESS_DENIED_ERROR = 1142; 735 | Client.ERROR_COLUMNACCESS_DENIED_ERROR = 1143; 736 | Client.ERROR_ILLEGAL_GRANT_FOR_TABLE = 1144; 737 | Client.ERROR_GRANT_WRONG_HOST_OR_USER = 1145; 738 | Client.ERROR_NO_SUCH_TABLE = 1146; 739 | Client.ERROR_NONEXISTING_TABLE_GRANT = 1147; 740 | Client.ERROR_NOT_ALLOWED_COMMAND = 1148; 741 | Client.ERROR_SYNTAX_ERROR = 1149; 742 | Client.ERROR_DELAYED_CANT_CHANGE_LOCK = 1150; 743 | Client.ERROR_TOO_MANY_DELAYED_THREADS = 1151; 744 | Client.ERROR_ABORTING_CONNECTION = 1152; 745 | Client.ERROR_NET_PACKET_TOO_LARGE = 1153; 746 | Client.ERROR_NET_READ_ERROR_FROM_PIPE = 1154; 747 | Client.ERROR_NET_FCNTL_ERROR = 1155; 748 | Client.ERROR_NET_PACKETS_OUT_OF_ORDER = 1156; 749 | Client.ERROR_NET_UNCOMPRESS_ERROR = 1157; 750 | Client.ERROR_NET_READ_ERROR = 1158; 751 | Client.ERROR_NET_READ_INTERRUPTED = 1159; 752 | Client.ERROR_NET_ERROR_ON_WRITE = 1160; 753 | Client.ERROR_NET_WRITE_INTERRUPTED = 1161; 754 | Client.ERROR_TOO_LONG_STRING = 1162; 755 | Client.ERROR_TABLE_CANT_HANDLE_BLOB = 1163; 756 | Client.ERROR_TABLE_CANT_HANDLE_AUTO_INCREMENT = 1164; 757 | Client.ERROR_DELAYED_INSERT_TABLE_LOCKED = 1165; 758 | Client.ERROR_WRONG_COLUMN_NAME = 1166; 759 | Client.ERROR_WRONG_KEY_COLUMN = 1167; 760 | Client.ERROR_WRONG_MRG_TABLE = 1168; 761 | Client.ERROR_DUP_UNIQUE = 1169; 762 | Client.ERROR_BLOB_KEY_WITHOUT_LENGTH = 1170; 763 | Client.ERROR_PRIMARY_CANT_HAVE_NULL = 1171; 764 | Client.ERROR_TOO_MANY_ROWS = 1172; 765 | Client.ERROR_REQUIRES_PRIMARY_KEY = 1173; 766 | Client.ERROR_NO_RAID_COMPILED = 1174; 767 | Client.ERROR_UPDATE_WITHOUT_KEY_IN_SAFE_MODE = 1175; 768 | Client.ERROR_KEY_DOES_NOT_EXITS = 1176; 769 | Client.ERROR_CHECK_NO_SUCH_TABLE = 1177; 770 | Client.ERROR_CHECK_NOT_IMPLEMENTED = 1178; 771 | Client.ERROR_CANT_DO_THIS_DURING_AN_TRANSACTION = 1179; 772 | Client.ERROR_ERROR_DURING_COMMIT = 1180; 773 | Client.ERROR_ERROR_DURING_ROLLBACK = 1181; 774 | Client.ERROR_ERROR_DURING_FLUSH_LOGS = 1182; 775 | Client.ERROR_ERROR_DURING_CHECKPOINT = 1183; 776 | Client.ERROR_NEW_ABORTING_CONNECTION = 1184; 777 | Client.ERROR_DUMP_NOT_IMPLEMENTED = 1185; 778 | Client.ERROR_FLUSH_MASTERROR_BINLOG_CLOSED = 1186; 779 | Client.ERROR_INDEX_REBUILD = 1187; 780 | Client.ERROR_MASTER = 1188; 781 | Client.ERROR_MASTERROR_NET_READ = 1189; 782 | Client.ERROR_MASTERROR_NET_WRITE = 1190; 783 | Client.ERROR_FT_MATCHING_KEY_NOT_FOUND = 1191; 784 | Client.ERROR_LOCK_OR_ACTIVE_TRANSACTION = 1192; 785 | Client.ERROR_UNKNOWN_SYSTEM_VARIABLE = 1193; 786 | Client.ERROR_CRASHED_ON_USAGE = 1194; 787 | Client.ERROR_CRASHED_ON_REPAIR = 1195; 788 | Client.ERROR_WARNING_NOT_COMPLETE_ROLLBACK = 1196; 789 | Client.ERROR_TRANS_CACHE_FULL = 1197; 790 | Client.ERROR_SLAVE_MUST_STOP = 1198; 791 | Client.ERROR_SLAVE_NOT_RUNNING = 1199; 792 | Client.ERROR_BAD_SLAVE = 1200; 793 | Client.ERROR_MASTERROR_INFO = 1201; 794 | Client.ERROR_SLAVE_THREAD = 1202; 795 | Client.ERROR_TOO_MANY_USERROR_CONNECTIONS = 1203; 796 | Client.ERROR_SET_CONSTANTS_ONLY = 1204; 797 | Client.ERROR_LOCK_WAIT_TIMEOUT = 1205; 798 | Client.ERROR_LOCK_TABLE_FULL = 1206; 799 | Client.ERROR_READ_ONLY_TRANSACTION = 1207; 800 | Client.ERROR_DROP_DB_WITH_READ_LOCK = 1208; 801 | Client.ERROR_CREATE_DB_WITH_READ_LOCK = 1209; 802 | Client.ERROR_WRONG_ARGUMENTS = 1210; 803 | Client.ERROR_NO_PERMISSION_TO_CREATE_USER = 1211; 804 | Client.ERROR_UNION_TABLES_IN_DIFFERENT_DIR = 1212; 805 | Client.ERROR_LOCK_DEADLOCK = 1213; 806 | Client.ERROR_TABLE_CANT_HANDLE_FT = 1214; 807 | Client.ERROR_CANNOT_ADD_FOREIGN = 1215; 808 | Client.ERROR_NO_REFERENCED_ROW = 1216; 809 | Client.ERROR_ROW_IS_REFERENCED = 1217; 810 | Client.ERROR_CONNECT_TO_MASTER = 1218; 811 | Client.ERROR_QUERY_ON_MASTER = 1219; 812 | Client.ERROR_ERROR_WHEN_EXECUTING_COMMAND = 1220; 813 | Client.ERROR_WRONG_USAGE = 1221; 814 | Client.ERROR_WRONG_NUMBERROR_OF_COLUMNS_IN_SELECT = 1222; 815 | Client.ERROR_CANT_UPDATE_WITH_READLOCK = 1223; 816 | Client.ERROR_MIXING_NOT_ALLOWED = 1224; 817 | Client.ERROR_DUP_ARGUMENT = 1225; 818 | Client.ERROR_USERROR_LIMIT_REACHED = 1226; 819 | Client.ERROR_SPECIFIC_ACCESS_DENIED_ERROR = 1227; 820 | Client.ERROR_LOCAL_VARIABLE = 1228; 821 | Client.ERROR_GLOBAL_VARIABLE = 1229; 822 | Client.ERROR_NO_DEFAULT = 1230; 823 | Client.ERROR_WRONG_VALUE_FOR_VAR = 1231; 824 | Client.ERROR_WRONG_TYPE_FOR_VAR = 1232; 825 | Client.ERROR_VAR_CANT_BE_READ = 1233; 826 | Client.ERROR_CANT_USE_OPTION_HERE = 1234; 827 | Client.ERROR_NOT_SUPPORTED_YET = 1235; 828 | Client.ERROR_MASTERROR_FATAL_ERROR_READING_BINLOG = 1236; 829 | Client.ERROR_SLAVE_IGNORED_TABLE = 1237; 830 | Client.ERROR_INCORRECT_GLOBAL_LOCAL_VAR = 1238; 831 | Client.ERROR_WRONG_FK_DEF = 1239; 832 | Client.ERROR_KEY_REF_DO_NOT_MATCH_TABLE_REF = 1240; 833 | Client.ERROR_OPERAND_COLUMNS = 1241; 834 | Client.ERROR_SUBQUERY_NO_1_ROW = 1242; 835 | Client.ERROR_UNKNOWN_STMT_HANDLER = 1243; 836 | Client.ERROR_CORRUPT_HELP_DB = 1244; 837 | Client.ERROR_CYCLIC_REFERENCE = 1245; 838 | Client.ERROR_AUTO_CONVERT = 1246; 839 | Client.ERROR_ILLEGAL_REFERENCE = 1247; 840 | Client.ERROR_DERIVED_MUST_HAVE_ALIAS = 1248; 841 | Client.ERROR_SELECT_REDUCED = 1249; 842 | Client.ERROR_TABLENAME_NOT_ALLOWED_HERE = 1250; 843 | Client.ERROR_NOT_SUPPORTED_AUTH_MODE = 1251; 844 | Client.ERROR_SPATIAL_CANT_HAVE_NULL = 1252; 845 | Client.ERROR_COLLATION_CHARSET_MISMATCH = 1253; 846 | Client.ERROR_SLAVE_WAS_RUNNING = 1254; 847 | Client.ERROR_SLAVE_WAS_NOT_RUNNING = 1255; 848 | Client.ERROR_TOO_BIG_FOR_UNCOMPRESS = 1256; 849 | Client.ERROR_ZLIB_Z_MEM_ERROR = 1257; 850 | Client.ERROR_ZLIB_Z_BUF_ERROR = 1258; 851 | Client.ERROR_ZLIB_Z_DATA_ERROR = 1259; 852 | Client.ERROR_CUT_VALUE_GROUP_CONCAT = 1260; 853 | Client.ERROR_WARN_TOO_FEW_RECORDS = 1261; 854 | Client.ERROR_WARN_TOO_MANY_RECORDS = 1262; 855 | Client.ERROR_WARN_NULL_TO_NOTNULL = 1263; 856 | Client.ERROR_WARN_DATA_OUT_OF_RANGE = 1264; 857 | Client.WARN_DATA_TRUNCATED = 1265; 858 | Client.ERROR_WARN_USING_OTHERROR_HANDLER = 1266; 859 | Client.ERROR_CANT_AGGREGATE_2COLLATIONS = 1267; 860 | Client.ERROR_DROP_USER = 1268; 861 | Client.ERROR_REVOKE_GRANTS = 1269; 862 | Client.ERROR_CANT_AGGREGATE_3COLLATIONS = 1270; 863 | Client.ERROR_CANT_AGGREGATE_NCOLLATIONS = 1271; 864 | Client.ERROR_VARIABLE_IS_NOT_STRUCT = 1272; 865 | Client.ERROR_UNKNOWN_COLLATION = 1273; 866 | Client.ERROR_SLAVE_IGNORED_SSL_PARAMS = 1274; 867 | Client.ERROR_SERVERROR_IS_IN_SECURE_AUTH_MODE = 1275; 868 | Client.ERROR_WARN_FIELD_RESOLVED = 1276; 869 | Client.ERROR_BAD_SLAVE_UNTIL_COND = 1277; 870 | Client.ERROR_MISSING_SKIP_SLAVE = 1278; 871 | Client.ERROR_UNTIL_COND_IGNORED = 1279; 872 | Client.ERROR_WRONG_NAME_FOR_INDEX = 1280; 873 | Client.ERROR_WRONG_NAME_FOR_CATALOG = 1281; 874 | Client.ERROR_WARN_QC_RESIZE = 1282; 875 | Client.ERROR_BAD_FT_COLUMN = 1283; 876 | Client.ERROR_UNKNOWN_KEY_CACHE = 1284; 877 | Client.ERROR_WARN_HOSTNAME_WONT_WORK = 1285; 878 | Client.ERROR_UNKNOWN_STORAGE_ENGINE = 1286; 879 | Client.ERROR_WARN_DEPRECATED_SYNTAX = 1287; 880 | Client.ERROR_NON_UPDATABLE_TABLE = 1288; 881 | Client.ERROR_FEATURE_DISABLED = 1289; 882 | Client.ERROR_OPTION_PREVENTS_STATEMENT = 1290; 883 | Client.ERROR_DUPLICATED_VALUE_IN_TYPE = 1291; 884 | Client.ERROR_TRUNCATED_WRONG_VALUE = 1292; 885 | Client.ERROR_TOO_MUCH_AUTO_TIMESTAMP_COLS = 1293; 886 | Client.ERROR_INVALID_ON_UPDATE = 1294; 887 | Client.ERROR_UNSUPPORTED_PS = 1295; 888 | Client.ERROR_GET_ERRMSG = 1296; 889 | Client.ERROR_GET_TEMPORARY_ERRMSG = 1297; 890 | Client.ERROR_UNKNOWN_TIME_ZONE = 1298; 891 | Client.ERROR_WARN_INVALID_TIMESTAMP = 1299; 892 | Client.ERROR_INVALID_CHARACTERROR_STRING = 1300; 893 | Client.ERROR_WARN_ALLOWED_PACKET_OVERFLOWED = 1301; 894 | Client.ERROR_CONFLICTING_DECLARATIONS = 1302; 895 | Client.ERROR_SP_NO_RECURSIVE_CREATE = 1303; 896 | Client.ERROR_SP_ALREADY_EXISTS = 1304; 897 | Client.ERROR_SP_DOES_NOT_EXIST = 1305; 898 | Client.ERROR_SP_DROP_FAILED = 1306; 899 | Client.ERROR_SP_STORE_FAILED = 1307; 900 | Client.ERROR_SP_LILABEL_MISMATCH = 1308; 901 | Client.ERROR_SP_LABEL_REDEFINE = 1309; 902 | Client.ERROR_SP_LABEL_MISMATCH = 1310; 903 | Client.ERROR_SP_UNINIT_VAR = 1311; 904 | Client.ERROR_SP_BADSELECT = 1312; 905 | Client.ERROR_SP_BADRETURN = 1313; 906 | Client.ERROR_SP_BADSTATEMENT = 1314; 907 | Client.ERROR_UPDATE_LOG_DEPRECATED_IGNORED = 1315; 908 | Client.ERROR_UPDATE_LOG_DEPRECATED_TRANSLATED = 1316; 909 | Client.ERROR_QUERY_INTERRUPTED = 1317; 910 | Client.ERROR_SP_WRONG_NO_OF_ARGS = 1318; 911 | Client.ERROR_SP_COND_MISMATCH = 1319; 912 | Client.ERROR_SP_NORETURN = 1320; 913 | Client.ERROR_SP_NORETURNEND = 1321; 914 | Client.ERROR_SP_BAD_CURSOR_QUERY = 1322; 915 | Client.ERROR_SP_BAD_CURSOR_SELECT = 1323; 916 | Client.ERROR_SP_CURSOR_MISMATCH = 1324; 917 | Client.ERROR_SP_CURSOR_ALREADY_OPEN = 1325; 918 | Client.ERROR_SP_CURSOR_NOT_OPEN = 1326; 919 | Client.ERROR_SP_UNDECLARED_VAR = 1327; 920 | Client.ERROR_SP_WRONG_NO_OF_FETCH_ARGS = 1328; 921 | Client.ERROR_SP_FETCH_NO_DATA = 1329; 922 | Client.ERROR_SP_DUP_PARAM = 1330; 923 | Client.ERROR_SP_DUP_VAR = 1331; 924 | Client.ERROR_SP_DUP_COND = 1332; 925 | Client.ERROR_SP_DUP_CURS = 1333; 926 | Client.ERROR_SP_CANT_ALTER = 1334; 927 | Client.ERROR_SP_SUBSELECT_NYI = 1335; 928 | Client.ERROR_STMT_NOT_ALLOWED_IN_SF_OR_TRG = 1336; 929 | Client.ERROR_SP_VARCOND_AFTERROR_CURSHNDLR = 1337; 930 | Client.ERROR_SP_CURSOR_AFTERROR_HANDLER = 1338; 931 | Client.ERROR_SP_CASE_NOT_FOUND = 1339; 932 | Client.ERROR_FPARSERROR_TOO_BIG_FILE = 1340; 933 | Client.ERROR_FPARSERROR_BAD_HEADER = 1341; 934 | Client.ERROR_FPARSERROR_EOF_IN_COMMENT = 1342; 935 | Client.ERROR_FPARSERROR_ERROR_IN_PARAMETER = 1343; 936 | Client.ERROR_FPARSERROR_EOF_IN_UNKNOWN_PARAMETER = 1344; 937 | Client.ERROR_VIEW_NO_EXPLAIN = 1345; 938 | Client.ERROR_FRM_UNKNOWN_TYPE = 1346; 939 | Client.ERROR_WRONG_OBJECT = 1347; 940 | Client.ERROR_NONUPDATEABLE_COLUMN = 1348; 941 | Client.ERROR_VIEW_SELECT_DERIVED = 1349; 942 | Client.ERROR_VIEW_SELECT_CLAUSE = 1350; 943 | Client.ERROR_VIEW_SELECT_VARIABLE = 1351; 944 | Client.ERROR_VIEW_SELECT_TMPTABLE = 1352; 945 | Client.ERROR_VIEW_WRONG_LIST = 1353; 946 | Client.ERROR_WARN_VIEW_MERGE = 1354; 947 | Client.ERROR_WARN_VIEW_WITHOUT_KEY = 1355; 948 | Client.ERROR_VIEW_INVALID = 1356; 949 | Client.ERROR_SP_NO_DROP_SP = 1357; 950 | Client.ERROR_SP_GOTO_IN_HNDLR = 1358; 951 | Client.ERROR_TRG_ALREADY_EXISTS = 1359; 952 | Client.ERROR_TRG_DOES_NOT_EXIST = 1360; 953 | Client.ERROR_TRG_ON_VIEW_OR_TEMP_TABLE = 1361; 954 | Client.ERROR_TRG_CANT_CHANGE_ROW = 1362; 955 | Client.ERROR_TRG_NO_SUCH_ROW_IN_TRG = 1363; 956 | Client.ERROR_NO_DEFAULT_FOR_FIELD = 1364; 957 | Client.ERROR_DIVISION_BY_ZERO = 1365; 958 | Client.ERROR_TRUNCATED_WRONG_VALUE_FOR_FIELD = 1366; 959 | Client.ERROR_ILLEGAL_VALUE_FOR_TYPE = 1367; 960 | Client.ERROR_VIEW_NONUPD_CHECK = 1368; 961 | Client.ERROR_VIEW_CHECK_FAILED = 1369; 962 | Client.ERROR_PROCACCESS_DENIED_ERROR = 1370; 963 | Client.ERROR_RELAY_LOG_FAIL = 1371; 964 | Client.ERROR_PASSWD_LENGTH = 1372; 965 | Client.ERROR_UNKNOWN_TARGET_BINLOG = 1373; 966 | Client.ERROR_IO_ERR_LOG_INDEX_READ = 1374; 967 | Client.ERROR_BINLOG_PURGE_PROHIBITED = 1375; 968 | Client.ERROR_FSEEK_FAIL = 1376; 969 | Client.ERROR_BINLOG_PURGE_FATAL_ERR = 1377; 970 | Client.ERROR_LOG_IN_USE = 1378; 971 | Client.ERROR_LOG_PURGE_UNKNOWN_ERR = 1379; 972 | Client.ERROR_RELAY_LOG_INIT = 1380; 973 | Client.ERROR_NO_BINARY_LOGGING = 1381; 974 | Client.ERROR_RESERVED_SYNTAX = 1382; 975 | Client.ERROR_WSAS_FAILED = 1383; 976 | Client.ERROR_DIFF_GROUPS_PROC = 1384; 977 | Client.ERROR_NO_GROUP_FOR_PROC = 1385; 978 | Client.ERROR_ORDERROR_WITH_PROC = 1386; 979 | Client.ERROR_LOGGING_PROHIBIT_CHANGING_OF = 1387; 980 | Client.ERROR_NO_FILE_MAPPING = 1388; 981 | Client.ERROR_WRONG_MAGIC = 1389; 982 | Client.ERROR_PS_MANY_PARAM = 1390; 983 | Client.ERROR_KEY_PART_0 = 1391; 984 | Client.ERROR_VIEW_CHECKSUM = 1392; 985 | Client.ERROR_VIEW_MULTIUPDATE = 1393; 986 | Client.ERROR_VIEW_NO_INSERT_FIELD_LIST = 1394; 987 | Client.ERROR_VIEW_DELETE_MERGE_VIEW = 1395; 988 | Client.ERROR_CANNOT_USER = 1396; 989 | Client.ERROR_XAERROR_NOTA = 1397; 990 | Client.ERROR_XAERROR_INVAL = 1398; 991 | Client.ERROR_XAERROR_RMFAIL = 1399; 992 | Client.ERROR_XAERROR_OUTSIDE = 1400; 993 | Client.ERROR_XAERROR_RMERR = 1401; 994 | Client.ERROR_XA_RBROLLBACK = 1402; 995 | Client.ERROR_NONEXISTING_PROC_GRANT = 1403; 996 | Client.ERROR_PROC_AUTO_GRANT_FAIL = 1404; 997 | Client.ERROR_PROC_AUTO_REVOKE_FAIL = 1405; 998 | Client.ERROR_DATA_TOO_LONG = 1406; 999 | Client.ERROR_SP_BAD_SQLSTATE = 1407; 1000 | Client.ERROR_STARTUP = 1408; 1001 | Client.ERROR_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR = 1409; 1002 | Client.ERROR_CANT_CREATE_USERROR_WITH_GRANT = 1410; 1003 | Client.ERROR_WRONG_VALUE_FOR_TYPE = 1411; 1004 | Client.ERROR_TABLE_DEF_CHANGED = 1412; 1005 | Client.ERROR_SP_DUP_HANDLER = 1413; 1006 | Client.ERROR_SP_NOT_VAR_ARG = 1414; 1007 | Client.ERROR_SP_NO_RETSET = 1415; 1008 | Client.ERROR_CANT_CREATE_GEOMETRY_OBJECT = 1416; 1009 | Client.ERROR_FAILED_ROUTINE_BREAK_BINLOG = 1417; 1010 | Client.ERROR_BINLOG_UNSAFE_ROUTINE = 1418; 1011 | Client.ERROR_BINLOG_CREATE_ROUTINE_NEED_SUPER = 1419; 1012 | Client.ERROR_EXEC_STMT_WITH_OPEN_CURSOR = 1420; 1013 | Client.ERROR_STMT_HAS_NO_OPEN_CURSOR = 1421; 1014 | Client.ERROR_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG = 1422; 1015 | Client.ERROR_NO_DEFAULT_FOR_VIEW_FIELD = 1423; 1016 | Client.ERROR_SP_NO_RECURSION = 1424; 1017 | Client.ERROR_TOO_BIG_SCALE = 1425; 1018 | Client.ERROR_TOO_BIG_PRECISION = 1426; 1019 | Client.ERROR_M_BIGGERROR_THAN_D = 1427; 1020 | Client.ERROR_WRONG_LOCK_OF_SYSTEM_TABLE = 1428; 1021 | Client.ERROR_CONNECT_TO_FOREIGN_DATA_SOURCE = 1429; 1022 | Client.ERROR_QUERY_ON_FOREIGN_DATA_SOURCE = 1430; 1023 | Client.ERROR_FOREIGN_DATA_SOURCE_DOESNT_EXIST = 1431; 1024 | Client.ERROR_FOREIGN_DATA_STRING_INVALID_CANT_CREATE = 1432; 1025 | Client.ERROR_FOREIGN_DATA_STRING_INVALID = 1433; 1026 | Client.ERROR_CANT_CREATE_FEDERATED_TABLE = 1434; 1027 | Client.ERROR_TRG_IN_WRONG_SCHEMA = 1435; 1028 | Client.ERROR_STACK_OVERRUN_NEED_MORE = 1436; 1029 | Client.ERROR_TOO_LONG_BODY = 1437; 1030 | Client.ERROR_WARN_CANT_DROP_DEFAULT_KEYCACHE = 1438; 1031 | Client.ERROR_TOO_BIG_DISPLAYWIDTH = 1439; 1032 | Client.ERROR_XAERROR_DUPID = 1440; 1033 | Client.ERROR_DATETIME_FUNCTION_OVERFLOW = 1441; 1034 | Client.ERROR_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG = 1442; 1035 | Client.ERROR_VIEW_PREVENT_UPDATE = 1443; 1036 | Client.ERROR_PS_NO_RECURSION = 1444; 1037 | Client.ERROR_SP_CANT_SET_AUTOCOMMIT = 1445; 1038 | Client.ERROR_MALFORMED_DEFINER = 1446; 1039 | Client.ERROR_VIEW_FRM_NO_USER = 1447; 1040 | Client.ERROR_VIEW_OTHERROR_USER = 1448; 1041 | Client.ERROR_NO_SUCH_USER = 1449; 1042 | Client.ERROR_FORBID_SCHEMA_CHANGE = 1450; 1043 | Client.ERROR_ROW_IS_REFERENCED_2 = 1451; 1044 | Client.ERROR_NO_REFERENCED_ROW_2 = 1452; 1045 | Client.ERROR_SP_BAD_VAR_SHADOW = 1453; 1046 | Client.ERROR_TRG_NO_DEFINER = 1454; 1047 | Client.ERROR_OLD_FILE_FORMAT = 1455; 1048 | Client.ERROR_SP_RECURSION_LIMIT = 1456; 1049 | Client.ERROR_SP_PROC_TABLE_CORRUPT = 1457; 1050 | Client.ERROR_SP_WRONG_NAME = 1458; 1051 | Client.ERROR_TABLE_NEEDS_UPGRADE = 1459; 1052 | Client.ERROR_SP_NO_AGGREGATE = 1460; 1053 | Client.ERROR_MAX_PREPARED_STMT_COUNT_REACHED = 1461; 1054 | Client.ERROR_VIEW_RECURSIVE = 1462; 1055 | Client.ERROR_NON_GROUPING_FIELD_USED = 1463; 1056 | Client.ERROR_TABLE_CANT_HANDLE_SPKEYS = 1464; 1057 | Client.ERROR_NO_TRIGGERS_ON_SYSTEM_SCHEMA = 1465; 1058 | Client.ERROR_REMOVED_SPACES = 1466; 1059 | Client.ERROR_AUTOINC_READ_FAILED = 1467; 1060 | Client.ERROR_USERNAME = 1468; 1061 | Client.ERROR_HOSTNAME = 1469; 1062 | Client.ERROR_WRONG_STRING_LENGTH = 1470; 1063 | Client.ERROR_NON_INSERTABLE_TABLE = 1471; 1064 | Client.ERROR_ADMIN_WRONG_MRG_TABLE = 1472; 1065 | Client.ERROR_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT = 1473; 1066 | Client.ERROR_NAME_BECOMES_EMPTY = 1474; 1067 | Client.ERROR_AMBIGUOUS_FIELD_TERM = 1475; 1068 | Client.ERROR_LOAD_DATA_INVALID_COLUMN = 1476; 1069 | Client.ERROR_LOG_PURGE_NO_FILE = 1477; 1070 | Client.ERROR_XA_RBTIMEOUT = 1478; 1071 | Client.ERROR_XA_RBDEADLOCK = 1479; 1072 | Client.ERROR_TOO_MANY_CONCURRENT_TRXS = 1480; 1073 | -------------------------------------------------------------------------------- /test/system/test-mysql-client-example.js: -------------------------------------------------------------------------------- 1 | var common = require('../common'); 2 | var assert = common.assert; 3 | var test = common.microtest.module(common.dir.fixture + '/mysql_client.js'); 4 | 5 | test.requires('util'); 6 | test.requires('events', [{class: 'EventEmitter'}]); 7 | test.requires('./query', {class: 'Query'}); 8 | test.requires('net', [{class: 'Stream'}]); 9 | test.requires('./parser', {class: 'Parser'}); 10 | 11 | var inheritsCall = test.stub(test.required.util, 'inherits'); 12 | var Client = test.compile(); 13 | 14 | test.describe('inherits from EventEmitter', function() { 15 | var args = inheritsCall.getLastArgs(); 16 | assert.strictEqual(args[0], Client); 17 | assert.strictEqual(args[1], test.required.EventEmitter); 18 | }); 19 | 20 | test.before(function() { 21 | test.stub(test.required.EventEmitter); 22 | return new Client(); 23 | }); 24 | 25 | test.describe('Client#connect', function(client) { 26 | var CONNECTION = test.object('connection'); 27 | var PARSER = test.object('parser'); 28 | var CB_PARAM = test.object('cb'); 29 | 30 | var _enqueueCall = test 31 | .expect(client, '_enqueue') 32 | .withArg(2, CB_PARAM); 33 | 34 | client.connect(CB_PARAM); 35 | 36 | var connectClosure = _enqueueCall.getLastArgs()[0]; 37 | 38 | test.expect('new', test.required.Stream, null, CONNECTION); 39 | test.expect('new', test.required.Parser, null, PARSER); 40 | 41 | test.expect(CONNECTION, 'on', 3).andReturn(CONNECTION); 42 | test.expect(CONNECTION, 'connect'); 43 | 44 | test.expect(PARSER, 'on', 1).andReturn(CONNECTION); 45 | 46 | connectClosure(); 47 | }); 48 | --------------------------------------------------------------------------------