【问题标题】:SQLite and Windows Metro, Correct Query not returning dataSQLite 和 Windows Metro,正确查询不返回数据
【发布时间】:2012-09-25 00:11:08
【问题描述】:

我遇到了一个奇怪的问题,

我在 Windows 8 应用程序上使用 SQLite,一切正常...除了一个查询。

我对 4 个不同的查询使用相同的方法(它们都返回相同的列),映射是正确的,因为其中至少有一个在工作。

问题是...查询没有返回结果,如果我复制我的 sql 语句并手动将其运行到 sqlite 中,它可以工作并返回 14 行...

我的sql语句是: “从 word_sense 中选择 w1.word_sense,w2.word 作为 w1,word_sense 作为 w2,其中 w1.equiv_word = 'A' and w1.ID = w2.ID and w1.word_sense != w2.word_sense and w2.usage & 66294!= 0 and w2.usage &3072= 0 order by w1.word_sense, w2.word"

执行查询的代码行是:

列出同义词 = 等待 DBHelper.Instance.QueryAsync(sql);

映射是:

public class WordSynonymMapping
{
    [SQLite.Column("word_sense")]
    public int WordSense { get; set; }

    [SQLite.Column("word")]
    public string Word { get; set; }
}

我找不到解决办法...

这是一个实际有效的语句的副本......

"select w1.word_sense, e.example as word from word_senses w1 ,examples e where w1.equiv_word = 'A' and w1.usage & 0 = 0 and e.word_sense = w1.word_sense order by w1.word_sense,例如”

谁能帮我解决这个问题?我被卡住了,不知道如何继续。

谢谢!

【问题讨论】:

  • 作为附加信息...我刚刚发现其他一些无法正常工作的查询...我认为问题与时间有关...失败的查询需要 2 秒(2和一半)在 SQLClient 上执行......这可能是问题吗?
  • 我想我创建了解决方案...我在一些表上添加了一些索引,现在一些查询开始工作...

标签: c# sqlite microsoft-metro windows-store


【解决方案1】:

仅针对遇到相同问题的其他人...我的数据库缺少一些索引,显然没有这些索引,查询最多需要 2 秒...而 SQLite 在花费这么多时间时返回空。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多