| 596 | |
| 597 | // The clauses that cap a statement at `rows` rows, for `SELECT ${top} ... ${limit}`. |
| 598 | const rowCap = (rows: number) => ({ |
| 599 | top: sql.onDialectOrElse({ mssql: () => sql.literal(`TOP (${rows})`), orElse: () => noClause }), |
| 600 | limit: sql.onDialectOrElse({ mssql: () => noClause, orElse: () => sql.literal(`LIMIT ${rows}`) }) |
| 601 | }) |
| 602 | const { limit, top } = rowCap(pageSize) |
| 603 | const { limit: chunkLimit, top: chunkTop } = rowCap(pruneChunkRows) |
| 604 | // Streams rows in key order, one page per statement. |