├── README.assets └── logo.png ├── README.md ├── app.js ├── index.js ├── logo.png ├── node_modules ├── bignumber.js │ ├── CHANGELOG.md │ ├── LICENCE │ ├── README.md │ ├── bignumber.d.ts │ ├── bignumber.js │ ├── bignumber.js.map │ ├── bignumber.min.js │ ├── bignumber.mjs │ ├── bower.json │ ├── doc │ │ └── API.html │ └── package.json ├── core-util-is │ ├── LICENSE │ ├── README.md │ ├── float.patch │ ├── lib │ │ └── util.js │ ├── package.json │ └── test.js ├── inherits │ ├── LICENSE │ ├── README.md │ ├── inherits.js │ ├── inherits_browser.js │ └── package.json ├── isarray │ ├── .npmignore │ ├── .travis.yml │ ├── Makefile │ ├── README.md │ ├── component.json │ ├── index.js │ ├── package.json │ └── test.js ├── mysql │ ├── Changes.md │ ├── License │ ├── Readme.md │ ├── index.js │ ├── lib │ │ ├── Connection.js │ │ ├── ConnectionConfig.js │ │ ├── Pool.js │ │ ├── PoolCluster.js │ │ ├── PoolConfig.js │ │ ├── PoolConnection.js │ │ ├── PoolNamespace.js │ │ ├── PoolSelector.js │ │ └── protocol │ │ │ ├── Auth.js │ │ │ ├── BufferList.js │ │ │ ├── PacketHeader.js │ │ │ ├── PacketWriter.js │ │ │ ├── Parser.js │ │ │ ├── Protocol.js │ │ │ ├── ResultSet.js │ │ │ ├── SqlString.js │ │ │ ├── Timer.js │ │ │ ├── constants │ │ │ ├── charsets.js │ │ │ ├── client.js │ │ │ ├── errors.js │ │ │ ├── field_flags.js │ │ │ ├── server_status.js │ │ │ ├── ssl_profiles.js │ │ │ └── types.js │ │ │ ├── packets │ │ │ ├── AuthSwitchRequestPacket.js │ │ │ ├── AuthSwitchResponsePacket.js │ │ │ ├── ClientAuthenticationPacket.js │ │ │ ├── ComChangeUserPacket.js │ │ │ ├── ComPingPacket.js │ │ │ ├── ComQueryPacket.js │ │ │ ├── ComQuitPacket.js │ │ │ ├── ComStatisticsPacket.js │ │ │ ├── EmptyPacket.js │ │ │ ├── EofPacket.js │ │ │ ├── ErrorPacket.js │ │ │ ├── Field.js │ │ │ ├── FieldPacket.js │ │ │ ├── HandshakeInitializationPacket.js │ │ │ ├── LocalDataFilePacket.js │ │ │ ├── OkPacket.js │ │ │ ├── OldPasswordPacket.js │ │ │ ├── ResultSetHeaderPacket.js │ │ │ ├── RowDataPacket.js │ │ │ ├── SSLRequestPacket.js │ │ │ ├── StatisticsPacket.js │ │ │ ├── UseOldPasswordPacket.js │ │ │ └── index.js │ │ │ └── sequences │ │ │ ├── ChangeUser.js │ │ │ ├── Handshake.js │ │ │ ├── Ping.js │ │ │ ├── Query.js │ │ │ ├── Quit.js │ │ │ ├── Sequence.js │ │ │ ├── Statistics.js │ │ │ └── index.js │ └── package.json ├── process-nextick-args │ ├── index.js │ ├── license.md │ ├── package.json │ └── readme.md ├── readable-stream │ ├── .travis.yml │ ├── CONTRIBUTING.md │ ├── GOVERNANCE.md │ ├── LICENSE │ ├── README.md │ ├── doc │ │ └── wg-meetings │ │ │ └── 2015-01-30.md │ ├── duplex-browser.js │ ├── duplex.js │ ├── lib │ │ ├── _stream_duplex.js │ │ ├── _stream_passthrough.js │ │ ├── _stream_readable.js │ │ ├── _stream_transform.js │ │ ├── _stream_writable.js │ │ └── internal │ │ │ └── streams │ │ │ ├── BufferList.js │ │ │ ├── destroy.js │ │ │ ├── stream-browser.js │ │ │ └── stream.js │ ├── package.json │ ├── passthrough.js │ ├── readable-browser.js │ ├── readable.js │ ├── transform.js │ ├── writable-browser.js │ └── writable.js ├── safe-buffer │ ├── LICENSE │ ├── README.md │ ├── index.d.ts │ ├── index.js │ └── package.json ├── sqlstring │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ └── SqlString.js │ └── package.json ├── string_decoder │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── lib │ │ └── string_decoder.js │ └── package.json └── util-deprecate │ ├── History.md │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── node.js │ └── package.json ├── package-lock.json └── package.json /README.assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kxzkane/mysql-ithm/5b9fae46bd85a4dd50a4d6df7bff20454f65178f/README.assets/logo.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](README.assets/logo.png) 2 | 3 | # mysql-ithm 4 | 5 | 一款nodejs操作mysql数据库的orm库 6 | 7 | * 黑马程序员:[http://www.itheima.com](http://www.itheima.com/) 8 | * 官方文档地址:[https://github.com/kxzkane/mysql-ithm](https://github.com/kxzkane/mysql-ithm) 9 | * npm地址:[https://www.npmjs.com/package/mysql-ithm](https://www.npmjs.com/package/mysql-ithm) 10 | 11 | * 技术亮点 12 | * (1)基于ORM技术,使用对象的方式来操作mysql数据库,而无需编写任何sql语句 13 | * (2)支持数据库的常规操作`增删改查`,API极为简洁,且高效智能。 14 | * (3)支持条件查询 与 分页查询 15 | * (4)支持原生sql语句,如果我们的框架无法满足您的需求,我们也提供了特殊的API可以直接使用sql语句来操作 16 | * (5)支持链式语法 17 | 18 | # 01-安装 19 | 20 | * 安装`mysql-ithm` 21 | * `npm install mysql-ithm` 22 | 23 | 24 | 25 | # 02-导入 26 | 27 | ```javascript 28 | //导入模块 29 | const hm = require('mysql-ithm'); 30 | ``` 31 | 32 | 33 | 34 | # 03-使用(example) 35 | 36 | ```javascript 37 | //1.导入模块 38 | const hm = require('mysql-ithm'); 39 | 40 | //2.连接数据库 41 | //如果数据库存在则连接,不存在则会自动创建数据库 42 | hm.connect({ 43 | host: 'localhost',//数据库地址 44 | port:'3306', 45 | user: 'root',//用户名,没有可不填 46 | password: 'root',//密码,没有可不填 47 | database: 'hm'//数据库名称 48 | }); 49 | 50 | //3.创建Model(表格模型:负责增删改查) 51 | //如果table表格存在则连接,不存在则自动创建 52 | let studentModel = hm.model('student',{ 53 | name:String, 54 | age:Number 55 | }); 56 | 57 | //4.调用API:添加数据 58 | studentModel.insert({name:'张三10',age:30},(err,results)=>{ 59 | console.log(err); 60 | console.log(results); 61 | if(!err) console.log('增加成功'); 62 | }); 63 | ``` 64 | 65 | 66 | 67 | # 04-API Document 68 | 69 | ## 1.1-增加操作 70 | 71 | 72 | 73 | ```javascript 74 | studentModel.insert({name:'张三10',age:30},(err,results)=>{ 75 | console.log(err); 76 | console.log(results); 77 | if(!err) console.log('增加成功'); 78 | }); 79 | ``` 80 | 81 | * 批量增加 82 | ```javascript 83 | var arr = []; 84 | for (var i = 1; i <= 10; i++) { 85 | arr.push({ name: '张三', age: 30 }) 86 | } 87 | 88 | studentModel.insert(arr, (err, results) => { 89 | console.log(err); 90 | console.log(results); 91 | if (!err) console.log('增加成功'); 92 | }); 93 | ``` 94 | 95 | 96 | 97 | ## 1.2-查询操作 98 | 99 | ### 1-查询所有数据 100 | 101 | ```javascript 102 | //2.1 查询所有数据 103 | studentModel.find((err,results)=>{ 104 | console.log(results); 105 | }); 106 | ``` 107 | 108 | ### 2-查询数据库指定字段数据 109 | 110 | ```javascript 111 | //2.2 根据数据库字段查询部分数据 112 | // ['name'] : 将要查询的字段放入数组中 113 | studentModel.find(['name'],(err,results)=>{ 114 | console.log(results); 115 | }); 116 | ``` 117 | 118 | ### 3-条件查询 119 | 120 | ```javascript 121 | //2.3 根据条件查询数据 122 | // 'id=1' : 查询id为1的数据 (查询条件可以参考sql语句) 123 | //例如 'age>10' : 查询age超过10的数据 124 | //例如 'name>"张三"' : 查询名字为张三的数据,注意字符串添加引号 125 | studentModel.find('id>21',(err,results)=>{ 126 | console.log(results); 127 | }); 128 | ``` 129 | 130 | ### 4-分页查询 131 | 132 | ```javascript 133 | //2.4 分页查询 134 | // 第一个参数options对象有三个属性 {where:分页查询条件(可选), number:页数 , count:每页数量} 135 | studentModel.limit({where:'age>28',number:1,count:10},(err,results)=>{ 136 | console.log(results); 137 | }); 138 | ``` 139 | 140 | ## 1.3-修改操作 141 | 142 | ### 1-修改所有数据 143 | 144 | ```javascript 145 | //3.1 将数据库中所有的name字段值:修改为李四 146 | studentModel.update({name:'李四'},(err,results)=>{ 147 | console.log(results); 148 | }); 149 | ``` 150 | 151 | ### 2-条件修改 152 | 153 | ```javascript 154 | //3.2 将数据库中 id = 1 的数据,age修改为30 155 | studentModel.update('id=1',{age:30},(err,results)=>{ 156 | console.log(results); 157 | }); 158 | 159 | //3.3 将数据库中所有 age < 20 的数据,name修改为王五 160 | studentModel.update('age<20',{name:'王五'},(err,results)=>{ 161 | console.log(results); 162 | }); 163 | ``` 164 | 165 | 166 | 167 | ## 1.4-删除操作 168 | 169 | ```javascript 170 | //4.1 删除所有 age>30 的数据 171 | studentModel.delete('age>20',(err,results)=>{ 172 | console.log(results); 173 | }); 174 | 175 | //4.2 清空表中所有数据 176 | studentModel.delete((err,results)=>{ 177 | console.log(results); 178 | }); 179 | ``` 180 | 181 | 182 | 183 | ## 1.5-执行自定义SQL语句 184 | 185 | ```javascript 186 | studentModel.sql('insert into student(name,age) values("andy",20)',(err,results)=>{ 187 | console.log(results); 188 | }); 189 | ``` 190 | 191 | 192 | 193 | ## 1.5-删除表格(慎用) 194 | 195 | ```javascript 196 | studentModel.drop((err,results)=>{ 197 | console.log(results); 198 | }); 199 | ``` 200 | 201 | 202 | 203 | ## 1.7-链式语法支持 204 | 205 | ```javascript 206 | studentModel.insert({name:'张三22',age:22},(err,results)=>{ 207 | console.log(err); 208 | console.log(results); 209 | }) 210 | .find('name="张三22"',(err,results)=>{ 211 | console.log(err); 212 | console.log(results); 213 | }); 214 | ``` 215 | 216 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | //1.导入模块 2 | const hm = require('./index.js'); 3 | 4 | //2.连接数据库 5 | //如果数据库存在则连接,不存在则会自动创建数据库 6 | hm.connect({ 7 | host: 'localhost',//数据库地址 8 | port: '3306', 9 | user: 'root',//用户名,没有可不填 10 | password: 'root',//密码,没有可不填 11 | database: 'hm'//数据库名称 12 | }); 13 | 14 | //3.创建Model(表格模型:负责增删改查) 15 | //如果table表格存在则连接,不存在则自动创建 16 | let studentModel = hm.model('student', { 17 | name: String, 18 | age: Number 19 | }); 20 | 21 | //4.调用API:添加数据 22 | var arr = []; 23 | for (var i = 1; i <= 10; i++) { 24 | arr.push({ name: '张三10', age: 30 }) 25 | }; 26 | 27 | studentModel.insert(arr, (err, results) => { 28 | console.log(err); 29 | console.log(results); 30 | if (!err) console.log('增加成功'); 31 | }); 32 | 33 | // studentModel.find('name="111"',(err,results)=>{ 34 | // console.log(err); 35 | // console.log(results); 36 | 37 | 38 | // }) -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kxzkane/mysql-ithm/5b9fae46bd85a4dd50a4d6df7bff20454f65178f/logo.png -------------------------------------------------------------------------------- /node_modules/bignumber.js/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | #### 7.2.1 2 | * 24/05/2018 3 | * Add `browser` field to *package.json*. 4 | 5 | #### 7.2.0 6 | * 22/05/2018 7 | * #166 Correct *.mjs* file. Remove extension from `main` field in *package.json*. 8 | 9 | #### 7.1.0 10 | * 18/05/2018 11 | * Add `module` field to *package.json* for *bignumber.mjs*. 12 | 13 | #### 7.0.2 14 | * 17/05/2018 15 | * #165 Bugfix: upper-case letters for bases 11-36 in a custom alphabet. 16 | * Add note to *README* regarding creating BigNumbers from Number values. 17 | 18 | #### 7.0.1 19 | * 26/04/2018 20 | * #158 Fix global object variable name typo. 21 | 22 | #### 7.0.0 23 | * 26/04/2018 24 | * #143 Remove global BigNumber from typings. 25 | * #144 Enable compatibility with `Object.freeze(Object.prototype)`. 26 | * #148 #123 #11 Only throw on a number primitive with more than 15 significant digits if `BigNumber.DEBUG` is `true`. 27 | * Only throw on an invalid BigNumber value if `BigNumber.DEBUG` is `true`. Return BigNumber `NaN` instead. 28 | * #154 `exponentiatedBy`: allow BigNumber exponent. 29 | * #156 Prevent Content Security Policy *unsafe-eval* issue. 30 | * `toFraction`: allow `Infinity` maximum denominator. 31 | * Comment-out some excess tests to reduce test time. 32 | * Amend indentation and other spacing. 33 | 34 | #### 6.0.0 35 | * 26/01/2018 36 | * #137 Implement `APLHABET` configuration option. 37 | * Remove `ERRORS` configuration option. 38 | * Remove `toDigits` method; extend `precision` method accordingly. 39 | * Remove s`round` method; extend `decimalPlaces` method accordingly. 40 | * Remove methods: `ceil`, `floor`, and `truncated`. 41 | * Remove method aliases: `add`, `cmp`, `isInt`, `isNeg`, `trunc`, `mul`, `neg` and `sub`. 42 | * Rename methods: `shift` to `shiftedBy`, `another` to `clone`, `toPower` to `exponentiatedBy`, and `equals` to `isEqualTo`. 43 | * Rename methods: add `is` prefix to `greaterThan`, `greaterThanOrEqualTo`, `lessThan` and `lessThanOrEqualTo`. 44 | * Add methods: `multipliedBy`, `isBigNumber`, `isPositive`, `integerValue`, `maximum` and `minimum`. 45 | * Refactor test suite. 46 | * Add *CHANGELOG.md*. 47 | * Rewrite *bignumber.d.ts*. 48 | * Redo API image. 49 | 50 | #### 5.0.0 51 | * 27/11/2017 52 | * #81 Don't throw on constructor call without `new`. 53 | 54 | #### 4.1.0 55 | * 26/09/2017 56 | * Remove node 0.6 from *.travis.yml*. 57 | * Add *bignumber.mjs*. 58 | 59 | #### 4.0.4 60 | * 03/09/2017 61 | * Add missing aliases to *bignumber.d.ts*. 62 | 63 | #### 4.0.3 64 | * 30/08/2017 65 | * Add types: *bignumber.d.ts*. 66 | 67 | #### 4.0.2 68 | * 03/05/2017 69 | * #120 Workaround Safari/Webkit bug. 70 | 71 | #### 4.0.1 72 | * 05/04/2017 73 | * #121 BigNumber.default to BigNumber['default']. 74 | 75 | #### 4.0.0 76 | * 09/01/2017 77 | * Replace BigNumber.isBigNumber method with isBigNumber prototype property. 78 | 79 | #### 3.1.2 80 | * 08/01/2017 81 | * Minor documentation edit. 82 | 83 | #### 3.1.1 84 | * 08/01/2017 85 | * Uncomment `isBigNumber` tests. 86 | * Ignore dot files. 87 | 88 | #### 3.1.0 89 | * 08/01/2017 90 | * Add `isBigNumber` method. 91 | 92 | #### 3.0.2 93 | * 08/01/2017 94 | * Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope). 95 | 96 | #### 3.0.1 97 | * 23/11/2016 98 | * Apply fix for old ipads with `%` issue, see #57 and #102. 99 | * Correct error message. 100 | 101 | #### 3.0.0 102 | * 09/11/2016 103 | * Remove `require('crypto')` - leave it to the user. 104 | * Add `BigNumber.set` as `BigNumber.config` alias. 105 | * Default `POW_PRECISION` to `0`. 106 | 107 | #### 2.4.0 108 | * 14/07/2016 109 | * #97 Add exports to support ES6 imports. 110 | 111 | #### 2.3.0 112 | * 07/03/2016 113 | * #86 Add modulus parameter to `toPower`. 114 | 115 | #### 2.2.0 116 | * 03/03/2016 117 | * #91 Permit larger JS integers. 118 | 119 | #### 2.1.4 120 | * 15/12/2015 121 | * Correct UMD. 122 | 123 | #### 2.1.3 124 | * 13/12/2015 125 | * Refactor re global object and crypto availability when bundling. 126 | 127 | #### 2.1.2 128 | * 10/12/2015 129 | * Bugfix: `window.crypto` not assigned to `crypto`. 130 | 131 | #### 2.1.1 132 | * 09/12/2015 133 | * Prevent code bundler from adding `crypto` shim. 134 | 135 | #### 2.1.0 136 | * 26/10/2015 137 | * For `valueOf` and `toJSON`, include the minus sign with negative zero. 138 | 139 | #### 2.0.8 140 | * 2/10/2015 141 | * Internal round function bugfix. 142 | 143 | #### 2.0.6 144 | * 31/03/2015 145 | * Add bower.json. Tweak division after in-depth review. 146 | 147 | #### 2.0.5 148 | * 25/03/2015 149 | * Amend README. Remove bitcoin address. 150 | 151 | #### 2.0.4 152 | * 25/03/2015 153 | * Critical bugfix #58: division. 154 | 155 | #### 2.0.3 156 | * 18/02/2015 157 | * Amend README. Add source map. 158 | 159 | #### 2.0.2 160 | * 18/02/2015 161 | * Correct links. 162 | 163 | #### 2.0.1 164 | * 18/02/2015 165 | * Add `max`, `min`, `precision`, `random`, `shiftedBy`, `toDigits` and `truncated` methods. 166 | * Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`. 167 | * Add an `another` method to enable multiple independent constructors to be created. 168 | * Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`. 169 | * Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`. 170 | * Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified. 171 | * Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified. 172 | * Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited. 173 | * Improve code quality. 174 | * Improve documentation. 175 | 176 | #### 2.0.0 177 | * 29/12/2014 178 | * Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods. 179 | * Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`. 180 | * Store a BigNumber's coefficient in base 1e14, rather than base 10. 181 | * Add fast path for integers to BigNumber constructor. 182 | * Incorporate the library into the online documentation. 183 | 184 | #### 1.5.0 185 | * 13/11/2014 186 | * Add `toJSON` and `decimalPlaces` methods. 187 | 188 | #### 1.4.1 189 | * 08/06/2014 190 | * Amend README. 191 | 192 | #### 1.4.0 193 | * 08/05/2014 194 | * Add `toNumber`. 195 | 196 | #### 1.3.0 197 | * 08/11/2013 198 | * Ensure correct rounding of `sqrt` in all, rather than almost all, cases. 199 | * Maximum radix to 64. 200 | 201 | #### 1.2.1 202 | * 17/10/2013 203 | * Sign of zero when x < 0 and x + (-x) = 0. 204 | 205 | #### 1.2.0 206 | * 19/9/2013 207 | * Throw Error objects for stack. 208 | 209 | #### 1.1.1 210 | * 22/8/2013 211 | * Show original value in constructor error message. 212 | 213 | #### 1.1.0 214 | * 1/8/2013 215 | * Allow numbers with trailing radix point. 216 | 217 | #### 1.0.1 218 | * Bugfix: error messages with incorrect method name 219 | 220 | #### 1.0.0 221 | * 8/11/2012 222 | * Initial release 223 | -------------------------------------------------------------------------------- /node_modules/bignumber.js/LICENCE: -------------------------------------------------------------------------------- 1 | The MIT Licence. 2 | 3 | Copyright (c) 2018 Michael Mclaughlin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /node_modules/bignumber.js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bignumber.js", 3 | "main": "bignumber.js", 4 | "version": "7.2.1", 5 | "homepage": "https://github.com/MikeMcl/bignumber.js", 6 | "authors": [ 7 | "Michael Mclaughlin " 8 | ], 9 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 10 | "moduleType": [ 11 | "amd", 12 | "globals", 13 | "node" 14 | ], 15 | "keywords": [ 16 | "arbitrary", 17 | "precision", 18 | "arithmetic", 19 | "big", 20 | "number", 21 | "decimal", 22 | "float", 23 | "biginteger", 24 | "bigdecimal", 25 | "bignumber", 26 | "bigint", 27 | "bignum" 28 | ], 29 | "license": "MIT", 30 | "ignore": [ 31 | ".*", 32 | "*.json", 33 | "test" 34 | ] 35 | } 36 | 37 | -------------------------------------------------------------------------------- /node_modules/bignumber.js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "bignumber.js@7.2.1", 3 | "_id": "bignumber.js@7.2.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-gMBIdZ2CaACAfEv9Uh5Q7bulel8=", 6 | "_location": "/bignumber.js", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "version", 10 | "registry": true, 11 | "raw": "bignumber.js@7.2.1", 12 | "name": "bignumber.js", 13 | "escapedName": "bignumber.js", 14 | "rawSpec": "7.2.1", 15 | "saveSpec": null, 16 | "fetchSpec": "7.2.1" 17 | }, 18 | "_requiredBy": [ 19 | "/mysql" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/bignumber.js/download/bignumber.js-7.2.1.tgz", 22 | "_shasum": "80c048759d826800807c4bfd521e50edbba57a5f", 23 | "_spec": "bignumber.js@7.2.1", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\mysql", 25 | "author": { 26 | "name": "Michael Mclaughlin", 27 | "email": "M8ch88l@gmail.com" 28 | }, 29 | "browser": "bignumber.js", 30 | "bugs": { 31 | "url": "https://github.com/MikeMcl/bignumber.js/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 36 | "engines": { 37 | "node": "*" 38 | }, 39 | "homepage": "https://github.com/MikeMcl/bignumber.js#readme", 40 | "keywords": [ 41 | "arbitrary", 42 | "precision", 43 | "arithmetic", 44 | "big", 45 | "number", 46 | "decimal", 47 | "float", 48 | "biginteger", 49 | "bigdecimal", 50 | "bignumber", 51 | "bigint", 52 | "bignum" 53 | ], 54 | "license": "MIT", 55 | "main": "bignumber", 56 | "module": "bignumber.mjs", 57 | "name": "bignumber.js", 58 | "repository": { 59 | "type": "git", 60 | "url": "git+https://github.com/MikeMcl/bignumber.js.git" 61 | }, 62 | "scripts": { 63 | "build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v7.2.1 https://github.com/MikeMcl/bignumber.js/LICENCE */\"", 64 | "test": "node test/test" 65 | }, 66 | "types": "bignumber.d.ts", 67 | "version": "7.2.1" 68 | } 69 | -------------------------------------------------------------------------------- /node_modules/core-util-is/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Node.js contributors. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to 5 | deal in the Software without restriction, including without limitation the 6 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | sell copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/core-util-is/README.md: -------------------------------------------------------------------------------- 1 | # core-util-is 2 | 3 | The `util.is*` functions introduced in Node v0.12. 4 | -------------------------------------------------------------------------------- /node_modules/core-util-is/lib/util.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // NOTE: These type checking functions intentionally don't use `instanceof` 23 | // because it is fragile and can be easily faked with `Object.create()`. 24 | 25 | function isArray(arg) { 26 | if (Array.isArray) { 27 | return Array.isArray(arg); 28 | } 29 | return objectToString(arg) === '[object Array]'; 30 | } 31 | exports.isArray = isArray; 32 | 33 | function isBoolean(arg) { 34 | return typeof arg === 'boolean'; 35 | } 36 | exports.isBoolean = isBoolean; 37 | 38 | function isNull(arg) { 39 | return arg === null; 40 | } 41 | exports.isNull = isNull; 42 | 43 | function isNullOrUndefined(arg) { 44 | return arg == null; 45 | } 46 | exports.isNullOrUndefined = isNullOrUndefined; 47 | 48 | function isNumber(arg) { 49 | return typeof arg === 'number'; 50 | } 51 | exports.isNumber = isNumber; 52 | 53 | function isString(arg) { 54 | return typeof arg === 'string'; 55 | } 56 | exports.isString = isString; 57 | 58 | function isSymbol(arg) { 59 | return typeof arg === 'symbol'; 60 | } 61 | exports.isSymbol = isSymbol; 62 | 63 | function isUndefined(arg) { 64 | return arg === void 0; 65 | } 66 | exports.isUndefined = isUndefined; 67 | 68 | function isRegExp(re) { 69 | return objectToString(re) === '[object RegExp]'; 70 | } 71 | exports.isRegExp = isRegExp; 72 | 73 | function isObject(arg) { 74 | return typeof arg === 'object' && arg !== null; 75 | } 76 | exports.isObject = isObject; 77 | 78 | function isDate(d) { 79 | return objectToString(d) === '[object Date]'; 80 | } 81 | exports.isDate = isDate; 82 | 83 | function isError(e) { 84 | return (objectToString(e) === '[object Error]' || e instanceof Error); 85 | } 86 | exports.isError = isError; 87 | 88 | function isFunction(arg) { 89 | return typeof arg === 'function'; 90 | } 91 | exports.isFunction = isFunction; 92 | 93 | function isPrimitive(arg) { 94 | return arg === null || 95 | typeof arg === 'boolean' || 96 | typeof arg === 'number' || 97 | typeof arg === 'string' || 98 | typeof arg === 'symbol' || // ES6 symbol 99 | typeof arg === 'undefined'; 100 | } 101 | exports.isPrimitive = isPrimitive; 102 | 103 | exports.isBuffer = Buffer.isBuffer; 104 | 105 | function objectToString(o) { 106 | return Object.prototype.toString.call(o); 107 | } 108 | -------------------------------------------------------------------------------- /node_modules/core-util-is/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "core-util-is@~1.0.0", 3 | "_id": "core-util-is@1.0.2", 4 | "_inBundle": false, 5 | "_integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 6 | "_location": "/core-util-is", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "core-util-is@~1.0.0", 12 | "name": "core-util-is", 13 | "escapedName": "core-util-is", 14 | "rawSpec": "~1.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "~1.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/readable-stream" 20 | ], 21 | "_resolved": "http://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz", 22 | "_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", 23 | "_spec": "core-util-is@~1.0.0", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\readable-stream", 25 | "author": { 26 | "name": "Isaac Z. Schlueter", 27 | "email": "i@izs.me", 28 | "url": "http://blog.izs.me/" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/isaacs/core-util-is/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "The `util.is*` functions introduced in Node v0.12.", 36 | "devDependencies": { 37 | "tap": "^2.3.0" 38 | }, 39 | "homepage": "https://github.com/isaacs/core-util-is#readme", 40 | "keywords": [ 41 | "util", 42 | "isBuffer", 43 | "isArray", 44 | "isNumber", 45 | "isString", 46 | "isRegExp", 47 | "isThis", 48 | "isThat", 49 | "polyfill" 50 | ], 51 | "license": "MIT", 52 | "main": "lib/util.js", 53 | "name": "core-util-is", 54 | "repository": { 55 | "type": "git", 56 | "url": "git://github.com/isaacs/core-util-is.git" 57 | }, 58 | "scripts": { 59 | "test": "tap test.js" 60 | }, 61 | "version": "1.0.2" 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/core-util-is/test.js: -------------------------------------------------------------------------------- 1 | var assert = require('tap'); 2 | 3 | var t = require('./lib/util'); 4 | 5 | assert.equal(t.isArray([]), true); 6 | assert.equal(t.isArray({}), false); 7 | 8 | assert.equal(t.isBoolean(null), false); 9 | assert.equal(t.isBoolean(true), true); 10 | assert.equal(t.isBoolean(false), true); 11 | 12 | assert.equal(t.isNull(null), true); 13 | assert.equal(t.isNull(undefined), false); 14 | assert.equal(t.isNull(false), false); 15 | assert.equal(t.isNull(), false); 16 | 17 | assert.equal(t.isNullOrUndefined(null), true); 18 | assert.equal(t.isNullOrUndefined(undefined), true); 19 | assert.equal(t.isNullOrUndefined(false), false); 20 | assert.equal(t.isNullOrUndefined(), true); 21 | 22 | assert.equal(t.isNumber(null), false); 23 | assert.equal(t.isNumber('1'), false); 24 | assert.equal(t.isNumber(1), true); 25 | 26 | assert.equal(t.isString(null), false); 27 | assert.equal(t.isString('1'), true); 28 | assert.equal(t.isString(1), false); 29 | 30 | assert.equal(t.isSymbol(null), false); 31 | assert.equal(t.isSymbol('1'), false); 32 | assert.equal(t.isSymbol(1), false); 33 | assert.equal(t.isSymbol(Symbol()), true); 34 | 35 | assert.equal(t.isUndefined(null), false); 36 | assert.equal(t.isUndefined(undefined), true); 37 | assert.equal(t.isUndefined(false), false); 38 | assert.equal(t.isUndefined(), true); 39 | 40 | assert.equal(t.isRegExp(null), false); 41 | assert.equal(t.isRegExp('1'), false); 42 | assert.equal(t.isRegExp(new RegExp()), true); 43 | 44 | assert.equal(t.isObject({}), true); 45 | assert.equal(t.isObject([]), true); 46 | assert.equal(t.isObject(new RegExp()), true); 47 | assert.equal(t.isObject(new Date()), true); 48 | 49 | assert.equal(t.isDate(null), false); 50 | assert.equal(t.isDate('1'), false); 51 | assert.equal(t.isDate(new Date()), true); 52 | 53 | assert.equal(t.isError(null), false); 54 | assert.equal(t.isError({ err: true }), false); 55 | assert.equal(t.isError(new Error()), true); 56 | 57 | assert.equal(t.isFunction(null), false); 58 | assert.equal(t.isFunction({ }), false); 59 | assert.equal(t.isFunction(function() {}), true); 60 | 61 | assert.equal(t.isPrimitive(null), true); 62 | assert.equal(t.isPrimitive(''), true); 63 | assert.equal(t.isPrimitive(0), true); 64 | assert.equal(t.isPrimitive(new Date()), false); 65 | 66 | assert.equal(t.isBuffer(null), false); 67 | assert.equal(t.isBuffer({}), false); 68 | assert.equal(t.isBuffer(new Buffer(0)), true); 69 | -------------------------------------------------------------------------------- /node_modules/inherits/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | 17 | -------------------------------------------------------------------------------- /node_modules/inherits/README.md: -------------------------------------------------------------------------------- 1 | Browser-friendly inheritance fully compatible with standard node.js 2 | [inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). 3 | 4 | This package exports standard `inherits` from node.js `util` module in 5 | node environment, but also provides alternative browser-friendly 6 | implementation through [browser 7 | field](https://gist.github.com/shtylman/4339901). Alternative 8 | implementation is a literal copy of standard one located in standalone 9 | module to avoid requiring of `util`. It also has a shim for old 10 | browsers with no `Object.create` support. 11 | 12 | While keeping you sure you are using standard `inherits` 13 | implementation in node.js environment, it allows bundlers such as 14 | [browserify](https://github.com/substack/node-browserify) to not 15 | include full `util` package to your client code if all you need is 16 | just `inherits` function. It worth, because browser shim for `util` 17 | package is large and `inherits` is often the single function you need 18 | from it. 19 | 20 | It's recommended to use this package instead of 21 | `require('util').inherits` for any code that has chances to be used 22 | not only in node.js but in browser too. 23 | 24 | ## usage 25 | 26 | ```js 27 | var inherits = require('inherits'); 28 | // then use exactly as the standard one 29 | ``` 30 | 31 | ## note on version ~1.0 32 | 33 | Version ~1.0 had completely different motivation and is not compatible 34 | neither with 2.0 nor with standard node.js `inherits`. 35 | 36 | If you are using version ~1.0 and planning to switch to ~2.0, be 37 | careful: 38 | 39 | * new version uses `super_` instead of `super` for referencing 40 | superclass 41 | * new version overwrites current prototype while old one preserves any 42 | existing fields on it 43 | -------------------------------------------------------------------------------- /node_modules/inherits/inherits.js: -------------------------------------------------------------------------------- 1 | try { 2 | var util = require('util'); 3 | /* istanbul ignore next */ 4 | if (typeof util.inherits !== 'function') throw ''; 5 | module.exports = util.inherits; 6 | } catch (e) { 7 | /* istanbul ignore next */ 8 | module.exports = require('./inherits_browser.js'); 9 | } 10 | -------------------------------------------------------------------------------- /node_modules/inherits/inherits_browser.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.create === 'function') { 2 | // implementation from standard node.js 'util' module 3 | module.exports = function inherits(ctor, superCtor) { 4 | if (superCtor) { 5 | ctor.super_ = superCtor 6 | ctor.prototype = Object.create(superCtor.prototype, { 7 | constructor: { 8 | value: ctor, 9 | enumerable: false, 10 | writable: true, 11 | configurable: true 12 | } 13 | }) 14 | } 15 | }; 16 | } else { 17 | // old school shim for old browsers 18 | module.exports = function inherits(ctor, superCtor) { 19 | if (superCtor) { 20 | ctor.super_ = superCtor 21 | var TempCtor = function () {} 22 | TempCtor.prototype = superCtor.prototype 23 | ctor.prototype = new TempCtor() 24 | ctor.prototype.constructor = ctor 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /node_modules/inherits/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "inherits@~2.0.3", 3 | "_id": "inherits@2.0.4", 4 | "_inBundle": false, 5 | "_integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=", 6 | "_location": "/inherits", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "inherits@~2.0.3", 12 | "name": "inherits", 13 | "escapedName": "inherits", 14 | "rawSpec": "~2.0.3", 15 | "saveSpec": null, 16 | "fetchSpec": "~2.0.3" 17 | }, 18 | "_requiredBy": [ 19 | "/readable-stream" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz", 22 | "_shasum": "0fa2c64f932917c3433a0ded55363aae37416b7c", 23 | "_spec": "inherits@~2.0.3", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\readable-stream", 25 | "browser": "./inherits_browser.js", 26 | "bugs": { 27 | "url": "https://github.com/isaacs/inherits/issues" 28 | }, 29 | "bundleDependencies": false, 30 | "deprecated": false, 31 | "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", 32 | "devDependencies": { 33 | "tap": "^14.2.4" 34 | }, 35 | "files": [ 36 | "inherits.js", 37 | "inherits_browser.js" 38 | ], 39 | "homepage": "https://github.com/isaacs/inherits#readme", 40 | "keywords": [ 41 | "inheritance", 42 | "class", 43 | "klass", 44 | "oop", 45 | "object-oriented", 46 | "inherits", 47 | "browser", 48 | "browserify" 49 | ], 50 | "license": "ISC", 51 | "main": "./inherits.js", 52 | "name": "inherits", 53 | "repository": { 54 | "type": "git", 55 | "url": "git://github.com/isaacs/inherits.git" 56 | }, 57 | "scripts": { 58 | "test": "tap" 59 | }, 60 | "version": "2.0.4" 61 | } 62 | -------------------------------------------------------------------------------- /node_modules/isarray/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /node_modules/isarray/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | - "0.10" 5 | -------------------------------------------------------------------------------- /node_modules/isarray/Makefile: -------------------------------------------------------------------------------- 1 | 2 | test: 3 | @node_modules/.bin/tape test.js 4 | 5 | .PHONY: test 6 | 7 | -------------------------------------------------------------------------------- /node_modules/isarray/README.md: -------------------------------------------------------------------------------- 1 | 2 | # isarray 3 | 4 | `Array#isArray` for older browsers. 5 | 6 | [![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) 7 | [![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) 8 | 9 | [![browser support](https://ci.testling.com/juliangruber/isarray.png) 10 | ](https://ci.testling.com/juliangruber/isarray) 11 | 12 | ## Usage 13 | 14 | ```js 15 | var isArray = require('isarray'); 16 | 17 | console.log(isArray([])); // => true 18 | console.log(isArray({})); // => false 19 | ``` 20 | 21 | ## Installation 22 | 23 | With [npm](http://npmjs.org) do 24 | 25 | ```bash 26 | $ npm install isarray 27 | ``` 28 | 29 | Then bundle for the browser with 30 | [browserify](https://github.com/substack/browserify). 31 | 32 | With [component](http://component.io) do 33 | 34 | ```bash 35 | $ component install juliangruber/isarray 36 | ``` 37 | 38 | ## License 39 | 40 | (MIT) 41 | 42 | Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> 43 | 44 | Permission is hereby granted, free of charge, to any person obtaining a copy of 45 | this software and associated documentation files (the "Software"), to deal in 46 | the Software without restriction, including without limitation the rights to 47 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 48 | of the Software, and to permit persons to whom the Software is furnished to do 49 | so, subject to the following conditions: 50 | 51 | The above copyright notice and this permission notice shall be included in all 52 | copies or substantial portions of the Software. 53 | 54 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 55 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 56 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 57 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 58 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 59 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 60 | SOFTWARE. 61 | -------------------------------------------------------------------------------- /node_modules/isarray/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "isarray", 3 | "description" : "Array#isArray for older browsers", 4 | "version" : "0.0.1", 5 | "repository" : "juliangruber/isarray", 6 | "homepage": "https://github.com/juliangruber/isarray", 7 | "main" : "index.js", 8 | "scripts" : [ 9 | "index.js" 10 | ], 11 | "dependencies" : {}, 12 | "keywords": ["browser","isarray","array"], 13 | "author": { 14 | "name": "Julian Gruber", 15 | "email": "mail@juliangruber.com", 16 | "url": "http://juliangruber.com" 17 | }, 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /node_modules/isarray/index.js: -------------------------------------------------------------------------------- 1 | var toString = {}.toString; 2 | 3 | module.exports = Array.isArray || function (arr) { 4 | return toString.call(arr) == '[object Array]'; 5 | }; 6 | -------------------------------------------------------------------------------- /node_modules/isarray/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "isarray@~1.0.0", 3 | "_id": "isarray@1.0.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 6 | "_location": "/isarray", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "isarray@~1.0.0", 12 | "name": "isarray", 13 | "escapedName": "isarray", 14 | "rawSpec": "~1.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "~1.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/readable-stream" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz?cache=0&sync_timestamp=1562592096220&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fisarray%2Fdownload%2Fisarray-1.0.0.tgz", 22 | "_shasum": "bb935d48582cba168c06834957a54a3e07124f11", 23 | "_spec": "isarray@~1.0.0", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\readable-stream", 25 | "author": { 26 | "name": "Julian Gruber", 27 | "email": "mail@juliangruber.com", 28 | "url": "http://juliangruber.com" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/juliangruber/isarray/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": {}, 35 | "deprecated": false, 36 | "description": "Array#isArray for older browsers", 37 | "devDependencies": { 38 | "tape": "~2.13.4" 39 | }, 40 | "homepage": "https://github.com/juliangruber/isarray", 41 | "keywords": [ 42 | "browser", 43 | "isarray", 44 | "array" 45 | ], 46 | "license": "MIT", 47 | "main": "index.js", 48 | "name": "isarray", 49 | "repository": { 50 | "type": "git", 51 | "url": "git://github.com/juliangruber/isarray.git" 52 | }, 53 | "scripts": { 54 | "test": "tape test.js" 55 | }, 56 | "testling": { 57 | "files": "test.js", 58 | "browsers": [ 59 | "ie/8..latest", 60 | "firefox/17..latest", 61 | "firefox/nightly", 62 | "chrome/22..latest", 63 | "chrome/canary", 64 | "opera/12..latest", 65 | "opera/next", 66 | "safari/5.1..latest", 67 | "ipad/6.0..latest", 68 | "iphone/6.0..latest", 69 | "android-browser/4.2..latest" 70 | ] 71 | }, 72 | "version": "1.0.0" 73 | } 74 | -------------------------------------------------------------------------------- /node_modules/isarray/test.js: -------------------------------------------------------------------------------- 1 | var isArray = require('./'); 2 | var test = require('tape'); 3 | 4 | test('is array', function(t){ 5 | t.ok(isArray([])); 6 | t.notOk(isArray({})); 7 | t.notOk(isArray(null)); 8 | t.notOk(isArray(false)); 9 | 10 | var obj = {}; 11 | obj[0] = true; 12 | t.notOk(isArray(obj)); 13 | 14 | var arr = []; 15 | arr.foo = 'bar'; 16 | t.ok(isArray(arr)); 17 | 18 | t.end(); 19 | }); 20 | 21 | -------------------------------------------------------------------------------- /node_modules/mysql/License: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/mysql/index.js: -------------------------------------------------------------------------------- 1 | var Classes = Object.create(null); 2 | 3 | /** 4 | * Create a new Connection instance. 5 | * @param {object|string} config Configuration or connection string for new MySQL connection 6 | * @return {Connection} A new MySQL connection 7 | * @public 8 | */ 9 | exports.createConnection = function createConnection(config) { 10 | var Connection = loadClass('Connection'); 11 | var ConnectionConfig = loadClass('ConnectionConfig'); 12 | 13 | return new Connection({config: new ConnectionConfig(config)}); 14 | }; 15 | 16 | /** 17 | * Create a new Pool instance. 18 | * @param {object|string} config Configuration or connection string for new MySQL connections 19 | * @return {Pool} A new MySQL pool 20 | * @public 21 | */ 22 | exports.createPool = function createPool(config) { 23 | var Pool = loadClass('Pool'); 24 | var PoolConfig = loadClass('PoolConfig'); 25 | 26 | return new Pool({config: new PoolConfig(config)}); 27 | }; 28 | 29 | /** 30 | * Create a new PoolCluster instance. 31 | * @param {object} [config] Configuration for pool cluster 32 | * @return {PoolCluster} New MySQL pool cluster 33 | * @public 34 | */ 35 | exports.createPoolCluster = function createPoolCluster(config) { 36 | var PoolCluster = loadClass('PoolCluster'); 37 | 38 | return new PoolCluster(config); 39 | }; 40 | 41 | /** 42 | * Create a new Query instance. 43 | * @param {string} sql The SQL for the query 44 | * @param {array} [values] Any values to insert into placeholders in sql 45 | * @param {function} [callback] The callback to use when query is complete 46 | * @return {Query} New query object 47 | * @public 48 | */ 49 | exports.createQuery = function createQuery(sql, values, callback) { 50 | var Connection = loadClass('Connection'); 51 | 52 | return Connection.createQuery(sql, values, callback); 53 | }; 54 | 55 | /** 56 | * Escape a value for SQL. 57 | * @param {*} value The value to escape 58 | * @param {boolean} [stringifyObjects=false] Setting if objects should be stringified 59 | * @param {string} [timeZone=local] Setting for time zone to use for Date conversion 60 | * @return {string} Escaped string value 61 | * @public 62 | */ 63 | exports.escape = function escape(value, stringifyObjects, timeZone) { 64 | var SqlString = loadClass('SqlString'); 65 | 66 | return SqlString.escape(value, stringifyObjects, timeZone); 67 | }; 68 | 69 | /** 70 | * Escape an identifier for SQL. 71 | * @param {*} value The value to escape 72 | * @param {boolean} [forbidQualified=false] Setting to treat '.' as part of identifier 73 | * @return {string} Escaped string value 74 | * @public 75 | */ 76 | exports.escapeId = function escapeId(value, forbidQualified) { 77 | var SqlString = loadClass('SqlString'); 78 | 79 | return SqlString.escapeId(value, forbidQualified); 80 | }; 81 | 82 | /** 83 | * Format SQL and replacement values into a SQL string. 84 | * @param {string} sql The SQL for the query 85 | * @param {array} [values] Any values to insert into placeholders in sql 86 | * @param {boolean} [stringifyObjects=false] Setting if objects should be stringified 87 | * @param {string} [timeZone=local] Setting for time zone to use for Date conversion 88 | * @return {string} Formatted SQL string 89 | * @public 90 | */ 91 | exports.format = function format(sql, values, stringifyObjects, timeZone) { 92 | var SqlString = loadClass('SqlString'); 93 | 94 | return SqlString.format(sql, values, stringifyObjects, timeZone); 95 | }; 96 | 97 | /** 98 | * Wrap raw SQL strings from escape overriding. 99 | * @param {string} sql The raw SQL 100 | * @return {object} Wrapped object 101 | * @public 102 | */ 103 | exports.raw = function raw(sql) { 104 | var SqlString = loadClass('SqlString'); 105 | 106 | return SqlString.raw(sql); 107 | }; 108 | 109 | /** 110 | * The type constants. 111 | * @public 112 | */ 113 | Object.defineProperty(exports, 'Types', { 114 | get: loadClass.bind(null, 'Types') 115 | }); 116 | 117 | /** 118 | * Load the given class. 119 | * @param {string} className Name of class to default 120 | * @return {function|object} Class constructor or exports 121 | * @private 122 | */ 123 | function loadClass(className) { 124 | var Class = Classes[className]; 125 | 126 | if (Class !== undefined) { 127 | return Class; 128 | } 129 | 130 | // This uses a switch for static require analysis 131 | switch (className) { 132 | case 'Connection': 133 | Class = require('./lib/Connection'); 134 | break; 135 | case 'ConnectionConfig': 136 | Class = require('./lib/ConnectionConfig'); 137 | break; 138 | case 'Pool': 139 | Class = require('./lib/Pool'); 140 | break; 141 | case 'PoolCluster': 142 | Class = require('./lib/PoolCluster'); 143 | break; 144 | case 'PoolConfig': 145 | Class = require('./lib/PoolConfig'); 146 | break; 147 | case 'SqlString': 148 | Class = require('./lib/protocol/SqlString'); 149 | break; 150 | case 'Types': 151 | Class = require('./lib/protocol/constants/types'); 152 | break; 153 | default: 154 | throw new Error('Cannot find class \'' + className + '\''); 155 | } 156 | 157 | // Store to prevent invoking require() 158 | Classes[className] = Class; 159 | 160 | return Class; 161 | } 162 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/ConnectionConfig.js: -------------------------------------------------------------------------------- 1 | var urlParse = require('url').parse; 2 | var ClientConstants = require('./protocol/constants/client'); 3 | var Charsets = require('./protocol/constants/charsets'); 4 | var SSLProfiles = null; 5 | 6 | module.exports = ConnectionConfig; 7 | function ConnectionConfig(options) { 8 | if (typeof options === 'string') { 9 | options = ConnectionConfig.parseUrl(options); 10 | } 11 | 12 | this.host = options.host || 'localhost'; 13 | this.port = options.port || 3306; 14 | this.localAddress = options.localAddress; 15 | this.socketPath = options.socketPath; 16 | this.user = options.user || undefined; 17 | this.password = options.password || undefined; 18 | this.database = options.database; 19 | this.connectTimeout = (options.connectTimeout === undefined) 20 | ? (10 * 1000) 21 | : options.connectTimeout; 22 | this.insecureAuth = options.insecureAuth || false; 23 | this.supportBigNumbers = options.supportBigNumbers || false; 24 | this.bigNumberStrings = options.bigNumberStrings || false; 25 | this.dateStrings = options.dateStrings || false; 26 | this.debug = options.debug; 27 | this.trace = options.trace !== false; 28 | this.stringifyObjects = options.stringifyObjects || false; 29 | this.timezone = options.timezone || 'local'; 30 | this.flags = options.flags || ''; 31 | this.queryFormat = options.queryFormat; 32 | this.pool = options.pool || undefined; 33 | this.ssl = (typeof options.ssl === 'string') 34 | ? ConnectionConfig.getSSLProfile(options.ssl) 35 | : (options.ssl || false); 36 | this.multipleStatements = options.multipleStatements || false; 37 | this.typeCast = (options.typeCast === undefined) 38 | ? true 39 | : options.typeCast; 40 | 41 | if (this.timezone[0] === ' ') { 42 | // "+" is a url encoded char for space so it 43 | // gets translated to space when giving a 44 | // connection string.. 45 | this.timezone = '+' + this.timezone.substr(1); 46 | } 47 | 48 | if (this.ssl) { 49 | // Default rejectUnauthorized to true 50 | this.ssl.rejectUnauthorized = this.ssl.rejectUnauthorized !== false; 51 | } 52 | 53 | this.maxPacketSize = 0; 54 | this.charsetNumber = (options.charset) 55 | ? ConnectionConfig.getCharsetNumber(options.charset) 56 | : options.charsetNumber || Charsets.UTF8_GENERAL_CI; 57 | 58 | // Set the client flags 59 | var defaultFlags = ConnectionConfig.getDefaultFlags(options); 60 | this.clientFlags = ConnectionConfig.mergeFlags(defaultFlags, options.flags); 61 | } 62 | 63 | ConnectionConfig.mergeFlags = function mergeFlags(defaultFlags, userFlags) { 64 | var allFlags = ConnectionConfig.parseFlagList(defaultFlags); 65 | var newFlags = ConnectionConfig.parseFlagList(userFlags); 66 | 67 | // Merge the new flags 68 | for (var flag in newFlags) { 69 | if (allFlags[flag] !== false) { 70 | allFlags[flag] = newFlags[flag]; 71 | } 72 | } 73 | 74 | // Build flags 75 | var flags = 0x0; 76 | for (var flag in allFlags) { 77 | if (allFlags[flag]) { 78 | // TODO: Throw here on some future release 79 | flags |= ClientConstants['CLIENT_' + flag] || 0x0; 80 | } 81 | } 82 | 83 | return flags; 84 | }; 85 | 86 | ConnectionConfig.getCharsetNumber = function getCharsetNumber(charset) { 87 | var num = Charsets[charset.toUpperCase()]; 88 | 89 | if (num === undefined) { 90 | throw new TypeError('Unknown charset \'' + charset + '\''); 91 | } 92 | 93 | return num; 94 | }; 95 | 96 | ConnectionConfig.getDefaultFlags = function getDefaultFlags(options) { 97 | var defaultFlags = [ 98 | '-COMPRESS', // Compression protocol *NOT* supported 99 | '-CONNECT_ATTRS', // Does *NOT* send connection attributes in Protocol::HandshakeResponse41 100 | '+CONNECT_WITH_DB', // One can specify db on connect in Handshake Response Packet 101 | '+FOUND_ROWS', // Send found rows instead of affected rows 102 | '+IGNORE_SIGPIPE', // Don't issue SIGPIPE if network failures 103 | '+IGNORE_SPACE', // Let the parser ignore spaces before '(' 104 | '+LOCAL_FILES', // Can use LOAD DATA LOCAL 105 | '+LONG_FLAG', // Longer flags in Protocol::ColumnDefinition320 106 | '+LONG_PASSWORD', // Use the improved version of Old Password Authentication 107 | '+MULTI_RESULTS', // Can handle multiple resultsets for COM_QUERY 108 | '+ODBC', // Special handling of ODBC behaviour 109 | '-PLUGIN_AUTH', // Does *NOT* support auth plugins 110 | '+PROTOCOL_41', // Uses the 4.1 protocol 111 | '+PS_MULTI_RESULTS', // Can handle multiple resultsets for COM_STMT_EXECUTE 112 | '+RESERVED', // Unused 113 | '+SECURE_CONNECTION', // Supports Authentication::Native41 114 | '+TRANSACTIONS' // Expects status flags 115 | ]; 116 | 117 | if (options && options.multipleStatements) { 118 | // May send multiple statements per COM_QUERY and COM_STMT_PREPARE 119 | defaultFlags.push('+MULTI_STATEMENTS'); 120 | } 121 | 122 | return defaultFlags; 123 | }; 124 | 125 | ConnectionConfig.getSSLProfile = function getSSLProfile(name) { 126 | if (!SSLProfiles) { 127 | SSLProfiles = require('./protocol/constants/ssl_profiles'); 128 | } 129 | 130 | var ssl = SSLProfiles[name]; 131 | 132 | if (ssl === undefined) { 133 | throw new TypeError('Unknown SSL profile \'' + name + '\''); 134 | } 135 | 136 | return ssl; 137 | }; 138 | 139 | ConnectionConfig.parseFlagList = function parseFlagList(flagList) { 140 | var allFlags = Object.create(null); 141 | 142 | if (!flagList) { 143 | return allFlags; 144 | } 145 | 146 | var flags = !Array.isArray(flagList) 147 | ? String(flagList || '').toUpperCase().split(/\s*,+\s*/) 148 | : flagList; 149 | 150 | for (var i = 0; i < flags.length; i++) { 151 | var flag = flags[i]; 152 | var offset = 1; 153 | var state = flag[0]; 154 | 155 | if (state === undefined) { 156 | // TODO: throw here on some future release 157 | continue; 158 | } 159 | 160 | if (state !== '-' && state !== '+') { 161 | offset = 0; 162 | state = '+'; 163 | } 164 | 165 | allFlags[flag.substr(offset)] = state === '+'; 166 | } 167 | 168 | return allFlags; 169 | }; 170 | 171 | ConnectionConfig.parseUrl = function(url) { 172 | url = urlParse(url, true); 173 | 174 | var options = { 175 | host : url.hostname, 176 | port : url.port, 177 | database : url.pathname.substr(1) 178 | }; 179 | 180 | if (url.auth) { 181 | var auth = url.auth.split(':'); 182 | options.user = auth.shift(); 183 | options.password = auth.join(':'); 184 | } 185 | 186 | if (url.query) { 187 | for (var key in url.query) { 188 | var value = url.query[key]; 189 | 190 | try { 191 | // Try to parse this as a JSON expression first 192 | options[key] = JSON.parse(value); 193 | } catch (err) { 194 | // Otherwise assume it is a plain string 195 | options[key] = value; 196 | } 197 | } 198 | } 199 | 200 | return options; 201 | }; 202 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/PoolCluster.js: -------------------------------------------------------------------------------- 1 | var Pool = require('./Pool'); 2 | var PoolConfig = require('./PoolConfig'); 3 | var PoolNamespace = require('./PoolNamespace'); 4 | var PoolSelector = require('./PoolSelector'); 5 | var Util = require('util'); 6 | var EventEmitter = require('events').EventEmitter; 7 | 8 | module.exports = PoolCluster; 9 | 10 | /** 11 | * PoolCluster 12 | * @constructor 13 | * @param {object} [config] The pool cluster configuration 14 | * @public 15 | */ 16 | function PoolCluster(config) { 17 | EventEmitter.call(this); 18 | 19 | config = config || {}; 20 | this._canRetry = typeof config.canRetry === 'undefined' ? true : config.canRetry; 21 | this._defaultSelector = config.defaultSelector || 'RR'; 22 | this._removeNodeErrorCount = config.removeNodeErrorCount || 5; 23 | this._restoreNodeTimeout = config.restoreNodeTimeout || 0; 24 | 25 | this._closed = false; 26 | this._findCaches = Object.create(null); 27 | this._lastId = 0; 28 | this._namespaces = Object.create(null); 29 | this._nodes = Object.create(null); 30 | } 31 | 32 | Util.inherits(PoolCluster, EventEmitter); 33 | 34 | PoolCluster.prototype.add = function add(id, config) { 35 | if (this._closed) { 36 | throw new Error('PoolCluster is closed.'); 37 | } 38 | 39 | var nodeId = typeof id === 'object' 40 | ? 'CLUSTER::' + (++this._lastId) 41 | : String(id); 42 | 43 | if (this._nodes[nodeId] !== undefined) { 44 | throw new Error('Node ID "' + nodeId + '" is already defined in PoolCluster.'); 45 | } 46 | 47 | var poolConfig = typeof id !== 'object' 48 | ? new PoolConfig(config) 49 | : new PoolConfig(id); 50 | 51 | this._nodes[nodeId] = { 52 | id : nodeId, 53 | errorCount : 0, 54 | pool : new Pool({config: poolConfig}), 55 | _offlineUntil : 0 56 | }; 57 | 58 | this._clearFindCaches(); 59 | }; 60 | 61 | PoolCluster.prototype.end = function end(callback) { 62 | var cb = callback !== undefined 63 | ? callback 64 | : _cb; 65 | 66 | if (typeof cb !== 'function') { 67 | throw TypeError('callback argument must be a function'); 68 | } 69 | 70 | if (this._closed) { 71 | process.nextTick(cb); 72 | return; 73 | } 74 | 75 | this._closed = true; 76 | 77 | var calledBack = false; 78 | var nodeIds = Object.keys(this._nodes); 79 | var waitingClose = 0; 80 | 81 | function onEnd(err) { 82 | if (!calledBack && (err || --waitingClose <= 0)) { 83 | calledBack = true; 84 | cb(err); 85 | } 86 | } 87 | 88 | for (var i = 0; i < nodeIds.length; i++) { 89 | var nodeId = nodeIds[i]; 90 | var node = this._nodes[nodeId]; 91 | 92 | waitingClose++; 93 | node.pool.end(onEnd); 94 | } 95 | 96 | if (waitingClose === 0) { 97 | process.nextTick(onEnd); 98 | } 99 | }; 100 | 101 | PoolCluster.prototype.of = function(pattern, selector) { 102 | pattern = pattern || '*'; 103 | 104 | selector = selector || this._defaultSelector; 105 | selector = selector.toUpperCase(); 106 | if (typeof PoolSelector[selector] === 'undefined') { 107 | selector = this._defaultSelector; 108 | } 109 | 110 | var key = pattern + selector; 111 | 112 | if (typeof this._namespaces[key] === 'undefined') { 113 | this._namespaces[key] = new PoolNamespace(this, pattern, selector); 114 | } 115 | 116 | return this._namespaces[key]; 117 | }; 118 | 119 | PoolCluster.prototype.remove = function remove(pattern) { 120 | var foundNodeIds = this._findNodeIds(pattern, true); 121 | 122 | for (var i = 0; i < foundNodeIds.length; i++) { 123 | var node = this._getNode(foundNodeIds[i]); 124 | 125 | if (node) { 126 | this._removeNode(node); 127 | } 128 | } 129 | }; 130 | 131 | PoolCluster.prototype.getConnection = function(pattern, selector, cb) { 132 | var namespace; 133 | if (typeof pattern === 'function') { 134 | cb = pattern; 135 | namespace = this.of(); 136 | } else { 137 | if (typeof selector === 'function') { 138 | cb = selector; 139 | selector = this._defaultSelector; 140 | } 141 | 142 | namespace = this.of(pattern, selector); 143 | } 144 | 145 | namespace.getConnection(cb); 146 | }; 147 | 148 | PoolCluster.prototype._clearFindCaches = function _clearFindCaches() { 149 | this._findCaches = Object.create(null); 150 | }; 151 | 152 | PoolCluster.prototype._decreaseErrorCount = function _decreaseErrorCount(node) { 153 | var errorCount = node.errorCount; 154 | 155 | if (errorCount > this._removeNodeErrorCount) { 156 | errorCount = this._removeNodeErrorCount; 157 | } 158 | 159 | if (errorCount < 1) { 160 | errorCount = 1; 161 | } 162 | 163 | node.errorCount = errorCount - 1; 164 | 165 | if (node._offlineUntil) { 166 | node._offlineUntil = 0; 167 | this.emit('online', node.id); 168 | } 169 | }; 170 | 171 | PoolCluster.prototype._findNodeIds = function _findNodeIds(pattern, includeOffline) { 172 | var currentTime = 0; 173 | var foundNodeIds = this._findCaches[pattern]; 174 | 175 | if (foundNodeIds === undefined) { 176 | var expression = patternRegExp(pattern); 177 | var nodeIds = Object.keys(this._nodes); 178 | 179 | foundNodeIds = nodeIds.filter(function (id) { 180 | return id.match(expression); 181 | }); 182 | 183 | this._findCaches[pattern] = foundNodeIds; 184 | } 185 | 186 | if (includeOffline) { 187 | return foundNodeIds; 188 | } 189 | 190 | return foundNodeIds.filter(function (nodeId) { 191 | var node = this._getNode(nodeId); 192 | 193 | if (!node._offlineUntil) { 194 | return true; 195 | } 196 | 197 | if (!currentTime) { 198 | currentTime = getMonotonicMilliseconds(); 199 | } 200 | 201 | return node._offlineUntil <= currentTime; 202 | }, this); 203 | }; 204 | 205 | PoolCluster.prototype._getNode = function _getNode(id) { 206 | return this._nodes[id] || null; 207 | }; 208 | 209 | PoolCluster.prototype._increaseErrorCount = function _increaseErrorCount(node) { 210 | var errorCount = ++node.errorCount; 211 | 212 | if (this._removeNodeErrorCount > errorCount) { 213 | return; 214 | } 215 | 216 | if (this._restoreNodeTimeout > 0) { 217 | node._offlineUntil = getMonotonicMilliseconds() + this._restoreNodeTimeout; 218 | this.emit('offline', node.id); 219 | return; 220 | } 221 | 222 | this._removeNode(node); 223 | this.emit('remove', node.id); 224 | }; 225 | 226 | PoolCluster.prototype._getConnection = function(node, cb) { 227 | var self = this; 228 | 229 | node.pool.getConnection(function (err, connection) { 230 | if (err) { 231 | self._increaseErrorCount(node); 232 | cb(err); 233 | return; 234 | } else { 235 | self._decreaseErrorCount(node); 236 | } 237 | 238 | connection._clusterId = node.id; 239 | 240 | cb(null, connection); 241 | }); 242 | }; 243 | 244 | PoolCluster.prototype._removeNode = function _removeNode(node) { 245 | delete this._nodes[node.id]; 246 | 247 | this._clearFindCaches(); 248 | 249 | node.pool.end(_noop); 250 | }; 251 | 252 | function getMonotonicMilliseconds() { 253 | var ms; 254 | 255 | if (typeof process.hrtime === 'function') { 256 | ms = process.hrtime(); 257 | ms = ms[0] * 1e3 + ms[1] * 1e-6; 258 | } else { 259 | ms = process.uptime() * 1000; 260 | } 261 | 262 | return Math.floor(ms); 263 | } 264 | 265 | function isRegExp(val) { 266 | return typeof val === 'object' 267 | && Object.prototype.toString.call(val) === '[object RegExp]'; 268 | } 269 | 270 | function patternRegExp(pattern) { 271 | if (isRegExp(pattern)) { 272 | return pattern; 273 | } 274 | 275 | var source = pattern 276 | .replace(/([.+?^=!:${}()|\[\]\/\\])/g, '\\$1') 277 | .replace(/\*/g, '.*'); 278 | 279 | return new RegExp('^' + source + '$'); 280 | } 281 | 282 | function _cb(err) { 283 | if (err) { 284 | throw err; 285 | } 286 | } 287 | 288 | function _noop() {} 289 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/PoolConfig.js: -------------------------------------------------------------------------------- 1 | 2 | var ConnectionConfig = require('./ConnectionConfig'); 3 | 4 | module.exports = PoolConfig; 5 | function PoolConfig(options) { 6 | if (typeof options === 'string') { 7 | options = ConnectionConfig.parseUrl(options); 8 | } 9 | 10 | this.acquireTimeout = (options.acquireTimeout === undefined) 11 | ? 10 * 1000 12 | : Number(options.acquireTimeout); 13 | this.connectionConfig = new ConnectionConfig(options); 14 | this.waitForConnections = (options.waitForConnections === undefined) 15 | ? true 16 | : Boolean(options.waitForConnections); 17 | this.connectionLimit = (options.connectionLimit === undefined) 18 | ? 10 19 | : Number(options.connectionLimit); 20 | this.queueLimit = (options.queueLimit === undefined) 21 | ? 0 22 | : Number(options.queueLimit); 23 | } 24 | 25 | PoolConfig.prototype.newConnectionConfig = function newConnectionConfig() { 26 | var connectionConfig = new ConnectionConfig(this.connectionConfig); 27 | 28 | connectionConfig.clientFlags = this.connectionConfig.clientFlags; 29 | connectionConfig.maxPacketSize = this.connectionConfig.maxPacketSize; 30 | 31 | return connectionConfig; 32 | }; 33 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/PoolConnection.js: -------------------------------------------------------------------------------- 1 | var inherits = require('util').inherits; 2 | var Connection = require('./Connection'); 3 | var Events = require('events'); 4 | 5 | module.exports = PoolConnection; 6 | inherits(PoolConnection, Connection); 7 | 8 | function PoolConnection(pool, options) { 9 | Connection.call(this, options); 10 | this._pool = pool; 11 | 12 | // Bind connection to pool domain 13 | if (Events.usingDomains) { 14 | this.domain = pool.domain; 15 | } 16 | 17 | // When a fatal error occurs the connection's protocol ends, which will cause 18 | // the connection to end as well, thus we only need to watch for the end event 19 | // and we will be notified of disconnects. 20 | this.on('end', this._removeFromPool); 21 | this.on('error', function (err) { 22 | if (err.fatal) { 23 | this._removeFromPool(); 24 | } 25 | }); 26 | } 27 | 28 | PoolConnection.prototype.release = function release() { 29 | var pool = this._pool; 30 | 31 | if (!pool || pool._closed) { 32 | return undefined; 33 | } 34 | 35 | return pool.releaseConnection(this); 36 | }; 37 | 38 | // TODO: Remove this when we are removing PoolConnection#end 39 | PoolConnection.prototype._realEnd = Connection.prototype.end; 40 | 41 | PoolConnection.prototype.end = function () { 42 | console.warn( 43 | 'Calling conn.end() to release a pooled connection is ' + 44 | 'deprecated. In next version calling conn.end() will be ' + 45 | 'restored to default conn.end() behavior. Use ' + 46 | 'conn.release() instead.' 47 | ); 48 | this.release(); 49 | }; 50 | 51 | PoolConnection.prototype.destroy = function () { 52 | Connection.prototype.destroy.apply(this, arguments); 53 | this._removeFromPool(this); 54 | }; 55 | 56 | PoolConnection.prototype._removeFromPool = function _removeFromPool() { 57 | if (!this._pool || this._pool._closed) { 58 | return; 59 | } 60 | 61 | var pool = this._pool; 62 | this._pool = null; 63 | 64 | pool._purgeConnection(this); 65 | }; 66 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/PoolNamespace.js: -------------------------------------------------------------------------------- 1 | var Connection = require('./Connection'); 2 | var PoolSelector = require('./PoolSelector'); 3 | 4 | module.exports = PoolNamespace; 5 | 6 | /** 7 | * PoolNamespace 8 | * @constructor 9 | * @param {PoolCluster} cluster The parent cluster for the namespace 10 | * @param {string} pattern The selection pattern to use 11 | * @param {string} selector The selector name to use 12 | * @public 13 | */ 14 | function PoolNamespace(cluster, pattern, selector) { 15 | this._cluster = cluster; 16 | this._pattern = pattern; 17 | this._selector = new PoolSelector[selector](); 18 | } 19 | 20 | PoolNamespace.prototype.getConnection = function(cb) { 21 | var clusterNode = this._getClusterNode(); 22 | var cluster = this._cluster; 23 | var namespace = this; 24 | 25 | if (clusterNode === null) { 26 | var err = null; 27 | 28 | if (this._cluster._findNodeIds(this._pattern, true).length !== 0) { 29 | err = new Error('Pool does not have online node.'); 30 | err.code = 'POOL_NONEONLINE'; 31 | } else { 32 | err = new Error('Pool does not exist.'); 33 | err.code = 'POOL_NOEXIST'; 34 | } 35 | 36 | cb(err); 37 | return; 38 | } 39 | 40 | cluster._getConnection(clusterNode, function(err, connection) { 41 | var retry = err && cluster._canRetry 42 | && cluster._findNodeIds(namespace._pattern).length !== 0; 43 | 44 | if (retry) { 45 | namespace.getConnection(cb); 46 | return; 47 | } 48 | 49 | if (err) { 50 | cb(err); 51 | return; 52 | } 53 | 54 | cb(null, connection); 55 | }); 56 | }; 57 | 58 | PoolNamespace.prototype.query = function (sql, values, cb) { 59 | var cluster = this._cluster; 60 | var clusterNode = this._getClusterNode(); 61 | var query = Connection.createQuery(sql, values, cb); 62 | var namespace = this; 63 | 64 | if (clusterNode === null) { 65 | var err = null; 66 | 67 | if (this._cluster._findNodeIds(this._pattern, true).length !== 0) { 68 | err = new Error('Pool does not have online node.'); 69 | err.code = 'POOL_NONEONLINE'; 70 | } else { 71 | err = new Error('Pool does not exist.'); 72 | err.code = 'POOL_NOEXIST'; 73 | } 74 | 75 | process.nextTick(function () { 76 | query.on('error', function () {}); 77 | query.end(err); 78 | }); 79 | return query; 80 | } 81 | 82 | if (!(typeof sql === 'object' && 'typeCast' in sql)) { 83 | query.typeCast = clusterNode.pool.config.connectionConfig.typeCast; 84 | } 85 | 86 | if (clusterNode.pool.config.connectionConfig.trace) { 87 | // Long stack trace support 88 | query._callSite = new Error(); 89 | } 90 | 91 | cluster._getConnection(clusterNode, function (err, conn) { 92 | var retry = err && cluster._canRetry 93 | && cluster._findNodeIds(namespace._pattern).length !== 0; 94 | 95 | if (retry) { 96 | namespace.query(query); 97 | return; 98 | } 99 | 100 | if (err) { 101 | query.on('error', function () {}); 102 | query.end(err); 103 | return; 104 | } 105 | 106 | // Release connection based off event 107 | query.once('end', function() { 108 | conn.release(); 109 | }); 110 | 111 | conn.query(query); 112 | }); 113 | 114 | return query; 115 | }; 116 | 117 | PoolNamespace.prototype._getClusterNode = function _getClusterNode() { 118 | var foundNodeIds = this._cluster._findNodeIds(this._pattern); 119 | var nodeId; 120 | 121 | switch (foundNodeIds.length) { 122 | case 0: 123 | nodeId = null; 124 | break; 125 | case 1: 126 | nodeId = foundNodeIds[0]; 127 | break; 128 | default: 129 | nodeId = this._selector(foundNodeIds); 130 | break; 131 | } 132 | 133 | return nodeId !== null 134 | ? this._cluster._getNode(nodeId) 135 | : null; 136 | }; 137 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/PoolSelector.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * PoolSelector 4 | */ 5 | var PoolSelector = module.exports = {}; 6 | 7 | PoolSelector.RR = function PoolSelectorRoundRobin() { 8 | var index = 0; 9 | 10 | return function(clusterIds) { 11 | if (index >= clusterIds.length) { 12 | index = 0; 13 | } 14 | 15 | var clusterId = clusterIds[index++]; 16 | 17 | return clusterId; 18 | }; 19 | }; 20 | 21 | PoolSelector.RANDOM = function PoolSelectorRandom() { 22 | return function(clusterIds) { 23 | return clusterIds[Math.floor(Math.random() * clusterIds.length)]; 24 | }; 25 | }; 26 | 27 | PoolSelector.ORDER = function PoolSelectorOrder() { 28 | return function(clusterIds) { 29 | return clusterIds[0]; 30 | }; 31 | }; 32 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/Auth.js: -------------------------------------------------------------------------------- 1 | var Buffer = require('safe-buffer').Buffer; 2 | var Crypto = require('crypto'); 3 | var Auth = exports; 4 | 5 | function auth(name, data, options) { 6 | options = options || {}; 7 | 8 | switch (name) { 9 | case 'mysql_native_password': 10 | return Auth.token(options.password, data.slice(0, 20)); 11 | default: 12 | return undefined; 13 | } 14 | } 15 | Auth.auth = auth; 16 | 17 | function sha1(msg) { 18 | var hash = Crypto.createHash('sha1'); 19 | hash.update(msg, 'binary'); 20 | return hash.digest('binary'); 21 | } 22 | Auth.sha1 = sha1; 23 | 24 | function xor(a, b) { 25 | a = Buffer.from(a, 'binary'); 26 | b = Buffer.from(b, 'binary'); 27 | var result = Buffer.allocUnsafe(a.length); 28 | for (var i = 0; i < a.length; i++) { 29 | result[i] = (a[i] ^ b[i]); 30 | } 31 | return result; 32 | } 33 | Auth.xor = xor; 34 | 35 | Auth.token = function(password, scramble) { 36 | if (!password) { 37 | return Buffer.alloc(0); 38 | } 39 | 40 | // password must be in binary format, not utf8 41 | var stage1 = sha1((Buffer.from(password, 'utf8')).toString('binary')); 42 | var stage2 = sha1(stage1); 43 | var stage3 = sha1(scramble.toString('binary') + stage2); 44 | return xor(stage3, stage1); 45 | }; 46 | 47 | // This is a port of sql/password.c:hash_password which needs to be used for 48 | // pre-4.1 passwords. 49 | Auth.hashPassword = function(password) { 50 | var nr = [0x5030, 0x5735]; 51 | var add = 7; 52 | var nr2 = [0x1234, 0x5671]; 53 | var result = Buffer.alloc(8); 54 | 55 | if (typeof password === 'string'){ 56 | password = Buffer.from(password); 57 | } 58 | 59 | for (var i = 0; i < password.length; i++) { 60 | var c = password[i]; 61 | if (c === 32 || c === 9) { 62 | // skip space in password 63 | continue; 64 | } 65 | 66 | // nr^= (((nr & 63)+add)*c)+ (nr << 8); 67 | // nr = xor(nr, add(mul(add(and(nr, 63), add), c), shl(nr, 8))) 68 | nr = this.xor32(nr, this.add32(this.mul32(this.add32(this.and32(nr, [0, 63]), [0, add]), [0, c]), this.shl32(nr, 8))); 69 | 70 | // nr2+=(nr2 << 8) ^ nr; 71 | // nr2 = add(nr2, xor(shl(nr2, 8), nr)) 72 | nr2 = this.add32(nr2, this.xor32(this.shl32(nr2, 8), nr)); 73 | 74 | // add+=tmp; 75 | add += c; 76 | } 77 | 78 | this.int31Write(result, nr, 0); 79 | this.int31Write(result, nr2, 4); 80 | 81 | return result; 82 | }; 83 | 84 | Auth.randomInit = function(seed1, seed2) { 85 | return { 86 | max_value : 0x3FFFFFFF, 87 | max_value_dbl : 0x3FFFFFFF, 88 | seed1 : seed1 % 0x3FFFFFFF, 89 | seed2 : seed2 % 0x3FFFFFFF 90 | }; 91 | }; 92 | 93 | Auth.myRnd = function(r){ 94 | r.seed1 = (r.seed1 * 3 + r.seed2) % r.max_value; 95 | r.seed2 = (r.seed1 + r.seed2 + 33) % r.max_value; 96 | 97 | return r.seed1 / r.max_value_dbl; 98 | }; 99 | 100 | Auth.scramble323 = function(message, password) { 101 | if (!password) { 102 | return Buffer.alloc(0); 103 | } 104 | 105 | var to = Buffer.allocUnsafe(8); 106 | var hashPass = this.hashPassword(password); 107 | var hashMessage = this.hashPassword(message.slice(0, 8)); 108 | var seed1 = this.int32Read(hashPass, 0) ^ this.int32Read(hashMessage, 0); 109 | var seed2 = this.int32Read(hashPass, 4) ^ this.int32Read(hashMessage, 4); 110 | var r = this.randomInit(seed1, seed2); 111 | 112 | for (var i = 0; i < 8; i++){ 113 | to[i] = Math.floor(this.myRnd(r) * 31) + 64; 114 | } 115 | var extra = (Math.floor(this.myRnd(r) * 31)); 116 | 117 | for (var i = 0; i < 8; i++){ 118 | to[i] ^= extra; 119 | } 120 | 121 | return to; 122 | }; 123 | 124 | Auth.xor32 = function(a, b){ 125 | return [a[0] ^ b[0], a[1] ^ b[1]]; 126 | }; 127 | 128 | Auth.add32 = function(a, b){ 129 | var w1 = a[1] + b[1]; 130 | var w2 = a[0] + b[0] + ((w1 & 0xFFFF0000) >> 16); 131 | 132 | return [w2 & 0xFFFF, w1 & 0xFFFF]; 133 | }; 134 | 135 | Auth.mul32 = function(a, b){ 136 | // based on this example of multiplying 32b ints using 16b 137 | // http://www.dsprelated.com/showmessage/89790/1.php 138 | var w1 = a[1] * b[1]; 139 | var w2 = (((a[1] * b[1]) >> 16) & 0xFFFF) + ((a[0] * b[1]) & 0xFFFF) + (a[1] * b[0] & 0xFFFF); 140 | 141 | return [w2 & 0xFFFF, w1 & 0xFFFF]; 142 | }; 143 | 144 | Auth.and32 = function(a, b){ 145 | return [a[0] & b[0], a[1] & b[1]]; 146 | }; 147 | 148 | Auth.shl32 = function(a, b){ 149 | // assume b is 16 or less 150 | var w1 = a[1] << b; 151 | var w2 = (a[0] << b) | ((w1 & 0xFFFF0000) >> 16); 152 | 153 | return [w2 & 0xFFFF, w1 & 0xFFFF]; 154 | }; 155 | 156 | Auth.int31Write = function(buffer, number, offset) { 157 | buffer[offset] = (number[0] >> 8) & 0x7F; 158 | buffer[offset + 1] = (number[0]) & 0xFF; 159 | buffer[offset + 2] = (number[1] >> 8) & 0xFF; 160 | buffer[offset + 3] = (number[1]) & 0xFF; 161 | }; 162 | 163 | Auth.int32Read = function(buffer, offset){ 164 | return (buffer[offset] << 24) 165 | + (buffer[offset + 1] << 16) 166 | + (buffer[offset + 2] << 8) 167 | + (buffer[offset + 3]); 168 | }; 169 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/BufferList.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = BufferList; 3 | function BufferList() { 4 | this.bufs = []; 5 | this.size = 0; 6 | } 7 | 8 | BufferList.prototype.shift = function shift() { 9 | var buf = this.bufs.shift(); 10 | 11 | if (buf) { 12 | this.size -= buf.length; 13 | } 14 | 15 | return buf; 16 | }; 17 | 18 | BufferList.prototype.push = function push(buf) { 19 | if (!buf || !buf.length) { 20 | return; 21 | } 22 | 23 | this.bufs.push(buf); 24 | this.size += buf.length; 25 | }; 26 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/PacketHeader.js: -------------------------------------------------------------------------------- 1 | module.exports = PacketHeader; 2 | function PacketHeader(length, number) { 3 | this.length = length; 4 | this.number = number; 5 | } 6 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/PacketWriter.js: -------------------------------------------------------------------------------- 1 | var BIT_16 = Math.pow(2, 16); 2 | var BIT_24 = Math.pow(2, 24); 3 | var BUFFER_ALLOC_SIZE = Math.pow(2, 8); 4 | // The maximum precision JS Numbers can hold precisely 5 | // Don't panic: Good enough to represent byte values up to 8192 TB 6 | var IEEE_754_BINARY_64_PRECISION = Math.pow(2, 53); 7 | var MAX_PACKET_LENGTH = Math.pow(2, 24) - 1; 8 | var Buffer = require('safe-buffer').Buffer; 9 | 10 | module.exports = PacketWriter; 11 | function PacketWriter() { 12 | this._buffer = null; 13 | this._offset = 0; 14 | } 15 | 16 | PacketWriter.prototype.toBuffer = function toBuffer(parser) { 17 | if (!this._buffer) { 18 | this._buffer = Buffer.alloc(0); 19 | this._offset = 0; 20 | } 21 | 22 | var buffer = this._buffer; 23 | var length = this._offset; 24 | var packets = Math.floor(length / MAX_PACKET_LENGTH) + 1; 25 | 26 | this._buffer = Buffer.allocUnsafe(length + packets * 4); 27 | this._offset = 0; 28 | 29 | for (var packet = 0; packet < packets; packet++) { 30 | var isLast = (packet + 1 === packets); 31 | var packetLength = (isLast) 32 | ? length % MAX_PACKET_LENGTH 33 | : MAX_PACKET_LENGTH; 34 | 35 | var packetNumber = parser.incrementPacketNumber(); 36 | 37 | this.writeUnsignedNumber(3, packetLength); 38 | this.writeUnsignedNumber(1, packetNumber); 39 | 40 | var start = packet * MAX_PACKET_LENGTH; 41 | var end = start + packetLength; 42 | 43 | this.writeBuffer(buffer.slice(start, end)); 44 | } 45 | 46 | return this._buffer; 47 | }; 48 | 49 | PacketWriter.prototype.writeUnsignedNumber = function(bytes, value) { 50 | this._allocate(bytes); 51 | 52 | for (var i = 0; i < bytes; i++) { 53 | this._buffer[this._offset++] = (value >> (i * 8)) & 0xff; 54 | } 55 | }; 56 | 57 | PacketWriter.prototype.writeFiller = function(bytes) { 58 | this._allocate(bytes); 59 | 60 | for (var i = 0; i < bytes; i++) { 61 | this._buffer[this._offset++] = 0x00; 62 | } 63 | }; 64 | 65 | PacketWriter.prototype.writeNullTerminatedString = function(value, encoding) { 66 | // Typecast undefined into '' and numbers into strings 67 | value = value || ''; 68 | value = value + ''; 69 | 70 | var bytes = Buffer.byteLength(value, encoding || 'utf-8') + 1; 71 | this._allocate(bytes); 72 | 73 | this._buffer.write(value, this._offset, encoding); 74 | this._buffer[this._offset + bytes - 1] = 0x00; 75 | 76 | this._offset += bytes; 77 | }; 78 | 79 | PacketWriter.prototype.writeString = function(value) { 80 | // Typecast undefined into '' and numbers into strings 81 | value = value || ''; 82 | value = value + ''; 83 | 84 | var bytes = Buffer.byteLength(value, 'utf-8'); 85 | this._allocate(bytes); 86 | 87 | this._buffer.write(value, this._offset, 'utf-8'); 88 | 89 | this._offset += bytes; 90 | }; 91 | 92 | PacketWriter.prototype.writeBuffer = function(value) { 93 | var bytes = value.length; 94 | 95 | this._allocate(bytes); 96 | value.copy(this._buffer, this._offset); 97 | this._offset += bytes; 98 | }; 99 | 100 | PacketWriter.prototype.writeLengthCodedNumber = function(value) { 101 | if (value === null) { 102 | this._allocate(1); 103 | this._buffer[this._offset++] = 251; 104 | return; 105 | } 106 | 107 | if (value <= 250) { 108 | this._allocate(1); 109 | this._buffer[this._offset++] = value; 110 | return; 111 | } 112 | 113 | if (value > IEEE_754_BINARY_64_PRECISION) { 114 | throw new Error( 115 | 'writeLengthCodedNumber: JS precision range exceeded, your ' + 116 | 'number is > 53 bit: "' + value + '"' 117 | ); 118 | } 119 | 120 | if (value < BIT_16) { 121 | this._allocate(3); 122 | this._buffer[this._offset++] = 252; 123 | } else if (value < BIT_24) { 124 | this._allocate(4); 125 | this._buffer[this._offset++] = 253; 126 | } else { 127 | this._allocate(9); 128 | this._buffer[this._offset++] = 254; 129 | } 130 | 131 | // 16 Bit 132 | this._buffer[this._offset++] = value & 0xff; 133 | this._buffer[this._offset++] = (value >> 8) & 0xff; 134 | 135 | if (value < BIT_16) { 136 | return; 137 | } 138 | 139 | // 24 Bit 140 | this._buffer[this._offset++] = (value >> 16) & 0xff; 141 | 142 | if (value < BIT_24) { 143 | return; 144 | } 145 | 146 | this._buffer[this._offset++] = (value >> 24) & 0xff; 147 | 148 | // Hack: Get the most significant 32 bit (JS bitwise operators are 32 bit) 149 | value = value.toString(2); 150 | value = value.substr(0, value.length - 32); 151 | value = parseInt(value, 2); 152 | 153 | this._buffer[this._offset++] = value & 0xff; 154 | this._buffer[this._offset++] = (value >> 8) & 0xff; 155 | this._buffer[this._offset++] = (value >> 16) & 0xff; 156 | 157 | // Set last byte to 0, as we can only support 53 bits in JS (see above) 158 | this._buffer[this._offset++] = 0; 159 | }; 160 | 161 | PacketWriter.prototype.writeLengthCodedBuffer = function(value) { 162 | var bytes = value.length; 163 | this.writeLengthCodedNumber(bytes); 164 | this.writeBuffer(value); 165 | }; 166 | 167 | PacketWriter.prototype.writeNullTerminatedBuffer = function(value) { 168 | this.writeBuffer(value); 169 | this.writeFiller(1); // 0x00 terminator 170 | }; 171 | 172 | PacketWriter.prototype.writeLengthCodedString = function(value) { 173 | if (value === null) { 174 | this.writeLengthCodedNumber(null); 175 | return; 176 | } 177 | 178 | value = (value === undefined) 179 | ? '' 180 | : String(value); 181 | 182 | var bytes = Buffer.byteLength(value, 'utf-8'); 183 | this.writeLengthCodedNumber(bytes); 184 | 185 | if (!bytes) { 186 | return; 187 | } 188 | 189 | this._allocate(bytes); 190 | this._buffer.write(value, this._offset, 'utf-8'); 191 | this._offset += bytes; 192 | }; 193 | 194 | PacketWriter.prototype._allocate = function _allocate(bytes) { 195 | if (!this._buffer) { 196 | this._buffer = Buffer.alloc(Math.max(BUFFER_ALLOC_SIZE, bytes)); 197 | this._offset = 0; 198 | return; 199 | } 200 | 201 | var bytesRemaining = this._buffer.length - this._offset; 202 | if (bytesRemaining >= bytes) { 203 | return; 204 | } 205 | 206 | var newSize = this._buffer.length + Math.max(BUFFER_ALLOC_SIZE, bytes); 207 | var oldBuffer = this._buffer; 208 | 209 | this._buffer = Buffer.alloc(newSize); 210 | oldBuffer.copy(this._buffer); 211 | }; 212 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/ResultSet.js: -------------------------------------------------------------------------------- 1 | module.exports = ResultSet; 2 | function ResultSet(resultSetHeaderPacket) { 3 | this.resultSetHeaderPacket = resultSetHeaderPacket; 4 | this.fieldPackets = []; 5 | this.eofPackets = []; 6 | this.rows = []; 7 | } 8 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/SqlString.js: -------------------------------------------------------------------------------- 1 | module.exports = require('sqlstring'); 2 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/Timer.js: -------------------------------------------------------------------------------- 1 | var Timers = require('timers'); 2 | 3 | module.exports = Timer; 4 | function Timer(object) { 5 | this._object = object; 6 | this._timeout = null; 7 | } 8 | 9 | Timer.prototype.active = function active() { 10 | if (this._timeout) { 11 | if (this._timeout.refresh) { 12 | this._timeout.refresh(); 13 | } else { 14 | Timers.active(this._timeout); 15 | } 16 | } 17 | }; 18 | 19 | Timer.prototype.start = function start(msecs) { 20 | this.stop(); 21 | this._timeout = Timers.setTimeout(this._onTimeout.bind(this), msecs); 22 | }; 23 | 24 | Timer.prototype.stop = function stop() { 25 | if (this._timeout) { 26 | Timers.clearTimeout(this._timeout); 27 | this._timeout = null; 28 | } 29 | }; 30 | 31 | Timer.prototype._onTimeout = function _onTimeout() { 32 | return this._object._onTimeout(); 33 | }; 34 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/constants/client.js: -------------------------------------------------------------------------------- 1 | // Manually extracted from mysql-5.5.23/include/mysql_com.h 2 | exports.CLIENT_LONG_PASSWORD = 1; /* new more secure passwords */ 3 | exports.CLIENT_FOUND_ROWS = 2; /* Found instead of affected rows */ 4 | exports.CLIENT_LONG_FLAG = 4; /* Get all column flags */ 5 | exports.CLIENT_CONNECT_WITH_DB = 8; /* One can specify db on connect */ 6 | exports.CLIENT_NO_SCHEMA = 16; /* Don't allow database.table.column */ 7 | exports.CLIENT_COMPRESS = 32; /* Can use compression protocol */ 8 | exports.CLIENT_ODBC = 64; /* Odbc client */ 9 | exports.CLIENT_LOCAL_FILES = 128; /* Can use LOAD DATA LOCAL */ 10 | exports.CLIENT_IGNORE_SPACE = 256; /* Ignore spaces before '(' */ 11 | exports.CLIENT_PROTOCOL_41 = 512; /* New 4.1 protocol */ 12 | exports.CLIENT_INTERACTIVE = 1024; /* This is an interactive client */ 13 | exports.CLIENT_SSL = 2048; /* Switch to SSL after handshake */ 14 | exports.CLIENT_IGNORE_SIGPIPE = 4096; /* IGNORE sigpipes */ 15 | exports.CLIENT_TRANSACTIONS = 8192; /* Client knows about transactions */ 16 | exports.CLIENT_RESERVED = 16384; /* Old flag for 4.1 protocol */ 17 | exports.CLIENT_SECURE_CONNECTION = 32768; /* New 4.1 authentication */ 18 | 19 | exports.CLIENT_MULTI_STATEMENTS = 65536; /* Enable/disable multi-stmt support */ 20 | exports.CLIENT_MULTI_RESULTS = 131072; /* Enable/disable multi-results */ 21 | exports.CLIENT_PS_MULTI_RESULTS = 262144; /* Multi-results in PS-protocol */ 22 | 23 | exports.CLIENT_PLUGIN_AUTH = 524288; /* Client supports plugin authentication */ 24 | 25 | exports.CLIENT_SSL_VERIFY_SERVER_CERT = 1073741824; 26 | exports.CLIENT_REMEMBER_OPTIONS = 2147483648; 27 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/constants/field_flags.js: -------------------------------------------------------------------------------- 1 | // Manually extracted from mysql-5.5.23/include/mysql_com.h 2 | exports.NOT_NULL_FLAG = 1; /* Field can't be NULL */ 3 | exports.PRI_KEY_FLAG = 2; /* Field is part of a primary key */ 4 | exports.UNIQUE_KEY_FLAG = 4; /* Field is part of a unique key */ 5 | exports.MULTIPLE_KEY_FLAG = 8; /* Field is part of a key */ 6 | exports.BLOB_FLAG = 16; /* Field is a blob */ 7 | exports.UNSIGNED_FLAG = 32; /* Field is unsigned */ 8 | exports.ZEROFILL_FLAG = 64; /* Field is zerofill */ 9 | exports.BINARY_FLAG = 128; /* Field is binary */ 10 | 11 | /* The following are only sent to new clients */ 12 | exports.ENUM_FLAG = 256; /* field is an enum */ 13 | exports.AUTO_INCREMENT_FLAG = 512; /* field is a autoincrement field */ 14 | exports.TIMESTAMP_FLAG = 1024; /* Field is a timestamp */ 15 | exports.SET_FLAG = 2048; /* field is a set */ 16 | exports.NO_DEFAULT_VALUE_FLAG = 4096; /* Field doesn't have default value */ 17 | exports.ON_UPDATE_NOW_FLAG = 8192; /* Field is set to NOW on UPDATE */ 18 | exports.NUM_FLAG = 32768; /* Field is num (for clients) */ 19 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/constants/server_status.js: -------------------------------------------------------------------------------- 1 | // Manually extracted from mysql-5.5.23/include/mysql_com.h 2 | 3 | /** 4 | Is raised when a multi-statement transaction 5 | has been started, either explicitly, by means 6 | of BEGIN or COMMIT AND CHAIN, or 7 | implicitly, by the first transactional 8 | statement, when autocommit=off. 9 | */ 10 | exports.SERVER_STATUS_IN_TRANS = 1; 11 | exports.SERVER_STATUS_AUTOCOMMIT = 2; /* Server in auto_commit mode */ 12 | exports.SERVER_MORE_RESULTS_EXISTS = 8; /* Multi query - next query exists */ 13 | exports.SERVER_QUERY_NO_GOOD_INDEX_USED = 16; 14 | exports.SERVER_QUERY_NO_INDEX_USED = 32; 15 | /** 16 | The server was able to fulfill the clients request and opened a 17 | read-only non-scrollable cursor for a query. This flag comes 18 | in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands. 19 | */ 20 | exports.SERVER_STATUS_CURSOR_EXISTS = 64; 21 | /** 22 | This flag is sent when a read-only cursor is exhausted, in reply to 23 | COM_STMT_FETCH command. 24 | */ 25 | exports.SERVER_STATUS_LAST_ROW_SENT = 128; 26 | exports.SERVER_STATUS_DB_DROPPED = 256; /* A database was dropped */ 27 | exports.SERVER_STATUS_NO_BACKSLASH_ESCAPES = 512; 28 | /** 29 | Sent to the client if after a prepared statement reprepare 30 | we discovered that the new statement returns a different 31 | number of result set columns. 32 | */ 33 | exports.SERVER_STATUS_METADATA_CHANGED = 1024; 34 | exports.SERVER_QUERY_WAS_SLOW = 2048; 35 | 36 | /** 37 | To mark ResultSet containing output parameter values. 38 | */ 39 | exports.SERVER_PS_OUT_PARAMS = 4096; 40 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/constants/types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * MySQL type constants 3 | * 4 | * Extracted from version 5.7.19 5 | * 6 | * !! Generated by generate-type-constants.js, do not modify by hand !! 7 | */ 8 | 9 | exports.DECIMAL = 0; 10 | exports.TINY = 1; 11 | exports.SHORT = 2; 12 | exports.LONG = 3; 13 | exports.FLOAT = 4; 14 | exports.DOUBLE = 5; 15 | exports.NULL = 6; 16 | exports.TIMESTAMP = 7; 17 | exports.LONGLONG = 8; 18 | exports.INT24 = 9; 19 | exports.DATE = 10; 20 | exports.TIME = 11; 21 | exports.DATETIME = 12; 22 | exports.YEAR = 13; 23 | exports.NEWDATE = 14; 24 | exports.VARCHAR = 15; 25 | exports.BIT = 16; 26 | exports.TIMESTAMP2 = 17; 27 | exports.DATETIME2 = 18; 28 | exports.TIME2 = 19; 29 | exports.JSON = 245; 30 | exports.NEWDECIMAL = 246; 31 | exports.ENUM = 247; 32 | exports.SET = 248; 33 | exports.TINY_BLOB = 249; 34 | exports.MEDIUM_BLOB = 250; 35 | exports.LONG_BLOB = 251; 36 | exports.BLOB = 252; 37 | exports.VAR_STRING = 253; 38 | exports.STRING = 254; 39 | exports.GEOMETRY = 255; 40 | 41 | // Lookup-by-number table 42 | exports[0] = 'DECIMAL'; 43 | exports[1] = 'TINY'; 44 | exports[2] = 'SHORT'; 45 | exports[3] = 'LONG'; 46 | exports[4] = 'FLOAT'; 47 | exports[5] = 'DOUBLE'; 48 | exports[6] = 'NULL'; 49 | exports[7] = 'TIMESTAMP'; 50 | exports[8] = 'LONGLONG'; 51 | exports[9] = 'INT24'; 52 | exports[10] = 'DATE'; 53 | exports[11] = 'TIME'; 54 | exports[12] = 'DATETIME'; 55 | exports[13] = 'YEAR'; 56 | exports[14] = 'NEWDATE'; 57 | exports[15] = 'VARCHAR'; 58 | exports[16] = 'BIT'; 59 | exports[17] = 'TIMESTAMP2'; 60 | exports[18] = 'DATETIME2'; 61 | exports[19] = 'TIME2'; 62 | exports[245] = 'JSON'; 63 | exports[246] = 'NEWDECIMAL'; 64 | exports[247] = 'ENUM'; 65 | exports[248] = 'SET'; 66 | exports[249] = 'TINY_BLOB'; 67 | exports[250] = 'MEDIUM_BLOB'; 68 | exports[251] = 'LONG_BLOB'; 69 | exports[252] = 'BLOB'; 70 | exports[253] = 'VAR_STRING'; 71 | exports[254] = 'STRING'; 72 | exports[255] = 'GEOMETRY'; 73 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/AuthSwitchRequestPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = AuthSwitchRequestPacket; 2 | function AuthSwitchRequestPacket(options) { 3 | options = options || {}; 4 | 5 | this.status = 0xfe; 6 | this.authMethodName = options.authMethodName; 7 | this.authMethodData = options.authMethodData; 8 | } 9 | 10 | AuthSwitchRequestPacket.prototype.parse = function parse(parser) { 11 | this.status = parser.parseUnsignedNumber(1); 12 | this.authMethodName = parser.parseNullTerminatedString(); 13 | this.authMethodData = parser.parsePacketTerminatedBuffer(); 14 | }; 15 | 16 | AuthSwitchRequestPacket.prototype.write = function write(writer) { 17 | writer.writeUnsignedNumber(1, this.status); 18 | writer.writeNullTerminatedString(this.authMethodName); 19 | writer.writeBuffer(this.authMethodData); 20 | }; 21 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/AuthSwitchResponsePacket.js: -------------------------------------------------------------------------------- 1 | module.exports = AuthSwitchResponsePacket; 2 | function AuthSwitchResponsePacket(options) { 3 | options = options || {}; 4 | 5 | this.data = options.data; 6 | } 7 | 8 | AuthSwitchResponsePacket.prototype.parse = function parse(parser) { 9 | this.data = parser.parsePacketTerminatedBuffer(); 10 | }; 11 | 12 | AuthSwitchResponsePacket.prototype.write = function write(writer) { 13 | writer.writeBuffer(this.data); 14 | }; 15 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ClientAuthenticationPacket.js: -------------------------------------------------------------------------------- 1 | var Buffer = require('safe-buffer').Buffer; 2 | 3 | module.exports = ClientAuthenticationPacket; 4 | function ClientAuthenticationPacket(options) { 5 | options = options || {}; 6 | 7 | this.clientFlags = options.clientFlags; 8 | this.maxPacketSize = options.maxPacketSize; 9 | this.charsetNumber = options.charsetNumber; 10 | this.filler = undefined; 11 | this.user = options.user; 12 | this.scrambleBuff = options.scrambleBuff; 13 | this.database = options.database; 14 | this.protocol41 = options.protocol41; 15 | } 16 | 17 | ClientAuthenticationPacket.prototype.parse = function(parser) { 18 | if (this.protocol41) { 19 | this.clientFlags = parser.parseUnsignedNumber(4); 20 | this.maxPacketSize = parser.parseUnsignedNumber(4); 21 | this.charsetNumber = parser.parseUnsignedNumber(1); 22 | this.filler = parser.parseFiller(23); 23 | this.user = parser.parseNullTerminatedString(); 24 | this.scrambleBuff = parser.parseLengthCodedBuffer(); 25 | this.database = parser.parseNullTerminatedString(); 26 | } else { 27 | this.clientFlags = parser.parseUnsignedNumber(2); 28 | this.maxPacketSize = parser.parseUnsignedNumber(3); 29 | this.user = parser.parseNullTerminatedString(); 30 | this.scrambleBuff = parser.parseBuffer(8); 31 | this.database = parser.parseLengthCodedBuffer(); 32 | } 33 | }; 34 | 35 | ClientAuthenticationPacket.prototype.write = function(writer) { 36 | if (this.protocol41) { 37 | writer.writeUnsignedNumber(4, this.clientFlags); 38 | writer.writeUnsignedNumber(4, this.maxPacketSize); 39 | writer.writeUnsignedNumber(1, this.charsetNumber); 40 | writer.writeFiller(23); 41 | writer.writeNullTerminatedString(this.user); 42 | writer.writeLengthCodedBuffer(this.scrambleBuff); 43 | writer.writeNullTerminatedString(this.database); 44 | } else { 45 | writer.writeUnsignedNumber(2, this.clientFlags); 46 | writer.writeUnsignedNumber(3, this.maxPacketSize); 47 | writer.writeNullTerminatedString(this.user); 48 | writer.writeBuffer(this.scrambleBuff); 49 | if (this.database && this.database.length) { 50 | writer.writeFiller(1); 51 | writer.writeBuffer(Buffer.from(this.database)); 52 | } 53 | } 54 | }; 55 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ComChangeUserPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = ComChangeUserPacket; 2 | function ComChangeUserPacket(options) { 3 | options = options || {}; 4 | 5 | this.command = 0x11; 6 | this.user = options.user; 7 | this.scrambleBuff = options.scrambleBuff; 8 | this.database = options.database; 9 | this.charsetNumber = options.charsetNumber; 10 | } 11 | 12 | ComChangeUserPacket.prototype.parse = function(parser) { 13 | this.command = parser.parseUnsignedNumber(1); 14 | this.user = parser.parseNullTerminatedString(); 15 | this.scrambleBuff = parser.parseLengthCodedBuffer(); 16 | this.database = parser.parseNullTerminatedString(); 17 | this.charsetNumber = parser.parseUnsignedNumber(1); 18 | }; 19 | 20 | ComChangeUserPacket.prototype.write = function(writer) { 21 | writer.writeUnsignedNumber(1, this.command); 22 | writer.writeNullTerminatedString(this.user); 23 | writer.writeLengthCodedBuffer(this.scrambleBuff); 24 | writer.writeNullTerminatedString(this.database); 25 | writer.writeUnsignedNumber(2, this.charsetNumber); 26 | }; 27 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ComPingPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = ComPingPacket; 2 | function ComPingPacket() { 3 | this.command = 0x0e; 4 | } 5 | 6 | ComPingPacket.prototype.write = function(writer) { 7 | writer.writeUnsignedNumber(1, this.command); 8 | }; 9 | 10 | ComPingPacket.prototype.parse = function(parser) { 11 | this.command = parser.parseUnsignedNumber(1); 12 | }; 13 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ComQueryPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = ComQueryPacket; 2 | function ComQueryPacket(sql) { 3 | this.command = 0x03; 4 | this.sql = sql; 5 | } 6 | 7 | ComQueryPacket.prototype.write = function(writer) { 8 | writer.writeUnsignedNumber(1, this.command); 9 | writer.writeString(this.sql); 10 | }; 11 | 12 | ComQueryPacket.prototype.parse = function(parser) { 13 | this.command = parser.parseUnsignedNumber(1); 14 | this.sql = parser.parsePacketTerminatedString(); 15 | }; 16 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ComQuitPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = ComQuitPacket; 2 | function ComQuitPacket() { 3 | this.command = 0x01; 4 | } 5 | 6 | ComQuitPacket.prototype.parse = function parse(parser) { 7 | this.command = parser.parseUnsignedNumber(1); 8 | }; 9 | 10 | ComQuitPacket.prototype.write = function write(writer) { 11 | writer.writeUnsignedNumber(1, this.command); 12 | }; 13 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ComStatisticsPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = ComStatisticsPacket; 2 | function ComStatisticsPacket() { 3 | this.command = 0x09; 4 | } 5 | 6 | ComStatisticsPacket.prototype.write = function(writer) { 7 | writer.writeUnsignedNumber(1, this.command); 8 | }; 9 | 10 | ComStatisticsPacket.prototype.parse = function(parser) { 11 | this.command = parser.parseUnsignedNumber(1); 12 | }; 13 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/EmptyPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = EmptyPacket; 2 | function EmptyPacket() { 3 | } 4 | 5 | EmptyPacket.prototype.write = function write() { 6 | }; 7 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/EofPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = EofPacket; 2 | function EofPacket(options) { 3 | options = options || {}; 4 | 5 | this.fieldCount = undefined; 6 | this.warningCount = options.warningCount; 7 | this.serverStatus = options.serverStatus; 8 | this.protocol41 = options.protocol41; 9 | } 10 | 11 | EofPacket.prototype.parse = function(parser) { 12 | this.fieldCount = parser.parseUnsignedNumber(1); 13 | if (this.protocol41) { 14 | this.warningCount = parser.parseUnsignedNumber(2); 15 | this.serverStatus = parser.parseUnsignedNumber(2); 16 | } 17 | }; 18 | 19 | EofPacket.prototype.write = function(writer) { 20 | writer.writeUnsignedNumber(1, 0xfe); 21 | if (this.protocol41) { 22 | writer.writeUnsignedNumber(2, this.warningCount); 23 | writer.writeUnsignedNumber(2, this.serverStatus); 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ErrorPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = ErrorPacket; 2 | function ErrorPacket(options) { 3 | options = options || {}; 4 | 5 | this.fieldCount = options.fieldCount; 6 | this.errno = options.errno; 7 | this.sqlStateMarker = options.sqlStateMarker; 8 | this.sqlState = options.sqlState; 9 | this.message = options.message; 10 | } 11 | 12 | ErrorPacket.prototype.parse = function(parser) { 13 | this.fieldCount = parser.parseUnsignedNumber(1); 14 | this.errno = parser.parseUnsignedNumber(2); 15 | 16 | // sqlStateMarker ('#' = 0x23) indicates error packet format 17 | if (parser.peak() === 0x23) { 18 | this.sqlStateMarker = parser.parseString(1); 19 | this.sqlState = parser.parseString(5); 20 | } 21 | 22 | this.message = parser.parsePacketTerminatedString(); 23 | }; 24 | 25 | ErrorPacket.prototype.write = function(writer) { 26 | writer.writeUnsignedNumber(1, 0xff); 27 | writer.writeUnsignedNumber(2, this.errno); 28 | 29 | if (this.sqlStateMarker) { 30 | writer.writeString(this.sqlStateMarker); 31 | writer.writeString(this.sqlState); 32 | } 33 | 34 | writer.writeString(this.message); 35 | }; 36 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/Field.js: -------------------------------------------------------------------------------- 1 | var Types = require('../constants/types'); 2 | 3 | module.exports = Field; 4 | function Field(options) { 5 | options = options || {}; 6 | 7 | this.parser = options.parser; 8 | this.packet = options.packet; 9 | this.db = options.packet.db; 10 | this.table = options.packet.table; 11 | this.name = options.packet.name; 12 | this.type = Types[options.packet.type]; 13 | this.length = options.packet.length; 14 | } 15 | 16 | Field.prototype.string = function () { 17 | return this.parser.parseLengthCodedString(); 18 | }; 19 | 20 | Field.prototype.buffer = function () { 21 | return this.parser.parseLengthCodedBuffer(); 22 | }; 23 | 24 | Field.prototype.geometry = function () { 25 | return this.parser.parseGeometryValue(); 26 | }; 27 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/FieldPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = FieldPacket; 2 | function FieldPacket(options) { 3 | options = options || {}; 4 | 5 | this.catalog = options.catalog; 6 | this.db = options.db; 7 | this.table = options.table; 8 | this.orgTable = options.orgTable; 9 | this.name = options.name; 10 | this.orgName = options.orgName; 11 | this.charsetNr = options.charsetNr; 12 | this.length = options.length; 13 | this.type = options.type; 14 | this.flags = options.flags; 15 | this.decimals = options.decimals; 16 | this.default = options.default; 17 | this.zeroFill = options.zeroFill; 18 | this.protocol41 = options.protocol41; 19 | } 20 | 21 | FieldPacket.prototype.parse = function(parser) { 22 | if (this.protocol41) { 23 | this.catalog = parser.parseLengthCodedString(); 24 | this.db = parser.parseLengthCodedString(); 25 | this.table = parser.parseLengthCodedString(); 26 | this.orgTable = parser.parseLengthCodedString(); 27 | this.name = parser.parseLengthCodedString(); 28 | this.orgName = parser.parseLengthCodedString(); 29 | 30 | if (parser.parseLengthCodedNumber() !== 0x0c) { 31 | var err = new TypeError('Received invalid field length'); 32 | err.code = 'PARSER_INVALID_FIELD_LENGTH'; 33 | throw err; 34 | } 35 | 36 | this.charsetNr = parser.parseUnsignedNumber(2); 37 | this.length = parser.parseUnsignedNumber(4); 38 | this.type = parser.parseUnsignedNumber(1); 39 | this.flags = parser.parseUnsignedNumber(2); 40 | this.decimals = parser.parseUnsignedNumber(1); 41 | 42 | var filler = parser.parseBuffer(2); 43 | if (filler[0] !== 0x0 || filler[1] !== 0x0) { 44 | var err = new TypeError('Received invalid filler'); 45 | err.code = 'PARSER_INVALID_FILLER'; 46 | throw err; 47 | } 48 | 49 | // parsed flags 50 | this.zeroFill = (this.flags & 0x0040 ? true : false); 51 | 52 | if (parser.reachedPacketEnd()) { 53 | return; 54 | } 55 | 56 | this.default = parser.parseLengthCodedString(); 57 | } else { 58 | this.table = parser.parseLengthCodedString(); 59 | this.name = parser.parseLengthCodedString(); 60 | this.length = parser.parseUnsignedNumber(parser.parseUnsignedNumber(1)); 61 | this.type = parser.parseUnsignedNumber(parser.parseUnsignedNumber(1)); 62 | } 63 | }; 64 | 65 | FieldPacket.prototype.write = function(writer) { 66 | if (this.protocol41) { 67 | writer.writeLengthCodedString(this.catalog); 68 | writer.writeLengthCodedString(this.db); 69 | writer.writeLengthCodedString(this.table); 70 | writer.writeLengthCodedString(this.orgTable); 71 | writer.writeLengthCodedString(this.name); 72 | writer.writeLengthCodedString(this.orgName); 73 | 74 | writer.writeLengthCodedNumber(0x0c); 75 | writer.writeUnsignedNumber(2, this.charsetNr || 0); 76 | writer.writeUnsignedNumber(4, this.length || 0); 77 | writer.writeUnsignedNumber(1, this.type || 0); 78 | writer.writeUnsignedNumber(2, this.flags || 0); 79 | writer.writeUnsignedNumber(1, this.decimals || 0); 80 | writer.writeFiller(2); 81 | 82 | if (this.default !== undefined) { 83 | writer.writeLengthCodedString(this.default); 84 | } 85 | } else { 86 | writer.writeLengthCodedString(this.table); 87 | writer.writeLengthCodedString(this.name); 88 | writer.writeUnsignedNumber(1, 0x01); 89 | writer.writeUnsignedNumber(1, this.length); 90 | writer.writeUnsignedNumber(1, 0x01); 91 | writer.writeUnsignedNumber(1, this.type); 92 | } 93 | }; 94 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/HandshakeInitializationPacket.js: -------------------------------------------------------------------------------- 1 | var Buffer = require('safe-buffer').Buffer; 2 | var Client = require('../constants/client'); 3 | 4 | module.exports = HandshakeInitializationPacket; 5 | function HandshakeInitializationPacket(options) { 6 | options = options || {}; 7 | 8 | this.protocolVersion = options.protocolVersion; 9 | this.serverVersion = options.serverVersion; 10 | this.threadId = options.threadId; 11 | this.scrambleBuff1 = options.scrambleBuff1; 12 | this.filler1 = options.filler1; 13 | this.serverCapabilities1 = options.serverCapabilities1; 14 | this.serverLanguage = options.serverLanguage; 15 | this.serverStatus = options.serverStatus; 16 | this.serverCapabilities2 = options.serverCapabilities2; 17 | this.scrambleLength = options.scrambleLength; 18 | this.filler2 = options.filler2; 19 | this.scrambleBuff2 = options.scrambleBuff2; 20 | this.filler3 = options.filler3; 21 | this.pluginData = options.pluginData; 22 | this.protocol41 = options.protocol41; 23 | 24 | if (this.protocol41) { 25 | // force set the bit in serverCapabilities1 26 | this.serverCapabilities1 |= Client.CLIENT_PROTOCOL_41; 27 | } 28 | } 29 | 30 | HandshakeInitializationPacket.prototype.parse = function(parser) { 31 | this.protocolVersion = parser.parseUnsignedNumber(1); 32 | this.serverVersion = parser.parseNullTerminatedString(); 33 | this.threadId = parser.parseUnsignedNumber(4); 34 | this.scrambleBuff1 = parser.parseBuffer(8); 35 | this.filler1 = parser.parseFiller(1); 36 | this.serverCapabilities1 = parser.parseUnsignedNumber(2); 37 | this.serverLanguage = parser.parseUnsignedNumber(1); 38 | this.serverStatus = parser.parseUnsignedNumber(2); 39 | 40 | this.protocol41 = (this.serverCapabilities1 & (1 << 9)) > 0; 41 | 42 | if (this.protocol41) { 43 | this.serverCapabilities2 = parser.parseUnsignedNumber(2); 44 | this.scrambleLength = parser.parseUnsignedNumber(1); 45 | this.filler2 = parser.parseFiller(10); 46 | // scrambleBuff2 should be 0x00 terminated, but sphinx does not do this 47 | // so we assume scrambleBuff2 to be 12 byte and treat the next byte as a 48 | // filler byte. 49 | this.scrambleBuff2 = parser.parseBuffer(12); 50 | this.filler3 = parser.parseFiller(1); 51 | } else { 52 | this.filler2 = parser.parseFiller(13); 53 | } 54 | 55 | if (parser.reachedPacketEnd()) { 56 | return; 57 | } 58 | 59 | // According to the docs this should be 0x00 terminated, but MariaDB does 60 | // not do this, so we assume this string to be packet terminated. 61 | this.pluginData = parser.parsePacketTerminatedString(); 62 | 63 | // However, if there is a trailing '\0', strip it 64 | var lastChar = this.pluginData.length - 1; 65 | if (this.pluginData[lastChar] === '\0') { 66 | this.pluginData = this.pluginData.substr(0, lastChar); 67 | } 68 | }; 69 | 70 | HandshakeInitializationPacket.prototype.write = function(writer) { 71 | writer.writeUnsignedNumber(1, this.protocolVersion); 72 | writer.writeNullTerminatedString(this.serverVersion); 73 | writer.writeUnsignedNumber(4, this.threadId); 74 | writer.writeBuffer(this.scrambleBuff1); 75 | writer.writeFiller(1); 76 | writer.writeUnsignedNumber(2, this.serverCapabilities1); 77 | writer.writeUnsignedNumber(1, this.serverLanguage); 78 | writer.writeUnsignedNumber(2, this.serverStatus); 79 | if (this.protocol41) { 80 | writer.writeUnsignedNumber(2, this.serverCapabilities2); 81 | writer.writeUnsignedNumber(1, this.scrambleLength); 82 | writer.writeFiller(10); 83 | } 84 | writer.writeNullTerminatedBuffer(this.scrambleBuff2); 85 | 86 | if (this.pluginData !== undefined) { 87 | writer.writeNullTerminatedString(this.pluginData); 88 | } 89 | }; 90 | 91 | HandshakeInitializationPacket.prototype.scrambleBuff = function() { 92 | var buffer = null; 93 | 94 | if (typeof this.scrambleBuff2 === 'undefined') { 95 | buffer = Buffer.from(this.scrambleBuff1); 96 | } else { 97 | buffer = Buffer.allocUnsafe(this.scrambleBuff1.length + this.scrambleBuff2.length); 98 | this.scrambleBuff1.copy(buffer, 0); 99 | this.scrambleBuff2.copy(buffer, this.scrambleBuff1.length); 100 | } 101 | 102 | return buffer; 103 | }; 104 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/LocalDataFilePacket.js: -------------------------------------------------------------------------------- 1 | module.exports = LocalDataFilePacket; 2 | 3 | /** 4 | * Create a new LocalDataFilePacket 5 | * @constructor 6 | * @param {Buffer} data The data contents of the packet 7 | * @public 8 | */ 9 | function LocalDataFilePacket(data) { 10 | this.data = data; 11 | } 12 | 13 | LocalDataFilePacket.prototype.write = function(writer) { 14 | writer.writeBuffer(this.data); 15 | }; 16 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/OkPacket.js: -------------------------------------------------------------------------------- 1 | 2 | // Language-neutral expression to match ER_UPDATE_INFO 3 | var ER_UPDATE_INFO_REGEXP = /^[^:0-9]+: [0-9]+[^:0-9]+: ([0-9]+)[^:0-9]+: [0-9]+[^:0-9]*$/; 4 | 5 | module.exports = OkPacket; 6 | function OkPacket(options) { 7 | options = options || {}; 8 | 9 | this.fieldCount = undefined; 10 | this.affectedRows = undefined; 11 | this.insertId = undefined; 12 | this.serverStatus = undefined; 13 | this.warningCount = undefined; 14 | this.message = undefined; 15 | this.protocol41 = options.protocol41; 16 | } 17 | 18 | OkPacket.prototype.parse = function(parser) { 19 | this.fieldCount = parser.parseUnsignedNumber(1); 20 | this.affectedRows = parser.parseLengthCodedNumber(); 21 | this.insertId = parser.parseLengthCodedNumber(); 22 | if (this.protocol41) { 23 | this.serverStatus = parser.parseUnsignedNumber(2); 24 | this.warningCount = parser.parseUnsignedNumber(2); 25 | } 26 | this.message = parser.parsePacketTerminatedString(); 27 | this.changedRows = 0; 28 | 29 | var m = ER_UPDATE_INFO_REGEXP.exec(this.message); 30 | if (m !== null) { 31 | this.changedRows = parseInt(m[1], 10); 32 | } 33 | }; 34 | 35 | OkPacket.prototype.write = function(writer) { 36 | writer.writeUnsignedNumber(1, 0x00); 37 | writer.writeLengthCodedNumber(this.affectedRows || 0); 38 | writer.writeLengthCodedNumber(this.insertId || 0); 39 | if (this.protocol41) { 40 | writer.writeUnsignedNumber(2, this.serverStatus || 0); 41 | writer.writeUnsignedNumber(2, this.warningCount || 0); 42 | } 43 | writer.writeString(this.message); 44 | }; 45 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/OldPasswordPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = OldPasswordPacket; 2 | function OldPasswordPacket(options) { 3 | options = options || {}; 4 | 5 | this.scrambleBuff = options.scrambleBuff; 6 | } 7 | 8 | OldPasswordPacket.prototype.parse = function(parser) { 9 | this.scrambleBuff = parser.parsePacketTerminatedBuffer(); 10 | }; 11 | 12 | OldPasswordPacket.prototype.write = function(writer) { 13 | writer.writeBuffer(this.scrambleBuff); 14 | }; 15 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/ResultSetHeaderPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = ResultSetHeaderPacket; 2 | function ResultSetHeaderPacket(options) { 3 | options = options || {}; 4 | 5 | this.fieldCount = options.fieldCount; 6 | this.extra = options.extra; 7 | } 8 | 9 | ResultSetHeaderPacket.prototype.parse = function(parser) { 10 | this.fieldCount = parser.parseLengthCodedNumber(); 11 | 12 | if (parser.reachedPacketEnd()) return; 13 | 14 | this.extra = (this.fieldCount === null) 15 | ? parser.parsePacketTerminatedString() 16 | : parser.parseLengthCodedNumber(); 17 | }; 18 | 19 | ResultSetHeaderPacket.prototype.write = function(writer) { 20 | writer.writeLengthCodedNumber(this.fieldCount); 21 | 22 | if (this.extra !== undefined) { 23 | writer.writeLengthCodedNumber(this.extra); 24 | } 25 | }; 26 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/RowDataPacket.js: -------------------------------------------------------------------------------- 1 | var Types = require('../constants/types'); 2 | var Charsets = require('../constants/charsets'); 3 | var Field = require('./Field'); 4 | var IEEE_754_BINARY_64_PRECISION = Math.pow(2, 53); 5 | 6 | module.exports = RowDataPacket; 7 | function RowDataPacket() { 8 | } 9 | 10 | Object.defineProperty(RowDataPacket.prototype, 'parse', { 11 | configurable : true, 12 | enumerable : false, 13 | value : parse 14 | }); 15 | 16 | Object.defineProperty(RowDataPacket.prototype, '_typeCast', { 17 | configurable : true, 18 | enumerable : false, 19 | value : typeCast 20 | }); 21 | 22 | function parse(parser, fieldPackets, typeCast, nestTables, connection) { 23 | var self = this; 24 | var next = function () { 25 | return self._typeCast(fieldPacket, parser, connection.config.timezone, connection.config.supportBigNumbers, connection.config.bigNumberStrings, connection.config.dateStrings); 26 | }; 27 | 28 | for (var i = 0; i < fieldPackets.length; i++) { 29 | var fieldPacket = fieldPackets[i]; 30 | var value; 31 | 32 | if (typeof typeCast === 'function') { 33 | value = typeCast.apply(connection, [ new Field({ packet: fieldPacket, parser: parser }), next ]); 34 | } else { 35 | value = (typeCast) 36 | ? this._typeCast(fieldPacket, parser, connection.config.timezone, connection.config.supportBigNumbers, connection.config.bigNumberStrings, connection.config.dateStrings) 37 | : ( (fieldPacket.charsetNr === Charsets.BINARY) 38 | ? parser.parseLengthCodedBuffer() 39 | : parser.parseLengthCodedString() ); 40 | } 41 | 42 | if (typeof nestTables === 'string' && nestTables.length) { 43 | this[fieldPacket.table + nestTables + fieldPacket.name] = value; 44 | } else if (nestTables) { 45 | this[fieldPacket.table] = this[fieldPacket.table] || {}; 46 | this[fieldPacket.table][fieldPacket.name] = value; 47 | } else { 48 | this[fieldPacket.name] = value; 49 | } 50 | } 51 | } 52 | 53 | function typeCast(field, parser, timeZone, supportBigNumbers, bigNumberStrings, dateStrings) { 54 | var numberString; 55 | 56 | switch (field.type) { 57 | case Types.TIMESTAMP: 58 | case Types.TIMESTAMP2: 59 | case Types.DATE: 60 | case Types.DATETIME: 61 | case Types.DATETIME2: 62 | case Types.NEWDATE: 63 | var dateString = parser.parseLengthCodedString(); 64 | 65 | if (typeMatch(field.type, dateStrings)) { 66 | return dateString; 67 | } 68 | 69 | if (dateString === null) { 70 | return null; 71 | } 72 | 73 | var originalString = dateString; 74 | if (field.type === Types.DATE) { 75 | dateString += ' 00:00:00'; 76 | } 77 | 78 | if (timeZone !== 'local') { 79 | dateString += ' ' + timeZone; 80 | } 81 | 82 | var dt = new Date(dateString); 83 | if (isNaN(dt.getTime())) { 84 | return originalString; 85 | } 86 | 87 | return dt; 88 | case Types.TINY: 89 | case Types.SHORT: 90 | case Types.LONG: 91 | case Types.INT24: 92 | case Types.YEAR: 93 | case Types.FLOAT: 94 | case Types.DOUBLE: 95 | numberString = parser.parseLengthCodedString(); 96 | return (numberString === null || (field.zeroFill && numberString[0] === '0')) 97 | ? numberString : Number(numberString); 98 | case Types.NEWDECIMAL: 99 | case Types.LONGLONG: 100 | numberString = parser.parseLengthCodedString(); 101 | return (numberString === null || (field.zeroFill && numberString[0] === '0')) 102 | ? numberString 103 | : ((supportBigNumbers && (bigNumberStrings || (Number(numberString) >= IEEE_754_BINARY_64_PRECISION) || Number(numberString) <= -IEEE_754_BINARY_64_PRECISION)) 104 | ? numberString 105 | : Number(numberString)); 106 | case Types.BIT: 107 | return parser.parseLengthCodedBuffer(); 108 | case Types.STRING: 109 | case Types.VAR_STRING: 110 | case Types.TINY_BLOB: 111 | case Types.MEDIUM_BLOB: 112 | case Types.LONG_BLOB: 113 | case Types.BLOB: 114 | return (field.charsetNr === Charsets.BINARY) 115 | ? parser.parseLengthCodedBuffer() 116 | : parser.parseLengthCodedString(); 117 | case Types.GEOMETRY: 118 | return parser.parseGeometryValue(); 119 | default: 120 | return parser.parseLengthCodedString(); 121 | } 122 | } 123 | 124 | function typeMatch(type, list) { 125 | if (Array.isArray(list)) { 126 | return list.indexOf(Types[type]) !== -1; 127 | } else { 128 | return Boolean(list); 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/SSLRequestPacket.js: -------------------------------------------------------------------------------- 1 | // http://dev.mysql.com/doc/internals/en/ssl.html 2 | // http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest 3 | 4 | var ClientConstants = require('../constants/client'); 5 | 6 | module.exports = SSLRequestPacket; 7 | 8 | function SSLRequestPacket(options) { 9 | options = options || {}; 10 | this.clientFlags = options.clientFlags | ClientConstants.CLIENT_SSL; 11 | this.maxPacketSize = options.maxPacketSize; 12 | this.charsetNumber = options.charsetNumber; 13 | } 14 | 15 | SSLRequestPacket.prototype.parse = function(parser) { 16 | // TODO: check SSLRequest packet v41 vs pre v41 17 | this.clientFlags = parser.parseUnsignedNumber(4); 18 | this.maxPacketSize = parser.parseUnsignedNumber(4); 19 | this.charsetNumber = parser.parseUnsignedNumber(1); 20 | }; 21 | 22 | SSLRequestPacket.prototype.write = function(writer) { 23 | writer.writeUnsignedNumber(4, this.clientFlags); 24 | writer.writeUnsignedNumber(4, this.maxPacketSize); 25 | writer.writeUnsignedNumber(1, this.charsetNumber); 26 | writer.writeFiller(23); 27 | }; 28 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/StatisticsPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = StatisticsPacket; 2 | function StatisticsPacket() { 3 | this.message = undefined; 4 | } 5 | 6 | StatisticsPacket.prototype.parse = function(parser) { 7 | this.message = parser.parsePacketTerminatedString(); 8 | 9 | var items = this.message.split(/\s\s/); 10 | for (var i = 0; i < items.length; i++) { 11 | var m = items[i].match(/^(.+)\:\s+(.+)$/); 12 | if (m !== null) { 13 | this[m[1].toLowerCase().replace(/\s/g, '_')] = Number(m[2]); 14 | } 15 | } 16 | }; 17 | 18 | StatisticsPacket.prototype.write = function(writer) { 19 | writer.writeString(this.message); 20 | }; 21 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/UseOldPasswordPacket.js: -------------------------------------------------------------------------------- 1 | module.exports = UseOldPasswordPacket; 2 | function UseOldPasswordPacket(options) { 3 | options = options || {}; 4 | 5 | this.firstByte = options.firstByte || 0xfe; 6 | } 7 | 8 | UseOldPasswordPacket.prototype.parse = function(parser) { 9 | this.firstByte = parser.parseUnsignedNumber(1); 10 | }; 11 | 12 | UseOldPasswordPacket.prototype.write = function(writer) { 13 | writer.writeUnsignedNumber(1, this.firstByte); 14 | }; 15 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/packets/index.js: -------------------------------------------------------------------------------- 1 | exports.AuthSwitchRequestPacket = require('./AuthSwitchRequestPacket'); 2 | exports.AuthSwitchResponsePacket = require('./AuthSwitchResponsePacket'); 3 | exports.ClientAuthenticationPacket = require('./ClientAuthenticationPacket'); 4 | exports.ComChangeUserPacket = require('./ComChangeUserPacket'); 5 | exports.ComPingPacket = require('./ComPingPacket'); 6 | exports.ComQueryPacket = require('./ComQueryPacket'); 7 | exports.ComQuitPacket = require('./ComQuitPacket'); 8 | exports.ComStatisticsPacket = require('./ComStatisticsPacket'); 9 | exports.EmptyPacket = require('./EmptyPacket'); 10 | exports.EofPacket = require('./EofPacket'); 11 | exports.ErrorPacket = require('./ErrorPacket'); 12 | exports.Field = require('./Field'); 13 | exports.FieldPacket = require('./FieldPacket'); 14 | exports.HandshakeInitializationPacket = require('./HandshakeInitializationPacket'); 15 | exports.LocalDataFilePacket = require('./LocalDataFilePacket'); 16 | exports.OkPacket = require('./OkPacket'); 17 | exports.OldPasswordPacket = require('./OldPasswordPacket'); 18 | exports.ResultSetHeaderPacket = require('./ResultSetHeaderPacket'); 19 | exports.RowDataPacket = require('./RowDataPacket'); 20 | exports.SSLRequestPacket = require('./SSLRequestPacket'); 21 | exports.StatisticsPacket = require('./StatisticsPacket'); 22 | exports.UseOldPasswordPacket = require('./UseOldPasswordPacket'); 23 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/ChangeUser.js: -------------------------------------------------------------------------------- 1 | var Sequence = require('./Sequence'); 2 | var Util = require('util'); 3 | var Packets = require('../packets'); 4 | var Auth = require('../Auth'); 5 | 6 | module.exports = ChangeUser; 7 | Util.inherits(ChangeUser, Sequence); 8 | function ChangeUser(options, callback) { 9 | Sequence.call(this, options, callback); 10 | 11 | this._user = options.user; 12 | this._password = options.password; 13 | this._database = options.database; 14 | this._charsetNumber = options.charsetNumber; 15 | this._currentConfig = options.currentConfig; 16 | } 17 | 18 | ChangeUser.prototype.determinePacket = function determinePacket(firstByte) { 19 | switch (firstByte) { 20 | case 0xfe: return Packets.AuthSwitchRequestPacket; 21 | case 0xff: return Packets.ErrorPacket; 22 | default: return undefined; 23 | } 24 | }; 25 | 26 | ChangeUser.prototype.start = function(handshakeInitializationPacket) { 27 | var scrambleBuff = handshakeInitializationPacket.scrambleBuff(); 28 | scrambleBuff = Auth.token(this._password, scrambleBuff); 29 | 30 | var packet = new Packets.ComChangeUserPacket({ 31 | user : this._user, 32 | scrambleBuff : scrambleBuff, 33 | database : this._database, 34 | charsetNumber : this._charsetNumber 35 | }); 36 | 37 | this._currentConfig.user = this._user; 38 | this._currentConfig.password = this._password; 39 | this._currentConfig.database = this._database; 40 | this._currentConfig.charsetNumber = this._charsetNumber; 41 | 42 | this.emit('packet', packet); 43 | }; 44 | 45 | ChangeUser.prototype['AuthSwitchRequestPacket'] = function (packet) { 46 | var name = packet.authMethodName; 47 | var data = Auth.auth(name, packet.authMethodData, { 48 | password: this._password 49 | }); 50 | 51 | if (data !== undefined) { 52 | this.emit('packet', new Packets.AuthSwitchResponsePacket({ 53 | data: data 54 | })); 55 | } else { 56 | var err = new Error('MySQL is requesting the ' + name + ' authentication method, which is not supported.'); 57 | err.code = 'UNSUPPORTED_AUTH_METHOD'; 58 | err.fatal = true; 59 | this.end(err); 60 | } 61 | }; 62 | 63 | ChangeUser.prototype['ErrorPacket'] = function(packet) { 64 | var err = this._packetToError(packet); 65 | err.fatal = true; 66 | this.end(err); 67 | }; 68 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/Handshake.js: -------------------------------------------------------------------------------- 1 | var Sequence = require('./Sequence'); 2 | var Util = require('util'); 3 | var Packets = require('../packets'); 4 | var Auth = require('../Auth'); 5 | var ClientConstants = require('../constants/client'); 6 | 7 | module.exports = Handshake; 8 | Util.inherits(Handshake, Sequence); 9 | function Handshake(options, callback) { 10 | Sequence.call(this, options, callback); 11 | 12 | options = options || {}; 13 | 14 | this._config = options.config; 15 | this._handshakeInitializationPacket = null; 16 | } 17 | 18 | Handshake.prototype.determinePacket = function determinePacket(firstByte, parser) { 19 | if (firstByte === 0xff) { 20 | return Packets.ErrorPacket; 21 | } 22 | 23 | if (!this._handshakeInitializationPacket) { 24 | return Packets.HandshakeInitializationPacket; 25 | } 26 | 27 | if (firstByte === 0xfe) { 28 | return (parser.packetLength() === 1) 29 | ? Packets.UseOldPasswordPacket 30 | : Packets.AuthSwitchRequestPacket; 31 | } 32 | 33 | return undefined; 34 | }; 35 | 36 | Handshake.prototype['AuthSwitchRequestPacket'] = function (packet) { 37 | var name = packet.authMethodName; 38 | var data = Auth.auth(name, packet.authMethodData, { 39 | password: this._config.password 40 | }); 41 | 42 | if (data !== undefined) { 43 | this.emit('packet', new Packets.AuthSwitchResponsePacket({ 44 | data: data 45 | })); 46 | } else { 47 | var err = new Error('MySQL is requesting the ' + name + ' authentication method, which is not supported.'); 48 | err.code = 'UNSUPPORTED_AUTH_METHOD'; 49 | err.fatal = true; 50 | this.end(err); 51 | } 52 | }; 53 | 54 | Handshake.prototype['HandshakeInitializationPacket'] = function(packet) { 55 | this._handshakeInitializationPacket = packet; 56 | 57 | this._config.protocol41 = packet.protocol41; 58 | 59 | var serverSSLSupport = packet.serverCapabilities1 & ClientConstants.CLIENT_SSL; 60 | 61 | if (this._config.ssl) { 62 | if (!serverSSLSupport) { 63 | var err = new Error('Server does not support secure connection'); 64 | 65 | err.code = 'HANDSHAKE_NO_SSL_SUPPORT'; 66 | err.fatal = true; 67 | 68 | this.end(err); 69 | return; 70 | } 71 | 72 | this._config.clientFlags |= ClientConstants.CLIENT_SSL; 73 | this.emit('packet', new Packets.SSLRequestPacket({ 74 | clientFlags : this._config.clientFlags, 75 | maxPacketSize : this._config.maxPacketSize, 76 | charsetNumber : this._config.charsetNumber 77 | })); 78 | this.emit('start-tls'); 79 | } else { 80 | this._sendCredentials(); 81 | } 82 | }; 83 | 84 | Handshake.prototype._tlsUpgradeCompleteHandler = function() { 85 | this._sendCredentials(); 86 | }; 87 | 88 | Handshake.prototype._sendCredentials = function() { 89 | var packet = this._handshakeInitializationPacket; 90 | this.emit('packet', new Packets.ClientAuthenticationPacket({ 91 | clientFlags : this._config.clientFlags, 92 | maxPacketSize : this._config.maxPacketSize, 93 | charsetNumber : this._config.charsetNumber, 94 | user : this._config.user, 95 | database : this._config.database, 96 | protocol41 : packet.protocol41, 97 | scrambleBuff : (packet.protocol41) 98 | ? Auth.token(this._config.password, packet.scrambleBuff()) 99 | : Auth.scramble323(packet.scrambleBuff(), this._config.password) 100 | })); 101 | }; 102 | 103 | Handshake.prototype['UseOldPasswordPacket'] = function() { 104 | if (!this._config.insecureAuth) { 105 | var err = new Error( 106 | 'MySQL server is requesting the old and insecure pre-4.1 auth mechanism. ' + 107 | 'Upgrade the user password or use the {insecureAuth: true} option.' 108 | ); 109 | 110 | err.code = 'HANDSHAKE_INSECURE_AUTH'; 111 | err.fatal = true; 112 | 113 | this.end(err); 114 | return; 115 | } 116 | 117 | this.emit('packet', new Packets.OldPasswordPacket({ 118 | scrambleBuff: Auth.scramble323(this._handshakeInitializationPacket.scrambleBuff(), this._config.password) 119 | })); 120 | }; 121 | 122 | Handshake.prototype['ErrorPacket'] = function(packet) { 123 | var err = this._packetToError(packet, true); 124 | err.fatal = true; 125 | this.end(err); 126 | }; 127 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/Ping.js: -------------------------------------------------------------------------------- 1 | var Sequence = require('./Sequence'); 2 | var Util = require('util'); 3 | var Packets = require('../packets'); 4 | 5 | module.exports = Ping; 6 | Util.inherits(Ping, Sequence); 7 | 8 | function Ping(options, callback) { 9 | if (!callback && typeof options === 'function') { 10 | callback = options; 11 | options = {}; 12 | } 13 | 14 | Sequence.call(this, options, callback); 15 | } 16 | 17 | Ping.prototype.start = function() { 18 | this.emit('packet', new Packets.ComPingPacket()); 19 | }; 20 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/Query.js: -------------------------------------------------------------------------------- 1 | var Sequence = require('./Sequence'); 2 | var Util = require('util'); 3 | var Packets = require('../packets'); 4 | var ResultSet = require('../ResultSet'); 5 | var ServerStatus = require('../constants/server_status'); 6 | var fs = require('fs'); 7 | var Readable = require('readable-stream'); 8 | 9 | module.exports = Query; 10 | Util.inherits(Query, Sequence); 11 | function Query(options, callback) { 12 | Sequence.call(this, options, callback); 13 | 14 | this.sql = options.sql; 15 | this.values = options.values; 16 | this.typeCast = (options.typeCast === undefined) 17 | ? true 18 | : options.typeCast; 19 | this.nestTables = options.nestTables || false; 20 | 21 | this._resultSet = null; 22 | this._results = []; 23 | this._fields = []; 24 | this._index = 0; 25 | this._loadError = null; 26 | } 27 | 28 | Query.prototype.start = function() { 29 | this.emit('packet', new Packets.ComQueryPacket(this.sql)); 30 | }; 31 | 32 | Query.prototype.determinePacket = function determinePacket(byte, parser) { 33 | var resultSet = this._resultSet; 34 | 35 | if (!resultSet) { 36 | switch (byte) { 37 | case 0x00: return Packets.OkPacket; 38 | case 0xff: return Packets.ErrorPacket; 39 | default: return Packets.ResultSetHeaderPacket; 40 | } 41 | } 42 | 43 | if (resultSet.eofPackets.length === 0) { 44 | return (resultSet.fieldPackets.length < resultSet.resultSetHeaderPacket.fieldCount) 45 | ? Packets.FieldPacket 46 | : Packets.EofPacket; 47 | } 48 | 49 | if (byte === 0xff) { 50 | return Packets.ErrorPacket; 51 | } 52 | 53 | if (byte === 0xfe && parser.packetLength() < 9) { 54 | return Packets.EofPacket; 55 | } 56 | 57 | return Packets.RowDataPacket; 58 | }; 59 | 60 | Query.prototype['OkPacket'] = function(packet) { 61 | // try...finally for exception safety 62 | try { 63 | if (!this._callback) { 64 | this.emit('result', packet, this._index); 65 | } else { 66 | this._results.push(packet); 67 | this._fields.push(undefined); 68 | } 69 | } finally { 70 | this._index++; 71 | this._resultSet = null; 72 | this._handleFinalResultPacket(packet); 73 | } 74 | }; 75 | 76 | Query.prototype['ErrorPacket'] = function(packet) { 77 | var err = this._packetToError(packet); 78 | 79 | var results = (this._results.length > 0) 80 | ? this._results 81 | : undefined; 82 | 83 | var fields = (this._fields.length > 0) 84 | ? this._fields 85 | : undefined; 86 | 87 | err.index = this._index; 88 | err.sql = this.sql; 89 | 90 | this.end(err, results, fields); 91 | }; 92 | 93 | Query.prototype['ResultSetHeaderPacket'] = function(packet) { 94 | if (packet.fieldCount === null) { 95 | this._sendLocalDataFile(packet.extra); 96 | } else { 97 | this._resultSet = new ResultSet(packet); 98 | } 99 | }; 100 | 101 | Query.prototype['FieldPacket'] = function(packet) { 102 | this._resultSet.fieldPackets.push(packet); 103 | }; 104 | 105 | Query.prototype['EofPacket'] = function(packet) { 106 | this._resultSet.eofPackets.push(packet); 107 | 108 | if (this._resultSet.eofPackets.length === 1 && !this._callback) { 109 | this.emit('fields', this._resultSet.fieldPackets, this._index); 110 | } 111 | 112 | if (this._resultSet.eofPackets.length !== 2) { 113 | return; 114 | } 115 | 116 | if (this._callback) { 117 | this._results.push(this._resultSet.rows); 118 | this._fields.push(this._resultSet.fieldPackets); 119 | } 120 | 121 | this._index++; 122 | this._resultSet = null; 123 | this._handleFinalResultPacket(packet); 124 | }; 125 | 126 | Query.prototype._handleFinalResultPacket = function(packet) { 127 | if (packet.serverStatus & ServerStatus.SERVER_MORE_RESULTS_EXISTS) { 128 | return; 129 | } 130 | 131 | var results = (this._results.length > 1) 132 | ? this._results 133 | : this._results[0]; 134 | 135 | var fields = (this._fields.length > 1) 136 | ? this._fields 137 | : this._fields[0]; 138 | 139 | this.end(this._loadError, results, fields); 140 | }; 141 | 142 | Query.prototype['RowDataPacket'] = function(packet, parser, connection) { 143 | packet.parse(parser, this._resultSet.fieldPackets, this.typeCast, this.nestTables, connection); 144 | 145 | if (this._callback) { 146 | this._resultSet.rows.push(packet); 147 | } else { 148 | this.emit('result', packet, this._index); 149 | } 150 | }; 151 | 152 | Query.prototype._sendLocalDataFile = function(path) { 153 | var self = this; 154 | var localStream = fs.createReadStream(path, { 155 | flag : 'r', 156 | encoding : null, 157 | autoClose : true 158 | }); 159 | 160 | this.on('pause', function () { 161 | localStream.pause(); 162 | }); 163 | 164 | this.on('resume', function () { 165 | localStream.resume(); 166 | }); 167 | 168 | localStream.on('data', function (data) { 169 | self.emit('packet', new Packets.LocalDataFilePacket(data)); 170 | }); 171 | 172 | localStream.on('error', function (err) { 173 | self._loadError = err; 174 | localStream.emit('end'); 175 | }); 176 | 177 | localStream.on('end', function () { 178 | self.emit('packet', new Packets.EmptyPacket()); 179 | }); 180 | }; 181 | 182 | Query.prototype.stream = function(options) { 183 | var self = this; 184 | 185 | options = options || {}; 186 | options.objectMode = true; 187 | 188 | var stream = new Readable(options); 189 | 190 | stream._read = function() { 191 | self._connection && self._connection.resume(); 192 | }; 193 | 194 | stream.once('end', function() { 195 | process.nextTick(function () { 196 | stream.emit('close'); 197 | }); 198 | }); 199 | 200 | this.on('result', function(row, i) { 201 | if (!stream.push(row)) self._connection.pause(); 202 | stream.emit('result', row, i); // replicate old emitter 203 | }); 204 | 205 | this.on('error', function(err) { 206 | stream.emit('error', err); // Pass on any errors 207 | }); 208 | 209 | this.on('end', function() { 210 | stream.push(null); // pushing null, indicating EOF 211 | }); 212 | 213 | this.on('fields', function(fields, i) { 214 | stream.emit('fields', fields, i); // replicate old emitter 215 | }); 216 | 217 | return stream; 218 | }; 219 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/Quit.js: -------------------------------------------------------------------------------- 1 | var Sequence = require('./Sequence'); 2 | var Util = require('util'); 3 | var Packets = require('../packets'); 4 | 5 | module.exports = Quit; 6 | Util.inherits(Quit, Sequence); 7 | function Quit(options, callback) { 8 | if (!callback && typeof options === 'function') { 9 | callback = options; 10 | options = {}; 11 | } 12 | 13 | Sequence.call(this, options, callback); 14 | 15 | this._started = false; 16 | } 17 | 18 | Quit.prototype.end = function end(err) { 19 | if (this._ended) { 20 | return; 21 | } 22 | 23 | if (!this._started) { 24 | Sequence.prototype.end.call(this, err); 25 | return; 26 | } 27 | 28 | if (err && err.code === 'ECONNRESET' && err.syscall === 'read') { 29 | // Ignore read errors after packet sent 30 | Sequence.prototype.end.call(this); 31 | return; 32 | } 33 | 34 | Sequence.prototype.end.call(this, err); 35 | }; 36 | 37 | Quit.prototype.start = function() { 38 | this._started = true; 39 | this.emit('packet', new Packets.ComQuitPacket()); 40 | }; 41 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/Sequence.js: -------------------------------------------------------------------------------- 1 | var Util = require('util'); 2 | var EventEmitter = require('events').EventEmitter; 3 | var Packets = require('../packets'); 4 | var ErrorConstants = require('../constants/errors'); 5 | var Timer = require('../Timer'); 6 | 7 | // istanbul ignore next: Node.js < 0.10 not covered 8 | var listenerCount = EventEmitter.listenerCount 9 | || function(emitter, type){ return emitter.listeners(type).length; }; 10 | 11 | var LONG_STACK_DELIMITER = '\n --------------------\n'; 12 | 13 | module.exports = Sequence; 14 | Util.inherits(Sequence, EventEmitter); 15 | function Sequence(options, callback) { 16 | if (typeof options === 'function') { 17 | callback = options; 18 | options = {}; 19 | } 20 | 21 | EventEmitter.call(this); 22 | 23 | options = options || {}; 24 | 25 | this._callback = callback; 26 | this._callSite = null; 27 | this._ended = false; 28 | this._timeout = options.timeout; 29 | this._timer = new Timer(this); 30 | } 31 | 32 | Sequence.determinePacket = function(byte) { 33 | switch (byte) { 34 | case 0x00: return Packets.OkPacket; 35 | case 0xfe: return Packets.EofPacket; 36 | case 0xff: return Packets.ErrorPacket; 37 | default: return undefined; 38 | } 39 | }; 40 | 41 | Sequence.prototype.hasErrorHandler = function() { 42 | return Boolean(this._callback) || listenerCount(this, 'error') > 1; 43 | }; 44 | 45 | Sequence.prototype._packetToError = function(packet) { 46 | var code = ErrorConstants[packet.errno] || 'UNKNOWN_CODE_PLEASE_REPORT'; 47 | var err = new Error(code + ': ' + packet.message); 48 | err.code = code; 49 | err.errno = packet.errno; 50 | 51 | err.sqlMessage = packet.message; 52 | err.sqlState = packet.sqlState; 53 | 54 | return err; 55 | }; 56 | 57 | Sequence.prototype.end = function(err) { 58 | if (this._ended) { 59 | return; 60 | } 61 | 62 | this._ended = true; 63 | 64 | if (err) { 65 | this._addLongStackTrace(err); 66 | } 67 | 68 | // Without this we are leaking memory. This problem was introduced in 69 | // 8189925374e7ce3819bbe88b64c7b15abac96b16. I suspect that the error object 70 | // causes a cyclic reference that the GC does not detect properly, but I was 71 | // unable to produce a standalone version of this leak. This would be a great 72 | // challenge for somebody interested in difficult problems : )! 73 | this._callSite = null; 74 | 75 | // try...finally for exception safety 76 | try { 77 | if (err) { 78 | this.emit('error', err); 79 | } 80 | } finally { 81 | try { 82 | if (this._callback) { 83 | this._callback.apply(this, arguments); 84 | } 85 | } finally { 86 | this.emit('end'); 87 | } 88 | } 89 | }; 90 | 91 | Sequence.prototype['OkPacket'] = function(packet) { 92 | this.end(null, packet); 93 | }; 94 | 95 | Sequence.prototype['ErrorPacket'] = function(packet) { 96 | this.end(this._packetToError(packet)); 97 | }; 98 | 99 | // Implemented by child classes 100 | Sequence.prototype.start = function() {}; 101 | 102 | Sequence.prototype._addLongStackTrace = function _addLongStackTrace(err) { 103 | var callSiteStack = this._callSite && this._callSite.stack; 104 | 105 | if (!callSiteStack || typeof callSiteStack !== 'string') { 106 | // No recorded call site 107 | return; 108 | } 109 | 110 | if (err.stack.indexOf(LONG_STACK_DELIMITER) !== -1) { 111 | // Error stack already looks long 112 | return; 113 | } 114 | 115 | var index = callSiteStack.indexOf('\n'); 116 | 117 | if (index !== -1) { 118 | // Append recorded call site 119 | err.stack += LONG_STACK_DELIMITER + callSiteStack.substr(index + 1); 120 | } 121 | }; 122 | 123 | Sequence.prototype._onTimeout = function _onTimeout() { 124 | this.emit('timeout'); 125 | }; 126 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/Statistics.js: -------------------------------------------------------------------------------- 1 | var Sequence = require('./Sequence'); 2 | var Util = require('util'); 3 | var Packets = require('../packets'); 4 | 5 | module.exports = Statistics; 6 | Util.inherits(Statistics, Sequence); 7 | function Statistics(options, callback) { 8 | if (!callback && typeof options === 'function') { 9 | callback = options; 10 | options = {}; 11 | } 12 | 13 | Sequence.call(this, options, callback); 14 | } 15 | 16 | Statistics.prototype.start = function() { 17 | this.emit('packet', new Packets.ComStatisticsPacket()); 18 | }; 19 | 20 | Statistics.prototype['StatisticsPacket'] = function (packet) { 21 | this.end(null, packet); 22 | }; 23 | 24 | Statistics.prototype.determinePacket = function determinePacket(firstByte) { 25 | if (firstByte === 0x55) { 26 | return Packets.StatisticsPacket; 27 | } 28 | 29 | return undefined; 30 | }; 31 | -------------------------------------------------------------------------------- /node_modules/mysql/lib/protocol/sequences/index.js: -------------------------------------------------------------------------------- 1 | exports.ChangeUser = require('./ChangeUser'); 2 | exports.Handshake = require('./Handshake'); 3 | exports.Ping = require('./Ping'); 4 | exports.Query = require('./Query'); 5 | exports.Quit = require('./Quit'); 6 | exports.Sequence = require('./Sequence'); 7 | exports.Statistics = require('./Statistics'); 8 | -------------------------------------------------------------------------------- /node_modules/mysql/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "mysql@~2.17.1", 3 | "_id": "mysql@2.17.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-YrukoDmpsvc2OM0WUs5Q/G9oKJk=", 6 | "_location": "/mysql", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "mysql@~2.17.1", 12 | "name": "mysql", 13 | "escapedName": "mysql", 14 | "rawSpec": "~2.17.1", 15 | "saveSpec": null, 16 | "fetchSpec": "~2.17.1" 17 | }, 18 | "_requiredBy": [ 19 | "#DEV:/", 20 | "#USER" 21 | ], 22 | "_resolved": "https://registry.npm.taobao.org/mysql/download/mysql-2.17.1.tgz", 23 | "_shasum": "62bba4a039a9b2f73638cd1652ce50fc6f682899", 24 | "_spec": "mysql@~2.17.1", 25 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev", 26 | "author": { 27 | "name": "Felix Geisendörfer", 28 | "email": "felix@debuggable.com", 29 | "url": "http://debuggable.com/" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/mysqljs/mysql/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "contributors": [ 36 | { 37 | "name": "Andrey Sidorov", 38 | "email": "sidorares@yandex.ru" 39 | }, 40 | { 41 | "name": "Bradley Grainger", 42 | "email": "bgrainger@gmail.com" 43 | }, 44 | { 45 | "name": "Douglas Christopher Wilson", 46 | "email": "doug@somethingdoug.com" 47 | }, 48 | { 49 | "name": "Diogo Resende", 50 | "email": "dresende@thinkdigital.pt" 51 | }, 52 | { 53 | "name": "Nathan Woltman", 54 | "email": "nwoltman@outlook.com" 55 | } 56 | ], 57 | "dependencies": { 58 | "bignumber.js": "7.2.1", 59 | "readable-stream": "2.3.6", 60 | "safe-buffer": "5.1.2", 61 | "sqlstring": "2.3.1" 62 | }, 63 | "deprecated": false, 64 | "description": "A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.", 65 | "devDependencies": { 66 | "after": "0.8.2", 67 | "eslint": "5.15.1", 68 | "seedrandom": "3.0.1", 69 | "timezone-mock": "0.0.7", 70 | "urun": "0.0.8", 71 | "utest": "0.0.8" 72 | }, 73 | "engines": { 74 | "node": ">= 0.6" 75 | }, 76 | "files": [ 77 | "lib/", 78 | "Changes.md", 79 | "License", 80 | "Readme.md", 81 | "index.js" 82 | ], 83 | "homepage": "https://github.com/mysqljs/mysql#readme", 84 | "license": "MIT", 85 | "name": "mysql", 86 | "repository": { 87 | "type": "git", 88 | "url": "git+https://github.com/mysqljs/mysql.git" 89 | }, 90 | "scripts": { 91 | "lint": "eslint .", 92 | "test": "node test/run.js", 93 | "test-ci": "node tool/install-nyc.js --nyc-optional --reporter=text -- npm test", 94 | "test-cov": "node tool/install-nyc.js --reporter=html --reporter=text -- npm test", 95 | "version": "node tool/version-changes.js && git add Changes.md" 96 | }, 97 | "version": "2.17.1" 98 | } 99 | -------------------------------------------------------------------------------- /node_modules/process-nextick-args/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (typeof process === 'undefined' || 4 | !process.version || 5 | process.version.indexOf('v0.') === 0 || 6 | process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { 7 | module.exports = { nextTick: nextTick }; 8 | } else { 9 | module.exports = process 10 | } 11 | 12 | function nextTick(fn, arg1, arg2, arg3) { 13 | if (typeof fn !== 'function') { 14 | throw new TypeError('"callback" argument must be a function'); 15 | } 16 | var len = arguments.length; 17 | var args, i; 18 | switch (len) { 19 | case 0: 20 | case 1: 21 | return process.nextTick(fn); 22 | case 2: 23 | return process.nextTick(function afterTickOne() { 24 | fn.call(null, arg1); 25 | }); 26 | case 3: 27 | return process.nextTick(function afterTickTwo() { 28 | fn.call(null, arg1, arg2); 29 | }); 30 | case 4: 31 | return process.nextTick(function afterTickThree() { 32 | fn.call(null, arg1, arg2, arg3); 33 | }); 34 | default: 35 | args = new Array(len - 1); 36 | i = 0; 37 | while (i < args.length) { 38 | args[i++] = arguments[i]; 39 | } 40 | return process.nextTick(function afterTick() { 41 | fn.apply(null, args); 42 | }); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /node_modules/process-nextick-args/license.md: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 Calvin Metcalf 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE.** 20 | -------------------------------------------------------------------------------- /node_modules/process-nextick-args/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "process-nextick-args@~2.0.0", 3 | "_id": "process-nextick-args@2.0.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I=", 6 | "_location": "/process-nextick-args", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "process-nextick-args@~2.0.0", 12 | "name": "process-nextick-args", 13 | "escapedName": "process-nextick-args", 14 | "rawSpec": "~2.0.0", 15 | "saveSpec": null, 16 | "fetchSpec": "~2.0.0" 17 | }, 18 | "_requiredBy": [ 19 | "/readable-stream" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.1.tgz", 22 | "_shasum": "7820d9b16120cc55ca9ae7792680ae7dba6d7fe2", 23 | "_spec": "process-nextick-args@~2.0.0", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\readable-stream", 25 | "author": "", 26 | "bugs": { 27 | "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" 28 | }, 29 | "bundleDependencies": false, 30 | "deprecated": false, 31 | "description": "process.nextTick but always with args", 32 | "devDependencies": { 33 | "tap": "~0.2.6" 34 | }, 35 | "files": [ 36 | "index.js" 37 | ], 38 | "homepage": "https://github.com/calvinmetcalf/process-nextick-args", 39 | "license": "MIT", 40 | "main": "index.js", 41 | "name": "process-nextick-args", 42 | "repository": { 43 | "type": "git", 44 | "url": "git+https://github.com/calvinmetcalf/process-nextick-args.git" 45 | }, 46 | "scripts": { 47 | "test": "node test.js" 48 | }, 49 | "version": "2.0.1" 50 | } 51 | -------------------------------------------------------------------------------- /node_modules/process-nextick-args/readme.md: -------------------------------------------------------------------------------- 1 | process-nextick-args 2 | ===== 3 | 4 | [![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args) 5 | 6 | ```bash 7 | npm install --save process-nextick-args 8 | ``` 9 | 10 | Always be able to pass arguments to process.nextTick, no matter the platform 11 | 12 | ```js 13 | var pna = require('process-nextick-args'); 14 | 15 | pna.nextTick(function (a, b, c) { 16 | console.log(a, b, c); 17 | }, 'step', 3, 'profit'); 18 | ``` 19 | -------------------------------------------------------------------------------- /node_modules/readable-stream/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | before_install: 4 | - npm install -g npm@2 5 | - test $NPM_LEGACY && npm install -g npm@latest-3 || npm install npm -g 6 | notifications: 7 | email: false 8 | matrix: 9 | fast_finish: true 10 | include: 11 | - node_js: '0.8' 12 | env: 13 | - TASK=test 14 | - NPM_LEGACY=true 15 | - node_js: '0.10' 16 | env: 17 | - TASK=test 18 | - NPM_LEGACY=true 19 | - node_js: '0.11' 20 | env: 21 | - TASK=test 22 | - NPM_LEGACY=true 23 | - node_js: '0.12' 24 | env: 25 | - TASK=test 26 | - NPM_LEGACY=true 27 | - node_js: 1 28 | env: 29 | - TASK=test 30 | - NPM_LEGACY=true 31 | - node_js: 2 32 | env: 33 | - TASK=test 34 | - NPM_LEGACY=true 35 | - node_js: 3 36 | env: 37 | - TASK=test 38 | - NPM_LEGACY=true 39 | - node_js: 4 40 | env: TASK=test 41 | - node_js: 5 42 | env: TASK=test 43 | - node_js: 6 44 | env: TASK=test 45 | - node_js: 7 46 | env: TASK=test 47 | - node_js: 8 48 | env: TASK=test 49 | - node_js: 9 50 | env: TASK=test 51 | script: "npm run $TASK" 52 | env: 53 | global: 54 | - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc= 55 | - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI= 56 | -------------------------------------------------------------------------------- /node_modules/readable-stream/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Developer's Certificate of Origin 1.1 2 | 3 | By making a contribution to this project, I certify that: 4 | 5 | * (a) The contribution was created in whole or in part by me and I 6 | have the right to submit it under the open source license 7 | indicated in the file; or 8 | 9 | * (b) The contribution is based upon previous work that, to the best 10 | of my knowledge, is covered under an appropriate open source 11 | license and I have the right under that license to submit that 12 | work with modifications, whether created in whole or in part 13 | by me, under the same open source license (unless I am 14 | permitted to submit under a different license), as indicated 15 | in the file; or 16 | 17 | * (c) The contribution was provided directly to me by some other 18 | person who certified (a), (b) or (c) and I have not modified 19 | it. 20 | 21 | * (d) I understand and agree that this project and the contribution 22 | are public and that a record of the contribution (including all 23 | personal information I submit with it, including my sign-off) is 24 | maintained indefinitely and may be redistributed consistent with 25 | this project or the open source license(s) involved. 26 | 27 | ## Moderation Policy 28 | 29 | The [Node.js Moderation Policy] applies to this WG. 30 | 31 | ## Code of Conduct 32 | 33 | The [Node.js Code of Conduct][] applies to this WG. 34 | 35 | [Node.js Code of Conduct]: 36 | https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md 37 | [Node.js Moderation Policy]: 38 | https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md 39 | -------------------------------------------------------------------------------- /node_modules/readable-stream/GOVERNANCE.md: -------------------------------------------------------------------------------- 1 | ### Streams Working Group 2 | 3 | The Node.js Streams is jointly governed by a Working Group 4 | (WG) 5 | that is responsible for high-level guidance of the project. 6 | 7 | The WG has final authority over this project including: 8 | 9 | * Technical direction 10 | * Project governance and process (including this policy) 11 | * Contribution policy 12 | * GitHub repository hosting 13 | * Conduct guidelines 14 | * Maintaining the list of additional Collaborators 15 | 16 | For the current list of WG members, see the project 17 | [README.md](./README.md#current-project-team-members). 18 | 19 | ### Collaborators 20 | 21 | The readable-stream GitHub repository is 22 | maintained by the WG and additional Collaborators who are added by the 23 | WG on an ongoing basis. 24 | 25 | Individuals making significant and valuable contributions are made 26 | Collaborators and given commit-access to the project. These 27 | individuals are identified by the WG and their addition as 28 | Collaborators is discussed during the WG meeting. 29 | 30 | _Note:_ If you make a significant contribution and are not considered 31 | for commit-access log an issue or contact a WG member directly and it 32 | will be brought up in the next WG meeting. 33 | 34 | Modifications of the contents of the readable-stream repository are 35 | made on 36 | a collaborative basis. Anybody with a GitHub account may propose a 37 | modification via pull request and it will be considered by the project 38 | Collaborators. All pull requests must be reviewed and accepted by a 39 | Collaborator with sufficient expertise who is able to take full 40 | responsibility for the change. In the case of pull requests proposed 41 | by an existing Collaborator, an additional Collaborator is required 42 | for sign-off. Consensus should be sought if additional Collaborators 43 | participate and there is disagreement around a particular 44 | modification. See _Consensus Seeking Process_ below for further detail 45 | on the consensus model used for governance. 46 | 47 | Collaborators may opt to elevate significant or controversial 48 | modifications, or modifications that have not found consensus to the 49 | WG for discussion by assigning the ***WG-agenda*** tag to a pull 50 | request or issue. The WG should serve as the final arbiter where 51 | required. 52 | 53 | For the current list of Collaborators, see the project 54 | [README.md](./README.md#members). 55 | 56 | ### WG Membership 57 | 58 | WG seats are not time-limited. There is no fixed size of the WG. 59 | However, the expected target is between 6 and 12, to ensure adequate 60 | coverage of important areas of expertise, balanced with the ability to 61 | make decisions efficiently. 62 | 63 | There is no specific set of requirements or qualifications for WG 64 | membership beyond these rules. 65 | 66 | The WG may add additional members to the WG by unanimous consensus. 67 | 68 | A WG member may be removed from the WG by voluntary resignation, or by 69 | unanimous consensus of all other WG members. 70 | 71 | Changes to WG membership should be posted in the agenda, and may be 72 | suggested as any other agenda item (see "WG Meetings" below). 73 | 74 | If an addition or removal is proposed during a meeting, and the full 75 | WG is not in attendance to participate, then the addition or removal 76 | is added to the agenda for the subsequent meeting. This is to ensure 77 | that all members are given the opportunity to participate in all 78 | membership decisions. If a WG member is unable to attend a meeting 79 | where a planned membership decision is being made, then their consent 80 | is assumed. 81 | 82 | No more than 1/3 of the WG members may be affiliated with the same 83 | employer. If removal or resignation of a WG member, or a change of 84 | employment by a WG member, creates a situation where more than 1/3 of 85 | the WG membership shares an employer, then the situation must be 86 | immediately remedied by the resignation or removal of one or more WG 87 | members affiliated with the over-represented employer(s). 88 | 89 | ### WG Meetings 90 | 91 | The WG meets occasionally on a Google Hangout On Air. A designated moderator 92 | approved by the WG runs the meeting. Each meeting should be 93 | published to YouTube. 94 | 95 | Items are added to the WG agenda that are considered contentious or 96 | are modifications of governance, contribution policy, WG membership, 97 | or release process. 98 | 99 | The intention of the agenda is not to approve or review all patches; 100 | that should happen continuously on GitHub and be handled by the larger 101 | group of Collaborators. 102 | 103 | Any community member or contributor can ask that something be added to 104 | the next meeting's agenda by logging a GitHub Issue. Any Collaborator, 105 | WG member or the moderator can add the item to the agenda by adding 106 | the ***WG-agenda*** tag to the issue. 107 | 108 | Prior to each WG meeting the moderator will share the Agenda with 109 | members of the WG. WG members can add any items they like to the 110 | agenda at the beginning of each meeting. The moderator and the WG 111 | cannot veto or remove items. 112 | 113 | The WG may invite persons or representatives from certain projects to 114 | participate in a non-voting capacity. 115 | 116 | The moderator is responsible for summarizing the discussion of each 117 | agenda item and sends it as a pull request after the meeting. 118 | 119 | ### Consensus Seeking Process 120 | 121 | The WG follows a 122 | [Consensus 123 | Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) 124 | decision-making model. 125 | 126 | When an agenda item has appeared to reach a consensus the moderator 127 | will ask "Does anyone object?" as a final call for dissent from the 128 | consensus. 129 | 130 | If an agenda item cannot reach a consensus a WG member can call for 131 | either a closing vote or a vote to table the issue to the next 132 | meeting. The call for a vote must be seconded by a majority of the WG 133 | or else the discussion will continue. Simple majority wins. 134 | 135 | Note that changes to WG membership require a majority consensus. See 136 | "WG Membership" above. 137 | -------------------------------------------------------------------------------- /node_modules/readable-stream/LICENSE: -------------------------------------------------------------------------------- 1 | Node.js is licensed for use as follows: 2 | 3 | """ 4 | Copyright Node.js contributors. All rights reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | sell copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 | IN THE SOFTWARE. 23 | """ 24 | 25 | This license applies to parts of Node.js originating from the 26 | https://github.com/joyent/node repository: 27 | 28 | """ 29 | Copyright Joyent, Inc. and other Node contributors. All rights reserved. 30 | Permission is hereby granted, free of charge, to any person obtaining a copy 31 | of this software and associated documentation files (the "Software"), to 32 | deal in the Software without restriction, including without limitation the 33 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 34 | sell copies of the Software, and to permit persons to whom the Software is 35 | furnished to do so, subject to the following conditions: 36 | 37 | The above copyright notice and this permission notice shall be included in 38 | all copies or substantial portions of the Software. 39 | 40 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 42 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 44 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 45 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 46 | IN THE SOFTWARE. 47 | """ 48 | -------------------------------------------------------------------------------- /node_modules/readable-stream/README.md: -------------------------------------------------------------------------------- 1 | # readable-stream 2 | 3 | ***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) 4 | 5 | 6 | [![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) 7 | [![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) 8 | 9 | 10 | [![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream) 11 | 12 | ```bash 13 | npm install --save readable-stream 14 | ``` 15 | 16 | ***Node-core streams for userland*** 17 | 18 | This package is a mirror of the Streams2 and Streams3 implementations in 19 | Node-core. 20 | 21 | Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html). 22 | 23 | If you want to guarantee a stable streams base, regardless of what version of 24 | Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). 25 | 26 | As of version 2.0.0 **readable-stream** uses semantic versioning. 27 | 28 | # Streams Working Group 29 | 30 | `readable-stream` is maintained by the Streams Working Group, which 31 | oversees the development and maintenance of the Streams API within 32 | Node.js. The responsibilities of the Streams Working Group include: 33 | 34 | * Addressing stream issues on the Node.js issue tracker. 35 | * Authoring and editing stream documentation within the Node.js project. 36 | * Reviewing changes to stream subclasses within the Node.js project. 37 | * Redirecting changes to streams from the Node.js project to this 38 | project. 39 | * Assisting in the implementation of stream providers within Node.js. 40 | * Recommending versions of `readable-stream` to be included in Node.js. 41 | * Messaging about the future of streams to give the community advance 42 | notice of changes. 43 | 44 | 45 | ## Team Members 46 | 47 | * **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com> 48 | - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B 49 | * **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> 50 | - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 51 | * **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org> 52 | - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D 53 | * **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com> 54 | * **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> 55 | * **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me> 56 | * **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> 57 | - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E 58 | * **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> 59 | -------------------------------------------------------------------------------- /node_modules/readable-stream/doc/wg-meetings/2015-01-30.md: -------------------------------------------------------------------------------- 1 | # streams WG Meeting 2015-01-30 2 | 3 | ## Links 4 | 5 | * **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg 6 | * **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106 7 | * **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/ 8 | 9 | ## Agenda 10 | 11 | Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting. 12 | 13 | * adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105) 14 | * release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101) 15 | * simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102) 16 | * proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99) 17 | 18 | ## Minutes 19 | 20 | ### adopt a charter 21 | 22 | * group: +1's all around 23 | 24 | ### What versioning scheme should be adopted? 25 | * group: +1’s 3.0.0 26 | * domenic+group: pulling in patches from other sources where appropriate 27 | * mikeal: version independently, suggesting versions for io.js 28 | * mikeal+domenic: work with TC to notify in advance of changes 29 | simpler stream creation 30 | 31 | ### streamline creation of streams 32 | * sam: streamline creation of streams 33 | * domenic: nice simple solution posted 34 | but, we lose the opportunity to change the model 35 | may not be backwards incompatible (double check keys) 36 | 37 | **action item:** domenic will check 38 | 39 | ### remove implicit flowing of streams on(‘data’) 40 | * add isFlowing / isPaused 41 | * mikeal: worrying that we’re documenting polyfill methods – confuses users 42 | * domenic: more reflective API is probably good, with warning labels for users 43 | * new section for mad scientists (reflective stream access) 44 | * calvin: name the “third state” 45 | * mikeal: maybe borrow the name from whatwg? 46 | * domenic: we’re missing the “third state” 47 | * consensus: kind of difficult to name the third state 48 | * mikeal: figure out differences in states / compat 49 | * mathias: always flow on data – eliminates third state 50 | * explore what it breaks 51 | 52 | **action items:** 53 | * ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream) 54 | * ask rod/build for infrastructure 55 | * **chris**: explore the “flow on data” approach 56 | * add isPaused/isFlowing 57 | * add new docs section 58 | * move isPaused to that section 59 | 60 | 61 | -------------------------------------------------------------------------------- /node_modules/readable-stream/duplex-browser.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/_stream_duplex.js'); 2 | -------------------------------------------------------------------------------- /node_modules/readable-stream/duplex.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./readable').Duplex 2 | -------------------------------------------------------------------------------- /node_modules/readable-stream/lib/_stream_duplex.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // a duplex stream is just a stream that is both readable and writable. 23 | // Since JS doesn't have multiple prototypal inheritance, this class 24 | // prototypally inherits from Readable, and then parasitically from 25 | // Writable. 26 | 27 | 'use strict'; 28 | 29 | /**/ 30 | 31 | var pna = require('process-nextick-args'); 32 | /**/ 33 | 34 | /**/ 35 | var objectKeys = Object.keys || function (obj) { 36 | var keys = []; 37 | for (var key in obj) { 38 | keys.push(key); 39 | }return keys; 40 | }; 41 | /**/ 42 | 43 | module.exports = Duplex; 44 | 45 | /**/ 46 | var util = require('core-util-is'); 47 | util.inherits = require('inherits'); 48 | /**/ 49 | 50 | var Readable = require('./_stream_readable'); 51 | var Writable = require('./_stream_writable'); 52 | 53 | util.inherits(Duplex, Readable); 54 | 55 | { 56 | // avoid scope creep, the keys array can then be collected 57 | var keys = objectKeys(Writable.prototype); 58 | for (var v = 0; v < keys.length; v++) { 59 | var method = keys[v]; 60 | if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; 61 | } 62 | } 63 | 64 | function Duplex(options) { 65 | if (!(this instanceof Duplex)) return new Duplex(options); 66 | 67 | Readable.call(this, options); 68 | Writable.call(this, options); 69 | 70 | if (options && options.readable === false) this.readable = false; 71 | 72 | if (options && options.writable === false) this.writable = false; 73 | 74 | this.allowHalfOpen = true; 75 | if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; 76 | 77 | this.once('end', onend); 78 | } 79 | 80 | Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { 81 | // making it explicit this property is not enumerable 82 | // because otherwise some prototype manipulation in 83 | // userland will fail 84 | enumerable: false, 85 | get: function () { 86 | return this._writableState.highWaterMark; 87 | } 88 | }); 89 | 90 | // the no-half-open enforcer 91 | function onend() { 92 | // if we allow half-open state, or if the writable side ended, 93 | // then we're ok. 94 | if (this.allowHalfOpen || this._writableState.ended) return; 95 | 96 | // no more data can be written. 97 | // But allow more writes to happen in this tick. 98 | pna.nextTick(onEndNT, this); 99 | } 100 | 101 | function onEndNT(self) { 102 | self.end(); 103 | } 104 | 105 | Object.defineProperty(Duplex.prototype, 'destroyed', { 106 | get: function () { 107 | if (this._readableState === undefined || this._writableState === undefined) { 108 | return false; 109 | } 110 | return this._readableState.destroyed && this._writableState.destroyed; 111 | }, 112 | set: function (value) { 113 | // we ignore the value if the stream 114 | // has not been initialized yet 115 | if (this._readableState === undefined || this._writableState === undefined) { 116 | return; 117 | } 118 | 119 | // backward compatibility, the user is explicitly 120 | // managing destroyed 121 | this._readableState.destroyed = value; 122 | this._writableState.destroyed = value; 123 | } 124 | }); 125 | 126 | Duplex.prototype._destroy = function (err, cb) { 127 | this.push(null); 128 | this.end(); 129 | 130 | pna.nextTick(cb, err); 131 | }; -------------------------------------------------------------------------------- /node_modules/readable-stream/lib/_stream_passthrough.js: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | // a passthrough stream. 23 | // basically just the most minimal sort of Transform stream. 24 | // Every written chunk gets output as-is. 25 | 26 | 'use strict'; 27 | 28 | module.exports = PassThrough; 29 | 30 | var Transform = require('./_stream_transform'); 31 | 32 | /**/ 33 | var util = require('core-util-is'); 34 | util.inherits = require('inherits'); 35 | /**/ 36 | 37 | util.inherits(PassThrough, Transform); 38 | 39 | function PassThrough(options) { 40 | if (!(this instanceof PassThrough)) return new PassThrough(options); 41 | 42 | Transform.call(this, options); 43 | } 44 | 45 | PassThrough.prototype._transform = function (chunk, encoding, cb) { 46 | cb(null, chunk); 47 | }; -------------------------------------------------------------------------------- /node_modules/readable-stream/lib/internal/streams/BufferList.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4 | 5 | var Buffer = require('safe-buffer').Buffer; 6 | var util = require('util'); 7 | 8 | function copyBuffer(src, target, offset) { 9 | src.copy(target, offset); 10 | } 11 | 12 | module.exports = function () { 13 | function BufferList() { 14 | _classCallCheck(this, BufferList); 15 | 16 | this.head = null; 17 | this.tail = null; 18 | this.length = 0; 19 | } 20 | 21 | BufferList.prototype.push = function push(v) { 22 | var entry = { data: v, next: null }; 23 | if (this.length > 0) this.tail.next = entry;else this.head = entry; 24 | this.tail = entry; 25 | ++this.length; 26 | }; 27 | 28 | BufferList.prototype.unshift = function unshift(v) { 29 | var entry = { data: v, next: this.head }; 30 | if (this.length === 0) this.tail = entry; 31 | this.head = entry; 32 | ++this.length; 33 | }; 34 | 35 | BufferList.prototype.shift = function shift() { 36 | if (this.length === 0) return; 37 | var ret = this.head.data; 38 | if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; 39 | --this.length; 40 | return ret; 41 | }; 42 | 43 | BufferList.prototype.clear = function clear() { 44 | this.head = this.tail = null; 45 | this.length = 0; 46 | }; 47 | 48 | BufferList.prototype.join = function join(s) { 49 | if (this.length === 0) return ''; 50 | var p = this.head; 51 | var ret = '' + p.data; 52 | while (p = p.next) { 53 | ret += s + p.data; 54 | }return ret; 55 | }; 56 | 57 | BufferList.prototype.concat = function concat(n) { 58 | if (this.length === 0) return Buffer.alloc(0); 59 | if (this.length === 1) return this.head.data; 60 | var ret = Buffer.allocUnsafe(n >>> 0); 61 | var p = this.head; 62 | var i = 0; 63 | while (p) { 64 | copyBuffer(p.data, ret, i); 65 | i += p.data.length; 66 | p = p.next; 67 | } 68 | return ret; 69 | }; 70 | 71 | return BufferList; 72 | }(); 73 | 74 | if (util && util.inspect && util.inspect.custom) { 75 | module.exports.prototype[util.inspect.custom] = function () { 76 | var obj = util.inspect({ length: this.length }); 77 | return this.constructor.name + ' ' + obj; 78 | }; 79 | } -------------------------------------------------------------------------------- /node_modules/readable-stream/lib/internal/streams/destroy.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /**/ 4 | 5 | var pna = require('process-nextick-args'); 6 | /**/ 7 | 8 | // undocumented cb() API, needed for core, not for public API 9 | function destroy(err, cb) { 10 | var _this = this; 11 | 12 | var readableDestroyed = this._readableState && this._readableState.destroyed; 13 | var writableDestroyed = this._writableState && this._writableState.destroyed; 14 | 15 | if (readableDestroyed || writableDestroyed) { 16 | if (cb) { 17 | cb(err); 18 | } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { 19 | pna.nextTick(emitErrorNT, this, err); 20 | } 21 | return this; 22 | } 23 | 24 | // we set destroyed to true before firing error callbacks in order 25 | // to make it re-entrance safe in case destroy() is called within callbacks 26 | 27 | if (this._readableState) { 28 | this._readableState.destroyed = true; 29 | } 30 | 31 | // if this is a duplex stream mark the writable part as destroyed as well 32 | if (this._writableState) { 33 | this._writableState.destroyed = true; 34 | } 35 | 36 | this._destroy(err || null, function (err) { 37 | if (!cb && err) { 38 | pna.nextTick(emitErrorNT, _this, err); 39 | if (_this._writableState) { 40 | _this._writableState.errorEmitted = true; 41 | } 42 | } else if (cb) { 43 | cb(err); 44 | } 45 | }); 46 | 47 | return this; 48 | } 49 | 50 | function undestroy() { 51 | if (this._readableState) { 52 | this._readableState.destroyed = false; 53 | this._readableState.reading = false; 54 | this._readableState.ended = false; 55 | this._readableState.endEmitted = false; 56 | } 57 | 58 | if (this._writableState) { 59 | this._writableState.destroyed = false; 60 | this._writableState.ended = false; 61 | this._writableState.ending = false; 62 | this._writableState.finished = false; 63 | this._writableState.errorEmitted = false; 64 | } 65 | } 66 | 67 | function emitErrorNT(self, err) { 68 | self.emit('error', err); 69 | } 70 | 71 | module.exports = { 72 | destroy: destroy, 73 | undestroy: undestroy 74 | }; -------------------------------------------------------------------------------- /node_modules/readable-stream/lib/internal/streams/stream-browser.js: -------------------------------------------------------------------------------- 1 | module.exports = require('events').EventEmitter; 2 | -------------------------------------------------------------------------------- /node_modules/readable-stream/lib/internal/streams/stream.js: -------------------------------------------------------------------------------- 1 | module.exports = require('stream'); 2 | -------------------------------------------------------------------------------- /node_modules/readable-stream/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "readable-stream@2.3.6", 3 | "_id": "readable-stream@2.3.6", 4 | "_inBundle": false, 5 | "_integrity": "sha1-sRwn2IuP8fvgcGQ8+UsMea4bCq8=", 6 | "_location": "/readable-stream", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "version", 10 | "registry": true, 11 | "raw": "readable-stream@2.3.6", 12 | "name": "readable-stream", 13 | "escapedName": "readable-stream", 14 | "rawSpec": "2.3.6", 15 | "saveSpec": null, 16 | "fetchSpec": "2.3.6" 17 | }, 18 | "_requiredBy": [ 19 | "/mysql" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.6.tgz", 22 | "_shasum": "b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf", 23 | "_spec": "readable-stream@2.3.6", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\mysql", 25 | "browser": { 26 | "util": false, 27 | "./readable.js": "./readable-browser.js", 28 | "./writable.js": "./writable-browser.js", 29 | "./duplex.js": "./duplex-browser.js", 30 | "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/nodejs/readable-stream/issues" 34 | }, 35 | "bundleDependencies": false, 36 | "dependencies": { 37 | "core-util-is": "~1.0.0", 38 | "inherits": "~2.0.3", 39 | "isarray": "~1.0.0", 40 | "process-nextick-args": "~2.0.0", 41 | "safe-buffer": "~5.1.1", 42 | "string_decoder": "~1.1.1", 43 | "util-deprecate": "~1.0.1" 44 | }, 45 | "deprecated": false, 46 | "description": "Streams3, a user-land copy of the stream library from Node.js", 47 | "devDependencies": { 48 | "assert": "^1.4.0", 49 | "babel-polyfill": "^6.9.1", 50 | "buffer": "^4.9.0", 51 | "lolex": "^2.3.2", 52 | "nyc": "^6.4.0", 53 | "tap": "^0.7.0", 54 | "tape": "^4.8.0" 55 | }, 56 | "homepage": "https://github.com/nodejs/readable-stream#readme", 57 | "keywords": [ 58 | "readable", 59 | "stream", 60 | "pipe" 61 | ], 62 | "license": "MIT", 63 | "main": "readable.js", 64 | "name": "readable-stream", 65 | "nyc": { 66 | "include": [ 67 | "lib/**.js" 68 | ] 69 | }, 70 | "repository": { 71 | "type": "git", 72 | "url": "git://github.com/nodejs/readable-stream.git" 73 | }, 74 | "scripts": { 75 | "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", 76 | "cover": "nyc npm test", 77 | "report": "nyc report --reporter=lcov", 78 | "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js" 79 | }, 80 | "version": "2.3.6" 81 | } 82 | -------------------------------------------------------------------------------- /node_modules/readable-stream/passthrough.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./readable').PassThrough 2 | -------------------------------------------------------------------------------- /node_modules/readable-stream/readable-browser.js: -------------------------------------------------------------------------------- 1 | exports = module.exports = require('./lib/_stream_readable.js'); 2 | exports.Stream = exports; 3 | exports.Readable = exports; 4 | exports.Writable = require('./lib/_stream_writable.js'); 5 | exports.Duplex = require('./lib/_stream_duplex.js'); 6 | exports.Transform = require('./lib/_stream_transform.js'); 7 | exports.PassThrough = require('./lib/_stream_passthrough.js'); 8 | -------------------------------------------------------------------------------- /node_modules/readable-stream/readable.js: -------------------------------------------------------------------------------- 1 | var Stream = require('stream'); 2 | if (process.env.READABLE_STREAM === 'disable' && Stream) { 3 | module.exports = Stream; 4 | exports = module.exports = Stream.Readable; 5 | exports.Readable = Stream.Readable; 6 | exports.Writable = Stream.Writable; 7 | exports.Duplex = Stream.Duplex; 8 | exports.Transform = Stream.Transform; 9 | exports.PassThrough = Stream.PassThrough; 10 | exports.Stream = Stream; 11 | } else { 12 | exports = module.exports = require('./lib/_stream_readable.js'); 13 | exports.Stream = Stream || exports; 14 | exports.Readable = exports; 15 | exports.Writable = require('./lib/_stream_writable.js'); 16 | exports.Duplex = require('./lib/_stream_duplex.js'); 17 | exports.Transform = require('./lib/_stream_transform.js'); 18 | exports.PassThrough = require('./lib/_stream_passthrough.js'); 19 | } 20 | -------------------------------------------------------------------------------- /node_modules/readable-stream/transform.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./readable').Transform 2 | -------------------------------------------------------------------------------- /node_modules/readable-stream/writable-browser.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/_stream_writable.js'); 2 | -------------------------------------------------------------------------------- /node_modules/readable-stream/writable.js: -------------------------------------------------------------------------------- 1 | var Stream = require("stream") 2 | var Writable = require("./lib/_stream_writable.js") 3 | 4 | if (process.env.READABLE_STREAM === 'disable') { 5 | module.exports = Stream && Stream.Writable || Writable 6 | } else { 7 | module.exports = Writable 8 | } 9 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Feross Aboukhadijeh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable node/no-deprecated-api */ 2 | var buffer = require('buffer') 3 | var Buffer = buffer.Buffer 4 | 5 | // alternative to using Object.keys for old browsers 6 | function copyProps (src, dst) { 7 | for (var key in src) { 8 | dst[key] = src[key] 9 | } 10 | } 11 | if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { 12 | module.exports = buffer 13 | } else { 14 | // Copy properties from require('buffer') 15 | copyProps(buffer, exports) 16 | exports.Buffer = SafeBuffer 17 | } 18 | 19 | function SafeBuffer (arg, encodingOrOffset, length) { 20 | return Buffer(arg, encodingOrOffset, length) 21 | } 22 | 23 | // Copy static methods from Buffer 24 | copyProps(Buffer, SafeBuffer) 25 | 26 | SafeBuffer.from = function (arg, encodingOrOffset, length) { 27 | if (typeof arg === 'number') { 28 | throw new TypeError('Argument must not be a number') 29 | } 30 | return Buffer(arg, encodingOrOffset, length) 31 | } 32 | 33 | SafeBuffer.alloc = function (size, fill, encoding) { 34 | if (typeof size !== 'number') { 35 | throw new TypeError('Argument must be a number') 36 | } 37 | var buf = Buffer(size) 38 | if (fill !== undefined) { 39 | if (typeof encoding === 'string') { 40 | buf.fill(fill, encoding) 41 | } else { 42 | buf.fill(fill) 43 | } 44 | } else { 45 | buf.fill(0) 46 | } 47 | return buf 48 | } 49 | 50 | SafeBuffer.allocUnsafe = function (size) { 51 | if (typeof size !== 'number') { 52 | throw new TypeError('Argument must be a number') 53 | } 54 | return Buffer(size) 55 | } 56 | 57 | SafeBuffer.allocUnsafeSlow = function (size) { 58 | if (typeof size !== 'number') { 59 | throw new TypeError('Argument must be a number') 60 | } 61 | return buffer.SlowBuffer(size) 62 | } 63 | -------------------------------------------------------------------------------- /node_modules/safe-buffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "safe-buffer@5.1.2", 3 | "_id": "safe-buffer@5.1.2", 4 | "_inBundle": false, 5 | "_integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=", 6 | "_location": "/safe-buffer", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "version", 10 | "registry": true, 11 | "raw": "safe-buffer@5.1.2", 12 | "name": "safe-buffer", 13 | "escapedName": "safe-buffer", 14 | "rawSpec": "5.1.2", 15 | "saveSpec": null, 16 | "fetchSpec": "5.1.2" 17 | }, 18 | "_requiredBy": [ 19 | "/mysql", 20 | "/readable-stream", 21 | "/string_decoder" 22 | ], 23 | "_resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz", 24 | "_shasum": "991ec69d296e0313747d59bdfd2b745c35f8828d", 25 | "_spec": "safe-buffer@5.1.2", 26 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\mysql", 27 | "author": { 28 | "name": "Feross Aboukhadijeh", 29 | "email": "feross@feross.org", 30 | "url": "http://feross.org" 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/feross/safe-buffer/issues" 34 | }, 35 | "bundleDependencies": false, 36 | "deprecated": false, 37 | "description": "Safer Node.js Buffer API", 38 | "devDependencies": { 39 | "standard": "*", 40 | "tape": "^4.0.0" 41 | }, 42 | "homepage": "https://github.com/feross/safe-buffer", 43 | "keywords": [ 44 | "buffer", 45 | "buffer allocate", 46 | "node security", 47 | "safe", 48 | "safe-buffer", 49 | "security", 50 | "uninitialized" 51 | ], 52 | "license": "MIT", 53 | "main": "index.js", 54 | "name": "safe-buffer", 55 | "repository": { 56 | "type": "git", 57 | "url": "git://github.com/feross/safe-buffer.git" 58 | }, 59 | "scripts": { 60 | "test": "standard && tape test/*.js" 61 | }, 62 | "types": "index.d.ts", 63 | "version": "5.1.2" 64 | } 65 | -------------------------------------------------------------------------------- /node_modules/sqlstring/HISTORY.md: -------------------------------------------------------------------------------- 1 | 2.3.1 / 2018-02-24 2 | ================== 3 | 4 | * Fix incorrectly replacing non-placeholders in SQL 5 | 6 | 2.3.0 / 2017-10-01 7 | ================== 8 | 9 | * Add `.toSqlString()` escape overriding 10 | * Add `raw` method to wrap raw strings for escape overriding 11 | * Small performance improvement on `escapeId` 12 | 13 | 2.2.0 / 2016-11-01 14 | ================== 15 | 16 | * Escape invalid `Date` objects as `NULL` 17 | 18 | 2.1.0 / 2016-09-26 19 | ================== 20 | 21 | * Accept numbers and other value types in `escapeId` 22 | * Run `buffer.toString()` through escaping 23 | 24 | 2.0.1 / 2016-06-06 25 | ================== 26 | 27 | * Fix npm package to include missing `lib/` directory 28 | 29 | 2.0.0 / 2016-06-06 30 | ================== 31 | 32 | * Bring repository up-to-date with `mysql` module changes 33 | * Support Node.js 0.6.x 34 | 35 | 1.0.0 / 2014-11-09 36 | ================== 37 | 38 | * Support Node.js 0.8.x 39 | 40 | 0.0.1 / 2014-02-25 41 | ================== 42 | 43 | * Initial release 44 | -------------------------------------------------------------------------------- /node_modules/sqlstring/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /node_modules/sqlstring/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/SqlString'); 2 | -------------------------------------------------------------------------------- /node_modules/sqlstring/lib/SqlString.js: -------------------------------------------------------------------------------- 1 | var SqlString = exports; 2 | 3 | var ID_GLOBAL_REGEXP = /`/g; 4 | var QUAL_GLOBAL_REGEXP = /\./g; 5 | var CHARS_GLOBAL_REGEXP = /[\0\b\t\n\r\x1a\"\'\\]/g; // eslint-disable-line no-control-regex 6 | var CHARS_ESCAPE_MAP = { 7 | '\0' : '\\0', 8 | '\b' : '\\b', 9 | '\t' : '\\t', 10 | '\n' : '\\n', 11 | '\r' : '\\r', 12 | '\x1a' : '\\Z', 13 | '"' : '\\"', 14 | '\'' : '\\\'', 15 | '\\' : '\\\\' 16 | }; 17 | 18 | SqlString.escapeId = function escapeId(val, forbidQualified) { 19 | if (Array.isArray(val)) { 20 | var sql = ''; 21 | 22 | for (var i = 0; i < val.length; i++) { 23 | sql += (i === 0 ? '' : ', ') + SqlString.escapeId(val[i], forbidQualified); 24 | } 25 | 26 | return sql; 27 | } else if (forbidQualified) { 28 | return '`' + String(val).replace(ID_GLOBAL_REGEXP, '``') + '`'; 29 | } else { 30 | return '`' + String(val).replace(ID_GLOBAL_REGEXP, '``').replace(QUAL_GLOBAL_REGEXP, '`.`') + '`'; 31 | } 32 | }; 33 | 34 | SqlString.escape = function escape(val, stringifyObjects, timeZone) { 35 | if (val === undefined || val === null) { 36 | return 'NULL'; 37 | } 38 | 39 | switch (typeof val) { 40 | case 'boolean': return (val) ? 'true' : 'false'; 41 | case 'number': return val + ''; 42 | case 'object': 43 | if (val instanceof Date) { 44 | return SqlString.dateToString(val, timeZone || 'local'); 45 | } else if (Array.isArray(val)) { 46 | return SqlString.arrayToList(val, timeZone); 47 | } else if (Buffer.isBuffer(val)) { 48 | return SqlString.bufferToString(val); 49 | } else if (typeof val.toSqlString === 'function') { 50 | return String(val.toSqlString()); 51 | } else if (stringifyObjects) { 52 | return escapeString(val.toString()); 53 | } else { 54 | return SqlString.objectToValues(val, timeZone); 55 | } 56 | default: return escapeString(val); 57 | } 58 | }; 59 | 60 | SqlString.arrayToList = function arrayToList(array, timeZone) { 61 | var sql = ''; 62 | 63 | for (var i = 0; i < array.length; i++) { 64 | var val = array[i]; 65 | 66 | if (Array.isArray(val)) { 67 | sql += (i === 0 ? '' : ', ') + '(' + SqlString.arrayToList(val, timeZone) + ')'; 68 | } else { 69 | sql += (i === 0 ? '' : ', ') + SqlString.escape(val, true, timeZone); 70 | } 71 | } 72 | 73 | return sql; 74 | }; 75 | 76 | SqlString.format = function format(sql, values, stringifyObjects, timeZone) { 77 | if (values == null) { 78 | return sql; 79 | } 80 | 81 | if (!(values instanceof Array || Array.isArray(values))) { 82 | values = [values]; 83 | } 84 | 85 | var chunkIndex = 0; 86 | var placeholdersRegex = /\?+/g; 87 | var result = ''; 88 | var valuesIndex = 0; 89 | var match; 90 | 91 | while (valuesIndex < values.length && (match = placeholdersRegex.exec(sql))) { 92 | var len = match[0].length; 93 | 94 | if (len > 2) { 95 | continue; 96 | } 97 | 98 | var value = len === 2 99 | ? SqlString.escapeId(values[valuesIndex]) 100 | : SqlString.escape(values[valuesIndex], stringifyObjects, timeZone); 101 | 102 | result += sql.slice(chunkIndex, match.index) + value; 103 | chunkIndex = placeholdersRegex.lastIndex; 104 | valuesIndex++; 105 | } 106 | 107 | if (chunkIndex === 0) { 108 | // Nothing was replaced 109 | return sql; 110 | } 111 | 112 | if (chunkIndex < sql.length) { 113 | return result + sql.slice(chunkIndex); 114 | } 115 | 116 | return result; 117 | }; 118 | 119 | SqlString.dateToString = function dateToString(date, timeZone) { 120 | var dt = new Date(date); 121 | 122 | if (isNaN(dt.getTime())) { 123 | return 'NULL'; 124 | } 125 | 126 | var year; 127 | var month; 128 | var day; 129 | var hour; 130 | var minute; 131 | var second; 132 | var millisecond; 133 | 134 | if (timeZone === 'local') { 135 | year = dt.getFullYear(); 136 | month = dt.getMonth() + 1; 137 | day = dt.getDate(); 138 | hour = dt.getHours(); 139 | minute = dt.getMinutes(); 140 | second = dt.getSeconds(); 141 | millisecond = dt.getMilliseconds(); 142 | } else { 143 | var tz = convertTimezone(timeZone); 144 | 145 | if (tz !== false && tz !== 0) { 146 | dt.setTime(dt.getTime() + (tz * 60000)); 147 | } 148 | 149 | year = dt.getUTCFullYear(); 150 | month = dt.getUTCMonth() + 1; 151 | day = dt.getUTCDate(); 152 | hour = dt.getUTCHours(); 153 | minute = dt.getUTCMinutes(); 154 | second = dt.getUTCSeconds(); 155 | millisecond = dt.getUTCMilliseconds(); 156 | } 157 | 158 | // YYYY-MM-DD HH:mm:ss.mmm 159 | var str = zeroPad(year, 4) + '-' + zeroPad(month, 2) + '-' + zeroPad(day, 2) + ' ' + 160 | zeroPad(hour, 2) + ':' + zeroPad(minute, 2) + ':' + zeroPad(second, 2) + '.' + 161 | zeroPad(millisecond, 3); 162 | 163 | return escapeString(str); 164 | }; 165 | 166 | SqlString.bufferToString = function bufferToString(buffer) { 167 | return 'X' + escapeString(buffer.toString('hex')); 168 | }; 169 | 170 | SqlString.objectToValues = function objectToValues(object, timeZone) { 171 | var sql = ''; 172 | 173 | for (var key in object) { 174 | var val = object[key]; 175 | 176 | if (typeof val === 'function') { 177 | continue; 178 | } 179 | 180 | sql += (sql.length === 0 ? '' : ', ') + SqlString.escapeId(key) + ' = ' + SqlString.escape(val, true, timeZone); 181 | } 182 | 183 | return sql; 184 | }; 185 | 186 | SqlString.raw = function raw(sql) { 187 | if (typeof sql !== 'string') { 188 | throw new TypeError('argument sql must be a string'); 189 | } 190 | 191 | return { 192 | toSqlString: function toSqlString() { return sql; } 193 | }; 194 | }; 195 | 196 | function escapeString(val) { 197 | var chunkIndex = CHARS_GLOBAL_REGEXP.lastIndex = 0; 198 | var escapedVal = ''; 199 | var match; 200 | 201 | while ((match = CHARS_GLOBAL_REGEXP.exec(val))) { 202 | escapedVal += val.slice(chunkIndex, match.index) + CHARS_ESCAPE_MAP[match[0]]; 203 | chunkIndex = CHARS_GLOBAL_REGEXP.lastIndex; 204 | } 205 | 206 | if (chunkIndex === 0) { 207 | // Nothing was escaped 208 | return "'" + val + "'"; 209 | } 210 | 211 | if (chunkIndex < val.length) { 212 | return "'" + escapedVal + val.slice(chunkIndex) + "'"; 213 | } 214 | 215 | return "'" + escapedVal + "'"; 216 | } 217 | 218 | function zeroPad(number, length) { 219 | number = number.toString(); 220 | while (number.length < length) { 221 | number = '0' + number; 222 | } 223 | 224 | return number; 225 | } 226 | 227 | function convertTimezone(tz) { 228 | if (tz === 'Z') { 229 | return 0; 230 | } 231 | 232 | var m = tz.match(/([\+\-\s])(\d\d):?(\d\d)?/); 233 | if (m) { 234 | return (m[1] === '-' ? -1 : 1) * (parseInt(m[2], 10) + ((m[3] ? parseInt(m[3], 10) : 0) / 60)) * 60; 235 | } 236 | return false; 237 | } 238 | -------------------------------------------------------------------------------- /node_modules/sqlstring/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "sqlstring@2.3.1", 3 | "_id": "sqlstring@2.3.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A=", 6 | "_location": "/sqlstring", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "version", 10 | "registry": true, 11 | "raw": "sqlstring@2.3.1", 12 | "name": "sqlstring", 13 | "escapedName": "sqlstring", 14 | "rawSpec": "2.3.1", 15 | "saveSpec": null, 16 | "fetchSpec": "2.3.1" 17 | }, 18 | "_requiredBy": [ 19 | "/mysql" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/sqlstring/download/sqlstring-2.3.1.tgz", 22 | "_shasum": "475393ff9e91479aea62dcaf0ca3d14983a7fb40", 23 | "_spec": "sqlstring@2.3.1", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\mysql", 25 | "bugs": { 26 | "url": "https://github.com/mysqljs/sqlstring/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "contributors": [ 30 | { 31 | "name": "Adri Van Houdt", 32 | "email": "adri.van.houdt@gmail.com" 33 | }, 34 | { 35 | "name": "Douglas Christopher Wilson", 36 | "email": "doug@somethingdoug.com" 37 | }, 38 | { 39 | "name": "fengmk2", 40 | "email": "fengmk2@gmail.com", 41 | "url": "http://fengmk2.github.com" 42 | }, 43 | { 44 | "name": "Kevin Jose Martin", 45 | "email": "kevin@tiliq.com" 46 | }, 47 | { 48 | "name": "Nathan Woltman", 49 | "email": "nwoltman@outlook.com" 50 | }, 51 | { 52 | "name": "Sergej Sintschilin", 53 | "email": "seregpie@gmail.com" 54 | } 55 | ], 56 | "deprecated": false, 57 | "description": "Simple SQL escape and format for MySQL", 58 | "devDependencies": { 59 | "beautify-benchmark": "0.2.4", 60 | "benchmark": "2.1.4", 61 | "eslint": "4.18.1", 62 | "eslint-plugin-markdown": "1.0.0-beta.6", 63 | "nyc": "10.3.2", 64 | "urun": "0.0.8", 65 | "utest": "0.0.8" 66 | }, 67 | "engines": { 68 | "node": ">= 0.6" 69 | }, 70 | "files": [ 71 | "lib/", 72 | "HISTORY.md", 73 | "LICENSE", 74 | "README.md", 75 | "index.js" 76 | ], 77 | "homepage": "https://github.com/mysqljs/sqlstring#readme", 78 | "keywords": [ 79 | "sqlstring", 80 | "sql", 81 | "escape", 82 | "sql escape" 83 | ], 84 | "license": "MIT", 85 | "name": "sqlstring", 86 | "repository": { 87 | "type": "git", 88 | "url": "git+https://github.com/mysqljs/sqlstring.git" 89 | }, 90 | "scripts": { 91 | "bench": "node benchmark/index.js", 92 | "lint": "eslint --plugin markdown --ext js,md .", 93 | "test": "node test/run.js", 94 | "test-ci": "nyc --reporter=text npm test", 95 | "test-cov": "nyc --reporter=html --reporter=text npm test" 96 | }, 97 | "version": "2.3.1" 98 | } 99 | -------------------------------------------------------------------------------- /node_modules/string_decoder/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | before_install: 4 | - npm install -g npm@2 5 | - test $NPM_LEGACY && npm install -g npm@latest-3 || npm install npm -g 6 | notifications: 7 | email: false 8 | matrix: 9 | fast_finish: true 10 | include: 11 | - node_js: '0.8' 12 | env: 13 | - TASK=test 14 | - NPM_LEGACY=true 15 | - node_js: '0.10' 16 | env: 17 | - TASK=test 18 | - NPM_LEGACY=true 19 | - node_js: '0.11' 20 | env: 21 | - TASK=test 22 | - NPM_LEGACY=true 23 | - node_js: '0.12' 24 | env: 25 | - TASK=test 26 | - NPM_LEGACY=true 27 | - node_js: 1 28 | env: 29 | - TASK=test 30 | - NPM_LEGACY=true 31 | - node_js: 2 32 | env: 33 | - TASK=test 34 | - NPM_LEGACY=true 35 | - node_js: 3 36 | env: 37 | - TASK=test 38 | - NPM_LEGACY=true 39 | - node_js: 4 40 | env: TASK=test 41 | - node_js: 5 42 | env: TASK=test 43 | - node_js: 6 44 | env: TASK=test 45 | - node_js: 7 46 | env: TASK=test 47 | - node_js: 8 48 | env: TASK=test 49 | - node_js: 9 50 | env: TASK=test 51 | -------------------------------------------------------------------------------- /node_modules/string_decoder/LICENSE: -------------------------------------------------------------------------------- 1 | Node.js is licensed for use as follows: 2 | 3 | """ 4 | Copyright Node.js contributors. All rights reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | sell copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 | IN THE SOFTWARE. 23 | """ 24 | 25 | This license applies to parts of Node.js originating from the 26 | https://github.com/joyent/node repository: 27 | 28 | """ 29 | Copyright Joyent, Inc. and other Node contributors. All rights reserved. 30 | Permission is hereby granted, free of charge, to any person obtaining a copy 31 | of this software and associated documentation files (the "Software"), to 32 | deal in the Software without restriction, including without limitation the 33 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 34 | sell copies of the Software, and to permit persons to whom the Software is 35 | furnished to do so, subject to the following conditions: 36 | 37 | The above copyright notice and this permission notice shall be included in 38 | all copies or substantial portions of the Software. 39 | 40 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 42 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 44 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 45 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 46 | IN THE SOFTWARE. 47 | """ 48 | 49 | -------------------------------------------------------------------------------- /node_modules/string_decoder/README.md: -------------------------------------------------------------------------------- 1 | # string_decoder 2 | 3 | ***Node-core v8.9.4 string_decoder for userland*** 4 | 5 | 6 | [![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/) 7 | [![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/) 8 | 9 | 10 | ```bash 11 | npm install --save string_decoder 12 | ``` 13 | 14 | ***Node-core string_decoder for userland*** 15 | 16 | This package is a mirror of the string_decoder implementation in Node-core. 17 | 18 | Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/). 19 | 20 | As of version 1.0.0 **string_decoder** uses semantic versioning. 21 | 22 | ## Previous versions 23 | 24 | Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. 25 | 26 | ## Update 27 | 28 | The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version. 29 | 30 | ## Streams Working Group 31 | 32 | `string_decoder` is maintained by the Streams Working Group, which 33 | oversees the development and maintenance of the Streams API within 34 | Node.js. The responsibilities of the Streams Working Group include: 35 | 36 | * Addressing stream issues on the Node.js issue tracker. 37 | * Authoring and editing stream documentation within the Node.js project. 38 | * Reviewing changes to stream subclasses within the Node.js project. 39 | * Redirecting changes to streams from the Node.js project to this 40 | project. 41 | * Assisting in the implementation of stream providers within Node.js. 42 | * Recommending versions of `readable-stream` to be included in Node.js. 43 | * Messaging about the future of streams to give the community advance 44 | notice of changes. 45 | 46 | See [readable-stream](https://github.com/nodejs/readable-stream) for 47 | more details. 48 | -------------------------------------------------------------------------------- /node_modules/string_decoder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "string_decoder@~1.1.1", 3 | "_id": "string_decoder@1.1.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", 6 | "_location": "/string_decoder", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "string_decoder@~1.1.1", 12 | "name": "string_decoder", 13 | "escapedName": "string_decoder", 14 | "rawSpec": "~1.1.1", 15 | "saveSpec": null, 16 | "fetchSpec": "~1.1.1" 17 | }, 18 | "_requiredBy": [ 19 | "/readable-stream" 20 | ], 21 | "_resolved": "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz?cache=0&sync_timestamp=1565170823020&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring_decoder%2Fdownload%2Fstring_decoder-1.1.1.tgz", 22 | "_shasum": "9cf1611ba62685d7030ae9e4ba34149c3af03fc8", 23 | "_spec": "string_decoder@~1.1.1", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\readable-stream", 25 | "bugs": { 26 | "url": "https://github.com/nodejs/string_decoder/issues" 27 | }, 28 | "bundleDependencies": false, 29 | "dependencies": { 30 | "safe-buffer": "~5.1.0" 31 | }, 32 | "deprecated": false, 33 | "description": "The string_decoder module from Node core", 34 | "devDependencies": { 35 | "babel-polyfill": "^6.23.0", 36 | "core-util-is": "^1.0.2", 37 | "inherits": "^2.0.3", 38 | "tap": "~0.4.8" 39 | }, 40 | "homepage": "https://github.com/nodejs/string_decoder", 41 | "keywords": [ 42 | "string", 43 | "decoder", 44 | "browser", 45 | "browserify" 46 | ], 47 | "license": "MIT", 48 | "main": "lib/string_decoder.js", 49 | "name": "string_decoder", 50 | "repository": { 51 | "type": "git", 52 | "url": "git://github.com/nodejs/string_decoder.git" 53 | }, 54 | "scripts": { 55 | "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js", 56 | "test": "tap test/parallel/*.js && node test/verify-dependencies" 57 | }, 58 | "version": "1.1.1" 59 | } 60 | -------------------------------------------------------------------------------- /node_modules/util-deprecate/History.md: -------------------------------------------------------------------------------- 1 | 2 | 1.0.2 / 2015-10-07 3 | ================== 4 | 5 | * use try/catch when checking `localStorage` (#3, @kumavis) 6 | 7 | 1.0.1 / 2014-11-25 8 | ================== 9 | 10 | * browser: use `console.warn()` for deprecation calls 11 | * browser: more jsdocs 12 | 13 | 1.0.0 / 2014-04-30 14 | ================== 15 | 16 | * initial commit 17 | -------------------------------------------------------------------------------- /node_modules/util-deprecate/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Nathan Rajlich 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /node_modules/util-deprecate/README.md: -------------------------------------------------------------------------------- 1 | util-deprecate 2 | ============== 3 | ### The Node.js `util.deprecate()` function with browser support 4 | 5 | In Node.js, this module simply re-exports the `util.deprecate()` function. 6 | 7 | In the web browser (i.e. via browserify), a browser-specific implementation 8 | of the `util.deprecate()` function is used. 9 | 10 | 11 | ## API 12 | 13 | A `deprecate()` function is the only thing exposed by this module. 14 | 15 | ``` javascript 16 | // setup: 17 | exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); 18 | 19 | 20 | // users see: 21 | foo(); 22 | // foo() is deprecated, use bar() instead 23 | foo(); 24 | foo(); 25 | ``` 26 | 27 | 28 | ## License 29 | 30 | (The MIT License) 31 | 32 | Copyright (c) 2014 Nathan Rajlich 33 | 34 | Permission is hereby granted, free of charge, to any person 35 | obtaining a copy of this software and associated documentation 36 | files (the "Software"), to deal in the Software without 37 | restriction, including without limitation the rights to use, 38 | copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the 40 | Software is furnished to do so, subject to the following 41 | conditions: 42 | 43 | The above copyright notice and this permission notice shall be 44 | included in all copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 47 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 48 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 49 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 50 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 51 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 52 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 53 | OTHER DEALINGS IN THE SOFTWARE. 54 | -------------------------------------------------------------------------------- /node_modules/util-deprecate/browser.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module exports. 4 | */ 5 | 6 | module.exports = deprecate; 7 | 8 | /** 9 | * Mark that a method should not be used. 10 | * Returns a modified function which warns once by default. 11 | * 12 | * If `localStorage.noDeprecation = true` is set, then it is a no-op. 13 | * 14 | * If `localStorage.throwDeprecation = true` is set, then deprecated functions 15 | * will throw an Error when invoked. 16 | * 17 | * If `localStorage.traceDeprecation = true` is set, then deprecated functions 18 | * will invoke `console.trace()` instead of `console.error()`. 19 | * 20 | * @param {Function} fn - the function to deprecate 21 | * @param {String} msg - the string to print to the console when `fn` is invoked 22 | * @returns {Function} a new "deprecated" version of `fn` 23 | * @api public 24 | */ 25 | 26 | function deprecate (fn, msg) { 27 | if (config('noDeprecation')) { 28 | return fn; 29 | } 30 | 31 | var warned = false; 32 | function deprecated() { 33 | if (!warned) { 34 | if (config('throwDeprecation')) { 35 | throw new Error(msg); 36 | } else if (config('traceDeprecation')) { 37 | console.trace(msg); 38 | } else { 39 | console.warn(msg); 40 | } 41 | warned = true; 42 | } 43 | return fn.apply(this, arguments); 44 | } 45 | 46 | return deprecated; 47 | } 48 | 49 | /** 50 | * Checks `localStorage` for boolean values for the given `name`. 51 | * 52 | * @param {String} name 53 | * @returns {Boolean} 54 | * @api private 55 | */ 56 | 57 | function config (name) { 58 | // accessing global.localStorage can trigger a DOMException in sandboxed iframes 59 | try { 60 | if (!global.localStorage) return false; 61 | } catch (_) { 62 | return false; 63 | } 64 | var val = global.localStorage[name]; 65 | if (null == val) return false; 66 | return String(val).toLowerCase() === 'true'; 67 | } 68 | -------------------------------------------------------------------------------- /node_modules/util-deprecate/node.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * For Node.js, simply re-export the core `util.deprecate` function. 4 | */ 5 | 6 | module.exports = require('util').deprecate; 7 | -------------------------------------------------------------------------------- /node_modules/util-deprecate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "util-deprecate@~1.0.1", 3 | "_id": "util-deprecate@1.0.2", 4 | "_inBundle": false, 5 | "_integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 6 | "_location": "/util-deprecate", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "util-deprecate@~1.0.1", 12 | "name": "util-deprecate", 13 | "escapedName": "util-deprecate", 14 | "rawSpec": "~1.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "~1.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/readable-stream" 20 | ], 21 | "_resolved": "http://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz", 22 | "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", 23 | "_spec": "util-deprecate@~1.0.1", 24 | "_where": "C:\\Users\\张晓坤\\Desktop\\张晓坤前端备课资料\\全天模式\\07-Nodejs\\mysql-ithmDev\\node_modules\\readable-stream", 25 | "author": { 26 | "name": "Nathan Rajlich", 27 | "email": "nathan@tootallnate.net", 28 | "url": "http://n8.io/" 29 | }, 30 | "browser": "browser.js", 31 | "bugs": { 32 | "url": "https://github.com/TooTallNate/util-deprecate/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "deprecated": false, 36 | "description": "The Node.js `util.deprecate()` function with browser support", 37 | "homepage": "https://github.com/TooTallNate/util-deprecate", 38 | "keywords": [ 39 | "util", 40 | "deprecate", 41 | "browserify", 42 | "browser", 43 | "node" 44 | ], 45 | "license": "MIT", 46 | "main": "node.js", 47 | "name": "util-deprecate", 48 | "repository": { 49 | "type": "git", 50 | "url": "git://github.com/TooTallNate/util-deprecate.git" 51 | }, 52 | "scripts": { 53 | "test": "echo \"Error: no test specified\" && exit 1" 54 | }, 55 | "version": "1.0.2" 56 | } 57 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mysql-ithm", 3 | "version": "2.0.2", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "bignumber.js": { 8 | "version": "7.2.1", 9 | "resolved": "https://registry.npm.taobao.org/bignumber.js/download/bignumber.js-7.2.1.tgz", 10 | "integrity": "sha1-gMBIdZ2CaACAfEv9Uh5Q7bulel8=", 11 | "dev": true 12 | }, 13 | "core-util-is": { 14 | "version": "1.0.2", 15 | "resolved": "http://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz", 16 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 17 | "dev": true 18 | }, 19 | "inherits": { 20 | "version": "2.0.4", 21 | "resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.4.tgz", 22 | "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=", 23 | "dev": true 24 | }, 25 | "isarray": { 26 | "version": "1.0.0", 27 | "resolved": "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz?cache=0&sync_timestamp=1562592096220&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fisarray%2Fdownload%2Fisarray-1.0.0.tgz", 28 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 29 | "dev": true 30 | }, 31 | "mysql": { 32 | "version": "2.17.1", 33 | "resolved": "https://registry.npm.taobao.org/mysql/download/mysql-2.17.1.tgz", 34 | "integrity": "sha1-YrukoDmpsvc2OM0WUs5Q/G9oKJk=", 35 | "dev": true, 36 | "requires": { 37 | "bignumber.js": "7.2.1", 38 | "readable-stream": "2.3.6", 39 | "safe-buffer": "5.1.2", 40 | "sqlstring": "2.3.1" 41 | } 42 | }, 43 | "process-nextick-args": { 44 | "version": "2.0.1", 45 | "resolved": "https://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.1.tgz", 46 | "integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I=", 47 | "dev": true 48 | }, 49 | "readable-stream": { 50 | "version": "2.3.6", 51 | "resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.3.6.tgz", 52 | "integrity": "sha1-sRwn2IuP8fvgcGQ8+UsMea4bCq8=", 53 | "dev": true, 54 | "requires": { 55 | "core-util-is": "~1.0.0", 56 | "inherits": "~2.0.3", 57 | "isarray": "~1.0.0", 58 | "process-nextick-args": "~2.0.0", 59 | "safe-buffer": "~5.1.1", 60 | "string_decoder": "~1.1.1", 61 | "util-deprecate": "~1.0.1" 62 | } 63 | }, 64 | "safe-buffer": { 65 | "version": "5.1.2", 66 | "resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz", 67 | "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0=", 68 | "dev": true 69 | }, 70 | "sqlstring": { 71 | "version": "2.3.1", 72 | "resolved": "https://registry.npm.taobao.org/sqlstring/download/sqlstring-2.3.1.tgz", 73 | "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A=", 74 | "dev": true 75 | }, 76 | "string_decoder": { 77 | "version": "1.1.1", 78 | "resolved": "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.1.1.tgz?cache=0&sync_timestamp=1565170823020&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring_decoder%2Fdownload%2Fstring_decoder-1.1.1.tgz", 79 | "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", 80 | "dev": true, 81 | "requires": { 82 | "safe-buffer": "~5.1.0" 83 | } 84 | }, 85 | "util-deprecate": { 86 | "version": "1.0.2", 87 | "resolved": "http://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz", 88 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 89 | "dev": true 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mysql-ithm", 3 | "version": "2.2.4", 4 | "description": "\u0016一款nodejs操作mysql数据库的orm库", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "\u001b[A\u001b[:npm i mysql-ithm\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[Dmstall\u001b[D\u001b[D\u001b[D\u001b[D\u001b[n\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D \u001b[C\u001b[C\u001b mysql-ithm" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/kxzkane/mysql-ithm.git" 12 | }, 13 | "keywords": [ 14 | "mysql", 15 | "orm" 16 | ], 17 | "author": "张晓坤", 18 | "license": "ISC", 19 | "bugs": { 20 | "url": "https://github.com/kxzkane/mysql-ithm/issues" 21 | }, 22 | "homepage": "https://github.com/kxzkane/mysql-ithm#readme", 23 | "dependencies": { 24 | "mysql": "~2.17.1" 25 | }, 26 | "devDependencies": { 27 | "mysql": "~2.17.1" 28 | } 29 | 30 | } 31 | 32 | --------------------------------------------------------------------------------