Difference between revisions of "Freeside:3:Documentation:Developer/FS/Cursor"

From Freeside
Jump to: navigation, search
(Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
Line 1: Line 1:
==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.
 
 
==SEE ALSO==
 
[[Freeside:3:Documentation:Developer/FS/Record|FS::Record]]
 

Revision as of 05:26, 10 February 2015