本文整理汇总了C#中QueryTables.AddTable方法的典型用法代码示例。如果您正苦于以下问题:C# QueryTables.AddTable方法的具体用法?C# QueryTables.AddTable怎么用?C# QueryTables.AddTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryTables
的用法示例。
在下文中一共展示了QueryTables.AddTable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFriends
public FriendInfo[] GetFriends(UUID principalID)
{
List<FriendInfo> infos = new List<FriendInfo>();
QueryTables tables = new QueryTables();
tables.AddTable(m_realm, "my");
tables.AddTable(m_realm, "his", JoinType.Inner,
new[,] {{"my.Friend", "his.PrincipalID"}, {"my.PrincipalID", "his.Friend"}});
QueryFilter filter = new QueryFilter();
filter.andFilters["my.PrincipalID"] = principalID;
List<string> query = GD.Query(new string[]
{
"my.Friend",
"my.Flags",
"his.Flags"
}, tables, filter, null, null, null);
//These are used to get the other flags below
for (int i = 0; i < query.Count; i += 3)
{
FriendInfo info = new FriendInfo
{
PrincipalID = principalID,
Friend = query[i],
MyFlags = int.Parse(query[i + 1]),
TheirFlags = int.Parse(query[i + 2])
};
infos.Add(info);
}
return infos.ToArray();
}
示例2: GetGroupMembershipData
public GroupMembershipData GetGroupMembershipData(UUID requestingAgentID, UUID GroupID, UUID AgentID)
{
object remoteValue = DoRemote(requestingAgentID, GroupID, AgentID);
if (remoteValue != null || m_doRemoteOnly)
return (GroupMembershipData) remoteValue;
if (GroupID == UUID.Zero)
GroupID = GetAgentActiveGroup(requestingAgentID, AgentID);
if (GroupID == UUID.Zero)
return null;
QueryTables tables = new QueryTables();
tables.AddTable("osgroup", "osg");
tables.AddTable("osgroupmembership", "osgm", JoinType.Inner, new[,] {{"osg.GroupID", "osgm.GroupID"}});
tables.AddTable("osrole", "osr", JoinType.Inner,
new[,] {{"osgm.SelectedRoleID", "osr.RoleID"}, {"osr.GroupID", "osg.GroupID"}});
QueryFilter filter = new QueryFilter();
filter.andFilters["osg.GroupID"] = GroupID;
filter.andFilters["osgm.AgentID"] = AgentID;
string[] fields = new[]
{
"osgm.AcceptNotices",
"osgm.Contribution",
"osgm.ListInProfile",
"osgm.SelectedRoleID",
"osr.Title",
"osr.Powers",
"osg.AllowPublish",
"osg.Charter",
"osg.FounderID",
"osg.Name",
"osg.InsigniaID",
"osg.MaturePublish",
"osg.MembershipFee",
"osg.OpenEnrollment",
"osg.ShowInList"
};
List<string> Membership = data.Query(fields, tables, filter, null, null, null);
if (fields.Length != Membership.Count)
return null;
GroupMembershipData GMD = new GroupMembershipData
{
AcceptNotices = int.Parse(Membership[0]) == 1,
Active = true, //TODO: Figure out what this is and its effects if false
ActiveRole = UUID.Parse(Membership[3]),
AllowPublish = int.Parse(Membership[6]) == 1,
Charter = Membership[7],
Contribution = int.Parse(Membership[1]),
FounderID = UUID.Parse(Membership[8]),
GroupID = GroupID,
GroupName = Membership[9],
GroupPicture = UUID.Parse(Membership[10]),
GroupPowers = ulong.Parse(Membership[5]),
GroupTitle = Membership[4],
ListInProfile = int.Parse(Membership[2]) == 1,
MaturePublish = int.Parse(Membership[11]) == 1,
MembershipFee = int.Parse(Membership[12]),
OpenEnrollment = int.Parse(Membership[13]) == 1,
ShowInList = int.Parse(Membership[14]) == 1
};
return GMD;
}
示例3: GetAgentGroupRoles
public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
{
// I couldn't actually get this function to call when testing changes
object remoteValue = DoRemote(requestingAgentID, AgentID, GroupID);
if (remoteValue != null || m_doRemoteOnly)
return (List<GroupRolesData>) remoteValue;
//No permissions check necessary, we are checking only roles that they are in, so if they arn't in the group, that isn't a problem
QueryTables tables = new QueryTables();
tables.AddTable("osgrouprolemembership", "osgm");
tables.AddTable("osrole", "osr", JoinType.Inner, new[,] {{"osgm.RoleID", "osr.RoleID"}});
QueryFilter filter = new QueryFilter();
filter.andFilters["osgm.AgentID"] = AgentID;
filter.andFilters["osgm.GroupID"] = GroupID;
string[] fields = new[]
{
"osr.Name",
"osr.Description",
"osr.Title",
"osr.Powers",
"osr.RoleID"
};
List<string> Roles = data.Query(fields, tables, filter, null, null, null);
filter = new QueryFilter();
List<GroupRolesData> RolesData = new List<GroupRolesData>();
for (int loop = 0; loop < Roles.Count; loop += fields.Length)
{
RolesData.Add(new GroupRolesData
{
RoleID = UUID.Parse(Roles[loop + 4]),
Name = Roles[loop + 0],
Description = Roles[loop + 1],
Powers = ulong.Parse(Roles[loop + 3]),
Title = Roles[loop + 2]
});
}
return RolesData;
}
示例4: GetAgentGroupMemberships
public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
{
object remoteValue = DoRemote(requestingAgentID, AgentID);
if (remoteValue != null || m_doRemoteOnly)
return (List<GroupMembershipData>) remoteValue;
QueryTables tables = new QueryTables();
tables.AddTable("osgroup", "osg");
tables.AddTable("osgroupmembership", "osgm", JoinType.Inner, new[,] {{"osg.GroupID", "osgm.GroupID"}});
tables.AddTable("osrole", "osr", JoinType.Inner, new[,] {{"osgm.SelectedRoleID", "osr.RoleID"}});
QueryFilter filter = new QueryFilter();
filter.andFilters["osgm.AgentID"] = AgentID;
string[] fields = new[]
{
"osgm.AcceptNotices",
"osgm.Contribution",
"osgm.ListInProfile",
"osgm.SelectedRoleID",
"osr.Title",
"osr.Powers",
"osg.AllowPublish",
"osg.Charter",
"osg.FounderID",
"osg.Name",
"osg.InsigniaID",
"osg.MaturePublish",
"osg.MembershipFee",
"osg.OpenEnrollment",
"osg.ShowInList",
"osg.GroupID"
};
List<string> Membership = data.Query(fields, tables, filter, null, null, null);
List<GroupMembershipData> results = new List<GroupMembershipData>();
for (int loop = 0; loop < Membership.Count; loop += fields.Length)
{
results.Add(new GroupMembershipData
{
AcceptNotices = int.Parse(Membership[loop + 0]) == 1,
Active = true,
//TODO: Figure out what this is and its effects if false
ActiveRole = UUID.Parse(Membership[loop + 3]),
AllowPublish = int.Parse(Membership[loop + 6]) == 1,
Charter = Membership[loop + 7],
Contribution = int.Parse(Membership[loop + 1]),
FounderID = UUID.Parse(Membership[loop + 8]),
GroupID = UUID.Parse(Membership[loop + 15]),
GroupName = Membership[loop + 9],
GroupPicture = UUID.Parse(Membership[loop + 10]),
GroupPowers = ulong.Parse(Membership[loop + 5]),
GroupTitle = Membership[loop + 4],
ListInProfile = int.Parse(Membership[loop + 2]) == 1,
MaturePublish = int.Parse(Membership[loop + 11]) == 1,
MembershipFee = int.Parse(Membership[loop + 12]),
OpenEnrollment = int.Parse(Membership[loop + 13]) == 1,
ShowInList = int.Parse(Membership[loop + 14]) == 1
});
}
return results;
}
示例5: GetGroupTitles
public List<GroupTitlesData> GetGroupTitles(UUID requestingAgentID, UUID GroupID)
{
object remoteValue = DoRemote(requestingAgentID, GroupID);
if (remoteValue != null || m_doRemoteOnly)
return (List<GroupTitlesData>) remoteValue;
QueryTables tables = new QueryTables();
tables.AddTable("osgroupmembership", "osgm");
tables.AddTable("osgrouprolemembership", "osgrm", JoinType.Inner,
new[,] {{"osgm.AgentID", "osgrm.AgentID"}, {"osgm.GroupID", "osgrm.GroupID"}});
tables.AddTable("osrole", "osr", JoinType.Inner,
new[,] {{"osgrm.RoleID", "osr.RoleID"}, {"osgm.GroupID", "osr.GroupID"}});
QueryFilter filter = new QueryFilter();
filter.andFilters["osgm.AgentID"] = requestingAgentID;
filter.andFilters["osgm.GroupID"] = GroupID;
List<string> Membership = data.Query(new[]
{
"osgm.SelectedRoleID",
"osgrm.RoleID",
"osr.Name"
}, tables, filter, null, null, null);
List<GroupTitlesData> titles = new List<GroupTitlesData>();
for (int loop = 0; loop < Membership.Count(); loop += 3)
{
titles.Add(new GroupTitlesData
{
Name = Membership[loop + 2],
UUID = UUID.Parse(Membership[loop + 1]),
Selected = Membership[loop + 0] == Membership[loop + 1]
});
}
return titles;
}
示例6: GetGroupRoleMembers
public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
{
object remoteValue = DoRemote(requestingAgentID, GroupID);
if (remoteValue != null || m_doRemoteOnly)
return (List<GroupRoleMembersData>) remoteValue;
List<GroupRoleMembersData> RoleMembers = new List<GroupRoleMembersData>();
QueryTables tables = new QueryTables();
tables.AddTable("osgrouprolemembership", "osgrm");
tables.AddTable("osrole", "osr", JoinType.Inner, new[,] {{"osr.RoleID", "osgrm.RoleID"}});
QueryFilter filter = new QueryFilter();
filter.andFilters["osgrm.GroupID"] = GroupID;
string[] fields = new[]
{
"osgrm.RoleID",
"osgrm.AgentID",
"osr.Powers"
};
List<string> Roles = data.Query(fields, tables, filter, null, null, null);
GroupMembersData GMD = GetAgentGroupMemberData(requestingAgentID, GroupID, requestingAgentID);
const long canViewMemebersBit = 140737488355328L;
for (int i = 0; i < Roles.Count; i += fields.Length)
{
GroupRoleMembersData RoleMember = new GroupRoleMembersData
{
RoleID = UUID.Parse(Roles[i]),
MemberID = UUID.Parse(Roles[i + 1])
};
// if they are a member, they can see everyone, otherwise, only the roles that are supposed to be shown
if (GMD != null ||
((long.Parse(Roles[i + 2]) & canViewMemebersBit) == canViewMemebersBit ||
RoleMember.MemberID == requestingAgentID))
RoleMembers.Add(RoleMember);
}
return RoleMembers;
}
示例7: GetAgentGroupRoles
public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID agentID, UUID groupID)
{
if (m_doRemoteOnly) {
object remoteValue = DoRemote (requestingAgentID, agentID, groupID);
return remoteValue != null ? (List<GroupRolesData>)remoteValue : new List<GroupRolesData> ();
}
//No permissions check necessary, we are checking only roles that they are in, so if they arn't in the group, that isn't a problem
QueryTables tables = new QueryTables();
tables.AddTable(_MEMBERSHIPROLEREALM, "osgm");
tables.AddTable(_ROLEREALM, "osr", JoinType.Inner, new[,] {{"osgm.RoleID", "osr.RoleID"}});
QueryFilter filter = new QueryFilter();
filter.andFilters["osgm.AgentID"] = agentID;
filter.andFilters["osgm.GroupID"] = groupID;
string[] fields = new[]
{
"osr.Name",
"osr.Description",
"osr.Title",
"osr.Powers",
"osr.RoleID"
};
List<string> Roles = GD.Query(fields, tables, filter, null, null, null);
filter = new QueryFilter();
List<GroupRolesData> RolesData = new List<GroupRolesData>();
for (int loop = 0; loop < Roles.Count; loop += fields.Length)
{
RolesData.Add(new GroupRolesData
{
RoleID = UUID.Parse(Roles[loop + 4]),
Name = Roles[loop + 0],
Description = Roles[loop + 1],
Powers = ulong.Parse(Roles[loop + 3]),
Title = Roles[loop + 2]
});
}
return RolesData;
}