typedef struct _Query_t {
  R_Type_t refer;
  Q_Type_t querytype;
  WK_Type keytype;
  A_Type_t attribute;
  C_Type_t class;
  char * const query;
  ip_space_t space;
  rx_fam_t family;
} Query_t;

static struct _Query_t Query[] = {

  {
    R_SQL,
    Q_LOOKUP,
    WK_KEY_CERT,
    A_KC,
    C_KC,
    " SELECT object_id FROM key_cert WHERE key_cert = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NAME,
    A_PN,
    C_PN,
    " SELECT N00.object_id FROM %s WHERE %s AND N00.object_type = 8 ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_EMAIL,
    A_EM,
    -1,
    " SELECT object_id FROM e_mail WHERE e_mail = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_AUTNUM,
    A_OR,
    C_RT,
    " SELECT object_id FROM route WHERE origin = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_DOMAIN,
    A_DN,
    C_DN,
    " SELECT object_id FROM domain WHERE domain = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NAME,
    A_ZC,
    -1,
    " SELECT i.object_id FROM zone_c i, %s WHERE %s AND i.pe_ro_id = N00.object_id ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_ZC,
    -1,
    " SELECT i.object_id FROM zone_c i, person_role WHERE i.pe_ro_id = person_role.object_id AND person_role.nic_hdl = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_DOMAIN,
    A_IR,
    C_IR,
    " SELECT object_id FROM inet_rtr WHERE inet_rtr = '%s' ",
    0,
    0
  },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPRANGE,
    A_IN,
    C_IN,
    "",
    IP_V4,
    RX_FAM_IN
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_EMAIL,
    A_NY,
    -1,
    " SELECT object_id FROM notify WHERE notify = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NAME,
    A_TC,
    -1,
    " SELECT i.object_id FROM tech_c i, %s WHERE %s AND i.pe_ro_id = N00.object_id ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_TC,
    -1,
    " SELECT i.object_id FROM tech_c i, person_role WHERE i.pe_ro_id = person_role.object_id AND person_role.nic_hdl = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_CT,
    -1,
    " SELECT i.object_id FROM mntner, cross_mnt i WHERE mntner.object_id = i.mnt_id AND mntner.mntner = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_DOMAIN,
    A_NS,
    C_DN,
    " SELECT object_id FROM nserver WHERE host = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_IPADDRESS,
    A_NS,
    C_DN,
    " SELECT object_id FROM nserver WHERE host = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_CN,
    -1,
    " SELECT i.object_id FROM person_role, cross_nfy i WHERE person_role.object_id = i.pe_ro_id AND person_role.nic_hdl = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NIC_HDL,
    A_NH,
    C_PN,
    " SELECT object_id FROM person_role WHERE nic_hdl = '%s' AND object_type = 8 ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NIC_HDL,
    A_NH,
    C_RO,
    " SELECT object_id FROM person_role WHERE nic_hdl = '%s' AND object_type = 9 ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NETNAME,
    A_NA,
    C_IN,
    " SELECT object_id FROM inetnum WHERE netname = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NETNAME,
    A_NA,
    C_I6,
    " SELECT object_id FROM inet6num WHERE netname = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_DOMAIN,
    A_SD,
    C_DN,
    " SELECT object_id FROM sub_dom WHERE domain = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_MNTNER,
    A_MT,
    C_MT,
    " SELECT object_id FROM mntner WHERE mntner = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_ROUTESETNAME,
    A_MO,
    C_IR,
    " SELECT member_of.object_id FROM route_set, member_of WHERE route_set.object_id = member_of.set_id AND route_set='%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_ASSETNAME,
    A_MO,
    C_IR,
    " SELECT member_of.object_id FROM as_set, member_of WHERE as_set.object_id = member_of.set_id AND as_set='%s' ",
    0,
    0
  },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IP6PREFIX,
    A_I6,
    C_I6,
    "",
    IP_V6,
    RX_FAM_IN
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_ML,
    -1,
    " SELECT i.object_id FROM mntner, mnt_lower i WHERE mntner.object_id = i.mnt_id AND mntner.mntner = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_DOMAIN,
    A_RZ,
    C_IN,
    " SELECT object_id FROM rev_srv WHERE rev_srv = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_DOMAIN,
    A_RZ,
    C_I6,
    " SELECT i6_id FROM i6_rev_srv WHERE rev_srv = '%s' ",
    0,
    0
  },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPRANGE,
    A_RT,
    C_RT,
    "",
    IP_V4,
    RX_FAM_RT
  },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPPREFIX,
    A_RT,
    C_RT,
    "",
    IP_V4,
    RX_FAM_RT
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_MB,
    -1,
    " SELECT i.object_id FROM mntner, mnt_by i WHERE mntner.object_id = i.mnt_id AND mntner.mntner = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_ROUTESETNAME,
    A_RS,
    C_RS,
    " SELECT object_id FROM route_set WHERE route_set = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NAME,
    A_RO,
    C_RO,
    " SELECT N00.object_id FROM %s WHERE %s AND N00.object_type = 9 ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_ASSETNAME,
    A_AS,
    C_AS,
    " SELECT object_id FROM as_set WHERE as_set = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_AUTNUM,
    A_AN,
    C_AN,
    " SELECT object_id FROM aut_num WHERE aut_num = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_LOOKUP,
    WK_LIMERICK,
    A_LI,
    C_LI,
    " SELECT object_id FROM limerick WHERE limerick = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NAME,
    A_AH,
    -1,
    " SELECT i.object_id FROM author i, %s WHERE %s AND i.pe_ro_id = N00.object_id ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_AH,
    -1,
    " SELECT i.object_id FROM person_role, author i WHERE person_role.object_id = i.pe_ro_id AND person_role.nic_hdl = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NAME,
    A_AC,
    -1,
    " SELECT i.object_id FROM admin_c i, %s WHERE %s AND i.pe_ro_id = N00.object_id ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_AC,
    -1,
    " SELECT i.object_id FROM admin_c i, person_role WHERE i.pe_ro_id = person_role.object_id AND person_role.nic_hdl = '%s' ",
    0,
    0
  },
  {
    R_SQL,
    Q_INVERSE,
    WK_AUTNUM,
    A_LA,
    C_IR,
    " SELECT object_id FROM inet_rtr WHERE local_as = '%s' ",
    0,
    0
  },
  {
    0,
    0,
    0,
    0,
    0,
    NULL,
    0,
    0
  }
}; /* Query[] */

