Branch Coverage

blib/lib/Queue/DBI/Admin.pm
Criterion Covered Total %
branch 58 96 60.4


line true false branch
124 1 39 if scalar keys %args != 0
128 2 37 unless Data::Validate::Type::is_instance($database_handle, 'class', 'DBI::db')
162 0 2 if not defined $queue_name or $queue_name eq ''
173 0 2 unless $database_handle->do(sprintf("\n\t\t\t\tINSERT INTO %s ( name )\n\t\t\t\tVALUES ( ? )\n\t\t\t", $queues_table_name), {}, $queue_name)
206 0 4 if not defined $queue_name or $queue_name eq ''
216 0 2 unless defined $queue
250 0 12 if not defined $queue_name or $queue_name eq ''
284 0 2 if not defined $queue_name or $queue_name eq ''
298 0 2 unless $database_handle->do(sprintf("\n\t\t\t\tDELETE\n\t\t\t\tFROM %s\n\t\t\t\tWHERE queue_id = ?\n\t\t\t", $queue_elements_table_name), {}, $queue->get_queue_id)
316 0 2 unless $database_handle->do(sprintf("\n\t\t\t\tDELETE\n\t\t\t\tFROM %s\n\t\t\t\tWHERE queue_id = ?\n\t\t\t", $queues_table_name), {}, $queue->get_queue_id)
362 4 1 unless $queues_table_exists or $queue_elements_table_exists
367 1 13 if $queues_table_exists and not $queue_elements_table_exists
369 1 12 if not $queues_table_exists and $queue_elements_table_exists
374 1 11 unless $queues_table_has_fields
379 1 10 unless $queue_elements_table_has_fields
406 0 3 if scalar keys %args != 0
422 1 2 if $drop_if_exist
426 3 0 if ($database_type eq 'SQLite') { }
0 0 elsif ($database_type eq 'Pg') { }
428 0 3 unless $database_handle->do(sprintf("\n\t\t\t\t\tCREATE TABLE %s\n\t\t\t\t\t(\n\t\t\t\t\t\tqueue_id INTEGER PRIMARY KEY AUTOINCREMENT,\n\t\t\t\t\t\tname VARCHAR(255) NOT NULL UNIQUE\n\t\t\t\t\t)\n\t\t\t\t", $quoted_queues_table_name))
447 0 0 unless $database_handle->do(sprintf("\n\t\t\t\t\tCREATE TABLE %s\n\t\t\t\t\t(\n\t\t\t\t\t\tqueue_id SERIAL,\n\t\t\t\t\t\tname VARCHAR(255) NOT NULL,\n\t\t\t\t\t\tPRIMARY KEY (queue_id),\n\t\t\t\t\t\tCONSTRAINT %s UNIQUE (name)\n\t\t\t\t\t)\n\t\t\t\t", $quoted_queues_table_name, $unique_index_name))
469 0 0 unless $database_handle->do(sprintf("\n\t\t\t\t\tCREATE TABLE %s\n\t\t\t\t\t(\n\t\t\t\t\t\tqueue_id INT(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\tname VARCHAR(255) NOT NULL,\n\t\t\t\t\t\tPRIMARY KEY (queue_id),\n\t\t\t\t\t\tUNIQUE KEY %s (name)\n\t\t\t\t\t)\n\t\t\t\t\tENGINE=InnoDB\n\t\t\t\t", $quoted_queues_table_name, $unique_index_name))
488 3 0 if ($database_type eq 'SQLite') { }
0 0 elsif ($database_type eq 'Pg') { }
490 0 3 unless $database_handle->do(sprintf("\n\t\t\t\t\tCREATE TABLE %s\n\t\t\t\t\t(\n\t\t\t\t\t\tqueue_element_id INTEGER PRIMARY KEY AUTOINCREMENT,\n\t\t\t\t\t\tqueue_id INTEGER NOT NULL,\n\t\t\t\t\t\tdata TEXT,\n\t\t\t\t\t\tlock_time INT(10) DEFAULT NULL,\n\t\t\t\t\t\trequeue_count INT(3) DEFAULT '0',\n\t\t\t\t\t\tcreated INT(10) NOT NULL DEFAULT '0'\n\t\t\t\t\t)\n\t\t\t\t", $quoted_queue_elements_table_name))
509 0 0 unless $database_handle->do(sprintf("\n\t\t\t\t\tCREATE TABLE %s\n\t\t\t\t\t(\n\t\t\t\t\t\tqueue_element_id SERIAL,\n\t\t\t\t\t\tqueue_id INTEGER NOT NULL REFERENCES %s (queue_id),\n\t\t\t\t\t\tdata TEXT,\n\t\t\t\t\t\tlock_time INTEGER DEFAULT NULL,\n\t\t\t\t\t\trequeue_count SMALLINT DEFAULT 0,\n\t\t\t\t\t\tcreated INTEGER NOT NULL DEFAULT 0,\n\t\t\t\t\t\tPRIMARY KEY (queue_element_id)\n\t\t\t\t\t)\n\t\t\t\t", $quoted_queue_elements_table_name, $quoted_queues_table_name))
532 0 0 unless $database_handle->do(sprintf("\n\t\t\t\t\tCREATE INDEX %s\n\t\t\t\t\tON %s (queue_id)\n\t\t\t\t", $queue_id_index_name, $quoted_queue_elements_table_name))
552 0 0 unless $database_handle->do(sprintf("\n\t\t\t\t\tCREATE TABLE %s\n\t\t\t\t\t(\n\t\t\t\t\t\tqueue_element_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\tqueue_id INT(11) NOT NULL,\n\t\t\t\t\t\tdata TEXT,\n\t\t\t\t\t\tlock_time INT(10) UNSIGNED DEFAULT NULL,\n\t\t\t\t\t\trequeue_count INT(3) UNSIGNED DEFAULT '0',\n\t\t\t\t\t\tcreated INT(10) UNSIGNED NOT NULL DEFAULT '0',\n\t\t\t\t\t\tPRIMARY KEY (queue_element_id),\n\t\t\t\t\t\tKEY %s (queue_id),\n\t\t\t\t\t\tCONSTRAINT %s FOREIGN KEY (queue_id) REFERENCES %s (queue_id)\n\t\t\t\t\t)\n\t\t\t\t\tENGINE=InnoDB\n\t\t\t\t", $quoted_queue_elements_table_name, $queue_id_index_name, $queue_id_foreign_key_name, $quoted_queues_table_name))
605 2 1 if ($self->has_table('queues'))
608 0 2 unless $self->has_mandatory_fields('queues')
611 2 1 if ($self->has_table('queue_elements'))
614 0 2 unless $self->has_mandatory_fields('queue_elements')
625 0 3 unless $database_handle->do(sprintf('DROP TABLE IF EXISTS %s', $quoted_queue_elements_table_name))
632 0 3 unless $database_handle->do(sprintf('DROP TABLE IF EXISTS %s', $quoted_queues_table_name))
674 43 33 defined $self->{'table_names'}{'queues'} && $self->{'table_names'}{'queues'} ne '' ? :
692 40 31 defined $self->{'table_names'}{'queue_elements'} && $self->{'table_names'}{'queue_elements'} ne '' ? :
714 48 0 defined $queues_table_name ? :
736 47 0 defined $queue_elements_table_name ? :
760 0 25 unless $database_type =~ /^(?:SQLite|MySQL|Pg)$/xi
809 1 50 unless defined $table_type
811 0 50 unless $table_type =~ /\A(?:queues|queue_elements)\Z/x
815 25 25 $table_type eq 'queues' ? :
872 0 29 unless defined $table_type
874 0 29 unless $table_type =~ /\A(?:queues|queue_elements)\Z/x
878 15 14 $table_type eq 'queues' ? :
883 15 14 $table_type eq 'queues' ? :
934 12 8 if $self->{'tables_verified'}
939 0 8 unless $self->has_tables