Differences From
Artifact [30de1dd276]:
58 58 where $1::text = (a.handle || '@' || domain) or
59 59 $1::text = ('@' || a.handle || '@' || domain) or
60 60 (a.origin is null and
61 61 $1::text = a.handle or
62 62 $1::text = ('@' || a.handle))
63 63 ]];
64 64 };
65 +
66 + actor_save = {
67 + params = {
68 + uint64, --id
69 + rawstring, --nym
70 + rawstring, --handle
71 + rawstring, --bio
72 + rawstring, --epithet
73 + rawstring, --avataruri
74 + uint64, --avatarid
75 + uint16, --rank
76 + uint32 --quota
77 + }, cmd = true, sql = [[
78 + update parsav_actors set
79 + nym = $2::text,
80 + handle = $3::text,
81 + bio = $4::text,
82 + epithet = $5::text,
83 + avataruri = $6::text,
84 + avatarid = $7::bigint,
85 + rank = $8::smallint,
86 + quota = $9::integer
87 + --invites are controlled by their own specialized routines
88 + where id = $1::bigint
89 + ]];
90 + };
65 91
66 92 actor_create = {
67 93 params = {
68 94 rawstring, rawstring, uint64, lib.store.timepoint,
69 95 rawstring, rawstring, lib.mem.ptr(uint8),
70 96 rawstring, uint16, uint32
71 97 };
................................................................................
823 849
824 850 actor_enum = [terra(src: &lib.store.source)
825 851 var r = queries.actor_enum.exec(src)
826 852 if r.sz == 0 then
827 853 return [lib.mem.ptr(&lib.store.actor)] { ct = 0, ptr = nil }
828 854 else defer r:free()
829 855 var mem = lib.mem.heapa([&lib.store.actor], r.sz)
830 - for i=0,r.sz do mem.ptr[i] = row_to_actor(&r, i).ptr end
856 + for i=0,r.sz do
857 + mem.ptr[i] = row_to_actor(&r, i).ptr
858 + mem.ptr[i].source = src
859 + end
831 860 return [lib.mem.ptr(&lib.store.actor)] { ct = r.sz, ptr = mem.ptr }
832 861 end
833 862 end];
834 863
835 864 actor_enum_local = [terra(src: &lib.store.source)
836 865 var r = queries.actor_enum_local.exec(src)
837 866 if r.sz == 0 then
838 867 return [lib.mem.ptr(&lib.store.actor)] { ct = 0, ptr = nil }
839 868 else defer r:free()
840 869 var mem = lib.mem.heapa([&lib.store.actor], r.sz)
841 - for i=0,r.sz do mem.ptr[i] = row_to_actor(&r, i).ptr end
870 + for i=0,r.sz do
871 + mem.ptr[i] = row_to_actor(&r, i).ptr
872 + mem.ptr[i].source = src
873 + end
842 874 return [lib.mem.ptr(&lib.store.actor)] { ct = r.sz, ptr = mem.ptr }
843 875 end
844 876 end];
845 877
846 878 actor_auth_how = [terra(
847 879 src: &lib.store.source,
848 880 ip: lib.store.inet,
................................................................................
934 966
935 967 timeline_instance_fetch = [terra(src: &lib.store.source, rg: lib.store.range)
936 968 var r = pqr { sz = 0 }
937 969 var A,B,C,D = rg:matrix() -- :/
938 970 r = queries.timeline_instance_fetch.exec(src,A,B,C,D)
939 971
940 972 var ret: lib.mem.ptr(lib.mem.ptr(lib.store.post)) ret:init(r.sz)
941 - for i=0,r.sz do ret.ptr[i] = row_to_post(&r, i) end -- MUST FREE ALL
973 + for i=0,r.sz do
974 + ret.ptr[i] = row_to_post(&r, i) -- MUST FREE ALL
975 + ret.ptr[i].ptr.source = src
976 + end
942 977
943 978 return ret
944 979 end];
945 980
946 981 post_enum_author_uid = [terra(
947 982 src: &lib.store.source,
948 983 uid: uint64,
................................................................................
949 984 rg: lib.store.range
950 985 ): lib.mem.ptr(lib.mem.ptr(lib.store.post))
951 986 var r = pqr { sz = 0 }
952 987 var A,B,C,D = rg:matrix() -- :/
953 988 r = queries.post_enum_author_uid.exec(src,A,B,C,D,uid)
954 989
955 990 var ret: lib.mem.ptr(lib.mem.ptr(lib.store.post)) ret:init(r.sz)
956 - for i=0,r.sz do ret.ptr[i] = row_to_post(&r, i) end -- MUST FREE ALL
991 + for i=0,r.sz do
992 + ret.ptr[i] = row_to_post(&r, i) -- MUST FREE ALL
993 + ret.ptr[i].ptr.source = src
994 + end
957 995
958 996 return ret
959 997 end];
960 998
961 999 actor_powers_fetch = getpow;
1000 + actor_save = [terra(
1001 + src: &lib.store.source,
1002 + ac: &lib.store.actor
1003 + ): {}
1004 + queries.actor_save.exec(src,
1005 + ac.id, ac.nym, ac.handle,
1006 + ac.bio, ac.epithet, ac.avatar,
1007 + ac.avatarid, ac.rights.rank, ac.rights.quota)
1008 + end];
1009 +
962 1010 actor_save_privs = privupdate;
963 1011
964 1012 actor_create = [terra(
965 1013 src: &lib.store.source,
966 1014 ac: &lib.store.actor
967 1015 ): uint64
968 1016 var r = queries.actor_create.exec(src,ac.nym, ac.handle, ac.origin, ac.knownsince, ac.bio, ac.avatar, ac.key, ac.epithet, ac.rights.rank, ac.rights.quota)