MQdb::DBObject(3pm)
π MQdb::DBObject β bestie, it's the blueprint π
User Contributed Perl Documentation Β· MQdb::DBObject(3pm) Β· ok so sit down, hydrate, and let's talk about the literal blueprint of the whole toolkit π¦
β¨ NAME β¨
MQdb::DBObject β DESCRIPTION of Object πΈ (yes that's the actual NAME line, it's giving mysterious, we love that for it)
π SYNOPSIS π
Root class for all objects in MappedQuery toolkit
that's it. that's the synopsis. no arguments, no options, no drama β it's just the mom friend of the class hierarchy. π
π DESCRIPTION π
OK so here's the tea bestie π β MQdb::DBObject is the root object for the toolkit and for every derived subclass that comes from it. Literally everything in the MappedQuery structure is designed to be persisted in a database. And when we say "database" we mean it in the broad sense, like, any object persistence system counts. Currently the toolkit works with SQL based systems, but object databases or custom storage engines? Also possible, no cap. π
It provides the base common methods that all the objects use. So like, every subclass gets to inherit the basics and go be its own main character. π
π AUTHOR π
Contact Jessica Severin: jessica.severin@gmail.com π§ β hi Jessica, icon behaviour fr fr π«Ά
π LICENSE π
this part is legally important so we're keeping every single word exactly as written, bestie β no edits, no vibes, just facts:
* 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.
read it, don't skim it, it's literally a whole BSD license bestie π
π§ APPENDIX π§
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ β so if you see an underscore, that's the secret menu, iykyk π
πΈ new
- Description β instance creation method π
- Returntype β instance of this Class (subclass)
- Exceptions β none
baby's first method, it just makes you a new one. iconic.
πΈ init
- Description β initialization method which subclasses can extend
- Returntype β
$self - Exceptions β subclass dependent
πΈ copy
- Description β Shallow copy which copies all base attributes of object to new instance of same class
- Returntype β same as calling instance
- Exceptions β subclass dependent
shallow. say it with me. SHALLOW copy. it's not cloning your whole soul, just the base attributes π
πΈ class
- Description β fixed string symbol for this class. Must be implemented for each subclass and each subclass within toolkit should return a unique name. used by global methods.
- Returntype β string
- Exceptions β error if subclass does not redefine
bestie if your subclass doesn't redefine this you're getting an ERROR. no unique name, no entry. periodt. π
πΈ database
- Description β the
MQdb::Databasewhere this object is permanently persisted to. Here database is any object persistance system. - Returntype β
MQdb::Database - Exceptions β die if invalid setter value type is provided
set it to the wrong type and it will literally die on you π vibe check failed.
πΈ primary_id
- Description β the unique identifier for this object within database.
- Returntype β scalar or
UNDEF - Exceptions β none
πΈ id
- Description β the unique identifier for this object within database. Returns empty string if not persisted.
- Returntype β scalar or
'' - Exceptions β none
not persisted yet? you get the empty string, babe. it's a β¨placeholder eraβ¨
πΈ db_id
- Description β the worldwide unique identifier for this object. A URL-like combination of database, class, and id
- Returntype β string or undef if database is not defined
- Exceptions β none
worldwide unique!! it's the passport of object identifiers πβ¨
πΈ display_desc
- Description β general purpose debugging method that returns a nice human readable description of the object instance contents. Each subclass should implement and return a nice string.
- Returntype β string scalar
- Exceptions β none
πΈ display_info
- Description β convenience method which prints the display_desc string with a carriage return to STDOUT. useful for debugging.
- Returntype β none
- Exceptions β none
it just prints to STDOUT with a carriage return, that's the whole job, and honestly? relatable. π«Ά
πΈ xml
- Description β every object in system should be persistable in XML format. returns an XML description of the object and all child objects. Each subclass must implement and return a proper XML string. Best if one implements
xml_start()andxml_end()and use here. - Returntype β string scalar
- Exceptions β none
- Default β default is a simple
xml_start+xml_end
πΈ xml_start
- Description β every object in system should be persistable in XML format. returns an XML description of the object and all child objects. Each subclass should OVERRIDE this method and return a proper XML string.
xml_startis the primary XML start tag - Example β
return sprintf("<feature id='%d' name='%d' ..... >", $id, $name....); - Returntype β string scalar
- Exceptions β none
OVERRIDE. THIS. bestie, it's in all caps in the original for a reason π₯
πΈ xml_end
- Description β every object in system should be persistable in XML format. returns an XML description of the object and all child objects. Each subclass should OVERRIDE this method and return a proper XML string.
xml_endis the primary XML end tag - Example β
return "</feature>"; - Returntype β string scalar
- Exceptions β none
πΈ simple_xml
- Description β short hand for
xml_start().xml_end()Can be used when only the primary XML start tag and attributes are needed No need to override ifxml_start()andxml_end()are implemented - Returntype β string scalar
- Exceptions β none
the lazy girl's dream: if you already did xml_start() and xml_end(), you do NOT have to override this one. slay. π
and that's the whole page bestie!! every method, every returntype, every exception, nothing skipped, we ate and left no crumbs πβ¨
this page was brought to you by perl v5.36.0, dated 2022-12-13, in the MQdb::DBObject(3pm) manual β mwah, go persist something ππ¦π
π¦ 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