pears.GetPropertiesText

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

Original SQL

CREATE FUNCTION "pears"."GetPropertiesText"( 
  /* Application Maintained Function / Procedure - DO NOT EDIT*/
  IN "PropertyType" CHAR(1),IN "HeaderText" long VARCHAR,IN "ConID" INTEGER ) 
RETURNS long VARCHAR
BEGIN
  -- PropertyType - C for connection (requires connectionid), D for database, E for engine / server, W engine / server window messages 
  DECLARE "PropsText" long VARCHAR;
  DECLARE "NewLine" CHAR(2);
  DECLARE "Tab" CHAR(1);
  SET "NewLine" = "char"(13)+"char"(10);
  SET "Tab" = "char"(9);
  CASE "PropertyType"
  WHEN 'C' THEN
    SELECT "list"("string"("PropName",' = ',"Value","Tab",'(',"PropDescription",')'),"NewLine" ORDER BY "PropName" ASC) INTO "PropsText" FROM "sa_conn_properties_by_name"("ConID")
  WHEN 'D' THEN
    SELECT "list"("string"("PropName",' = ',"Value","Tab",'(',"PropDescription",')'),"NewLine" ORDER BY "PropName" ASC) INTO "PropsText" FROM "sa_db_properties"("DB_ID"())
  WHEN 'E' THEN
    SELECT "list"("string"("PropName",' = ',"Value","Tab",'(',"PropDescription",')'),"NewLine" ORDER BY "PropName" ASC) INTO "PropsText" FROM "sa_eng_properties"()
  WHEN 'W' THEN
    SELECT "list"("string"("dateformat"("msg_time",'yyyy-mm-dd hh:nn:ss'),"Tab","msg_text"),"NewLine" ORDER BY "msg_id" ASC) INTO "PropsText" FROM "sa_server_messages"()
  END CASE;
  RETURN("trim"("HeaderText" || "NewLine" || "NewLine" || "PropsText"))
END