Buffered rows, column values and binary data. More...
Classes | |
| class | Blob |
| Copy-on-write binary large object. More... | |
| class | Result |
| Buffered query result with random-access rows. More... | |
| class | Row |
| One row of a buffered query result. More... | |
| class | Value |
| One column value of a query result. More... | |
A Result is a query result held entirely in memory. Rows are addressed by index and visited with a random-access iterator, so the set can be walked more than once and in any order. size() is the number of rows. getFieldCount() is the number of columns. empty() is true when there are no rows. operator[] and getRow() return a Row at an index without range checking.
A Row is one of those rows. Columns are addressed by index. size() is the column count. getValue() and operator[] return a Value. Typed getters such as getInt() and getString() convert that column. isNull() reports SQL NULL at an index. The row also has a random-access iterator over its values.
A Value is one column. isNull() is true for SQL NULL and for an unbound value. Typed getters convert the stored value; a null or a conversion that cannot be performed throws TypeMismatch. getBlob() writes binary data into a Blob.
Blob is a copy-on-write binary value. data() and size() describe the bytes. assign() replaces them. Equality compares the bytes.
Result, Row, Value and Blob are shared values. Copying is cheap. They do not keep the connection busy: once a Result is returned, the connection can run another statement.
Use a Result when the whole set fits in memory and random access is useful. Use a Cursor when the set is large and rows should arrive in batches.