| 9 | |
| 10 | class Cursor extends EventEmitter { |
| 11 | constructor(text, values, config) { |
| 12 | super() |
| 13 | |
| 14 | this._conf = config || {} |
| 15 | this.text = text |
| 16 | this.values = values ? values.map(prepare) : null |
| 17 | this.connection = null |
| 18 | this._queue = [] |
| 19 | this.state = 'initialized' |
| 20 | this._result = new Result(this._conf.rowMode, this._conf.types) |
| 21 | this._Promise = this._conf.Promise || global.Promise |
| 22 | this._cb = null |
| 23 | this._rows = null |
| 24 | this._portal = null |
| 25 | this._ifNoData = this._ifNoData.bind(this) |
| 26 | this._rowDescription = this._rowDescription.bind(this) |
| 27 | } |
| 28 | |
| 29 | _ifNoData() { |
| 30 | this.state = 'idle' |