DBIx-Quick

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


    my @transactions = @{$dao->search(
           # SQL::Abstract::More where syntax using field names instead of columns
           amnt => { '>', 10000 },
           tax  => 21,
    )}

Searchs ::Instance Objects in the table using [SQL::Abstract::More](https://metacpan.org/pod/SQL%3A%3AAbstract%3A%3AMore) where syntax but replacing the column names by field names.

## free\_search

    my @transactions = @{$dao->free_search(
           -join => [
                   'users.id=transactions.id_user users',
           ],
           -where => {
                   'users.surname' => {-like => 'Gar%'},
           },
    )};

Searchs ::Instance Objects in the table using all the syntax of [SQL::Abstract::More](https://metacpan.org/pod/SQL%3A%3AAbstract%3A%3AMore) select, columns are the real columns not fields.

\-columns and -from are not allowed to be used. -from should be substituted by -join and -columns is not needed.

## insert

    $dao->insert(MyApp::DAO::Users::Instance->new(username => 'ent'));

Inserts a row in the table, doesn't return the inserted field. You can use UUIDs or other known unique attributes of the table to search for
the inserted object.

## update

    $user->username('X');
    $user->surname('González');
    $dao->update($user, 'username', 'surname');

Takes an instance and a list of the fields that should be updated in db with the instance data for that row, updates them and doesn't have a
meaningful return. Searches the object to update by the primary key.

## delete

    $dao->delete($user);

Vanishes the instance of the database. Searches by the primary key.

# INSTANCE SUBS

## fetch\_again

    $user = $user->fetch_again;

Get remote updates the ::Instance object may have.

## dbh

    $user->dbh($dbh);

Sets a database to be used in the constructor of the corresponding DAO while doing fetch\_again.

# BUGS AND LIMITATIONS

Every DAO/Instance must be associated directly with a table, if you need something extra, the good old and reliable [SQL::Abstract::More](https://metacpan.org/pod/SQL%3A%3AAbstract%3A%3AMore) is 
enough to you.

Errors must be improved to allow users to debug easier faulty code.

API is not stable since this program is so early in its development that I do not know if incorrect assumptions or bad design is hiding here.

No many to many easy wrapper, use free\_search, I could not come up with something that would be better than directly creating your own
queries with free\_search.

# AUTHOR

SERGIOXZ - Sergio Iglesias

# CONTRIBUTORS

SERGIOXZ - Sergio Iglesias

# COPYRIGHT

Copyright © Sergio Iglesias (2025)

# LICENSE

This library is free software and may be distributed under the same terms
as perl itself. See [https://dev.perl.org/licenses/](https://dev.perl.org/licenses/).



( run in 1.744 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )