本文整理汇总了C#中QueryTables类的典型用法代码示例。如果您正苦于以下问题:C# QueryTables类的具体用法?C# QueryTables怎么用?C# QueryTables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryTables类属于命名空间,在下文中一共展示了QueryTables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: QueryFullData
public abstract List<string> QueryFullData(string whereClause, QueryTables tables, string wantedValue);
示例6: QueryData
public abstract DataReaderConnection QueryData(string whereClause, QueryTables tables, string wantedValue);
示例7: QueryNames
public abstract Dictionary<string, List<string>> QueryNames(string[] keyRow, object[] keyValue,
QueryTables tables, string wantedValue);
示例8: QueryData
public override IDataReader QueryData(string whereClause, QueryTables tables, string wantedValue)
{
string query = string.Format("SELECT {0} FROM {1} {2}", wantedValue, tables, whereClause);
return QueryData2(query);
}
示例9: QueryNames
public override Dictionary<string, List<string>> QueryNames(string[] keyRow, object[] keyValue,
QueryTables tables, string wantedValue)
{
string query = string.Format("SELECT {0} FROM {1} where ", wantedValue, tables.ToSQL());
return QueryNames2(keyRow, keyValue, query);
}
示例10: QueryFullData
public override List<string> QueryFullData(string whereClause, QueryTables tables, string wantedValue)
{
string query = string.Format("SELECT {0} FROM {1} {2}", wantedValue, tables.ToSQL(), whereClause);
return QueryFullData2(query);
}
示例11: QueryData
public override DataReaderConnection QueryData(string whereClause, QueryTables tables, string wantedValue)
{
string query = string.Format("SELECT {0} FROM {1} {2}", wantedValue, tables.ToSQL(), whereClause);
return new DataReaderConnection {DataReader = QueryData2(query)};
}
示例12: Query
public override List<string> Query(string[] wantedValue, QueryTables tables, QueryFilter queryFilter,
Dictionary<string, bool> sort, uint? start, uint? count)
{
string query = string.Format("SELECT {0} FROM {1}", string.Join(", ", wantedValue), tables.ToSQL());
return Query2(query, queryFilter, sort, start, count);
}
示例13: QueryData
public override DataReaderConnection QueryData(string whereClause, QueryTables tables, string wantedValue)
{
string query = string.Format("SELECT {0} FROM {1} {2}", wantedValue, tables, whereClause);
SqliteConnection conn;
var data = QueryData2(query, out conn);
return new DataReaderConnection {DataReader = data, Connection = conn};
}
示例14: 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;
}
示例15: 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;
}