Engine/Builder/TableCreate.pm untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 68 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package SQL::Engine::Builder::TableCreate;
2  
3 use 5.014;
4  
5 use strict;
6 use warnings;
7  
8 use registry;
9 use routines;
10  
11 use Data::Object::Class;
12 use Data::Object::ClassHas;
13  
14 extends 'SQL::Engine::Builder';
15  
16 use SQL::Validator;
17  
18 our $VERSION = '0.02'; # VERSION
19  
20 # ATTRIBUTES
21  
22 has name => (
23 is => 'ro',
24 isa => 'Str',
25 req => 1
26 );
27  
28 has temp => (
29 is => 'ro',
30 isa => 'Bool',
31 opt => 1
32 );
33  
34 has safe => (
35 is => 'ro',
36 isa => 'Bool',
37 opt => 1
38 );
39  
40 has columns => (
41 is => 'ro',
42 isa => 'ArrayRef[HashRef]',
43 opt => 1
44 );
45  
46 has constraints => (
47 is => 'ro',
48 isa => 'ArrayRef[HashRef]',
49 opt => 1
50 );
51  
52 has query => (
53 is => 'ro',
54 isa => 'HashRef',
55 opt => 1
56 );
57  
58 # METHODS
59  
60 method data() {
61 my $schema = {};
62  
63 if ($self->name) {
64 $schema->{"name"} = $self->name;
65 }
66  
67 if ($self->temp) {
68 $schema->{"temp"} = $self->temp;
69 }
70  
71 if ($self->safe) {
72 $schema->{"safe"} = $self->safe;
73 }
74  
75 if ($self->columns) {
76 $schema->{"columns"} = $self->columns;
77 }
78  
79 if ($self->constraints) {
80 $schema->{"constraints"} = $self->constraints;
81 }
82  
83 if ($self->query) {
84 $schema->{"query"} = $self->query;
85 }
86  
87 return {
88 "table-create" => $schema
89 }
90 }
91  
92 1;