UD_query Insert[] = {
  {UD_NULL_, ""},
  {UD_AUX__, " INSERT admin_c          SELECT %d, %ld, person_role.object_id, %d          FROM person_role          WHERE person_role.nic_hdl='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " INSERT as_set         SET thread_id=%d, object_id=%ld, as_set='%s', dummy=0 "},
  {UD_LF_AT, " INSERT auth         SET thread_id=%d, object_id=%ld, object_type=%d, auth='%s' "},
  {UD_AUX__, " INSERT author           SELECT %d, %ld, person_role.object_id, %d           FROM person_role           WHERE person_role.nic_hdl='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AUX__, " INSERT cross_nfy           SELECT %d, %ld, person_role.object_id, %d           FROM person_role           WHERE person_role.nic_hdl='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " INSERT domain                 SET thread_id=%d, object_id=%ld, domain='%s' "},
  {UD_LF_OT, " INSERT e_mail         SET thread_id=%d, object_id=%ld, object_type=%d, e_mail='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MA_U2, " UPDATE %s SET thread_id=%d, filter='%s'          WHERE object_id=%ld "},
  {UD_MAIN_, " INSERT filter_set          SET thread_id=%d, object_id=%ld, filter_set='%s', filter='-' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LF_IF, " INSERT ifaddr           SET thread_id=%d, object_id=%ld, ifaddr=%u "},
  {UD_NULL_, ""},
  {UD_MA_IN, " INSERT inetnum         SET thread_id=%d, object_id=%ld, begin_in=%u, end_in=%u "},
  {UD_MA_I6, " INSERT inet6num         SET thread_id=%d, object_id=%ld,                 i6_msb='%llu', i6_lsb='%llu',                 prefix_length=%u "},
  {UD_NULL_, ""},
  {UD_MAIN_, " INSERT key_cert           SET thread_id=%d, object_id=%ld, key_cert='%s' "},
  {UD_AX_MR, " INSERT mbrs_by_ref         SELECT %d, %ld, mntner.object_id, %d         FROM mntner         WHERE mntner.mntner='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AUX__, " INSERT mnt_by          SELECT %d, %ld, mntner.object_id, %d          FROM mntner WHERE mntner.mntner='%s' "},
  {UD_AUX__, " INSERT mnt_lower         SELECT %d, %ld, mntner.object_id, %d         FROM mntner         WHERE mntner.mntner='%s' "},
  {UD_LEAF_, " INSERT mnt_nfy         SET thread_id=%d, object_id=%ld, mnt_nfy='%s' "},
  {UD_AX_MU, " INSERT mnt_routes         SELECT %d, %ld, mntner.object_id, %d         FROM mntner         WHERE mntner.mntner='%s' "},
  {UD_MAIN_, " INSERT mntner         SET thread_id=%d, object_id=%ld, mntner='%s', dummy=0 "},
  {UD_MA_U2, " UPDATE %s         SET thread_id=%d, netname='%s'         WHERE object_id=%ld "},
  {UD_MA_PR, " INSERT person_role         SET thread_id=%d, object_type=%d, object_id=%ld, nic_hdl='%s', dummy=0 "},
  {UD_LF_OT, " INSERT notify          SET thread_id=%d, object_id=%ld, object_type=%d, notify='%s' "},
  {UD_MA_OR, " UPDATE route           SET thread_id=%d, origin='%s'           WHERE object_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LF_OT, " INSERT names         SET thread_id=%d, object_id=%ld, object_type=%d, name='%s' "},
  {UD_NULL_, ""},
  {UD_AUX__, " INSERT referral_by         SELECT %d, %ld, mntner.object_id, %d         FROM mntner WHERE mntner.mntner='%s' "},
  {UD_NULL_, ""},
  {UD_LEAF_, " INSERT nserver         SET thread_id=%d, object_id=%ld, host='%s' "},
  {UD_LF_RF, " INSERT refer         SET thread_id=%d, object_id=%ld, type=%d, host='%s', port=%d "},
  {UD_LF_OT, " INSERT rev_srv         SET thread_id=%d, object_id=%ld, object_type=%d, rev_srv='%s' "},
  {UD_LF_OT, " INSERT names         SET thread_id=%d, object_id=%ld, object_type=%d, name='%s' "},
  {UD_MAIN_, " INSERT route_set         SET thread_id=%d, object_id=%ld, route_set='%s', dummy=0 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LEAF_, " INSERT sub_dom         SET thread_id=%d, object_id=%ld, domain='%s' "},
  {UD_AUX__, " INSERT tech_c          SELECT %d, %ld, person_role.object_id, %d          FROM person_role          WHERE person_role.nic_hdl='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LEAF_, " INSERT upd_to         SET thread_id=%d, object_id=%ld, upd_to='%s' "},
  {UD_AUX__, " INSERT zone_c         SELECT %d, %ld, person_role.object_id, %d         FROM person_role         WHERE person_role.nic_hdl='%s' "},
  {UD_MAIN_, " INSERT inet_rtr         SET thread_id=%d, object_id=%ld, inet_rtr='%s' "},
  {UD_MA_AK, " INSERT as_block         SET thread_id=%d, object_id=%ld, begin_as=%d, end_as=%d "},
  {UD_MAIN_, " INSERT aut_num         SET thread_id=%d, object_id=%ld, aut_num='%s' "},
  {UD_MAIN_, " INSERT limerick         SET thread_id=%d, object_id=%ld, limerick='%s' "},
  {UD_MA_RT, " INSERT route         SET thread_id=%d, object_id=%ld, prefix=%u, prefix_length=%d, dummy=0 "},
  {UD_MAIN_, " INSERT peering_set         SET thread_id=%d, object_id=%ld, peering_set='%s' "},
  {UD_MAIN_, " INSERT rtr_set         SET thread_id=%d, object_id=%ld, rtr_set='%s', dummy=0 "},
  {UD_MA_U2, " UPDATE %s SET thread_id=%d, local_as='%s'         WHERE object_id=%ld "},
  {UD_AX_MO, " INSERT member_of         SELECT %d, %ld, %s.object_id, %d         FROM %s         WHERE %s.%s='%s' "},
  {UD_AUX__, " INSERT cross_mnt         SELECT %d, %ld, mntner.object_id, %d         FROM mntner         WHERE mntner.mntner='%s' "},
  {UD_AUX__, " INSERT mnt_irt          SELECT %d, %ld, irt.object_id, %d          FROM irt WHERE irt.irt='%s' "},
  {UD_MAIN_, " INSERT irt         SET thread_id=%d, object_id=%ld, irt='%s', dummy=0 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LEAF_, " INSERT irt_nfy         SET thread_id=%d, object_id=%ld, irt_nfy='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {0, NULL}
}; /* Insert */

UD_query Update[] = {
  {UD_NULL_, ""},
  {UD_AX_PR, " UPDATE admin_c         SET thread_id=%d         WHERE object_id=%ld         AND pe_ro_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " UPDATE as_set         SET thread_id=%d         WHERE object_id=%ld "},
  {UD_LEAF_, " UPDATE auth         SET thread_id=%d         WHERE object_id=%ld         AND auth='%s' "},
  {UD_AX_PR, " UPDATE author           SET thread_id=%d           WHERE object_id=%ld           AND pe_ro_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_PR, " UPDATE cross_nfy           SET thread_id=%d           WHERE object_id=%ld           AND pe_ro_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, ""},
  {UD_LEAF_, " UPDATE e_mail         SET thread_id=%d         WHERE object_id=%ld         AND e_mail='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MA_U2, " UPDATE %s SET thread_id=%d, filter='%s'          WHERE object_id=%ld "},
  {UD_MAIN_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LF_IF, " UPDATE ifaddr           SET thread_id=%d           WHERE object_id=%ld           AND ifaddr=%u "},
  {UD_NULL_, ""},
  {UD_MAIN_, ""},
  {UD_MAIN_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, ""},
  {UD_AX_MR, " UPDATE mbrs_by_ref         SET thread_id=%d         WHERE object_id=%ld         AND mnt_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_MT, " UPDATE mnt_by         SET thread_id=%d         WHERE object_id=%ld         AND mnt_id=%ld "},
  {UD_AX_MT, " UPDATE mnt_lower         SET thread_id=%d         WHERE object_id=%ld         AND mnt_id=%ld "},
  {UD_LEAF_, " UPDATE mnt_nfy         SET thread_id=%d         WHERE object_id=%ld         AND mnt_nfy='%s' "},
  {UD_AX_MU, " UPDATE mnt_routes         SET thread_id=%d         WHERE object_id=%ld         AND mnt_id=%ld "},
  {UD_MAIN_, " UPDATE mntner         SET thread_id=%d         WHERE object_id=%ld "},
  {UD_MA_U2, " UPDATE %s         SET thread_id=%d, netname='%s'         WHERE object_id=%ld "},
  {UD_MA_PR, " UPDATE person_role         SET thread_id=%d, object_type=%d         WHERE object_id=%ld "},
  {UD_LEAF_, " UPDATE notify          SET thread_id=%d          WHERE object_id=%ld          AND notify='%s' "},
  {UD_MAIN_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LEAF_, " UPDATE names         SET thread_id=%d         WHERE object_id=%ld         AND name='%s' "},
  {UD_NULL_, ""},
  {UD_AX_MT, " UPDATE referral_by         SET thread_id=%d         WHERE object_id=%ld         AND mnt_id=%ld "},
  {UD_NULL_, ""},
  {UD_LEAF_, " UPDATE nserver         SET thread_id=%d         WHERE object_id=%ld         AND host='%s' "},
  {UD_LF_RF, " UPDATE refer         SET thread_id=%d         WHERE object_id=%ld         AND type=%d         AND host='%s'         AND port=%d "},
  {UD_LEAF_, " UPDATE rev_srv         SET thread_id=%d         WHERE object_id=%ld         AND rev_srv='%s' "},
  {UD_LEAF_, " UPDATE names         SET thread_id=%d         WHERE object_id=%ld         AND name='%s' "},
  {UD_MAIN_, " UPDATE route_set         SET thread_id=%d         WHERE object_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LEAF_, " UPDATE sub_dom         SET thread_id=%d         WHERE object_id=%ld         AND domain='%s' "},
  {UD_AX_PR, " UPDATE tech_c         SET thread_id=%d         WHERE object_id=%ld         AND pe_ro_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LEAF_, " UPDATE upd_to         SET thread_id=%d         WHERE object_id=%ld         AND upd_to='%s' "},
  {UD_AX_PR, " UPDATE zone_c         SET thread_id=%d         WHERE object_id=%ld         AND pe_ro_id=%ld "},
  {UD_MAIN_, ""},
  {UD_MAIN_, ""},
  {UD_MAIN_, ""},
  {UD_MAIN_, ""},
  {UD_MAIN_, ""},
  {UD_MAIN_, ""},
  {UD_MAIN_, ""},
  {UD_MA_U2, " UPDATE %s SET thread_id=%d, local_as='%s'         WHERE object_id=%ld "},
  {UD_AX_MO, " UPDATE member_of         SET thread_id=%d         WHERE object_id=%ld         AND set_id=%ld "},
  {UD_AX_MT, " UPDATE cross_mnt         SET thread_id=%d         WHERE object_id=%ld         AND mnt_id=%ld "},
  {UD_AX_IT, " UPDATE mnt_irt         SET thread_id=%d         WHERE object_id=%ld         AND irt_id=%ld "},
  {UD_MAIN_, " UPDATE irt         SET thread_id=%d         WHERE object_id=%ld "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_LEAF_, " UPDATE irt_nfy         SET thread_id=%d         WHERE object_id=%ld         AND irt_nfy='%s' "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {0, NULL}
}; /* Update */

UD_query Dummy[] = {
  {UD_NULL_, ""},
  {UD_AX_PR, " INSERT person_role          SET thread_id=%d, object_id=%ld, nic_hdl='%s', object_type=%d, dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_PR, " INSERT person_role           SET thread_id=%d, object_id=%ld, nic_hdl='%s', object_type=%d, dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_PR, " INSERT person_role           SET thread_id=%d, object_id=%ld, nic_hdl='%s', object_type=%d, dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_MT, " INSERT mntner         SET thread_id=%d, object_id=%ld, mntner='%s', dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_MT, " INSERT mntner          SET thread_id=%d, object_id=%ld, mntner='%s', dummy=1 "},
  {UD_AX_MT, " INSERT mntner         SET thread_id=%d, object_id=%ld, mntner='%s', dummy=1 "},
  {UD_NULL_, ""},
  {UD_AX_MT, " INSERT mntner         SET thread_id=%d, object_id=%ld, mntner='%s', dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_MT, " INSERT mntner         SET thread_id=%d, object_id=%ld, mntner='%s', dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_PR, " INSERT person_role          SET thread_id=%d, object_id=%ld, nic_hdl='%s', object_type=%d, dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_PR, " INSERT person_role         SET thread_id=%d, object_id=%ld, nic_hdl='%s', object_type=%d, dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_AX_MO, " INSERT %s         SET thread_id=%d, object_id=%ld, %s='%s', dummy=1 "},
  {UD_AX_MT, " INSERT mntner         SET thread_id=%d, object_id=%ld, mntner='%s', dummy=1 "},
  {UD_AX_IT, " INSERT irt         SET thread_id=%d, object_id=%ld, irt='%s', dummy=1 "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {0, NULL}
}; /* Dummy */

UD_query Select[] = {
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " as_set='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " domain='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " filter_set='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MA_IN, " begin_in=%u AND end_in=%u AND "},
  {UD_MA_I6, " i6_msb='%llu' AND i6_lsb='%llu' AND prefix_length=%u AND "},
  {UD_NULL_, ""},
  {UD_MAIN_, " key_cert='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " mntner='%s' AND "},
  {UD_NULL_, ""},
  {UD_MAIN_, " nic_hdl='%s' AND "},
  {UD_NULL_, ""},
  {UD_MAIN_, " origin='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " route_set='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " inet_rtr='%s' AND "},
  {UD_MA_AK, " begin_as=%d AND end_as=%d AND "},
  {UD_MAIN_, " aut_num='%s' AND "},
  {UD_MAIN_, " limerick='%s' AND "},
  {UD_MA_RT, " prefix=%u AND prefix_length=%d AND "},
  {UD_MAIN_, " peering_set='%s' AND "},
  {UD_MAIN_, " rtr_set='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_MAIN_, " irt='%s' AND "},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {UD_NULL_, ""},
  {0, NULL}
}; /* Select */

