* Prepares all queries on a single host. * @param {Host} host * @param {Array} allPrepared
(host, allPrepared)
| 206 | * @param {Array} allPrepared |
| 207 | */ |
| 208 | static async prepareAllQueries(host, allPrepared) { |
| 209 | const anyKeyspaceQueries = []; |
| 210 | |
| 211 | const queriesByKeyspace = new Map(); |
| 212 | allPrepared.forEach(info => { |
| 213 | let arr; |
| 214 | if (info.keyspace) { |
| 215 | arr = queriesByKeyspace.get(info.keyspace); |
| 216 | |
| 217 | if (!arr) { |
| 218 | arr = []; |
| 219 | queriesByKeyspace.set(info.keyspace, arr); |
| 220 | } |
| 221 | } else { |
| 222 | arr = anyKeyspaceQueries; |
| 223 | } |
| 224 | |
| 225 | arr.push(info.query); |
| 226 | }); |
| 227 | |
| 228 | for (const [keyspace, queries] of queriesByKeyspace) { |
| 229 | await PrepareHandler._borrowAndPrepare(host, keyspace, queries); |
| 230 | } |
| 231 | |
| 232 | await PrepareHandler._borrowAndPrepare(host, null, anyKeyspaceQueries); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Borrows a connection from the host and prepares the queries provided. |
no test coverage detected