.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "MQdb::DBStream 3pm" .TH MQdb::DBStream 3pm "2022-12-13" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" MQdb::DBStream \- DESCRIPTION of Object .SH "SYNOPSIS" .IX Header "SYNOPSIS" A simplified object to manage a collection of information related to streaming data from a database. at least with \s-1MYSQL,\s0 the perl driver does odd caching so to stream one needs to create a new database connection in order to stream .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SH "CONTACT" .IX Header "CONTACT" Jessica Severin .SH "LICENSE" .IX Header "LICENSE" .Vb 10 \& * Software License Agreement (BSD License) \& * MappedQueryDB [MQdb] toolkit \& * copyright (c) 2006\-2009 Jessica Severin \& * All rights reserved. \& * Redistribution and use in source and binary forms, with or without \& * modification, are permitted provided that the following conditions are met: \& * * Redistributions of source code must retain the above copyright \& * notice, this list of conditions and the following disclaimer. \& * * Redistributions in binary form must reproduce the above copyright \& * notice, this list of conditions and the following disclaimer in the \& * documentation and/or other materials provided with the distribution. \& * * Neither the name of Jessica Severin nor the \& * names of its contributors may be used to endorse or promote products \& * derived from this software without specific prior written permission. \& * \& * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS \*(Aq\*(AqAS IS\*(Aq\*(Aq AND ANY \& * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \& * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE \& * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY \& * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \& * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; \& * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND \& * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \& * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS \& * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .Ve .SH "APPENDIX" .IX Header "APPENDIX" The rest of the documentation details each of the object methods. Internal methods are labeled. .SS "set_stream_useresult_behaviour" .IX Subsection "set_stream_useresult_behaviour" .Vb 10 \& Description : sets a global behaviour for all DBStreams. \& setting use_result to "on" will leave the results on the database and \& will keep the database connection open durring streaming. \& Both methods have similar speed performance, but keeping the results \& on the database server means the client uses essentially no memory. \& The risk of turning this on is that the the database connection remains open \& and there is risk of it timing out if processing takes a long time to stream all data. \& When turned off, the entire result set is transfered in bulk to the driver (DBD::mysql) \& and streaming happens from the underlying driver code and the perl code layer. \& Default is "off" since this is safer but one risks needing lots of memory on the client. \& Parameter[1] : 1 or "y" or "on" turns the use_result on and keeps the database connection open \& Returntype : none \& Exceptions : none \& Example : MQdb::DBStream\->set_stream_useresult_behaviour(1); .Ve .SS "next_in_stream" .IX Subsection "next_in_stream" .Vb 8 \& Description: gets the next object in the stream. If the stream is empty it return undef. \& Returntype : instance of the defined DBStream::stream_class, or undef \& Exceptions : none \& Example : \& my $stream = WorldKit::Person\->stream_all_by_country_region($db, "USA", "wisconsin"); \& while(my $person = $stream\->next_in_stream) { \& #do something \& } .Ve .SS "as_array" .IX Subsection "as_array" .Vb 9 \& Description: instantiates all remaining instances in the stream and returns them as an array \& Returntype : reference to array of instances of the defined class of this stream \& Exceptions : none \& Example : \& my $stream = WorldKit::Person\->stream_all_by_country_region($db, "USA", "wisconsin"); \& my $all_people = $stream\->as_array; #because I have a large memory machine and need them all in memory \& foreach my $person (@$all_people) { \& #do something \& } .Ve .SS "stream_database" .IX Subsection "stream_database" .Vb 8 \& Description: this is an internal system method. \& Needs to have two database connections open, one for the active \& stream handle, and one for lazy\-loading additional data on the returned \& objects. This is used to set the database which is the one streaming objects \& Arg (1) : $database (MQdb::Database) for setting \& Returntype : MQdb::Database \& Exceptions : none \& Callers : MQdb::MappedQuery .Ve .SS "stream_class" .IX Subsection "stream_class" .Vb 7 \& Description: this is an internal system method. \& Set/get the class used for creation of objects on this stream. \& The class must be a subclass of MQdb::MappedQuery \& Arg (1) : $class (must be subclass of MQdb::MappedQuery) for setting \& Returntype : a class which is a subclass of MQdb::MappedQuery \& Exceptions : none \& Callers : MQdb::MappedQuery .Ve .SS "prepare" .IX Subsection "prepare" .Vb 6 \& Description: this is an internal system method. It is used to set the SQL query used \& to stream objects out of a database. Must be have stream_class() set \& to a subclass of MappedQuery which implements the mapRow() method. \& Returntype : $self \& Exceptions : none \& Callers : MQdb::MappedQuery .Ve