f_plugins_array.srf 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. $PBExportHeader$f_plugins_array.srf
  2. global type f_plugins_array from function_object
  3. end type
  4. forward prototypes
  5. global subroutine f_plugins_array (string arg_pluginsstr)
  6. end prototypes
  7. global subroutine f_plugins_array (string arg_pluginsstr);Long ll_cnt,cnt
  8. String ls_pluginsstr
  9. Long ll_plugins
  10. Long local_plugins[]
  11. ll_cnt = 0
  12. ls_pluginsstr = arg_pluginsstr
  13. IF Trim(arg_pluginsstr) = '' OR Trim(arg_pluginsstr) = '-1' THEN
  14. local_plugins[1] = 0
  15. ELSE
  16. IF sys_power_issuper OR arg_pluginsstr = '0' THEN
  17. SELECT count(*) INTO :cnt
  18. FROM u_plugins;
  19. IF sqlca.SQLCode <> 0 OR cnt = 0 THEN
  20. ll_cnt++
  21. local_plugins[ll_cnt] = 0
  22. ELSE
  23. DECLARE cur_plugins CURSOR FOR
  24. SELECT u_plugins.fileid
  25. FROM u_plugins
  26. Order By u_plugins.fileid Desc;
  27. OPEN cur_plugins;
  28. FETCH cur_plugins INTO :ll_plugins;
  29. DO WHILE sqlca.SQLCode = 0
  30. ll_cnt++
  31. local_plugins[ll_cnt] = ll_plugins
  32. FETCH cur_plugins INTO :ll_plugins;
  33. LOOP
  34. CLOSE cur_plugins;
  35. END IF
  36. ELSE
  37. DO WHILE Len(ls_pluginsstr) <> 1
  38. ls_pluginsstr = Replace( ls_pluginsstr, 1, 1, '' )
  39. ll_plugins = Long(Left(ls_pluginsstr,Pos(ls_pluginsstr,',',1) - 1))
  40. ll_cnt++
  41. local_plugins[ll_cnt] = ll_plugins
  42. ls_pluginsstr = Replace ( ls_pluginsstr, 1, Pos(ls_pluginsstr,',',1) - 1, '' )
  43. LOOP
  44. END IF
  45. END IF
  46. sys_user_plugins = local_plugins
  47. end subroutine