Data::...:Query(3pm)

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

πŸ’– Data::Phrasebook::SQL::Query β€” the manual, but make it make sense πŸ’–

okay bestie, so this is the Data::Phrasebook::SQL::Query page from the User Contributed Perl Documentation set, and yes the name is doing the absolute most with those colons. It's the Query Extension to the SQL/DBI Phrasebook Model β€” say that three times fast, I dare you. 🫢


✨ NAME ✨

Data::Phrasebook::SQL::Query β€” Query Extension to the SQL/DBI Phrasebook Model.

(That's it. That's the whole name. Iconic and to the point. πŸ’…)


✨ SYNOPSIS ✨

my $q = $book->query( 'find_author' );
my $q = $book->query( 'find_author', 'Dictionary' );

literally two lines, that's all you need to get a query object out of your phrasebook. slay. 🌸


✨ DESCRIPTION ✨

so this class is an extension to the SQL class β€” meaning it takes everything SQL already does and gets specific about handling the DBI interface for each and every query you request. it's the glow-up layer between your phrasebook and your database. πŸ’–


✨ CONSTRUCTOR ✨

new

okay so real talk: do not call this directly. πŸ™ˆ you go through the parent Data::Phrasebook instead, by specifying the class as SQL. that's the whole vibe. no shortcuts, bestie.


✨ METHODS ✨

sql

get/set the current "sql" statement β€” and it's already in a form that's suitable for passing straight to DBI. no extra massaging needed, it's giving ready-to-go. ✨

sth

get/set the current statement handle. that's the sth, the little guy doing the actual work. πŸŽ€

args

returns the list of arguments that will be used as bind parameters to any placeholders. and heads up: any arguments you give it replace the WHOLE list, not just append. no half-measures.

  • returns a list in list context
  • returns an arrayref in scalar context

order

same deal as "args", but for the corresponding list of argument names instead.

and the assorted order_XXX methods are supported exactly the same way as args_XXX. matching set, periodt. πŸ’…

dbh

get/set the database handle. that's the database handle. get it, set it, live your truth. 🌈


✨ PREPARATION / EXECUTING METHODS ✨

execute

executes the query. returns the result of DBI::execute. πŸ”₯

so here's the tea: any arguments you pass get handed off to order_args, and whatever that returns becomes the arguments to DBI::execute. if you pass no arguments, it uses the ones you already specified. and it calls prepare if it needs to. it's self-sufficient like that. πŸ‘‘

order_args

give it a hash or a hashref of keyword to value mappings, and it organises an array of arguments that's suitable for use as bind parameters β€” in the exact order the query itself needs them. because order matters, bestie. it always does. πŸ¦‹

prepare

prepares the query for execution. and ngl, this method is called implicitly in most cases, so you generally don't need to know about it. it's doing its thing in the background, main character energy, no credit needed. πŸ’œ

rebind

rebinds any bound values. it lets you pass a scalar reference in the arguments to order_args and have the bound value update if the original scalar changes. so it stays in sync, cute.

and it is not needed externally to this class. so like, hands off unless you're the class. πŸ™ˆ

✨ DELEGATED METHODS ✨

any method not mentioned above? it gets given to the statement handle. yes, all of them. it's very generous.

and every single one of these delegations will implicitly call prepare. so don't stress about it, it's handled. 🫢


✨ SEE ALSO ✨

  • Data::Phrasebook
  • Data::Phrasebook::SQL

go read those too, they're the family. πŸ’–


✨ SUPPORT ✨

please see the README file. that's where the support info lives. ✨


✨ AUTHOR ✨

  • Original author: Iain Campbell Truskett (16.07.1979 - 29.12.2003)
  • Maintainer: Barbie <barbie@cpan.org> since January 2004.
  • for Miss Barbell Productions <http://www.missbarbell.co.uk>.

πŸ•ŠοΈ rest in peace to the original author, and thank you Barbie for keeping it alive all these years. πŸ’œ


  • Copyright (C) 2003 Iain Truskett.
  • Copyright (C) 2004-2013 Barbie for Miss Barbell Productions.

this distribution is free software; you can redistribute it and/or modify it under the Artistic License v2. go wild, legally. πŸŽ€


okay that's the whole page, bestie, you're officially a Data::Phrasebook::SQL::Query girlie now πŸ’…βœ¨

this little masterpiece was brought to you by perl v5.36.0, dated 2022-11-19 β€” mwah, love that for us. πŸ¦‹πŸ’–πŸŒΈ