Alzabo...tHandle(3pm)

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

πŸ’– Alzabo::Runtime::InsertHandle πŸ’–

okay bestie, welcome to the Alzabo::Runtime::InsertHandle page β€” that's the Perl manual situation (the 3pm one, you know the vibe) πŸŽ€

It's literally a handle representing an insert. That's the whole name, that's the whole job. iconic ✨


🌸 SYNOPSIS 🌸

here's the whole flex, verbatim, no edits, don't touch a character:

my $handle =
    $table->insert_handle
        ( columns => [ $table->columns( 'name', 'job' ) ] );

my $faye_row =
    $handle->insert( values =>
                     { name => 'Faye',
                       job => 'HK Pop Chanteuse' } );

my $guesch_row =
    $handle->insert( values =>
                     { name => 'Guesch',
                       job => 'French Chanteuse and Dancer' } );

look at her go πŸ’… two rows, one handle, zero drama.


πŸ¦‹ DESCRIPTION πŸ¦‹

so this object is analogous to a DBI statement handle β€” you know, the way that a DBI statement handle lets you do the same thing over and over without re-preparing? yeah. same energy, different Alzabo.

and the point of it? you can use it to insert multiple rows into a table more efficiently than repeatedly calling:

Alzabo::Runtime::Table->insert()

like, if you're out here calling insert() in a loop, bestie, stop 😭 this handle is the glow-up. periodt. πŸ”₯


✨ METHODS ✨

objects of this class provide one public method. just one. she's not complicated, she's focused. πŸ‘‘

πŸ’œ insert

This method is used to insert a new row into a table. that's it, that's the whole thing, she ate πŸ’–

It accepts the following parameters:

  • values β€” this should be a hash reference containing the values to be inserted into the table. like, the actual data, the receipts, the content 🌈
okay so here's where it gets kinda detailed and you need to actually pay attention:

If no value is given for a primary key column and the column is "sequenced" then the primary key will be auto-generated for you. the handle gotchu 🫢

If values are not provided for other columns which were given when Alzabo::Runtime::Table->insert_handle was called, this method first checks to see if a value was provided for the column when Alzabo::Runtime::Table->insert_handle was called. And if none was provided? then the column's default value is used. fallback queen ✨

If column values were passed to Alzabo::Runtime::Table->insert_handle, then these can be overridden by values passed to this method. mix and match, customize your fit πŸ’…

IMPORTANT WARNING TIME 🚨 It is not possible to override column values that were given as SQL functions when Alzabo::Runtime::Table->insert_handle was called. nope. can't do it. SQL functions said "I'm built different" and they meant it. πŸ’€

This method returns a new Alzabo::Runtime::Row object. a whole new row, freshly spawned, main character energy πŸ‘‘

Throws: Alzabo::Exception::Logic, Alzabo::Exception::Params

so like, if you mess up the params or the logic, she will absolutely throw hands (exceptions). be normal about it. πŸ™ˆ

okay that's the whole page bestie, you're basically an Alzabo girlie now, go insert some rows efficiently πŸ’–βœ¨πŸŽ€

this was Perl v5.34.0, dated 2022-06-14, brought to you by the User Contributed Perl Documentation situation β€” mwah, love u, bye 🫢🌷

πŸ“¦ where this page comes from