NAME

DBIx::QuickORM::Role::SQLBuilder - Role for SQL statement builders.

DESCRIPTION

Interface implemented by SQL builders that turn ORM sources, field lists, and where-clauses into statement/bind pairs. Consumers provide the per-statement builders; this role supplies a helper for building a row's primary-key where-clause.

A source's columns may use one name in the ORM and a different name in the database. Implementations must emit database names in all generated SQL (translating field lists, where-clauses, order-by, insert/update data, and returning lists from ORM names to database names via the source), and callers restore ORM names on fetched rows with qorm_row_to_orm. Literal SQL passed by the caller is never rewritten.

SYNOPSIS

package My::SQLBuilder;
use Role::Tiny::With;
with 'DBIx::QuickORM::Role::SQLBuilder';

sub qorm_select { ... }
# ...and the other required methods

REQUIRED METHODS

Consumers must provide qorm_select, qorm_insert, qorm_update, qorm_delete, qorm_where, qorm_and, and qorm_or.

PUBLIC METHODS

$where = $builder->qorm_where_for_row($row)

Return a where-clause (the row's primary-key hashref) that uniquely identifies the given row.

$orm_row = $builder->qorm_row_to_orm($source, \%row)

Return a new hashref with a fetched row's keys remapped from database column names back to ORM names for the given source. Unknown keys pass through unchanged.

SOURCE

The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

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.

See https://dev.perl.org/licenses/