Difference between revisions of "Freeside:4:Documentation:Developer/FS/Cursor"
From Freeside
(Edit via perl MediaWiki framework (1.13)) |
(No difference)
|
Latest revision as of 07:19, 18 November 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 [, DBH ]
- 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.
- DBH may be a database handle; if so, the cursor will be created on that connection and have all of its transaction state. Otherwise a new connection will be opened for the cursor.
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.