1 |
3 |
ahitrov@rambler.ru |
package SQL::LinkTable; |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
use base 'SQL::ProtoTable'; |
5 |
|
|
|
6 |
|
|
sub db_table |
7 |
|
|
{ |
8 |
|
|
return 'links'; |
9 |
|
|
} |
10 |
|
|
|
11 |
|
|
sub available_filters { |
12 |
|
|
my @available_filters = qw( |
13 |
|
|
_class_filter |
14 |
|
|
_status_filter |
15 |
|
|
_in_id_filter |
16 |
|
|
_id_filter |
17 |
|
|
_name_filter |
18 |
|
|
_class_excludes_filter |
19 |
|
|
_excludes_filter |
20 |
|
|
_datetime_filter |
21 |
|
|
_date_equal_filter |
22 |
|
|
_date_filter |
23 |
|
|
|
24 |
|
|
_dest_id_filter |
25 |
|
|
_source_id_filter |
26 |
|
|
_source_class_filter |
27 |
|
|
_dest_class_filter |
28 |
|
|
); |
29 |
|
|
return \@available_filters; |
30 |
|
|
} |
31 |
|
|
|
32 |
|
|
# ---------------------------------------------------------------------------- |
33 |
|
|
# �������� ������ � ��������, ������ ��� ������� �����! |
34 |
|
|
# ��� ����� �������� - ���������� ��� ���� ����������. |
35 |
|
|
# |
36 |
|
|
# attr - ������������ ��������, �������� ��������; |
37 |
|
|
# type - ��� ���������, ��������� ��� ������������; |
38 |
|
|
# rusname - ������� ��������, ����� �� ��������� ��� �����������; |
39 |
|
|
# hidden - ����� 1, ����� |
40 |
|
|
# readonly - ������������� ��� ������ ������ ��� ��������� � ���������� |
41 |
|
|
# db_field - ���� � ������� |
42 |
|
|
# default - �������� �� ��������� (���� ������ ����� ��� ��������) |
43 |
|
|
# ---------------------------------------------------------------------------- |
44 |
|
|
sub required_properties |
45 |
|
|
{ |
46 |
|
|
return ( |
47 |
|
|
{ # ������������� ���������, �������� �� ���� �����... |
48 |
|
|
'attr' => 'id', |
49 |
|
|
'type' => 'integer', |
50 |
|
|
'rusname' => '������������� ���������', |
51 |
|
|
'hidden' => 1, |
52 |
|
|
'auto' => 1, |
53 |
|
|
'db_field' => 'id', |
54 |
|
|
'readonly' => 1, |
55 |
|
|
'db_type' => 'integer', |
56 |
|
|
}, |
57 |
|
|
{ # ����� ���������... |
58 |
|
|
'attr' => 'class', |
59 |
|
|
'type' => 'string', |
60 |
|
|
'rusname' => '����� ���������', |
61 |
|
|
'hidden' => 1, |
62 |
|
|
'db_field' => 'class', |
63 |
|
|
'readonly' => 1, |
64 |
|
|
'db_type' => 'varchar(48)', |
65 |
|
|
}, |
66 |
|
|
{ # ��� ���������... |
67 |
|
|
'attr' => 'source_id', |
68 |
|
|
'type' => 'string', |
69 |
|
|
'rusname' => 'ID ���������', |
70 |
|
|
'db_field' => 'source_id', |
71 |
|
|
'db_type' => 'integer', |
72 |
|
|
}, |
73 |
|
|
{ # ��� ���������... |
74 |
|
|
'attr' => 'source_class', |
75 |
|
|
'type' => 'string', |
76 |
|
|
'rusname' => '����� ���������', |
77 |
|
|
'db_field' => 'source_class', |
78 |
|
|
'db_type' => 'varchar(48)', |
79 |
|
|
}, |
80 |
|
|
{ # ��� ���������... |
81 |
|
|
'attr' => 'dest_id', |
82 |
|
|
'type' => 'string', |
83 |
|
|
'rusname' => 'ID ����', |
84 |
|
|
'db_field' => 'dest_id', |
85 |
|
|
'db_type' => 'integer', |
86 |
|
|
}, |
87 |
|
|
{ # ��� ���������... |
88 |
|
|
'attr' => 'dest_class', |
89 |
|
|
'type' => 'string', |
90 |
|
|
'rusname' => '����� ����', |
91 |
|
|
'db_field' => 'dest_class', |
92 |
|
|
'db_type' => 'varchar(48)', |
93 |
|
|
}, |
94 |
|
|
{ # ����� �������� ���������, ��������� ����... |
95 |
|
|
'attr' => 'ctime', |
96 |
|
|
'type' => 'datetime', |
97 |
|
|
'rusname' => '����� ��������', |
98 |
|
|
'hidden' => 1, |
99 |
|
|
'auto' => 1, |
100 |
|
|
'db_field' => 'ctime', |
101 |
|
|
'readonly' => 1, |
102 |
|
|
'default' => 'CURRENT_TIMESTAMP', |
103 |
|
|
'db_type' => 'timestamp', |
104 |
|
|
}, |
105 |
|
|
{ # ����� ����������� ���������, ��������� ����... |
106 |
|
|
'attr' => 'mtime', |
107 |
|
|
'type' => 'datetime', |
108 |
|
|
'rusname' => '����� �����������', |
109 |
|
|
'hidden' => 1, |
110 |
|
|
'auto' => 1, |
111 |
|
|
'db_field' => 'mtime', |
112 |
|
|
'default' => 'CURRENT_TIMESTAMP', |
113 |
|
|
'db_type' => 'timestamp', |
114 |
|
|
}, |
115 |
|
|
{ # ���� ���� ������� �������� ����������... |
116 |
|
|
'attr' => 'status', |
117 |
|
|
'type' => 'status', |
118 |
|
|
'rusname' => '������', |
119 |
|
|
'db_field' => 'status', |
120 |
|
|
'db_type' => 'integer', |
121 |
|
|
}, |
122 |
|
|
); |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
|
126 |
|
|
########### FILTERS DESCRIPTION #################################################################################### |
127 |
|
|
sub _dest_id_filter { |
128 |
|
|
my ($self,%opts)=@_; |
129 |
|
|
return undef unless ( exists($opts{dest_id}) ); |
130 |
|
|
return &SQL::Common::_generic_int_filter('d.dest_id', $opts{dest_id}); |
131 |
|
|
} |
132 |
|
|
|
133 |
|
|
sub _source_id_filter { |
134 |
|
|
my ($self,%opts)=@_; |
135 |
|
|
return undef unless ( exists($opts{source_id}) ); |
136 |
|
|
return &SQL::Common::_generic_int_filter('d.source_id', $opts{source_id}); |
137 |
|
|
} |
138 |
|
|
|
139 |
|
|
sub _source_class_filter { |
140 |
|
|
my ($self, %opts)=@_; |
141 |
|
|
return undef unless ( exists($opts{source_class}) ); |
142 |
|
|
return &SQL::Common::_generic_text_filter('d.source_class', $opts{source_class}); |
143 |
|
|
} |
144 |
|
|
|
145 |
|
|
sub _dest_class_filter { |
146 |
|
|
my ($self, %opts)=@_; |
147 |
|
|
return undef unless ( exists($opts{dest_class}) ); |
148 |
|
|
return &SQL::Common::_generic_text_filter('d.dest_class', $opts{dest_class}); |
149 |
|
|
} |
150 |
|
|
|
151 |
|
|
1; |
152 |
|
|
|