| 223 | |
| 224 | |
| 225 | class IteratorResult(_CommonResult): |
| 226 | NUMBER = 1_000 |
| 227 | |
| 228 | impl: result.IteratorResult |
| 229 | |
| 230 | @staticmethod |
| 231 | def python(): |
| 232 | py_result = _CommonResult._load_python_module() |
| 233 | |
| 234 | PyIteratorResult = _CommonResult._make_subclass( |
| 235 | "PyIteratorResult", |
| 236 | py_result.BaseResultInternal, |
| 237 | result.IteratorResult, |
| 238 | ) |
| 239 | |
| 240 | assert PyIteratorResult._allrows.__class__ is FunctionType |
| 241 | return PyIteratorResult |
| 242 | |
| 243 | @staticmethod |
| 244 | def cython(): |
| 245 | from sqlalchemy.engine import _result_cy |
| 246 | |
| 247 | assert _result_cy._is_compiled() |
| 248 | |
| 249 | assert result.IteratorResult._allrows.__class__ is not FunctionType |
| 250 | return result.IteratorResult |
| 251 | |
| 252 | IMPLEMENTATIONS = { |
| 253 | "python": python.__func__, |
| 254 | "cython": cython.__func__, |
| 255 | } |
| 256 | |
| 257 | @classmethod |
| 258 | def get_init_args_callable( |
| 259 | cls, definition: Definition, data: list |
| 260 | ) -> Callable: |
| 261 | meta = result.SimpleResultMetaData( |
| 262 | definition.columns, |
| 263 | _processors=definition.processors, |
| 264 | _tuplefilter=definition.tuplefilter, |
| 265 | ) |
| 266 | return lambda: (meta, iter(data)) |
| 267 | |
| 268 | |
| 269 | class CursorResult(_CommonResult): |
no outgoing calls