* Prepares the query on a single host or on all hosts depending on the options. * Uses the info 'prepared' event to emit the result. * @param {Object} info * @param {String} query * @param {String} keyspace * @returns {Promise<{queryId, meta}>}
(info, query, keyspace)
| 101 | * @returns {Promise<{queryId, meta}>} |
| 102 | */ |
| 103 | async _prepare(info, query, keyspace) { |
| 104 | info.preparing = true; |
| 105 | let iterator; |
| 106 | |
| 107 | try { |
| 108 | iterator = await promiseUtils.newQueryPlan(this._loadBalancing, keyspace, null); |
| 109 | return await this._prepareWithQueryPlan(info, iterator, query, keyspace); |
| 110 | } catch (err) { |
| 111 | info.preparing = false; |
| 112 | err.query = query; |
| 113 | info.emit('prepared', err); |
| 114 | |
| 115 | throw err; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Uses the query plan to prepare the query on the first host and optionally on the rest of the hosts. |
no test coverage detected