Difference between revisions of "Freeside:3:Documentation:Developer/FS/Cursor"
From Freeside
(Edit via perl MediaWiki framework (1.13)) |
m (Edit via perl MediaWiki framework (1.13)) |
(One intermediate revision by the same user not shown) | |
(No difference)
|
Latest revision as of 05:30, 10 February 2015
NAME
FS::Cursor - Iterator for querying large data sets
SYNOPSIS
use FS::Cursor;
my $search = FS::Cursor->new('table', { field => 'value' ... }); while ( my $row = $search->fetch ) { ... }
CLASS METHODS
- new ARGUMENTS
- Constructs a cursored search. Accepts all the same arguments as qsearch, and returns an FS::Cursor object to fetch the rows one at a time.
METHODS
- fetch
- Fetch the next row from the search results.
TO DO
Replace all uses of qsearch with this.
BUGS
Still doesn't really support MySQL, but it pretends it does, by simply running the query and returning records one at a time.
The cursor will close prematurely if any code issues a rollback/commit. If you need protection against this use qsearch or fork and get a new dbh handle. Normally this issue will represent itself this message. ERROR: cursor "cursorXXXXXXX" does not exist.