Query_t Query[] = {

  {
    R_SQL,
    Q_LOOKUP,
    WK_NIC_HDL,
    A_NH,
    C_PN,
    "SELECT object_id           FROM   person_role           WHERE  nic_hdl = '%s'           AND    object_type = -1           AND    thread_id = 0",
    "SQL:pn/nh/WK_NIC_HDL"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NIC_HDL,
    A_NH,
    C_RO,
    "SELECT object_id           FROM   person_role           WHERE  nic_hdl = '%s'           AND    object_type = -1           AND    thread_id = 0",
    "SQL:ro/nh/WK_NIC_HDL"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_NAME,
    A_TC,
    C_ANY,
    "SELECT i.object_id           FROM   tech_c i, %s           WHERE  %s           AND    i.pe_ro_id = N00.object_id 	  AND	 i.thread_id = 0",
    "SQL:ANY/tc/WK_NAME"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_TC,
    C_ANY,
    "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' 	  AND	 i.thread_id = 0",
    "SQL:ANY/tc/WK_NIC_HDL"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_DOMAIN,
    A_IR,
    C_IR,
    "SELECT object_id           FROM   inet_rtr           WHERE  inet_rtr = '%s'           AND    thread_id = 0",
    "SQL:ir/ir/WK_DOMAIN"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NAME,
    A_PN,
    C_PN,
    "SELECT N00.object_id           FROM   %s           WHERE  %s           AND    N00.object_type = -1           AND    N00.thread_id = 0",
    "SQL:pn/pn/WK_NAME"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_AUTNUM,
    A_AN,
    C_AN,
    "SELECT object_id           FROM   aut_num           WHERE  aut_num = '%s'           AND    thread_id = 0",
    "SQL:an/an/WK_AUTNUM"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_KEY_CERT,
    A_KC,
    C_KC,
    "SELECT object_id           FROM   key_cert           WHERE  key_cert = '%s'           AND    thread_id = 0",
    "SQL:kc/kc/WK_KEY_CERT"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_EMAIL,
    A_NY,
    C_ANY,
    "SELECT object_id           FROM   notify i           WHERE  i.notify = '%s' 	  AND	 i.thread_id = 0",
    "SQL:ANY/ny/WK_EMAIL"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_MB,
    C_ANY,
    "SELECT i.object_id           FROM   mntner, mnt_by i           WHERE  mntner.object_id = i.mnt_id           AND    mntner.mntner = '%s' 	  AND	 i.thread_id = 0",
    "SQL:ANY/mb/WK_MNTNER"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_ASRANGE,
    A_AK,
    C_AK,
    "SELECT object_id           FROM  as_block           WHERE begin_as <= %u           AND   end_as   >= %u           AND   thread_id = 0",
    "SQL:ak/ak/WK_ASRANGE"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_NAME,
    A_ZC,
    C_ANY,
    "SELECT i.object_id           FROM   zone_c i, %s           WHERE  %s           AND    i.pe_ro_id = N00.object_id           AND    i.thread_id = 0",
    "SQL:ANY/zc/WK_NAME"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_ZC,
    C_ANY,
    "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'           AND    i.thread_id = 0",
    "SQL:ANY/zc/WK_NIC_HDL"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_MR,
    C_ANY,
    "SELECT MR.object_id         FROM   mbrs_by_ref MR, mntner MT         WHERE  MT.mntner = '%s'         AND    MT.dummy = 0         AND    MT.object_id = MR.mnt_id         AND    MR.thread_id = 0",
    "SQL:ANY/mr/WK_MNTNER"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_EMAIL,
    A_MN,
    C_MT,
    "SELECT object_id           FROM   mnt_nfy           WHERE  mnt_nfy = '%s'           AND    thread_id = 0",
    "SQL:mt/mn/WK_EMAIL"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_AUTNUM,
    A_LA,
    C_IR,
    "SELECT object_id           FROM   inet_rtr           WHERE  local_as  = '%s'           AND    thread_id = 0",
    "SQL:ir/la/WK_AUTNUM"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_EMAIL,
    A_DT,
    C_MT,
    "SELECT object_id           FROM   upd_to           WHERE  upd_to = '%s'           AND    thread_id = 0",
    "SQL:mt/dt/WK_EMAIL"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_MU,
    C_ANY,
    "SELECT i.object_id           FROM   mntner, mnt_routes i           WHERE  mntner.object_id = i.mnt_id           AND    mntner.mntner  = '%s'",
    "SQL:ANY/mu/WK_MNTNER"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_FILTERSET,
    A_FS,
    C_FS,
    "SELECT object_id 	FROM   filter_set  	WHERE  filter_set='%s' 	AND    thread_id=0",
    "SQL:fs/fs/WK_FILTERSET"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_ASSETNAME,
    A_AS,
    C_AS,
    "SELECT object_id           FROM   as_set           WHERE  as_set = '%s'           AND    thread_id = 0",
    "SQL:as/as/WK_ASSETNAME"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_RB,
    C_ANY,
    "SELECT i.object_id           FROM   mntner, referral_by i           WHERE  mntner.object_id = i.mnt_id           AND    mntner.mntner = '%s'           AND    i.thread_id = 0",
    "SQL:ANY/rb/WK_MNTNER"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_MNTNER,
    A_ML,
    C_ANY,
    "SELECT i.object_id           FROM   mntner, mnt_lower i           WHERE  mntner.object_id = i.mnt_id           AND    mntner.mntner  = '%s'           AND    i.thread_id = 0",
    "SQL:ANY/ml/WK_MNTNER"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_NAME,
    A_RO,
    C_RO,
    "SELECT N00.object_id           FROM   %s           WHERE  %s           AND    N00.object_type = -1           AND    N00.thread_id = 0",
    "SQL:ro/ro/WK_NAME"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_PEERINGSET,
    A_PS,
    C_PS,
    "SELECT object_id         FROM   peering_set         WHERE  peering_set='%s'         AND    thread_id=0",
    "SQL:ps/ps/WK_PEERINGSET"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_NAME,
    A_AC,
    C_ANY,
    "SELECT i.object_id           FROM   admin_c i, %s           WHERE  %s           AND    i.pe_ro_id = N00.object_id 	  AND	 i.thread_id = 0",
    "SQL:ANY/ac/WK_NAME"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_NIC_HDL,
    A_AC,
    C_ANY,
    "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' 	  AND	 i.thread_id = 0",
    "SQL:ANY/ac/WK_NIC_HDL"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_IPADDRESS,
    A_IF,
    C_IR,
    "SELECT object_id           FROM   ifaddr           WHERE  ifaddr >= %u           AND    ifaddr <= %u           AND    thread_id = 0",
    "SQL:ir/if/WK_IPADDRESS"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_ROUTESETNAME,
    A_RS,
    C_RS,
    "SELECT object_id           FROM   route_set           WHERE  route_set = '%s'           AND    thread_id = 0",
    "SQL:rs/rs/WK_ROUTESETNAME"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_ROUTESETNAME,
    A_MO,
    C_IR,
    "SELECT member_of.object_id         FROM mbrs_by_ref, member_of, route_set         LEFT OUTER JOIN mnt_by ON member_of.object_id = mnt_by.object_id         /* an old object might have no mntner at all */         WHERE (mbrs_by_ref.mnt_id = 0 OR mbrs_by_ref.mnt_id = mnt_by.mnt_id)         /* mbrs_by_ref is any or matches the mnt_by of a member */         AND member_of.set_id = mbrs_by_ref.object_id         AND route_set.object_id = member_of.set_id         AND route_set.route_set = '%s'         AND route_set.thread_id = 0",
    "SQL:ir/mo/WK_ROUTESETNAME"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_ASSETNAME,
    A_MO,
    C_IR,
    "SELECT member_of.object_id           FROM  as_set, member_of, mbrs_by_ref           LEFT OUTER JOIN mnt_by ON member_of.object_id = mnt_by.object_id           WHERE (mbrs_by_ref.mnt_id = 0 OR mbrs_by_ref.mnt_id = mnt_by.mnt_id)           AND member_of.set_id = mbrs_by_ref.object_id           AND as_set.object_id = member_of.set_id           AND as_set = '%s'           AND as_set.thread_id = 0",
    "SQL:ir/mo/WK_ASSETNAME"
    },
  {
    R_SQL,
    Q_INVERSE,
    WK_AUTNUM,
    A_OR,
    C_RT,
    "SELECT object_id           FROM   route           WHERE  origin = '%s'           AND    thread_id = 0",
    "SQL:rt/or/WK_AUTNUM"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_MNTNER,
    A_MT,
    C_MT,
    "SELECT object_id           FROM   mntner           WHERE  mntner = '%s'           AND    thread_id = 0",
    "SQL:mt/mt/WK_MNTNER"
    },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPRANGE,
    A_RT,
    C_RT,
    "",
    "RADIX:rt/WK_IPRANGE"
    },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPPREFIX,
    A_RT,
    C_RT,
    "",
    "RADIX:rt/WK_IPPREFIX"
    },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPADDRESS,
    A_RT,
    C_RT,
    "",
    "RADIX:rt/WK_IPADDRESS"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_RTRSET,
    A_IS,
    C_IS,
    "SELECT object_id         FROM   rtr_set         WHERE  rtr_set='%s'         AND    thread_id=0",
    "SQL:is/is/WK_RTRSET"
    },
  {
    R_SQL,
    Q_LOOKUP,
    WK_EMAIL,
    A_EM,
    C_ANY,
    "SELECT object_id           FROM   e_mail i           WHERE  i.e_mail = '%s'           AND    i.thread_id = 0",
    "SQL:ANY/em/WK_EMAIL"
    },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPRANGE,
    A_IN,
    C_IN,
    "",
    "RADIX:in/WK_IPRANGE"
    },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPPREFIX,
    A_IN,
    C_IN,
    "",
    "RADIX:in/WK_IPPREFIX"
    },
  {
    R_RADIX,
    Q_LOOKUP,
    WK_IPADDRESS,
    A_IN,
    C_IN,
    "",
    "RADIX:in/WK_IPADDRESS"
    },
  {
    0,
    0,
    0,
    0,
    0,
    NULL
  }
}; /* Query[] */

