Data::...:Query(3pm)
π 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::PhrasebookData::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 AND LICENSE β¨
- 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. π¦ππΈ
π¦ where this page comes from
- debian bookworm: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- debian trixie: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- ubuntu noble: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- ubuntu resolute: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- ubuntu stonking: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms