zeanium-node
Advanced tools
Comparing version 0.6.38 to 0.6.39
{ | ||
"name": "zeanium-node", | ||
"version": "0.6.38", | ||
"version": "0.6.39", | ||
"description": "Zeanium for Node.js, simple http server and custome your business.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# Zeanium-Node | ||
[![NPM version][npm-image]][npm-url] | ||
[![Downloads][downloads-image]][npm-url] | ||
[简体中文文档](https://github.com/yangyxu/Zeanium-Node/blob/master/README.md) | ||
@@ -177,4 +180,8 @@ | ||
## License | ||
## The MIT License (MIT) | ||
[MIT](https://github.com/yangyxu/Zeanium-Node/blob/master/LICENSE) | ||
[downloads-image]: http://img.shields.io/npm/dm/zeanium-node.svg | ||
[npm-image]: https://img.shields.io/npm/v/zeanium-node.svg | ||
[npm-url]: https://www.npmjs.com/package/zeanium-node |
# zeanium-node | ||
[![NPM version][npm-image]][npm-url] | ||
[![Downloads][downloads-image]][npm-url] | ||
[English Document](https://github.com/yangyxu/Zeanium-Node/blob/master/README_EN.md) | ||
@@ -215,4 +218,8 @@ | ||
## License | ||
## The MIT License (MIT) | ||
[MIT](https://github.com/yangyxu/zeanium-node/blob/master/LICENSE) | ||
[MIT](https://github.com/yangyxu/Zeanium-Node/blob/master/LICENSE) | ||
[downloads-image]: http://img.shields.io/npm/dm/zeanium-node.svg | ||
[npm-image]: https://img.shields.io/npm/v/zeanium-node.svg | ||
[npm-url]: https://www.npmjs.com/package/zeanium-node |
@@ -90,59 +90,2 @@ /** | ||
}, | ||
__parseInsertTask: function (handler, before, after){ | ||
return function (task, connection, rows, fields){ | ||
var _callback = null; | ||
if(before){ | ||
_callback = before.call(this, handler, rows, fields); | ||
if(typeof _callback == 'function'){ | ||
handler = _callback; | ||
} | ||
} | ||
if(_callback === false){ | ||
this._queue.destroy(); | ||
} else if(_callback === -1){ | ||
task.done(connection, rows, fields); | ||
} else { | ||
_callback = handler.call(this, task, connection, rows, fields); | ||
if(_callback === false){ | ||
this.rollback(err); | ||
} else { | ||
var _after = after && after.call(this, err, rows, fields); | ||
if(_after === false){ | ||
this._queue.destroy(); | ||
} | ||
} | ||
} | ||
}.bind(this); | ||
}, | ||
__parseQueryTask: function (query, before, after){ | ||
return function (task, connection, rows, fields){ | ||
var _callback = null, | ||
_tag = query; | ||
if(before){ | ||
_callback = before.call(this, query, rows, fields); | ||
if(typeof _callback == 'string'){ | ||
query = _callback; | ||
} | ||
} | ||
if(_callback === false){ | ||
this._queue.destroy(); | ||
} else if(_callback === -1){ | ||
task.done(connection, rows, fields); | ||
} else { | ||
zn.debug('Transaction Query SQL {0} : '.format(_tag!=query?'['+_tag+']':''), query); | ||
connection.query(query, function (err, rows, fields){ | ||
var _after = after && after.call(this, err, rows, fields); | ||
if(err){ | ||
this.rollback(err); | ||
}else { | ||
if(_after === false){ | ||
this._queue.destroy(); | ||
} else { | ||
task.done(connection, (_after || rows), fields); | ||
} | ||
} | ||
}.bind(this)); | ||
} | ||
}.bind(this); | ||
}, | ||
query: function(query, before, after, index){ | ||
@@ -198,2 +141,72 @@ if(!query&&!before){ return this; } | ||
}, | ||
__parseInsertTask: function (handler, before, after){ | ||
return function (task, connection, rows, fields){ | ||
var _callback = null; | ||
if(before){ | ||
_callback = before.call(this, handler, rows, fields); | ||
if(typeof _callback == 'function'){ | ||
handler = _callback; | ||
} | ||
} | ||
if(_callback === false){ | ||
this._queue.destroy(); | ||
} else if(_callback === -1){ | ||
task.done(connection, rows, fields); | ||
} else { | ||
_callback = handler.call(this, task, connection, rows, fields); | ||
if(_callback === false){ | ||
this.rollback(err); | ||
} else { | ||
var _after = after && after.call(this, err, rows, fields); | ||
if(_after === false){ | ||
this._queue.destroy(); | ||
} | ||
} | ||
} | ||
}.bind(this); | ||
}, | ||
__parseQueryTask: function (query, before, after){ | ||
return function (task, connection, rows, fields){ | ||
var _callback = null, | ||
_tag = query; | ||
if(before){ | ||
_callback = before.call(this, query, rows, fields); | ||
if(typeof _callback == 'string'){ | ||
query = _callback; | ||
} | ||
} | ||
if(_callback === false){ | ||
this._queue.destroy(); | ||
} else if(_callback === -1){ | ||
task.done(connection, rows, fields); | ||
} else { | ||
if(_callback && _callback.then) { | ||
_callback.then(function (data){ | ||
var _after = after && after.call(this, data); | ||
if(_after === false){ | ||
this._queue.destroy(); | ||
} else { | ||
task.done(connection, (_after || data)); | ||
} | ||
}.bind(this), function (err){ | ||
this.rollback(err); | ||
}.bind(this)); | ||
}else { | ||
zn.debug('Transaction Query SQL {0} : '.format(_tag!=query?'['+_tag+']':''), query); | ||
connection.query(query, function (err, rows, fields){ | ||
var _after = after && after.call(this, err, rows, fields); | ||
if(err){ | ||
this.rollback(err); | ||
}else { | ||
if(_after === false){ | ||
this._queue.destroy(); | ||
} else { | ||
task.done(connection, (_after || rows), fields); | ||
} | ||
} | ||
}.bind(this)); | ||
} | ||
} | ||
}.bind(this); | ||
}, | ||
__finally: function (error){ | ||
@@ -200,0 +213,0 @@ if(error) { |
@@ -37,4 +37,2 @@ /** | ||
this.sets(args); | ||
zn.SERVER_PATH = this._serverPath; | ||
zn.WEB_PATH = this._webPath; | ||
this.on('init', _config.onInit || zn.idle); | ||
@@ -51,2 +49,5 @@ this.on('loading', _config.onLoading || zn.idle); | ||
this.__scanWebPath(); | ||
zn.SERVER_PATH = this._serverPath; | ||
zn.SERVER_URL = this._root; | ||
zn.WEB_PATH = this._webPath; | ||
}, | ||
@@ -53,0 +54,0 @@ __init: function (){ |
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
263847
6132
225