本文整理汇总了C#中QueryInfo类的典型用法代码示例。如果您正苦于以下问题:C# QueryInfo类的具体用法?C# QueryInfo怎么用?C# QueryInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryInfo类属于命名空间,在下文中一共展示了QueryInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteQuerySimple
/// <summary>
/// The execute query simple.
/// </summary>
/// <param name="query">The query.</param>
/// <param name="parameterValues">The parameter values.</param>
/// <param name="version">The version.</param>
/// <param name="progress">The progress.</param>
/// <param name="groups">The groups.</param>
/// <returns>
/// The <see cref="QueryInstanceResultInfo" />.
/// </returns>
public QueryInstanceResultInfo ExecuteQuerySimple(
QueryInfo query,
QueryExecutionParams parameters,
InstanceVersion version,
ProgressItem progress,
params GroupDefinition[] groups
)
{
// Log.InfoFormat("73:query:'{0}'",
// query
// );
QueryInstanceResultInfo result = new QueryInstanceResultInfo(this.Instance);
QueryItemInfo queryItem = query.Items.GetQueryItemForVersion(version);
this.PrepareProgress(progress, groups);
this.ExecuteQuery(
query,
parameters,
progress,
groups,
result,
queryItem
);
return result;
}
示例2: GetStatementTest
public void GetStatementTest()
{
var inf = new QueryInfo();
var input1 = "select * from A";
(inf.AsDynamic().GetStatement(input1) as string[]).IsStructuralEqual(new[] { "select * from A" });
var input2 = "select * from A;";
(inf.AsDynamic().GetStatement(input2) as string[]).IsStructuralEqual(new[] { "select * from A" });
var input3 = "select * from A; select * from B";
(inf.AsDynamic().GetStatement(input3) as string[]).IsStructuralEqual(new[] { "select * from A", "select * from B" });
var input4 = @"" + Environment.NewLine +
@" create trigger set_foo_primary for foo" + Environment.NewLine +
@"before insert" + Environment.NewLine +
@"" + Environment.NewLine +
@"as begin" + Environment.NewLine +
@"" + Environment.NewLine +
@"new.a = gen_id(gen_foo, 1);" + Environment.NewLine +
@"end" + Environment.NewLine +
@";" + Environment.NewLine +
@" select* from A;" + Environment.NewLine +
@" create table V(a integer, b nvarchar(5))";
(inf.AsDynamic().GetStatement(input4) as string[]).IsStructuralEqual(new[] {
@"create trigger set_foo_primary for foo" + Environment.NewLine +
@"before insert" + Environment.NewLine +
@"" + Environment.NewLine +
@"as begin" + Environment.NewLine +
@"" + Environment.NewLine +
@"new.a = gen_id(gen_foo, 1);" + Environment.NewLine +
@"end" ,
"select* from A", "create table V(a integer, b nvarchar(5))" });
}
示例3: Load
/// <summary>
/// Load the artist search.
/// </summary>
public override void Load(XmlDocument doc, QueryInfo query)
{
last_query = query;
foreach (Widget widget in album_box.Children)
album_box.Remove (widget);
XmlNodeList list = doc.GetElementsByTagName ("getArtistResponse");
if (list.Count == 0)
return;
string artist = null;
XmlNodeList albums_node = null;
//look for artist name
foreach (XmlNode node in list[0].ChildNodes)
{
if (node.Name == "artist")
{
artist = node.InnerText;
search_title.Markup = "<b><big><big>" + Utils.ParseMarkup (artist) + "</big></big></b>\n";
}
else if (node.Name == "albums")
albums_node = node.ChildNodes;
}
if (albums_node == null || albums_node.Count == 0)
return;
string name = null;
string year = null;
album_box.PackStart (new HSeparator (), false, false, 2);
foreach (XmlNode node in albums_node)
{
switch (node.Name)
{
case "album":
name = node.InnerText;
break;
case "year":
if (node.InnerText != "0")
year = node.InnerText;
break;
case "songs":
Album album = new Album (artist, name, year, node.ChildNodes);
album_box.PackStart (new AlbumBox (album, main), false ,false, 0);
album_box.PackStart (new HSeparator (), false, false, 2);
name = null;
year = null;
break;
}
}
}
示例4: GetModel
public static Word GetModel(QueryInfo queryInfo)
{
List<Word> list = GetList(queryInfo);
if (list == null || list.Count == 0)
return null;
else
return list[0];
}
示例5: GetModel
public static SmallClass GetModel(QueryInfo queryInfo)
{
List<SmallClass> list = GetList(queryInfo);
if (list == null || list.Count == 0)
return null;
else
return list[0];
}
示例6: GetModel
public static ItemInCustomSmallType GetModel(QueryInfo queryInfo)
{
List<ItemInCustomSmallType> list = GetList(queryInfo);
if (list == null || list.Count == 0)
return null;
else
return list[0];
}
示例7: GetQuery
/// <summary>
/// The query to execute.
/// </summary>
public override string GetQuery(QueryInfo query)
{
if (query.Equals (last_query, QueryField.Username))
return null;
string url = "http://ws.audioscrobbler.com/1.0/user/{0}/topartists.xml";
return ParseQuery (url, query.Username);
}
示例8: GetQuery
/// <summary>
/// The query to execute.
/// </summary>
public override string GetQuery(QueryInfo query)
{
if (query.Equals (last_query, QueryField.Artist, QueryField.Title))
return null;
string url = "http://lyricwiki.org/api.php?artist={0}&song={1}&fmt=xml";
return ParseQuery (url, query.Artist, query.Title);
}
示例9: GetQuery
/// <summary>
/// The query to execute.
/// </summary>
public override string GetQuery(QueryInfo query)
{
if (query.Equals (last_query, QueryField.Artist, QueryField.Album))
return null;
string url = "http://ws.audioscrobbler.com/1.0/album/{0}/{1}/info.xml";
return ParseQuery (url, query.Artist, query.Album);
}
示例10: GetQuery
/// <summary>
/// The query to execute.
/// </summary>
public override string GetQuery(QueryInfo query)
{
if (query.Equals (last_query, QueryField.Artist))
return null;
string url = "http://ws.audioscrobbler.com/1.0/artist/{0}/toptracks.xml";
return ParseQuery (url, query.Artist);
}
示例11: GetModel
public static CustomBigType GetModel(QueryInfo queryInfo)
{
List<CustomBigType> list = GetList(queryInfo);
if (list == null || list.Count == 0)
return null;
else
return list[0];
}
示例12: GetQueryForGroups
/// <inheritdoc />
protected override QueryItemInfo GetQueryForGroups(QueryInfo query, InstanceVersion version)
{
if (query.GroupSelect != null && query.GroupSelect.Count > 0)
{
return query.GroupSelect.GetQueryItemForVersion(version);
}
return query.DatabaseSelect.GetQueryItemForVersion(version);
}
示例13: GetGroups
/// <summary>
/// The get groups.
/// </summary>
/// <param name="query">
/// The query information.
/// </param>
/// <param name="parameterValues">
/// The parameter values.
/// </param>
/// <param name="version">
/// The version.
/// </param>
/// <returns>
/// The <see cref="Dictionary{TKey,TValue}"/>.
/// </returns>
public virtual ICollection<GroupDefinition> GetGroups(
QueryInfo query,
IEnumerable<ParameterValue> parameterValues,
InstanceVersion version
)
{
var groups = new List<GroupDefinition>();
// TODO: Create GroupDefinition with childrens
QueryItemInfo selectGroupsSql = this.GetQueryForGroups(query, version);
if (selectGroupsSql != null)
{
try
{
var paramsArray = parameterValues as ParameterValue[] ?? parameterValues.ToArray();
DataTable[] groupsTabels = this.ExecuteSqlFunction(
this.Instance,
selectGroupsSql,
null,
query.Parameters,
paramsArray,
null,
true
);
foreach (DataTable groupTable in groupsTabels)
{
this.AddGroupsFromTable(groupTable, groups);
}
if (selectGroupsSql.ChildGroups.IsNullOrEmpty())
{
return groups;
}
foreach (GroupDefinition groupDefinition in groups)
{
this.GetChildGroupsDefinitions(selectGroupsSql, groupDefinition, paramsArray, version);
}
}
catch (OperationCanceledException ex)
{
log.Error(ex);
throw;
}
catch (Exception ex)
{
log.Error("instance=" + this.Instance.Name + " query=" + query, ex);
}
}
return groups;
}
示例14: ExecuteQueryTest
public void ExecuteQueryTest()
{
SetupTestDbFb2();
var inf = new QueryInfo();
inf.ExecuteQuery(GetFb2ConnectionString(), "select * from test").ToList()[0].View.Rows.Count.Is(0);
var result = inf.ExecuteQuery(GetFb2ConnectionString(), "insert into test(int_test, char_test) values (1, 'aaaaaaaaaa');update test set varchar_test = 'testtesttesttest' where int_test = 1;select * from test").ToList();
result[0].View.Rows[0].Is(x => ((string)x[0]).Contains("実行しました。"));
result[1].View.Rows[0].Is(x => ((string)x[0]).Contains("更新しました。"));
result[2].View.Rows.Count.Is(1);
}
示例15: ExecuteQueryTestFb3
public void ExecuteQueryTestFb3()
{
SetupTestDbFb3();
var inf = new QueryInfo();
var conStr = GetFb3ConnectionString();
inf.ExecuteQuery(conStr, "select * from test").ToList()[0].View.Rows.Count.Is(0);
var result = inf.ExecuteQuery(conStr, "insert into test values (1, 123456789000, null, '12asd', '2016-07-24', 50000, 2.5, 2.5555, 4500, 10, '10:00:00', current_timestamp, 'asdfghjk', true);update test set varchar_test = 'testtesttesttest' where int_test = 1;select * from test").ToList();
result[0].View.Rows[0].Is(x => ((string)x[0]).Contains("実行しました。"));
result[1].View.Rows[0].Is(x => ((string)x[0]).Contains("更新しました。"));
result[2].View.Rows.Count.Is(1);
}