d2sqlite3 icon indicating copy to clipboard operation
d2sqlite3 copied to clipboard

Add length property

Open FraMecca opened this issue 8 years ago • 4 comments

It is useful for test, currently WalkLength pops elements

FraMecca avatar Oct 07 '17 01:10 FraMecca

Sorry, can you elaborate on where you would like to have a length property ?

biozic avatar Nov 01 '17 15:11 biozic

I'd like to have a lenght on ResultEntities instances that could be useful for tests and other conditions. At the current state it is only possible to know if the range is empty or not.

FraMecca avatar Nov 06 '17 07:11 FraMecca

You mean a length property that returns the total number of Rows in a ResultRange, right? There's no API to do that in SQLite: the rows are just stepped over until there is none. You should use SQL for this (or maybe use the deprecated not-recommended sqlite_get_table function).

biozic avatar Nov 06 '17 11:11 biozic

This can be simulated by using: SELECT count(*) FROM... which gives you the length of the result set. SQLite is pretty quick so the costs are not to high.

Robert-M-Muench avatar Jun 29 '18 15:06 Robert-M-Muench