/*
   ** Create an sps that is used by the trigger.
   */
  private SPSDescriptor createSPS(
      LanguageConnectionContext lcc,
      DataDescriptorGenerator ddg,
      DataDictionary dd,
      TransactionController tc,
      UUID triggerId,
      SchemaDescriptor sd,
      UUID spsId,
      UUID compSchemaId,
      String text,
      boolean isWhen,
      TableDescriptor triggerTable)
      throws StandardException {
    if (text == null) {
      return null;
    }

    /*
     ** Note: the format of this string is very important.
     ** Dont change it arbitrarily -- see sps code.
     */
    String spsName =
        "TRIGGER"
            + (isWhen ? "WHEN_" : "ACTN_")
            + triggerId
            + "_"
            + triggerTable.getUUID().toString();

    SPSDescriptor spsd =
        new SPSDescriptor(
            dd,
            spsName,
            (spsId == null) ? dd.getUUIDFactory().createUUID() : spsId,
            sd.getUUID(),
            compSchemaId == null ? lcc.getDefaultSchema().getUUID() : compSchemaId,
            SPSDescriptor.SPS_TYPE_TRIGGER,
            true, // it is valid
            text, // the text
            true); // no defaults

    /*
     ** Prepared the stored prepared statement
     ** and release the activation class -- we
     ** know we aren't going to execute statement
     ** after create it, so for now we are finished.
     */
    spsd.prepareAndRelease(lcc, triggerTable);

    dd.addSPSDescriptor(spsd, tc);

    return spsd;
  }