MQdb::DBObject(3pm)

πŸ“¦
version 0.954 Β· 2 versions
  • 0.954 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.954 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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::Database where 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() and xml_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_start is 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_end is 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 if xml_start() and xml_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