QBit::Application::Model::DB::Table
Base class for DB tables.
name
inherits
primary_key
indexes
foreign_keys
create_sql
add_multi
add
edit
delete
_get_field_object
_convert_fk_auto_type
No arguments.
Method called from "new" before return object.
Return values:
$fields - reference to array of objects (QBit::Application::Model::DB::Field)
Example:
my $fields = $app->db->users->fields();
@field_names
my @field_names = $app->db->users->field_names();
Arguments:
%opts - options with keys
fields
filter
group_by
order_by
limit
distinct
for_update
all_langs
For more information see QBit::Application::Model::DB::Query::get_all
$data - reference to array
my $data = $app->db->users->get_all( fields => [qw(id login)], filter => {id => 3}, );
$id - scalar or hash
$data - reference to hash
my $data = $app->db->users->get(3, fields => [qw(id login)],);
Truncate table.
$app->db->users->truncate();
if_exists - added 'IF EXISTS'
$app->db->users->drop(); # DROP TABLE `users`; $app->db->users->drop(if_exists => TRUE); # DROP TABLE IF EXISTS `users`;
You can redefine this method in your Model.
$fields - reference to array
$bool
my $bool = $app->db->users->have_fields([qw(id login)]);
For more information see code and test.
To install QBit::Application::Model::DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm QBit::Application::Model::DB
CPAN shell
perl -MCPAN -e shell install QBit::Application::Model::DB
For more information on module installation, please visit the detailed CPAN module installation guide.