NAME
DBIx::QuickORM::Handle - Build a query and fetch its rows.
DESCRIPTION
A handle is a query over a source (DBIx::QuickORM::Role::Source): a table, an SQL query, or tables joined together. Modifiers such as where and order_by each return a new handle, so a handle can be refined and reused freely. The fetching methods run the query and hand out rows. The writing methods update or delete what it matches.
A handle is stateless until its query is sent. Then the results are cached on it until clear. Every reading method and every iter shares that one run of the query. A modifier's new handle starts without it.
Running the query fetches every row at once, ingests the rows of a table with a primary key into the lookup table (see DBIx::QuickORM) unless the handle is no_cache (or bare), and hands them out through an iterator (DBIx::QuickORM::Iterator).
The SQL comes from the ORM's sql_builder, whose documentation describes the syntax of where and order_by. The default is DBIx::QuickORM::SQLBuilder::SQLAbstract, using SQL::Abstract's syntax.
Rows are built with the handle's row_class when one was set (even to undef, for row data), otherwise as the ORM resolves them for the table. Rows of a query use the ORM's row_class. Rows of a join are DBIx::QuickORM::JoinRow objects (see "Joins"), and computed rows are DBIx::QuickORM::AggregateRow objects (see "Computed columns").
SYNOPSIS
my $h = $orm->handle('users')
->where({name => {-like => 'A%'}})
->order_by('name')
->limit(10);
my $n = $h->count;
my @all = $h->all;
my $user = $orm->handle('users')->find($id);
$orm->handle('posts')->where({views => 0})->delete;
EXAMPLES
Filter, sort, and page
my @page = $orm->handle('users')
->where({
name => {-like => 'A%'},
email => {'!=' => undef},
})
->order_by([{-desc => 'created'}, 'name'])
->limit(20)
->offset(40)
->all;
Narrow or widen a condition
my $alice = $orm->handle('users')->where({name => 'Alice'});
my $emailed = $alice->and({email => {'!=' => undef}}); # both conditions
my $either = $alice->or({name => 'Bob'}); # either condition
my $bob = $alice->where({name => 'Bob'}); # where replaces the condition
Compare with SQL
use DBIx::QuickORM::Value qw/sql/;
my @old = $orm->handle('users')
->where({created => {'<' => sql("now() - interval '30 days'")}})
->all;
Read only some fields
my @users = $orm->handle('users')->fields(['name'])->all; # name, plus the primary key
# a field not fetched loads on first read
my $email = $users[0]->field('email');
Get plain hashrefs instead of row objects
my @data = $orm->handle('users')->data_only->all;
my $name = $data[0]->{name};
# hashrefs the row cache never sees
my @bare = $orm->handle('users')->bare->all;
Query with your own SQL
my $dupes = $orm->handle(
\['SELECT name, COUNT(*) AS n FROM users GROUP BY name HAVING COUNT(*) > ?', 1],
);
my @dupes = $dupes->all;
my @named = $dupes->where({name => 'Alice'})->all; # the query becomes a subquery
Insert many rows and get them back
my $posts = $orm->handle('posts')->insert_many(
[
map {
+{
user_id => $id,
title => "Post $_",
}
} 1 .. 3
],
); # an arrayref of the new rows
Loop over the same rows twice at once
Each iter call returns a new iterator with its own position, so each loop has its own. They share the handle's one run of the query.
my $h = $orm->handle('posts')->order_by('id');
my @pairs;
my $outer = $h->iter;
while (my $left = $outer->next) {
my $inner = $h->iter; # the same rows, no second query
while (my $right = $inner->next) {
push @pairs => [$left->field('id'), $right->field('id')];
}
}
ATTRIBUTES
- $orm = $h->orm
- $source = $h->source
-
Both required.
- $state = $h->state
-
The iterator state (see DBIx::QuickORM::Iterator), undef unless given. A new
where(also throughandoror) or a join drops it. - $mode = $h->mode
-
async,aside, orforked, or undef for an ordinary handle.
PUBLIC METHODS
Modifiers
my $users = $orm->handle('users');
my $recent = $users->order_by({-desc => 'created'})->limit(5); # $users is unchanged
# 5: without an argument, the setting
my $limit = $recent->limit;
Each returns a new handle with the one setting replaced and no cached rows, and leaves the handle it was called on unchanged. So a modifier called in void context would do nothing, and croaks instead. One that takes a value returns the current setting when called without one. An argument of the wrong shape croaks, at the latest when the query runs.
- $h2 = $h->where($where)
-
The condition: a hashref or arrayref in the builder's syntax, an
sql()marker, or a plain string of SQL. The where builders render it (seewhere_builders).A plain string is raw SQL, used as written. Never interpolate untrusted input into it. Pass values as binds with
sql('... ?', $value).A new
wherereplaces the old one entirely, including onefollow_fkset. Useandto narrow a handle's condition instead. - $h2 = $h->and($where)
- $h2 = $h->or($where)
-
The handle with its
wherecombined with$where: rows must meet both (and) or either (or).Both need a condition to add to: on a handle without a
where, or with an empty one ({},[], or''), they croak. Usewherethere. Value markers work in either part. Neither returns the current setting, butwheredoes.A side that is wholly a string,
sql(), or\[...]is put in parentheses when combined, so anORin it stays grouped. A literal you nest yourself inside-andor-oris yours to parenthesize. - $h2 = $h->order_by($order)
-
The order of the rows, in the builder's syntax.
- $h2 = $h->limit($n)
- $h2 = $h->offset($n)
-
The most rows to return, and how many rows to skip before them.
- $h2 = $h->fields(\@fields)
-
Selects only these fields. The primary key is always added. Without it the table's default fields are selected (every column for a query).
- $h2 = $h->fields({$name => $spec, ...})
-
Computed columns, each selected as
$name. See "Computed columns". The rows are computed rows. - $h2 = $h->group_by(@fields)
- $h2 = $h->having($condition)
-
Group the rows by these fields, and keep the groups matching the condition. The rows are computed rows.
havingis in the builder's syntax, as forwhere. It can name grouped fields and computed fields, or take ansql()marker such assql('COUNT(*) > ?', 2). A computed field's name goes to MySQL and MariaDB as written. Elsewhere the builder writes the field's SQL in its place (PostgreSQL rejects a select alias inHAVING).Without computed fields the handle selects the grouped fields, or the
fieldsgiven as a list. A handle withhavingbut neither croaks when run.SQLite sends a bind in an
sql()marker as text, which an aggregate's number never matches. Cast the bind there:sql('COUNT(*) > CAST(? AS INTEGER)', $n). - $h2 = $h->row_class($class_or_undef)
-
The class rows from this handle are built with. Undef means row data.
A class without a
newis loaded now, as the ORM loads its row classes. One that cannot be loaded croaks. - $h2 = $h->data_only
-
Shorthand for
row_class(undef): rows come back as row data, as the CRUD operations'data => 1gives. A row object given toupdate_roworrefresh_rowis still returned as itself. Passdata => 1for its row data.Table rows still go through the lookup table. For a table with a primary key each hashref is the cache's own copy, so never change it. Use
barefor hashrefs the cache never sees.It takes no argument.
row_class($class)undoes it. - $h2 = $h->no_cache
-
Its queries skip the lookup table: rows come back as fetched, and nothing the ORM holds changes.
findandrefresh_rowuse the cache as their own options say. It takes no argument. Undo it withcache.The rows, row objects or hashrefs, are not canonical. Writing with them croaks under the default
enforce_canon.findorrefresh_rowgives a canonical row. - $h2 = $h->cache
-
Undoes
no_cache: reads go through the lookup table again and their rows are canonical. It takes no argument. - $h2 = $h->bare
-
Shorthand for
data_onlyandno_cachetogether: rows come back as hashrefs, as fetched, and the lookup table never sees them. Changing one changes nothing the ORM holds, though the handle's other reads hand out the same hashref.They are not canonical, so writing with them croaks under the default
enforce_canon. It takes no argument.row_class($class)brings back row objects, andcachebrings back the lookup table. - $h2 = $h->where_builders(\@builders)
-
The where builders this handle's
whereis rendered through, replacing the ORM'swhere_builders(see DBIx::QuickORM). Each class is loaded as the ORM loads them. Without an argument it returns the handle's own setting, undef unless set.
Computed rows are keyed by the selected names, which the order may name. They belong to no table: no primary key is added and they never enter the lookup table.
They are DBIx::QuickORM::AggregateRow objects, which inflate and follow foreign keys by each column's spec. When the row class resolved for the source (the table's, or the ORM's) is undef they are hashrefs. A handle row_class replaces either: undef for hashrefs, or a class built as for a query's rows.
Computed columns
use DBIx::QuickORM::Value qw/sql/;
my @per_user = $orm->handle('posts')
->group_by('user_id')
->order_by('user_id')
->fields({
# the field itself, with its type and foreign key
user_id => 'user_id',
# COUNT(*)
posts => [count => '*'],
# an SQL expression: no type, no foreign key
titles => sql('COUNT(DISTINCT title)'),
# SUM(views)
views => [sum => 'views'],
# MAX(id), followed to that post
latest => {
agg => [max => 'id'],
fk => 'posts',
},
})
->all;
my $count = $per_user[0]->field('posts');
my $user = $per_user[0]->follow_fk('users')->only;
my $latest = $per_user[0]->follow_fk('posts')->only;
fields({$name => $spec}) takes one of these per column:
- $name => 'field'
-
The field itself (
alias.fieldon a join), with the factslikegives below: its type and foreign keys. - $name => sql(...)
- $name => \'SQL'
-
An SQL expression (see DBIx::QuickORM::Value), with no type and no foreign key.
\'SQL'is short forsql('SQL'). - $name => [$func, 'field']
-
FUNC(field), the field quoted for the database.$funcmust be a word (it is written into the SQL), and the field must exist. When$funcisminormax, or one of the ORM'slike_aggregates(any case), the result is one of the field's values, so the column takes the field's type and foreign keys. Any other function's result has neither.The field
*givesFUNC(*):[count => '*']counts rows. Such a column has no type or foreign key. A function that does not take*fails when the query runs, with the database's error. - $name => {sql => sql(...) | agg => [$func, 'field'], type => $type, db_type => $db_type, fk => $fk, like => 'field'}
-
Exactly one of
sqloragg, which work as above. The other keys adjust the column:- like => 'field'
-
The column takes the field's facts: its type, its declared type (and what follows from it, such as affinity), and its single-field foreign keys. With
like, nothing comes fromagg's field. - type => $type
-
The type, named as in the ORM's
types. Replaces whatlikeoragggave. - db_type => $db_type
-
The declared type. Replaces what
likeoragggave, but keeps the type they implied. Givetypetoo to change it. - fk => $fk
-
A single-field foreign key, replacing what
likeoragggave: a table name (that table's primary key, which must be one field),[$table, $field], or{$table => $field}.
Croaks on an unknown key, an unknown field, a function name that is not a word, or an fk naming a table or field not in the map.
Running elsewhere
# the query starts, and iter() returns at once
my $it = $orm->handle('posts')->async->iter;
do_something_else() until $it->ready;
my @posts = $it->all;
my $aside = $orm->handle('posts')->aside->iter; # on a second connection
my $forked = $orm->handle('posts')->forked->iter; # in a child process
$orm->insert(users => {name => 'Busy'}); # the ORM's own connection stays free
my @all = ($aside->all, $forked->all);
- $h2 = $h->async
-
The handle's query starts without waiting on its first read:
iterreturns a pending iterator (see DBIx::QuickORM::Iterator), whosereadychecks without waiting and whose reading methods wait for the rows. Every iterator of the handle shares that one query.The query runs on the ORM's own connection, so its rows are canonical like any other's, inside a transaction or not. Until it is collected the connection is busy, and every other query, write, and transaction statement on it croaks.
A query not yet collected is cancelled once nothing can read it: the handle is freed or cleared, and so is every iterator over it. A transaction rolled back because its block threw or it went out of scope cancels it too. Its iterators then throw when read. On PostgreSQL, cancelling inside a transaction aborts that transaction. MySQL and MariaDB cannot cancel, so they wait for the result and discard it.
Needs a database with async queries (PostgreSQL, MySQL, MariaDB). Croaks on any other. On some platforms a child forked while a PostgreSQL async query is pending may crash on exit (https://github.com/bucardo/dbdpg/issues/218).
- $h2 = $h->aside
-
Like
async, but each query runs on a new connection from the ORM's connector, so the ORM's own connection stays free.The connection is closed once the rows are collected, or when the query is cancelled before that. It sees only committed data. Its rows are ingested as usual.
Starting the query, or reading its rows (
readyincluded), croaks while a transaction is open. A query started before a transaction may run during it, so read it after the transaction ends. Its rows may then be stale if the transaction changed the same rows.Needs a database with async queries that a second connection can reach (not an in-memory database). On an ORM given a
dbh,asideitself croaks. - $h2 = $h->forked
-
Each query runs in a forked child process, on a new connection from the connector, and the child sends the rows back and exits.
The iterator is pending as for
async. Rows are ingested, and transactions are refused, as foraside. An error in the child is thrown on collection asThe forked query failed: ...with the child's message. Cancelling the query kills and reaps the child.The child never touches the parent's connection. A forked query can race changes the parent makes meanwhile to the same rows, as any other reader can.
Needs a database a second connection can reach (not DuckDB or an in-memory SQLite database). On an ORM given a
dbh,forkeditself croaks. - $bool = $h->can_async
- $bool = $h->can_aside
- $bool = $h->can_forked
-
True when the mode can run here, false where it would croak.
- $h2 = $h->maybe_async
- $h2 = $h->maybe_aside
- $h2 = $h->maybe_forked
-
The mode when it can run, otherwise no mode change. Either way a new handle without cached rows, as for any modifier. Void context croaks.
On an ordinary handle, falling back runs the query normally on the ORM's connection. A handle already in another mode keeps it. Inside a transaction that query sees the transaction's own uncommitted writes, while
asideandforkedsee committed data only.Everything else (
iter,ready,all,count) works the same either way.
Joins
my @rows = $orm->handle('posts')
->join('users', as => 'author')
->where({
'author.name' => 'Alice',
'posts.views' => {'>' => 10},
})
->order_by('posts.id')
->all;
for my $row (@rows) {
my $post = $row->row('posts');
my $author = $row->row('author');
my $title = $row->data->{'posts.title'};
}
# Every user and their posts, keeping users without any.
my @users = $orm->handle('users')
->left_join('posts', link => {id => 'user_id'})
->order_by('users.name')
->all;
- $h2 = $h->join($table, as => $name, from => $name, link => \%link)
- $h2 = $h->join($table, as => $name, from => $name, via => \%via)
- $h2 = $h->inner_join($table, ...)
- $h2 = $h->left_join($table, ...)
-
Join another table to a table handle, or to a join handle (see DBIx::QuickORM::Source::Join).
joinandinner_joinare inner joins,left_joina left join.Options (an unknown one croaks):
- as => $name
-
The component's name, the table name by default. A table can be joined more than once, even to itself, under different names. A name already taken croaks.
- from => $name
-
The component the link starts at, the base table by default.
- link => \%link
-
The foreign key to join on,
{from_field => field}, asfollow_fktakes it (see "Following foreign keys" in DBIx::QuickORM). Without it there must be exactly one foreign key between the two tables. - via => \%via
-
The fields to join on when the map knows no key between the tables, in the same form:
via => {editor_id => 'id'}. Every field must exist. Not withlink.
On a join handle
where,order_by,fields,group_by, andhavingname fields ascomponent.field.fieldscroaks for any other name.The rows are DBIx::QuickORM::JoinRow objects. With
row_class(undef)they are each row's raw data instead, a hashref keyedcomponent.field. Any otherrow_classcroaks. A join cannot be written through: write through its component rows.
Fetching
my $h = $orm->handle('users')->order_by('name');
my $first = $h->first; # runs the query
my $last = $h->last; # same rows, no second query
my @all = $h->all;
my $bob = $h->where({email => 'bob@example.com'})->only; # one row or undef, croaks on more
my @names;
while (my $user = $h->next) { # the handle's own position
push @names => $user->field('name');
}
my $it = $h->iter; # a new position over the same rows
$h->clear; # forget the rows, so the next read runs the query again
- $row = $h->first
- $row = $h->last
- @rows = $h->all
- $row = $h->only
- $bool = $h->ready
- $row = $h->next
- $h->reset
-
The iterator methods (see DBIx::QuickORM::Iterator), on the handle's own iterator over the handle's one run of the query.
The query runs on the first read (these or
iter), and the rows stay on the handle untilclear. A modifier's new handle does not share them.
- $it = $h->iter
-
A new iterator, every call, with its own position over the handle's one run of the query. The first read sends the query. Later calls reuse its rows.
In
async,aside, orforkedmode there is one background query per handle, however many iterators read it. Collecting through any of them collects for all.
- $h->clear
-
Forgets the handle's cached rows and its own position, in place, so the next read sends the query again. Returns nothing.
Iterators already returned by
iterkeep the old rows. The ORM's lookup table is untouched.clear_cacheon the ORM clears that.
- $n = $h->count
-
How many rows match the
where, counted by the database (SELECT COUNT(*)).The order, limit, and offset are ignored, and nothing is ingested. It runs at once on the ORM's connection, whatever the handle's mode. Croaks with a
group_byorhaving. Count groups with computed fields instead,fields({n => [count => '*']}).
Writing
my $posts = $orm->handle('posts');
my $post = $posts->insert({
user_id => $id,
title => 'Draft',
});
$posts->update_row($post, {title => 'Final'});
$posts->delete_row($post);
my $changed = $posts->where({user_id => $id})->update({views => 0}); # how many rows changed
my $deleted = $posts->where({views => 0})->delete; # how many rows went
These need a table handle. On a query or join handle they croak.
- $count = $h->update(\%changes)
- $count = $h->delete
- $count = $h->delete(mark_deleted => 1)
-
Updates or deletes every row matching the
where(every row of the table without one) in one statement, and returns the number of rows the database reports.Changes are deflated as for
update_row, and a field the table does not have croaks.updatetakes exactly one hashref.deletetakes onlymark_deleted. Both croak when the handle has an order, limit, offset,group_by, orhaving.The ORM then drops every canonical copy of the table's rows, since it cannot tell which rows changed. Inside a transaction that includes the table's rows cached from before the transaction began: they are dropped, and rolling the outermost transaction back does not bring them back.
mark_deleted => 1makesdeletealso learn which rows it deleted. Held rows for them saywas_deleted, as after a rowdelete. The table's other rows are dropped as usual. A rollback undoes the marks. A table without a primary key croaks.my $stale = $posts->find($post_id); $posts->where({views => 0})->delete(mark_deleted => 1); my $gone = $stale->was_deleted; # true if that post had no viewsThe cost: the database sends back the primary key of every deleted row, and the ORM holds them all at once, so a huge delete uses memory in proportion.
MySQL has no
RETURNINGonDELETE(MariaDB has), so there it is slower: aSELECT ... FOR UPDATEof the keys runs first, locking the rows until the transaction ends, then theDELETE. Outside a transaction both run in one of their own. A row another session inserts and commits between the two statements may be deleted without being marked (MySQL and Percona atREAD COMMITTED, not MariaDB, which usesRETURNING).
- $row = $h->insert(\%fields, %opts)
- \@rows = $h->insert_many(\@rows, %opts)
- $row = $h->find($pk, %opts)
- $row = $h->update_row($row_or_data, \%changes, %opts)
- $count = $h->delete_row($row_or_data, %opts)
- $row = $h->refresh_row($row_or_data, %opts)
-
The ORM's CRUD operations (see "CRUD operations" in DBIx::QuickORM) on the handle's table, with rows built as the handle builds them.
They follow the ORM's return rule, building rows with the handle's row class.
refresh_rowtakes row data, a row, or a primary key.findisrefresh_rowgiven a primary key. A key comes in any form:my $users = $orm->handle('users'); my $user = $users->find({id => $id}); # a hashref of the key fields (row data works) $user = $users->find([$id]); # an arrayref of the values $user = $users->find($id); # a single value, for a single-field keyThe arrayref holds every key field's value, such as
[$org_id, $user_id], in the primary key's declared order, not the table's column order. A row object works as its row data. Key values are deflated like any value sent, so aDateTimeor a value marker works.A typed key finds the cached row in any form: a
DateTimein any zone or the database's text, a UUID in upper case or as 16 bytes.The database gets the key as you pass it, deflated, while the cache matches canonical values. On a text column, which compares exact text, pass the form it stores, or give the field a
format(see "Field hints" in DBIx::QuickORM::Role::Type).normalize_pkin DBIx::QuickORM::Map lists what croaks.Each croaks when the handle has a
where, order, limit, offset,group_by, orhaving. - $row = $h->find_or_insert(\%fields, by => \@fields, %opts)
-
The ORM's
find_or_insert(see "Finding or inserting" in DBIx::QuickORM) on the handle's table, building the row with the handle's row class.It croaks as the CRUD operations above do, and on a join or query handle.
PRIVATE METHODS
- $it = $h->_iter
- $it = $h->_iter(\@frame)
-
The handle's own iterator, made on the first read by sending the query. It holds the query every
itershares, so a pending query lives as long as the handle or any of its iterators.@frame, or its caller's (a public reader's), goes to_send.
- @out = $h->_read($method)
-
The handle's iterator's
$method, for the reader of that name. While the query is pending, the reader's frame goes in the query'sframefor the collection (see DBIx::QuickORM::Iterator), so the rows it brings arrive under that frame. A collected query is read as it is.
- \%query = $h->_send(\@frame)
-
Sends the handle's query and returns the query hashref its iterators share (see DBIx::QuickORM::Iterator): the rows, or the pending query in a background mode. Rows read at once arrive under
@framein the lookup table'scallerslot, unless it is set.asideandforkedcroak while a transaction is open, and give the pending query ablockedthat refuses reads while one is.
- $out = $h->_primitive($method, @args)
-
The ORM's CRUD operation on the handle's table, with rows built as the handle builds them.
- $value = $h->_modify($method, $key)
- $h2 = $h->_modify($method, $key, $value)
-
The setting, or a copy of the handle with it replaced, without the iterator (and without the state when the
whereor the source changes).$methodis the public modifier, for messages. Croaks on more than one argument, a badfieldsorrow_classvalue, or void context, where the copy would be lost.
- $h2 = $h->_combine_where($op, $where)
-
The handle with its
wherecombined with$whereby the builder'scombine_where. Croaks, pointing towhere, when the handle has nowhereor an empty one.
- $h2 = $h->_join(\@frame, $method, $table, %opts)
-
The handle over its source with one more joined table, making a join from a table source first. Link errors report at
@frame, the public method'scallerframe.
- $h2 = $h->_run_mode($mode)
- $h2 = $h->_run_mode($mode, $maybe)
-
The handle with the mode set. Without
$maybeit croaks with_cannot_run's reason. With it, a mode that cannot run leaves the mode as it was, but the handle is still a new one. - $reason = $h->_cannot_run($mode)
-
Why the mode cannot run, or undef when it can: the database has no async queries, or the mode needs a second connection and none can reach the database or the ORM was given a
dbh.
- \%pending = $h->_aside($conn, $source, $sql, \@binds)
-
Starts the query as an async one on a new Connection like
$conn, and returns its pending code references, closing that connection once it is collected or cancelled. The code references hold the ORM, not the handle.
- \%pending = $h->_forked($conn, $source, $sql, \@binds)
-
Forks a child that runs the query on a new Connection like
$conn, writes one message, and leaves throughPOSIX::_exiton every path, so nothing it inherited is destroyed there.The message is a Storable
freezeof{rows => \@rows}or{error => $message}. It is notnfreeze, which keeps no more than 15 significant digits of a float.readyreads without blocking,collectblocks, andcancelkills and reaps the child.
- $code = $h->_results
-
A code reference turning fetched rows into
(\@rows, \&build)for an iterator, given the rows: through the source'sresults, ingesting them unless the handle isno_cache, or as computed rows. It holds the ORM and the source, not the handle, so a pending iterator kept in the handle makes no cycle.
- %request = $h->_select_request
-
The builder's
selectrequest: the handle's settings (thewherethrough_where_request), with the primary key added tofields, or the source's default fields. For computed rows, each column's expression under its name.
- %request = $h->_where_request
-
The
whereandwhere_buildersfor a builder request: the handle's where builders, or the ORM's. Empty without awhere.
- $bool = $h->_fields_ok($value)
-
True for what
fieldstakes: an arrayref of field names, or a non-empty hashref (its columns are checked by_columns).
- \%columns = $h->_columns
-
The computed columns, built once per handle: each name mapped to its field record (as DBIx::QuickORM::AggregateRow takes
columns) plusexpr, a field name, ansql()marker, or[$FUNC, $field]($fieldmay be*). A record'snameis the column's, and itstablethe source's table, absent when it has none. Without afieldshashref, the grouped or listed fields each name themselves. Croaks whenhavinghas neither.
- \%column = $h->_column($name, $spec, \%like)
-
One column of
_columns.%likeholds the lowercased names of the aggregate functions that keep the field's facts.
- %facts = $h->_field_facts($name, $field)
-
The field's record from the map (
orm_type,db_type,type,size,affinity, as it has them) and its single-field foreign keys asfk, for the column$name. Croaks when the field is not a field of the source. A query source knows no fields, so a name passes unchecked with no facts.
- \%fk = $h->_column_fk($name, $fk)
-
An
fkgiven for column$name(a table,[$table, $field], or{$table => $field}) as{$table => [{$name => $field}]}. Croaks when its table or field is not in the map, or a bare table's primary key is not one field.
- $bool = $h->_is_name($value)
-
True for a defined, non-empty plain string.
- $bool = $h->_is_sql($value)
-
True for an
sql()marker.
- @args = $h->_row_class_arg
-
The handle's row class as named arguments,
(row_class => $class), when one was set (even to undef), or an empty list when none was. The ORM's_row,_row_builder, CRUD calls, and a source'sresultstake it as theirrow_classoption.
- $row = $h->_row(\%data)
-
The row data built into a row as the handle builds rows, or undef for undef.
- $table = $h->_bulk_table($action)
- $table = $h->_row_table($action)
-
The table, after croaking for the settings the action cannot honor.
SOURCE
The source code repository for DBIx-QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.