1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 **/
19
20 #include "common.h"
21 #include "db.h"
22 #include "dbupgrade.h"
23 #include "log.h"
24
25 /*
26 * 2.4 development database patches
27 */
28
29 #ifndef HAVE_SQLITE3
30
31 extern unsigned char program_type;
32
DBpatch_2030000(void)33 static int DBpatch_2030000(void)
34 {
35 return SUCCEED;
36 }
37
DBpatch_2030001(void)38 static int DBpatch_2030001(void)
39 {
40 const ZBX_FIELD field = {"every", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
41
42 return DBset_default("timeperiods", &field);
43 }
44
DBpatch_2030002(void)45 static int DBpatch_2030002(void)
46 {
47 const ZBX_TABLE table =
48 {"trigger_discovery_tmp", "", 0,
49 {
50 {"triggerid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
51 {"parent_triggerid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
52 {0}
53 },
54 NULL
55 };
56
57 return DBcreate_table(&table);
58 }
59
DBpatch_2030003(void)60 static int DBpatch_2030003(void)
61 {
62 if (ZBX_DB_OK <= DBexecute(
63 "insert into trigger_discovery_tmp (select triggerid,parent_triggerid from trigger_discovery)"))
64 {
65 return SUCCEED;
66 }
67
68 return FAIL;
69 }
70
DBpatch_2030004(void)71 static int DBpatch_2030004(void)
72 {
73 return DBdrop_table("trigger_discovery");
74 }
75
DBpatch_2030005(void)76 static int DBpatch_2030005(void)
77 {
78 const ZBX_TABLE table =
79 {"trigger_discovery", "triggerid", 0,
80 {
81 {"triggerid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
82 {"parent_triggerid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
83 {0}
84 },
85 NULL
86 };
87
88 return DBcreate_table(&table);
89 }
90
DBpatch_2030006(void)91 static int DBpatch_2030006(void)
92 {
93 return DBcreate_index("trigger_discovery", "trigger_discovery_1", "parent_triggerid", 0);
94 }
95
DBpatch_2030007(void)96 static int DBpatch_2030007(void)
97 {
98 const ZBX_FIELD field = {"triggerid", NULL, "triggers", "triggerid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
99
100 return DBadd_foreign_key("trigger_discovery", 1, &field);
101 }
102
DBpatch_2030008(void)103 static int DBpatch_2030008(void)
104 {
105 const ZBX_FIELD field = {"parent_triggerid", NULL, "triggers", "triggerid", 0, 0, 0, 0};
106
107 return DBadd_foreign_key("trigger_discovery", 2, &field);
108 }
109
DBpatch_2030009(void)110 static int DBpatch_2030009(void)
111 {
112 if (ZBX_DB_OK <= DBexecute(
113 "insert into trigger_discovery (select triggerid,parent_triggerid from trigger_discovery_tmp)"))
114 {
115 return SUCCEED;
116 }
117
118 return FAIL;
119 }
120
DBpatch_2030010(void)121 static int DBpatch_2030010(void)
122 {
123 return DBdrop_table("trigger_discovery_tmp");
124 }
125
DBpatch_2030011(void)126 static int DBpatch_2030011(void)
127 {
128 const ZBX_FIELD field = {"application", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
129
130 return DBadd_field("sysmaps_elements", &field);
131 }
132
DBpatch_2030012(void)133 static int DBpatch_2030012(void)
134 {
135 const ZBX_TABLE table =
136 {"graph_discovery_tmp", "", 0,
137 {
138 {"graphid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
139 {"parent_graphid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
140 {0}
141 },
142 NULL
143 };
144
145 return DBcreate_table(&table);
146 }
147
DBpatch_2030013(void)148 static int DBpatch_2030013(void)
149 {
150 if (ZBX_DB_OK <= DBexecute(
151 "insert into graph_discovery_tmp (select graphid,parent_graphid from graph_discovery)"))
152 {
153 return SUCCEED;
154 }
155
156 return FAIL;
157 }
158
DBpatch_2030014(void)159 static int DBpatch_2030014(void)
160 {
161 return DBdrop_table("graph_discovery");
162 }
163
DBpatch_2030015(void)164 static int DBpatch_2030015(void)
165 {
166 const ZBX_TABLE table =
167 {"graph_discovery", "graphid", 0,
168 {
169 {"graphid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
170 {"parent_graphid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
171 {0}
172 },
173 NULL
174 };
175
176 return DBcreate_table(&table);
177 }
178
DBpatch_2030016(void)179 static int DBpatch_2030016(void)
180 {
181 return DBcreate_index("graph_discovery", "graph_discovery_1", "parent_graphid", 0);
182 }
183
DBpatch_2030017(void)184 static int DBpatch_2030017(void)
185 {
186 const ZBX_FIELD field = {"graphid", NULL, "graphs", "graphid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
187
188 return DBadd_foreign_key("graph_discovery", 1, &field);
189 }
190
DBpatch_2030018(void)191 static int DBpatch_2030018(void)
192 {
193 const ZBX_FIELD field = {"parent_graphid", NULL, "graphs", "graphid", 0, 0, 0, 0};
194
195 return DBadd_foreign_key("graph_discovery", 2, &field);
196 }
197
DBpatch_2030019(void)198 static int DBpatch_2030019(void)
199 {
200 if (ZBX_DB_OK <= DBexecute(
201 "insert into graph_discovery (select graphid,parent_graphid from graph_discovery_tmp)"))
202 {
203 return SUCCEED;
204 }
205
206 return FAIL;
207 }
208
DBpatch_2030020(void)209 static int DBpatch_2030020(void)
210 {
211 return DBdrop_table("graph_discovery_tmp");
212 }
213
DBpatch_2030021(void)214 static int DBpatch_2030021(void)
215 {
216 const ZBX_TABLE table =
217 {"item_condition", "item_conditionid", 0,
218 {
219 {"item_conditionid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
220 {"itemid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
221 {"operator", "8", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
222 {"macro", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
223 {"value", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
224 {NULL}
225 },
226 NULL
227 };
228
229 return DBcreate_table(&table);
230 }
231
DBpatch_2030022(void)232 static int DBpatch_2030022(void)
233 {
234 return DBcreate_index("item_condition", "item_condition_1", "itemid", 0);
235 }
236
DBpatch_2030023(void)237 static int DBpatch_2030023(void)
238 {
239 const ZBX_FIELD field = {"itemid", NULL, "items", "itemid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
240
241 return DBadd_foreign_key("item_condition", 1, &field);
242 }
243
DBpatch_2030024(void)244 static int DBpatch_2030024(void)
245 {
246 DB_RESULT result;
247 DB_ROW row;
248 char *value, *macro_esc, *value_esc;
249 int ret = FAIL, rc;
250
251 /* 1 - ZBX_FLAG_DISCOVERY_RULE*/
252 if (NULL == (result = DBselect("select itemid,filter from items where filter<>'' and flags=1")))
253 return FAIL;
254
255 while (NULL != (row = DBfetch(result)))
256 {
257 if (NULL == (value = strchr(row[1], ':')) || 0 == strcmp(row[1], ":"))
258 continue;
259
260 *value++ = '\0';
261
262 macro_esc = DBdyn_escape_string(row[1]);
263 value_esc = DBdyn_escape_string(value);
264
265 rc = DBexecute("insert into item_condition"
266 " (item_conditionid,itemid,macro,value)"
267 " values (%s,%s,'%s','%s')",
268 row[0], row[0], macro_esc, value_esc);
269
270 zbx_free(value_esc);
271 zbx_free(macro_esc);
272
273 if (ZBX_DB_OK > rc)
274 goto out;
275 }
276
277 ret = SUCCEED;
278 out:
279 DBfree_result(result);
280
281 return ret;
282 }
283
DBpatch_2030025(void)284 static int DBpatch_2030025(void)
285 {
286 const ZBX_FIELD field = {"evaltype", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
287
288 return DBadd_field("items", &field);
289 }
290
DBpatch_2030026(void)291 static int DBpatch_2030026(void)
292 {
293 return DBdrop_field("items", "filter");
294 }
295
DBpatch_2030027(void)296 static int DBpatch_2030027(void)
297 {
298 const ZBX_FIELD field = {"formula", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
299
300 return DBset_default("items", &field);
301 }
302
DBpatch_2030028(void)303 static int DBpatch_2030028(void)
304 {
305 if (ZBX_DB_OK > DBexecute("update items set formula='' where flags=%d", ZBX_FLAG_DISCOVERY_RULE))
306 return FAIL;
307
308 return SUCCEED;
309 }
310
DBpatch_2030029(void)311 static int DBpatch_2030029(void)
312 {
313 /* 7 - SCREEN_SORT_TRIGGERS_STATUS_ASC */
314 /* 9 - SCREEN_SORT_TRIGGERS_RETRIES_LEFT_ASC (no more supported) */
315 if (ZBX_DB_OK > DBexecute("update screens_items set sort_triggers=7 where sort_triggers=9"))
316 return FAIL;
317
318 return SUCCEED;
319 }
320
DBpatch_2030030(void)321 static int DBpatch_2030030(void)
322 {
323 /* 8 - SCREEN_SORT_TRIGGERS_STATUS_DESC */
324 /* 10 - SCREEN_SORT_TRIGGERS_RETRIES_LEFT_DESC (no more supported) */
325 if (ZBX_DB_OK > DBexecute("update screens_items set sort_triggers=8 where sort_triggers=10"))
326 return FAIL;
327
328 return SUCCEED;
329 }
330
DBpatch_2030031(void)331 static int DBpatch_2030031(void)
332 {
333 /* 16 - CONDITION_TYPE_MAINTENANCE */
334 if (ZBX_DB_OK > DBexecute("update conditions set value='' where conditiontype=16"))
335 return FAIL;
336
337 return SUCCEED;
338 }
339
DBpatch_2030032(void)340 static int DBpatch_2030032(void)
341 {
342 const ZBX_FIELD field = {"description", "", NULL, NULL, 0, ZBX_TYPE_SHORTTEXT, ZBX_NOTNULL, 0};
343
344 return DBadd_field("hosts", &field);
345 }
346
DBpatch_2030033(void)347 static int DBpatch_2030033(void)
348 {
349 return DBdrop_table("history_sync");
350 }
351
DBpatch_2030034(void)352 static int DBpatch_2030034(void)
353 {
354 return DBdrop_table("history_uint_sync");
355 }
356
DBpatch_2030035(void)357 static int DBpatch_2030035(void)
358 {
359 return DBdrop_table("history_str_sync");
360 }
361
DBpatch_2030036(void)362 static int DBpatch_2030036(void)
363 {
364 return DBdrop_table("node_cksum");
365 }
366
DBpatch_2030037(void)367 static int DBpatch_2030037(void)
368 {
369 const ZBX_TABLE table =
370 {"ids_tmp", "", 0,
371 {
372 {"table_name", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
373 {"field_name", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
374 {"nextid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
375 {0}
376 },
377 NULL
378 };
379
380 if (ZBX_PROGRAM_TYPE_SERVER == program_type)
381 return SUCCEED;
382
383 return DBcreate_table(&table);
384 }
385
DBpatch_2030038(void)386 static int DBpatch_2030038(void)
387 {
388 if (ZBX_PROGRAM_TYPE_SERVER == program_type)
389 return SUCCEED;
390
391 if (ZBX_DB_OK <= DBexecute(
392 "insert into ids_tmp ("
393 "select table_name,field_name,nextid"
394 " from ids"
395 " where nodeid=0"
396 " and ("
397 "(table_name='proxy_history' and field_name='history_lastid')"
398 " or (table_name='proxy_dhistory' and field_name='dhistory_lastid')"
399 " or (table_name='proxy_autoreg_host' and field_name='autoreg_host_lastid')"
400 ")"
401 ")"))
402 {
403 return SUCCEED;
404 }
405
406 return FAIL;
407 }
408
DBpatch_2030039(void)409 static int DBpatch_2030039(void)
410 {
411 return DBdrop_table("ids");
412 }
413
DBpatch_2030040(void)414 static int DBpatch_2030040(void)
415 {
416 const ZBX_TABLE table =
417 {"ids", "table_name,field_name", 0,
418 {
419 {"table_name", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
420 {"field_name", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
421 {"nextid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
422 {0}
423 },
424 NULL
425 };
426
427 return DBcreate_table(&table);
428 }
429
DBpatch_2030041(void)430 static int DBpatch_2030041(void)
431 {
432 if (ZBX_PROGRAM_TYPE_SERVER == program_type)
433 return SUCCEED;
434
435 if (ZBX_DB_OK <= DBexecute(
436 "insert into ids (select table_name,field_name,nextid from ids_tmp)"))
437 {
438 return SUCCEED;
439 }
440
441 return FAIL;
442 }
443
DBpatch_2030042(void)444 static int DBpatch_2030042(void)
445 {
446 if (ZBX_PROGRAM_TYPE_SERVER == program_type)
447 return SUCCEED;
448
449 return DBdrop_table("ids_tmp");
450 }
451
DBpatch_2030043(void)452 static int DBpatch_2030043(void)
453 {
454 const char *sql =
455 "delete from profiles"
456 " where idx in ("
457 "'web.nodes.php.sort','web.nodes.php.sortorder','web.nodes.switch_node',"
458 "'web.nodes.selected','web.popup_right.nodeid.last'"
459 ")";
460
461 if (ZBX_DB_OK <= DBexecute("%s", sql))
462 return SUCCEED;
463
464 return FAIL;
465 }
466
DBpatch_2030044(void)467 static int DBpatch_2030044(void)
468 {
469 /* 21 - AUDIT_RESOURCE_NODE */
470 const char *sql = "delete from auditlog where resourcetype=21";
471
472 if (ZBX_DB_OK <= DBexecute("%s", sql))
473 return SUCCEED;
474
475 return FAIL;
476 }
477
DBpatch_2030045(void)478 static int DBpatch_2030045(void)
479 {
480 /* 17 - CONDITION_TYPE_NODE */
481 const char *sql = "delete from conditions where conditiontype=17";
482
483 if (ZBX_DB_OK <= DBexecute("%s", sql))
484 return SUCCEED;
485
486 return FAIL;
487 }
488
dm_rename_slave_data(const char * table_name,const char * key_name,const char * field_name,int field_length)489 static int dm_rename_slave_data(const char *table_name, const char *key_name, const char *field_name,
490 int field_length)
491 {
492 DB_RESULT result;
493 DB_ROW row;
494 int local_nodeid = 0, nodeid, globalmacro;
495 zbx_uint64_t id, min, max;
496 char *name = NULL, *name_esc;
497 size_t name_alloc = 0, name_offset;
498
499 /* 1 - ZBX_NODE_LOCAL */
500 if (NULL == (result = DBselect("select nodeid from nodes where nodetype=1")))
501 return FAIL;
502
503 if (NULL != (row = DBfetch(result)))
504 local_nodeid = atoi(row[0]);
505 DBfree_result(result);
506
507 if (0 == local_nodeid)
508 return SUCCEED;
509
510 globalmacro = (0 == strcmp(table_name, "globalmacro"));
511
512 min = local_nodeid * __UINT64_C(100000000000000);
513 max = min + __UINT64_C(100000000000000) - 1;
514
515 if (NULL == (result = DBselect(
516 "select " ZBX_FS_SQL_NAME "," ZBX_FS_SQL_NAME
517 " from " ZBX_FS_SQL_NAME
518 " where not " ZBX_FS_SQL_NAME " between " ZBX_FS_UI64 " and " ZBX_FS_UI64
519 " order by " ZBX_FS_SQL_NAME ,
520 key_name, field_name, table_name, key_name, min, max, key_name)))
521 {
522 return FAIL;
523 }
524
525 while (NULL != (row = DBfetch(result)))
526 {
527 ZBX_STR2UINT64(id, row[0]);
528 nodeid = (int)(id / __UINT64_C(100000000000000));
529
530 name_offset = 0;
531
532 if (0 == globalmacro)
533 zbx_snprintf_alloc(&name, &name_alloc, &name_offset, "N%d_%s", nodeid, row[1]);
534 else
535 zbx_snprintf_alloc(&name, &name_alloc, &name_offset, "{$N%d_%s", nodeid, row[1] + 2);
536
537 name_esc = DBdyn_escape_string_len(name, field_length);
538
539 if (ZBX_DB_OK > DBexecute("update " ZBX_FS_SQL_NAME " set " ZBX_FS_SQL_NAME "='%s'"
540 " where " ZBX_FS_SQL_NAME "=" ZBX_FS_UI64,
541 table_name, field_name, name_esc, key_name, id))
542 {
543 zbx_free(name_esc);
544 break;
545 }
546
547 zbx_free(name_esc);
548 }
549 DBfree_result(result);
550
551 zbx_free(name);
552
553 return SUCCEED;
554 }
555
check_data_uniqueness(const char * table_name,const char * field_name)556 static int check_data_uniqueness(const char *table_name, const char *field_name)
557 {
558 DB_RESULT result;
559 DB_ROW row;
560 int ret = SUCCEED;
561
562 if (NULL == (result = DBselect("select %s from %s group by %s having count(*)>1",
563 field_name, table_name, field_name)))
564 {
565 return FAIL;
566 }
567
568 while (NULL != (row = DBfetch(result)))
569 {
570 zabbix_log(LOG_LEVEL_CRIT, "Duplicate data \"%s\" for field \"%s\" is found in table \"%s\"."
571 " Remove it manually and restart the process.", row[0], field_name, table_name);
572 ret = FAIL;
573 }
574 DBfree_result(result);
575
576 return ret;
577 }
578
DBpatch_2030046(void)579 static int DBpatch_2030046(void)
580 {
581 return dm_rename_slave_data("actions", "actionid", "name", 255);
582 }
583
DBpatch_2030047(void)584 static int DBpatch_2030047(void)
585 {
586 return dm_rename_slave_data("drules", "druleid", "name", 255);
587 }
588
DBpatch_2030048(void)589 static int DBpatch_2030048(void)
590 {
591 return dm_rename_slave_data("globalmacro", "globalmacroid", "macro", 64);
592 }
593
DBpatch_2030049(void)594 static int DBpatch_2030049(void)
595 {
596 return dm_rename_slave_data("groups", "groupid", "name", 64);
597 }
598
DBpatch_2030050(void)599 static int DBpatch_2030050(void)
600 {
601 return dm_rename_slave_data("hosts", "hostid", "host", 64);
602 }
603
DBpatch_2030051(void)604 static int DBpatch_2030051(void)
605 {
606 return dm_rename_slave_data("hosts", "hostid", "name", 64);
607 }
608
DBpatch_2030052(void)609 static int DBpatch_2030052(void)
610 {
611 return dm_rename_slave_data("icon_map", "iconmapid", "name", 64);
612 }
613
DBpatch_2030053(void)614 static int DBpatch_2030053(void)
615 {
616 return dm_rename_slave_data("images", "imageid", "name", 64);
617 }
618
DBpatch_2030054(void)619 static int DBpatch_2030054(void)
620 {
621 return dm_rename_slave_data("maintenances", "maintenanceid", "name", 128);
622 }
623
DBpatch_2030055(void)624 static int DBpatch_2030055(void)
625 {
626 return dm_rename_slave_data("media_type", "mediatypeid", "description", 100);
627 }
628
DBpatch_2030056(void)629 static int DBpatch_2030056(void)
630 {
631 return dm_rename_slave_data("regexps", "regexpid", "name", 128);
632 }
633
DBpatch_2030057(void)634 static int DBpatch_2030057(void)
635 {
636 return dm_rename_slave_data("screens", "screenid", "name", 255);
637 }
638
DBpatch_2030058(void)639 static int DBpatch_2030058(void)
640 {
641 return dm_rename_slave_data("scripts", "scriptid", "name", 255);
642 }
643
DBpatch_2030059(void)644 static int DBpatch_2030059(void)
645 {
646 return dm_rename_slave_data("services", "serviceid", "name", 128);
647 }
648
DBpatch_2030060(void)649 static int DBpatch_2030060(void)
650 {
651 return dm_rename_slave_data("slideshows", "slideshowid", "name", 255);
652 }
653
DBpatch_2030061(void)654 static int DBpatch_2030061(void)
655 {
656 return dm_rename_slave_data("sysmaps", "sysmapid", "name", 128);
657 }
658
DBpatch_2030062(void)659 static int DBpatch_2030062(void)
660 {
661 return dm_rename_slave_data("usrgrp", "usrgrpid", "name", 64);
662 }
663
DBpatch_2030063(void)664 static int DBpatch_2030063(void)
665 {
666 return dm_rename_slave_data("users", "userid", "alias", 100);
667 }
668
DBpatch_2030064(void)669 static int DBpatch_2030064(void)
670 {
671 return dm_rename_slave_data("valuemaps", "valuemapid", "name", 64);
672 }
673
DBpatch_2030065(void)674 static int DBpatch_2030065(void)
675 {
676 DB_RESULT result;
677 DB_ROW row;
678 int local_nodeid = 0;
679 zbx_uint64_t min, max;
680
681 /* 1 - ZBX_NODE_LOCAL */
682 if (NULL == (result = DBselect("select nodeid from nodes where nodetype=1")))
683 return FAIL;
684
685 if (NULL != (row = DBfetch(result)))
686 local_nodeid = atoi(row[0]);
687 DBfree_result(result);
688
689 if (0 == local_nodeid)
690 return SUCCEED;
691
692 min = local_nodeid * __UINT64_C(100000000000000);
693 max = min + __UINT64_C(100000000000000) - 1;
694
695 if (ZBX_DB_OK <= DBexecute(
696 "delete from config where not configid between " ZBX_FS_UI64 " and " ZBX_FS_UI64, min, max))
697 {
698 return SUCCEED;
699 }
700
701 return FAIL;
702 }
703
DBpatch_2030066(void)704 static int DBpatch_2030066(void)
705 {
706 return DBdrop_table("nodes");
707 }
708
DBpatch_2030067(void)709 static int DBpatch_2030067(void)
710 {
711 if (SUCCEED != check_data_uniqueness("actions", "name"))
712 return FAIL;
713
714 return DBcreate_index("actions", "actions_2", "name", 1);
715 }
716
DBpatch_2030068(void)717 static int DBpatch_2030068(void)
718 {
719 if (0 != (program_type & ZBX_PROGRAM_TYPE_PROXY))
720 {
721 /* "name" is empty on proxy side, because it is not synchronized between server and proxy */
722 /* in 2.2, and should therefore be filled with unique values to create a unique index. */
723 if (ZBX_DB_OK > DBexecute("update drules set name=druleid"))
724 return FAIL;
725 }
726
727 if (SUCCEED != check_data_uniqueness("drules", "name"))
728 return FAIL;
729
730 return DBcreate_index("drules", "drules_2", "name", 1);
731 }
732
DBpatch_2030069(void)733 static int DBpatch_2030069(void)
734 {
735 return DBdrop_index("globalmacro", "globalmacro_1");
736 }
737
DBpatch_2030070(void)738 static int DBpatch_2030070(void)
739 {
740 if (SUCCEED != check_data_uniqueness("globalmacro", "macro"))
741 return FAIL;
742
743 return DBcreate_index("globalmacro", "globalmacro_1", "macro", 1);
744 }
745
DBpatch_2030071(void)746 static int DBpatch_2030071(void)
747 {
748 return DBdrop_index("graph_theme", "graph_theme_1");
749 }
750
DBpatch_2030072(void)751 static int DBpatch_2030072(void)
752 {
753 if (SUCCEED != check_data_uniqueness("graph_theme", "description"))
754 return FAIL;
755
756 return DBcreate_index("graph_theme", "graph_theme_1", "description", 1);
757 }
758
DBpatch_2030073(void)759 static int DBpatch_2030073(void)
760 {
761 return DBdrop_index("icon_map", "icon_map_1");
762 }
763
DBpatch_2030074(void)764 static int DBpatch_2030074(void)
765 {
766 if (SUCCEED != check_data_uniqueness("icon_map", "name"))
767 return FAIL;
768
769 return DBcreate_index("icon_map", "icon_map_1", "name", 1);
770 }
771
DBpatch_2030075(void)772 static int DBpatch_2030075(void)
773 {
774 return DBdrop_index("images", "images_1");
775 }
776
DBpatch_2030076(void)777 static int DBpatch_2030076(void)
778 {
779 if (SUCCEED != check_data_uniqueness("images", "name"))
780 return FAIL;
781
782 return DBcreate_index("images", "images_1", "name", 1);
783 }
784
DBpatch_2030077(void)785 static int DBpatch_2030077(void)
786 {
787 if (SUCCEED != check_data_uniqueness("maintenances", "name"))
788 return FAIL;
789
790 return DBcreate_index("maintenances", "maintenances_2", "name", 1);
791 }
792
DBpatch_2030078(void)793 static int DBpatch_2030078(void)
794 {
795 if (SUCCEED != check_data_uniqueness("media_type", "description"))
796 return FAIL;
797
798 return DBcreate_index("media_type", "media_type_1", "description", 1);
799 }
800
DBpatch_2030079(void)801 static int DBpatch_2030079(void)
802 {
803 return DBdrop_index("regexps", "regexps_1");
804 }
805
DBpatch_2030080(void)806 static int DBpatch_2030080(void)
807 {
808 if (SUCCEED != check_data_uniqueness("regexps", "name"))
809 return FAIL;
810
811 return DBcreate_index("regexps", "regexps_1", "name", 1);
812 }
813
DBpatch_2030081(void)814 static int DBpatch_2030081(void)
815 {
816 if (SUCCEED != check_data_uniqueness("scripts", "name"))
817 return FAIL;
818
819 return DBcreate_index("scripts", "scripts_3", "name", 1);
820 }
821
DBpatch_2030083(void)822 static int DBpatch_2030083(void)
823 {
824 if (SUCCEED != check_data_uniqueness("slideshows", "name"))
825 return FAIL;
826
827 return DBcreate_index("slideshows", "slideshows_1", "name", 1);
828 }
829
DBpatch_2030084(void)830 static int DBpatch_2030084(void)
831 {
832 return DBdrop_index("sysmaps", "sysmaps_1");
833 }
834
DBpatch_2030085(void)835 static int DBpatch_2030085(void)
836 {
837 if (SUCCEED != check_data_uniqueness("sysmaps", "name"))
838 return FAIL;
839
840 return DBcreate_index("sysmaps", "sysmaps_1", "name", 1);
841 }
842
DBpatch_2030086(void)843 static int DBpatch_2030086(void)
844 {
845 return DBdrop_index("usrgrp", "usrgrp_1");
846 }
847
DBpatch_2030087(void)848 static int DBpatch_2030087(void)
849 {
850 if (SUCCEED != check_data_uniqueness("usrgrp", "name"))
851 return FAIL;
852
853 return DBcreate_index("usrgrp", "usrgrp_1", "name", 1);
854 }
855
DBpatch_2030088(void)856 static int DBpatch_2030088(void)
857 {
858 return DBdrop_index("users", "users_1");
859 }
860
DBpatch_2030089(void)861 static int DBpatch_2030089(void)
862 {
863 if (SUCCEED != check_data_uniqueness("users", "alias"))
864 return FAIL;
865
866 return DBcreate_index("users", "users_1", "alias", 1);
867 }
868
DBpatch_2030090(void)869 static int DBpatch_2030090(void)
870 {
871 return DBdrop_index("valuemaps", "valuemaps_1");
872 }
873
DBpatch_2030091(void)874 static int DBpatch_2030091(void)
875 {
876 if (SUCCEED != check_data_uniqueness("valuemaps", "name"))
877 return FAIL;
878
879 return DBcreate_index("valuemaps", "valuemaps_1", "name", 1);
880 }
881
DBpatch_2030092(void)882 static int DBpatch_2030092(void)
883 {
884 const ZBX_FIELD field = {"timeout", "15", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
885
886 return DBset_default("httpstep", &field);
887 }
888
DBpatch_2030093(void)889 static int DBpatch_2030093(void)
890 {
891 const ZBX_FIELD field = {"error", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
892
893 return DBmodify_field_type("items", &field, NULL);
894 }
895
DBpatch_2030094(void)896 static int DBpatch_2030094(void)
897 {
898 DB_RESULT result;
899 DB_ROW row;
900 int ret = SUCCEED;
901 char *p, *expr = NULL, *expr_esc;
902 size_t expr_alloc = 0, expr_offset;
903
904 result = DBselect("select triggerid,expression from triggers");
905
906 while (SUCCEED == ret && NULL != (row = DBfetch(result)))
907 {
908 expr_offset = 0;
909 zbx_strcpy_alloc(&expr, &expr_alloc, &expr_offset, "");
910
911 for (p = row[1]; '\0' != *p; p++)
912 {
913 if (NULL == strchr("#&|", *p))
914 {
915 if (' ' != *p || (0 != expr_offset && ' ' != expr[expr_offset - 1]))
916 zbx_chrcpy_alloc(&expr, &expr_alloc, &expr_offset, *p);
917
918 continue;
919 }
920
921 if ('#' == *p && 0 != expr_offset && '{' == expr[expr_offset - 1])
922 {
923 zbx_chrcpy_alloc(&expr, &expr_alloc, &expr_offset, *p);
924 continue;
925 }
926
927 if (('&' == *p || '|' == *p) && 0 != expr_offset && ' ' != expr[expr_offset - 1])
928 zbx_chrcpy_alloc(&expr, &expr_alloc, &expr_offset, ' ');
929
930 switch (*p)
931 {
932 case '#':
933 zbx_strcpy_alloc(&expr, &expr_alloc, &expr_offset, "<>");
934 break;
935 case '&':
936 zbx_strcpy_alloc(&expr, &expr_alloc, &expr_offset, "and");
937 break;
938 case '|':
939 zbx_strcpy_alloc(&expr, &expr_alloc, &expr_offset, "or");
940 break;
941 }
942
943 if (('&' == *p || '|' == *p) && ' ' != *(p + 1))
944 zbx_chrcpy_alloc(&expr, &expr_alloc, &expr_offset, ' ');
945 }
946
947 if (2048 < expr_offset && 2048 /* TRIGGER_EXPRESSION_LEN */ < zbx_strlen_utf8(expr))
948 {
949 zabbix_log(LOG_LEVEL_WARNING, "cannot convert trigger expression \"%s\":"
950 " resulting expression is too long", row[1]);
951 }
952 else if (0 != strcmp(row[1], expr))
953 {
954 expr_esc = DBdyn_escape_string(expr);
955
956 if (ZBX_DB_OK > DBexecute("update triggers set expression='%s' where triggerid=%s",
957 expr_esc, row[0]))
958 {
959 ret = FAIL;
960 }
961
962 zbx_free(expr_esc);
963 }
964 }
965 DBfree_result(result);
966
967 zbx_free(expr);
968
969 return ret;
970 }
971
972 /******************************************************************************
973 * *
974 * Function: parse_function *
975 * *
976 * Purpose: return function and function parameters *
977 * func(param,...) *
978 * *
979 * Parameters: *
980 * exp - pointer to the first char of function *
981 * last("host:key[key params]",#1) *
982 * ^ *
983 * func - optional pointer to resulted function *
984 * params - optional pointer to resulted function parameters *
985 * *
986 * Return value: return SUCCEED and move exp to the next char after right ')' *
987 * or FAIL and move exp to incorrect character *
988 * *
989 * Author: Alexander Vladishev *
990 * *
991 * Comments: This function is outdated and should be used in this upgrade *
992 * only. For other applications consider zbx_function_find() or *
993 * zbx_function_validate(). *
994 * *
995 ******************************************************************************/
parse_function(char ** exp,char ** func,char ** params)996 static int parse_function(char **exp, char **func, char **params)
997 {
998 char *p, *s;
999 int state_fn; /* 0 - init
1000 * 1 - function name/params
1001 */
1002 unsigned char flags = 0x00; /* 0x01 - function OK
1003 * 0x02 - params OK
1004 */
1005
1006 for (p = *exp, s = *exp, state_fn = 0; '\0' != *p; p++) /* check for function */
1007 {
1008 if (SUCCEED == is_function_char(*p))
1009 {
1010 state_fn = 1;
1011 continue;
1012 }
1013
1014 if (0 == state_fn)
1015 goto error;
1016
1017 if ('(' == *p) /* key parameters
1018 * last("hostname:vfs.fs.size[\"/\",\"total\"]",0)}
1019 * ----^
1020 */
1021 {
1022 int state; /* 0 - init
1023 * 1 - inside quoted param
1024 * 2 - inside unquoted param
1025 * 3 - end of params
1026 */
1027
1028 if (NULL != func)
1029 {
1030 *p = '\0';
1031 *func = zbx_strdup(NULL, s);
1032 *p++ = '(';
1033 }
1034 flags |= 0x01;
1035
1036 for (s = p, state = 0; '\0' != *p; p++)
1037 {
1038 switch (state) {
1039 /* init state */
1040 case 0:
1041 if (',' == *p)
1042 ;
1043 else if ('"' == *p)
1044 state = 1;
1045 else if (')' == *p)
1046 state = 3;
1047 else if (' ' != *p)
1048 state = 2;
1049 break;
1050 /* quoted */
1051 case 1:
1052 if ('"' == *p)
1053 {
1054 if ('"' != p[1])
1055 state = 0;
1056 else
1057 goto error;
1058 }
1059 else if ('\\' == *p && '"' == p[1])
1060 p++;
1061 break;
1062 /* unquoted */
1063 case 2:
1064 if (',' == *p)
1065 state = 0;
1066 else if (')' == *p)
1067 state = 3;
1068 break;
1069 }
1070
1071 if (3 == state)
1072 break;
1073 }
1074
1075 if (3 == state)
1076 {
1077 if (NULL != params)
1078 {
1079 *p = '\0';
1080 *params = zbx_strdup(NULL, s);
1081 *p = ')';
1082 }
1083 flags |= 0x02;
1084 }
1085 else
1086 goto error;
1087 }
1088 else
1089 goto error;
1090
1091 break;
1092 }
1093
1094 if (0x03 != flags)
1095 goto error;
1096
1097 *exp = p + 1;
1098
1099 return SUCCEED;
1100 error:
1101 if (NULL != func)
1102 zbx_free(*func);
1103 if (NULL != params)
1104 zbx_free(*params);
1105
1106 *exp = p;
1107
1108 return FAIL;
1109 }
1110
DBpatch_2030095(void)1111 static int DBpatch_2030095(void)
1112 {
1113 DB_RESULT result;
1114 DB_ROW row;
1115 int ret = SUCCEED;
1116 char *p, *q, *params = NULL, *params_esc;
1117 size_t params_alloc = 0, params_offset;
1118
1119 result = DBselect("select itemid,params from items where type=%d", 15 /* ITEM_TYPE_CALCULATED */);
1120
1121 while (SUCCEED == ret && NULL != (row = DBfetch(result)))
1122 {
1123 params_offset = 0;
1124
1125 for (p = row[1]; '\0' != *p; p++)
1126 {
1127 if (NULL != strchr(ZBX_WHITESPACE, *p))
1128 {
1129 if (' ' != *p || (0 != params_offset &&
1130 NULL == strchr(ZBX_WHITESPACE, params[params_offset - 1])))
1131 {
1132 zbx_chrcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, *p);
1133 }
1134
1135 continue;
1136 }
1137
1138 if (NULL != strchr("#&|", *p))
1139 {
1140 if ('#' == *p && 0 != params_offset && '{' == params[params_offset - 1])
1141 {
1142 zbx_chrcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, *p);
1143 continue;
1144 }
1145
1146 if (('&' == *p || '|' == *p) && 0 != params_offset &&
1147 NULL == strchr(ZBX_WHITESPACE, params[params_offset - 1]))
1148 {
1149 zbx_chrcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, ' ');
1150 }
1151
1152 switch (*p)
1153 {
1154 case '#':
1155 zbx_strcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, "<>");
1156 break;
1157 case '&':
1158 zbx_strcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, "and");
1159 break;
1160 case '|':
1161 zbx_strcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, "or");
1162 break;
1163 }
1164
1165 if (('&' == *p || '|' == *p) && NULL == strchr(ZBX_WHITESPACE, *(p + 1)))
1166 zbx_chrcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, ' ');
1167
1168 continue;
1169 }
1170
1171 q = p;
1172
1173 if (SUCCEED == parse_function(&q, NULL, NULL))
1174 {
1175 zbx_strncpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, p, q - p);
1176 p = q - 1;
1177 continue;
1178 }
1179
1180 zbx_chrcpy_alloc(¶ms, ¶ms_alloc, ¶ms_offset, *p);
1181 }
1182
1183 #if defined(HAVE_ORACLE)
1184 if (0 == params_offset || (2048 < params_offset && 2048 /* ITEM_PARAM_LEN */ < zbx_strlen_utf8(params)))
1185 #else
1186 if (0 == params_offset ||
1187 (65535 < params_offset && 65535 /* ITEM_PARAM_LEN */ < zbx_strlen_utf8(params)))
1188 #endif
1189 {
1190 zabbix_log(LOG_LEVEL_WARNING, "cannot convert calculated item expression \"%s\": resulting"
1191 " expression is %s", row[1], 0 == params_offset ? "empty" : "too long");
1192 }
1193 else if ( 0 != strcmp(row[1], params))
1194 {
1195 params_esc = DBdyn_escape_string(params);
1196
1197 if (ZBX_DB_OK > DBexecute("update items set params='%s' where itemid=%s", params_esc, row[0]))
1198 ret = FAIL;
1199
1200 zbx_free(params_esc);
1201 }
1202 }
1203 DBfree_result(result);
1204
1205 zbx_free(params);
1206
1207 return ret;
1208 }
1209
DBpatch_2030096(void)1210 static int DBpatch_2030096(void)
1211 {
1212 const ZBX_FIELD field = {"ssl_cert_file", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
1213
1214 return DBadd_field("httptest", &field);
1215 }
1216
DBpatch_2030097(void)1217 static int DBpatch_2030097(void)
1218 {
1219 const ZBX_FIELD field = {"ssl_key_file", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
1220
1221 return DBadd_field("httptest", &field);
1222 }
1223
DBpatch_2030098(void)1224 static int DBpatch_2030098(void)
1225 {
1226 const ZBX_FIELD field = {"ssl_key_password", "", NULL, NULL, 64, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
1227
1228 return DBadd_field("httptest", &field);
1229 }
1230
DBpatch_2030099(void)1231 static int DBpatch_2030099(void)
1232 {
1233 const ZBX_FIELD field = {"verify_peer", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1234
1235 return DBadd_field("httptest", &field);
1236 }
1237
DBpatch_2030100(void)1238 static int DBpatch_2030100(void)
1239 {
1240 const ZBX_FIELD field = {"verify_host", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1241
1242 return DBadd_field("httptest", &field);
1243 }
1244
DBpatch_2030101(void)1245 static int DBpatch_2030101(void)
1246 {
1247 const ZBX_FIELD field = {"headers", "", NULL, NULL, 0, ZBX_TYPE_SHORTTEXT, ZBX_NOTNULL, 0};
1248
1249 return DBadd_field("httptest", &field);
1250 }
1251
DBpatch_2030102(void)1252 static int DBpatch_2030102(void)
1253 {
1254 const ZBX_FIELD field = {"url", "", NULL, NULL, 2048, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
1255
1256 return DBmodify_field_type("httpstep", &field, NULL);
1257 }
1258
DBpatch_2030103(void)1259 static int DBpatch_2030103(void)
1260 {
1261 const ZBX_FIELD field = {"follow_redirects", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1262
1263 return DBadd_field("httpstep", &field);
1264 }
1265
DBpatch_2030104(void)1266 static int DBpatch_2030104(void)
1267 {
1268 const ZBX_FIELD field = {"retrieve_mode", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1269
1270 return DBadd_field("httpstep", &field);
1271 }
1272
DBpatch_2030105(void)1273 static int DBpatch_2030105(void)
1274 {
1275 const ZBX_FIELD field = {"headers", "", NULL, NULL, 0, ZBX_TYPE_SHORTTEXT, ZBX_NOTNULL, 0};
1276
1277 return DBadd_field("httpstep", &field);
1278 }
1279
DBpatch_2030106(void)1280 static int DBpatch_2030106(void)
1281 {
1282 const ZBX_FIELD field = {"colspan", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1283
1284 return DBset_default("screens_items", &field);
1285 }
1286
DBpatch_2030107(void)1287 static int DBpatch_2030107(void)
1288 {
1289 const ZBX_FIELD field = {"rowspan", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1290
1291 return DBset_default("screens_items", &field);
1292 }
1293
DBpatch_2030108(void)1294 static int DBpatch_2030108(void)
1295 {
1296 if (ZBX_DB_OK <= DBexecute("update screens_items set colspan=1 where colspan=0"))
1297 return SUCCEED;
1298
1299 return FAIL;
1300 }
1301
DBpatch_2030109(void)1302 static int DBpatch_2030109(void)
1303 {
1304 if (ZBX_DB_OK <= DBexecute("update screens_items set rowspan=1 where rowspan=0"))
1305 return SUCCEED;
1306
1307 return FAIL;
1308 }
1309
DBpatch_2030110(void)1310 static int DBpatch_2030110(void)
1311 {
1312 if (ZBX_DB_OK > DBexecute("delete from profiles where idx='web.view.application'"))
1313 return FAIL;
1314
1315 return SUCCEED;
1316 }
1317
DBpatch_2030111(void)1318 static int DBpatch_2030111(void)
1319 {
1320 const ZBX_FIELD field = {"bulk", "1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1321
1322 return DBadd_field("interface", &field);
1323 }
1324
DBpatch_2030112(void)1325 static int DBpatch_2030112(void)
1326 {
1327 const ZBX_FIELD field = {"formula", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
1328
1329 return DBadd_field("actions", &field);
1330 }
1331
DBpatch_2030113(void)1332 static int DBpatch_2030113(void)
1333 {
1334 if (ZBX_DB_OK > DBexecute("delete from profiles where idx in ('web.latest.php.sort', 'web.httpmon.php.sort')"))
1335 return FAIL;
1336
1337 return SUCCEED;
1338 }
1339
DBpatch_2030114(void)1340 static int DBpatch_2030114(void)
1341 {
1342 if (ZBX_DB_OK > DBexecute("delete from profiles where idx='web.httpconf.php.sort' and value_str='h.hostid'"))
1343 return FAIL;
1344
1345 return SUCCEED;
1346 }
1347
DBpatch_2030115(void)1348 static int DBpatch_2030115(void)
1349 {
1350 if (ZBX_DB_OK > DBexecute(
1351 "delete from profiles where idx='web.hostinventories.php.sort' and value_str='hostid'"))
1352 {
1353 return FAIL;
1354 }
1355
1356 return SUCCEED;
1357 }
1358
DBpatch_2030116(void)1359 static int DBpatch_2030116(void)
1360 {
1361 const ZBX_FIELD field = {"host", "", NULL, NULL, 128, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
1362
1363 return DBmodify_field_type("hosts", &field, NULL);
1364 }
1365
DBpatch_2030117(void)1366 static int DBpatch_2030117(void)
1367 {
1368 const ZBX_FIELD field = {"name", "", NULL, NULL, 128, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
1369
1370 return DBmodify_field_type("hosts", &field, NULL);
1371 }
1372
DBpatch_2030118(void)1373 static int DBpatch_2030118(void)
1374 {
1375 const ZBX_FIELD field = {"max_columns", "3", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
1376
1377 return DBadd_field("screens_items", &field);
1378 }
1379
1380 #endif
1381
1382 DBPATCH_START(2030)
1383
1384 /* version, duplicates flag, mandatory flag */
1385
1386 DBPATCH_ADD(2030000, 0, 1)
1387 DBPATCH_ADD(2030001, 0, 1)
1388 DBPATCH_ADD(2030002, 0, 1)
1389 DBPATCH_ADD(2030003, 0, 1)
1390 DBPATCH_ADD(2030004, 0, 1)
1391 DBPATCH_ADD(2030005, 0, 1)
1392 DBPATCH_ADD(2030006, 0, 1)
1393 DBPATCH_ADD(2030007, 0, 1)
1394 DBPATCH_ADD(2030008, 0, 1)
1395 DBPATCH_ADD(2030009, 0, 1)
1396 DBPATCH_ADD(2030010, 0, 1)
1397 DBPATCH_ADD(2030011, 0, 1)
1398 DBPATCH_ADD(2030012, 0, 1)
1399 DBPATCH_ADD(2030013, 0, 1)
1400 DBPATCH_ADD(2030014, 0, 1)
1401 DBPATCH_ADD(2030015, 0, 1)
1402 DBPATCH_ADD(2030016, 0, 1)
1403 DBPATCH_ADD(2030017, 0, 1)
1404 DBPATCH_ADD(2030018, 0, 1)
1405 DBPATCH_ADD(2030019, 0, 1)
1406 DBPATCH_ADD(2030020, 0, 1)
1407 DBPATCH_ADD(2030021, 0, 1)
1408 DBPATCH_ADD(2030022, 0, 1)
1409 DBPATCH_ADD(2030023, 0, 1)
1410 DBPATCH_ADD(2030024, 0, 1)
1411 DBPATCH_ADD(2030025, 0, 1)
1412 DBPATCH_ADD(2030026, 0, 1)
1413 DBPATCH_ADD(2030027, 0, 1)
1414 DBPATCH_ADD(2030028, 0, 1)
1415 DBPATCH_ADD(2030029, 0, 1)
1416 DBPATCH_ADD(2030030, 0, 1)
1417 DBPATCH_ADD(2030031, 0, 0)
1418 DBPATCH_ADD(2030032, 0, 1)
1419 DBPATCH_ADD(2030033, 0, 1)
1420 DBPATCH_ADD(2030034, 0, 1)
1421 DBPATCH_ADD(2030035, 0, 1)
1422 DBPATCH_ADD(2030036, 0, 1)
1423 DBPATCH_ADD(2030037, 0, 1)
1424 DBPATCH_ADD(2030038, 0, 1)
1425 DBPATCH_ADD(2030039, 0, 1)
1426 DBPATCH_ADD(2030040, 0, 1)
1427 DBPATCH_ADD(2030041, 0, 1)
1428 DBPATCH_ADD(2030042, 0, 1)
1429 DBPATCH_ADD(2030043, 0, 1)
1430 DBPATCH_ADD(2030044, 0, 1)
1431 DBPATCH_ADD(2030045, 0, 1)
1432 DBPATCH_ADD(2030046, 0, 1)
1433 DBPATCH_ADD(2030047, 0, 1)
1434 DBPATCH_ADD(2030048, 0, 1)
1435 DBPATCH_ADD(2030049, 0, 1)
1436 DBPATCH_ADD(2030050, 0, 1)
1437 DBPATCH_ADD(2030051, 0, 1)
1438 DBPATCH_ADD(2030052, 0, 1)
1439 DBPATCH_ADD(2030053, 0, 1)
1440 DBPATCH_ADD(2030054, 0, 1)
1441 DBPATCH_ADD(2030055, 0, 1)
1442 DBPATCH_ADD(2030056, 0, 1)
1443 DBPATCH_ADD(2030057, 0, 1)
1444 DBPATCH_ADD(2030058, 0, 1)
1445 DBPATCH_ADD(2030059, 0, 1)
1446 DBPATCH_ADD(2030060, 0, 1)
1447 DBPATCH_ADD(2030061, 0, 1)
1448 DBPATCH_ADD(2030062, 0, 1)
1449 DBPATCH_ADD(2030063, 0, 1)
1450 DBPATCH_ADD(2030064, 0, 1)
1451 DBPATCH_ADD(2030065, 0, 1)
1452 DBPATCH_ADD(2030066, 0, 1)
1453 DBPATCH_ADD(2030067, 0, 1)
1454 DBPATCH_ADD(2030068, 0, 1)
1455 DBPATCH_ADD(2030069, 0, 1)
1456 DBPATCH_ADD(2030070, 0, 1)
1457 DBPATCH_ADD(2030071, 0, 1)
1458 DBPATCH_ADD(2030072, 0, 1)
1459 DBPATCH_ADD(2030073, 0, 1)
1460 DBPATCH_ADD(2030074, 0, 1)
1461 DBPATCH_ADD(2030075, 0, 1)
1462 DBPATCH_ADD(2030076, 0, 1)
1463 DBPATCH_ADD(2030077, 0, 1)
1464 DBPATCH_ADD(2030078, 0, 1)
1465 DBPATCH_ADD(2030079, 0, 1)
1466 DBPATCH_ADD(2030080, 0, 1)
1467 DBPATCH_ADD(2030081, 0, 1)
1468 DBPATCH_ADD(2030083, 0, 1)
1469 DBPATCH_ADD(2030084, 0, 1)
1470 DBPATCH_ADD(2030085, 0, 1)
1471 DBPATCH_ADD(2030086, 0, 1)
1472 DBPATCH_ADD(2030087, 0, 1)
1473 DBPATCH_ADD(2030088, 0, 1)
1474 DBPATCH_ADD(2030089, 0, 1)
1475 DBPATCH_ADD(2030090, 0, 1)
1476 DBPATCH_ADD(2030091, 0, 1)
1477 DBPATCH_ADD(2030092, 0, 1)
1478 DBPATCH_ADD(2030093, 0, 1)
1479 DBPATCH_ADD(2030094, 0, 1)
1480 DBPATCH_ADD(2030095, 0, 1)
1481 DBPATCH_ADD(2030096, 0, 1)
1482 DBPATCH_ADD(2030097, 0, 1)
1483 DBPATCH_ADD(2030098, 0, 1)
1484 DBPATCH_ADD(2030099, 0, 1)
1485 DBPATCH_ADD(2030100, 0, 1)
1486 DBPATCH_ADD(2030101, 0, 1)
1487 DBPATCH_ADD(2030102, 0, 1)
1488 DBPATCH_ADD(2030103, 0, 1)
1489 DBPATCH_ADD(2030104, 0, 1)
1490 DBPATCH_ADD(2030105, 0, 1)
1491 DBPATCH_ADD(2030106, 0, 1)
1492 DBPATCH_ADD(2030107, 0, 1)
1493 DBPATCH_ADD(2030108, 0, 1)
1494 DBPATCH_ADD(2030109, 0, 1)
1495 DBPATCH_ADD(2030110, 0, 0)
1496 DBPATCH_ADD(2030111, 0, 1)
1497 DBPATCH_ADD(2030112, 0, 1)
1498 DBPATCH_ADD(2030113, 0, 0)
1499 DBPATCH_ADD(2030114, 0, 0)
1500 DBPATCH_ADD(2030115, 0, 0)
1501 DBPATCH_ADD(2030116, 0, 1)
1502 DBPATCH_ADD(2030117, 0, 1)
1503 DBPATCH_ADD(2030118, 0, 1)
1504
1505 DBPATCH_END()
1506