Name

QBit::Application::Model::DB::mysql - Class for working with MySQL DB.

Description

Class for working with MySQL DB. It's not ORM.

GitHub

https://github.com/QBitFramework/QBit-Application-Model-DB-mysql

Install

  • cpanm QBit::Application::Model::DB::mysql

  • apt-get install libqbit-application-model-db-mysql-perl (http://perlhub.ru/)

Package methods

filter

Arguments:

  • $filter - filter (perl variables)

  • %opts - additional options

    • type - type (AND/OR NOT)

Return values:

  • $filter - object (QBit::Application::Model::DB::Filter)

Example:

my $filter = $app->db->filter([id => '=' => \23]);

get_query_id

No arguments.

Returns a current query ID or undef

Return values:

  • $query_id - number

Example:

my $query_id = $app->db->get_query_id();

query

No arguments.

Create and returns a new query object.

Return values:

  • $query - object (QBit::Application::Model::DB::mysql::Query)

Example:

my $query = $app->db->query();

transaction

Arguments:

  • $sub - reference to sub

Example:

$app->db->transaction(sub {
    # work with db
    ...
});

Internal packages

QBit::Application::Model::DB::mysql::Field - class for MySQL fields;
QBit::Application::Model::DB::mysql::Query - class for MySQL queries;
QBit::Application::Model::DB::mysql::Table - class for MySQL tables;