f_account_array.srf 1.4 KB

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