MQdb::DBStream(3pm)
π MQdb::DBStream π
okay bestie, welcome to the MQdb::DBStream page π
β it's part of the User Contributed Perl Documentation, and it's literally the vibe check for streaming data out of a database. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
MQdb::DBStream β DESCRIPTION of Object (yes bestie, that's what the manpage itself says, we're not editing the facts π)
πΈ SYNOPSIS πΈ
A simplified object to manage a collection of information related to streaming data from a database.
and here's the tea β: at least with MYSQL, the perl driver does odd caching π so to stream one needs to create a new database connection in order to stream. that's the whole reason this thing exists, no cap.
π¦ DESCRIPTION π¦
literally empty in the original, bestie. nothing here. a whole section with nothing in it. it's giving mystery β¨. we're leaving it exactly as it is π
π CONTACT π
Jessica Severin <jessica.severin@gmail.com> π«Ά
π LICENSE π
the whole thing, verbatim, because licenses are sacred and we do NOT paraphrase legal text, periodt:
* 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 ''AS IS'' 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.
π APPENDIX π
The rest of the documentation details each of the object methods. Internal methods are labeled. π
π set_stream_useresult_behaviour π
- Description β sets a global behaviour for all DBStreams. setting
use_resultto"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] β
1or"y"or"on"turns theuse_resulton and keeps the database connection open - Returntype β none
- Exceptions β none
- Example:
MQdb::DBStream->set_stream_useresult_behaviour(1);
fr fr bestie, this is a global switch. it hits every DBStream. choose wisely π
π§ next_in_stream π§
- Description β gets the next object in the stream. If the stream is empty it return
undef. - Returntype β instance of the defined
DBStream::stream_class, orundef - Exceptions β none
- Example:
my $stream = WorldKit::Person->stream_all_by_country_region($db, "USA", "wisconsin");
while(my $person = $stream->next_in_stream) {
#do something
}
π as_array π
- 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
}
note the comment in that example bestie, it's literally the author admitting the memory thing π iconic.
π stream_database π
- 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
π¦ stream_class π¦
- 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 ofMQdb::MappedQuery) for setting - Returntype β a class which is a subclass of
MQdb::MappedQuery - Exceptions β none
- Callers β
MQdb::MappedQuery
β prepare β
- 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 ofMappedQuerywhich implements themapRow()method. - Returntype β
$self - Exceptions β none
- Callers β
MQdb::MappedQuery
and that's the whole page bestie, you ate it up π β¨
this cutie was served to you by perl v5.36.0, dated 2022-12-13, and it's the MQdb::DBStream(3pm) page in the User Contributed Perl Documentation collection π go stream some data, no cap π«Ά
π¦ where this page comes from
- debian bookworm: libmqdb-perl 0.954-3 Β· Poetic
- debian trixie: libmqdb-perl 0.954-3 Β· Poetic
- ubuntu noble: libmqdb-perl 0.954-3 Β· Poetic
- ubuntu resolute: libmqdb-perl 0.954-3 Β· Poetic
- ubuntu stonking: libmqdb-perl 0.954-3 Β· Poetic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms