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]);
query
Create and returns a new query object.
Arguments:
%opts - options
comment
without_check_fields
without_table_alias
Return values:
$query - object (QBit::Application::Model::DB::mysql::Query)
Example:
my $query = $app->db->query(comment => 'example query');
kill_query
Arguments:
$query_id - number (ID query)
Return values:
$res - Returns the number of rows affected or undef on error.
A return value of -1 means the number of rows is not known, not applicable, or not available.
Example:
my $res = $app->db->kill_query(35); #SQL: KILL QUERY 35;
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;