Module cursor

Client side DB cursor represents record set of query.

Copyright © 2010-2014 Alexei Krasnopolski

Version: 1.2.4

Introduced in: 2014-03-08

Authors: Alexei Krasnopolski (krasnop@bellsouth.net) [web site: http://krasnopolski.org/].

Description

Client side DB cursor represents record set of query. Cursor allows easy navigate througth record set and retrieve field values by name or index. Cursor owns to process created it and can not access concurrently.

Function Index

back/1Move cursor pointer back to the previous position.
foreach/2Returns list of values of Name field from all rows of record set.
get/2Get value of field with Name.
new/1Creates new cursor from result record set obtained after db query.
new/2Creates new cursor with regestered name from result record set obtained after db query.
next/1Move cursor pointer to the next position.
reset/1Reset cursor pointer to the beginning position.
set/2Set I as a new positions of the cursor pointer.
size/1Get size (number of rows) of the cursor.
skip/2Skip I positions and set cursor pointer to the position.

Function Details

new/1

new(DB_result_set::tuple()) -> pid()

Creates new cursor from result record set obtained after db query.

new/2

new(Name::atom(), DB_result_set::tuple()) -> pid()

Creates new cursor with regestered name from result record set obtained after db query.

size/1

size(CursorId) -> integer()

Get size (number of rows) of the cursor.

next/1

next(CursorId) -> boolean()

Move cursor pointer to the next position. Returns false if pointer already on the end of cursor.

skip/2

skip(CursorId, I::integer()) -> integer()

Skip I positions and set cursor pointer to the position. Returns number actualy skipped positions.

back/1

back(CursorId) -> boolean()

Move cursor pointer back to the previous position. Returns false if pointer already on the beginning of cursor.

set/2

set(CursorId, I::integer()) -> boolean()

Set I as a new positions of the cursor pointer. Returns false if I is out of the range.

reset/1

reset(CursorId) -> boolean()

Reset cursor pointer to the beginning position.

get/2

get(CursorId, Name) -> Result

Get value of field with Name. Name can be string name of field or index in row list.

foreach/2

foreach(CursorId, Name) -> Result

Returns list of values of Name field from all rows of record set. Name can be string name of field or index in row list.


Generated by EDoc, Mar 19 2014, 23:27:00.