pears.CollectionDeleteAllowed

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

CREATE FUNCTION "pears"."CollectionDeleteAllowed"( 
  /* Application Maintained Function / Procedure - DO NOT EDIT*/
  IN "pCollectionid" CHAR(20) ) 
RETURNS long VARCHAR
BEGIN
  DECLARE "rv" long VARCHAR;
  DECLARE "collectioncount" INTEGER;
  SET "rv" = '';
  IF NOT EXISTS(SELECT * FROM "collection" WHERE "collectionid" = "pCollectionid") THEN
    RETURN "string"('Collection not found')
  END IF;
  SELECT "count"() INTO "collectioncount" FROM "collection" WHERE "parent" = "pCollectionid";
  IF "collectioncount" > 0 THEN
    SET "rv" = "string"('Collection has ',"collectioncount",' children')
  END IF;
  SELECT "count"() INTO "collectioncount" FROM "collectionchat" WHERE "collectionid" = "pcollectionid";
  IF "collectioncount" > 0 THEN
    SET "rv" = "trim"("string"("rv","char"(13),"char"(10),'Collection has ',"collectioncount",' messages'))
  END IF;
  RETURN "rv"
END
  • database/functions/pears_collectiondeleteallowed.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1