• <bdo id='oJKvO'></bdo><ul id='oJKvO'></ul>

  • <small id='oJKvO'></small><noframes id='oJKvO'>

  • <tfoot id='oJKvO'></tfoot>
      1. <legend id='oJKvO'><style id='oJKvO'><dir id='oJKvO'><q id='oJKvO'></q></dir></style></legend>
        <i id='oJKvO'><tr id='oJKvO'><dt id='oJKvO'><q id='oJKvO'><span id='oJKvO'><b id='oJKvO'><form id='oJKvO'><ins id='oJKvO'></ins><ul id='oJKvO'></ul><sub id='oJKvO'></sub></form><legend id='oJKvO'></legend><bdo id='oJKvO'><pre id='oJKvO'><center id='oJKvO'></center></pre></bdo></b><th id='oJKvO'></th></span></q></dt></tr></i><div id='oJKvO'><tfoot id='oJKvO'></tfoot><dl id='oJKvO'><fieldset id='oJKvO'></fieldset></dl></div>

        Adobe Air:为什么 SQLStatement 的 getResult().data 为空?

        时间:2023-08-21
          <bdo id='g1Gze'></bdo><ul id='g1Gze'></ul>

            <legend id='g1Gze'><style id='g1Gze'><dir id='g1Gze'><q id='g1Gze'></q></dir></style></legend>
              <tfoot id='g1Gze'></tfoot>

              1. <i id='g1Gze'><tr id='g1Gze'><dt id='g1Gze'><q id='g1Gze'><span id='g1Gze'><b id='g1Gze'><form id='g1Gze'><ins id='g1Gze'></ins><ul id='g1Gze'></ul><sub id='g1Gze'></sub></form><legend id='g1Gze'></legend><bdo id='g1Gze'><pre id='g1Gze'><center id='g1Gze'></center></pre></bdo></b><th id='g1Gze'></th></span></q></dt></tr></i><div id='g1Gze'><tfoot id='g1Gze'></tfoot><dl id='g1Gze'><fieldset id='g1Gze'></fieldset></dl></div>
                  <tbody id='g1Gze'></tbody>
              2. <small id='g1Gze'></small><noframes id='g1Gze'>

                • 本文介绍了Adobe Air:为什么 SQLStatement 的 getResult().data 为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  使用 Flash Builder 4.6,我关注 http://www.flex-blog.com/adobe-air-sqlite-example (链接好像坏了) 举个例子,还有一部分代码这不起作用:

                  Using Flash Builder 4.6, I am following http://www.flex-blog.com/adobe-air-sqlite-example (edit: link seems to be broken) as an example, and there is one part of codes that does not work:

                  private function resault(e:SQLEvent):void
                  {
                      // with sqls.getResault().data we get the array of objects for each row out of our database
                      var data:Array = sqls.getResult().data;
                      // we pass the array of objects to our data provider to fill the datagrid
                      dp = new ArrayCollection(data);
                  }
                  

                  在运行时检查程序告诉我 sqls.getResult() 返回一个有效的 SQLResult 对象,但它的数据为空.

                  Checking the program during runtime gives me that sqls.getResult() returns a valid SQLResult object, but its data is null.

                  从我之前的问题 Adobe Air:将 sqlite 的结果 [object Object] 转换为 String?,看来我是问错了问题.

                  And from my previous question Adobe Air: convert sqlite's result [object Object] to String?, it seems I am asking the wrong question.

                  尽管如此,我已经用

                  trace(ObjectUtil.toString(sqls.getResult()));
                  

                  并且我可以看到我从 sqlite 获得了我的所有内容:

                  and I can see that I got all of my content from sqlite:

                  (flash.data::SQLResult)#0
                    complete = true
                    data = (Array)#1
                      [0] (Object)#2
                        first_name = "AAA"
                        id = 1
                        last_name = "BBB"
                      [1] (Object)#3
                        first_name = "AAA"
                        id = 2
                        last_name = "BBB"
                      [2] (Object)#4
                        first_name = "qqq"
                        id = 3
                        last_name = "qqq"
                    lastInsertRowID = 0
                    rowsAffected = 0
                  

                  那么这里发生了什么?我真的必须创建自己的函数来解析我的所有 sqlite 元素,然后自己将它们放入数据提供程序中吗?是的,我可以做到这一点,但说真的,许多教程都显示使用:

                  So what's going on here? Do I really have to create my own function to parse all of my sqlite elements and then place them in the data provider myself? Yes, I can do that, but seriously, many tutorials have shown using:

                  var data:Array = sqls.getResult().data;
                  dp = new ArrayCollection(data);
                  

                  现在,回到问题:sqls.getResult().data 变为空的可能原因是什么?

                  Now, back on the question: What might be the possible causes of sqls.getResult().data becoming null?

                  推荐答案

                  这看起来不像是一个很好的教程(在我看来).在该代码中,您有一个用于所有正在执行的语句的事件侦听器.它甚至只有一个执行不同查询的 SQLStatement.我不知道你的代码到底出了什么问题,但我很确定原因可以在那里找到.(甚至不要让我开始使用 Timer 在语句仍在执行时用作延迟.糟糕!).我强烈建议您寻找更好的资源来学习 Flex/AIR/SQLite.

                  That doesn't look like a very good tutorial you're following there (in my opinion). In that code, you have one event listener for all the statements that are being executed. It even has just one SQLStatement that executes different queries. I don't know exactly what is going wrong with your code, but I'm fairly certain the cause is to be found there. (And don't even get me started about that Timer used as a delay when a statement is still executing. Yuck!). I strongly suggest you look for a better source for learning Flex/AIR/SQLite.

                  您应该简单地创建一个新的 SQLStatement,或者至少为每个 Statement 执行创建离散的事件处理程序.一个更好的方法是使用 Responder 类,像这样:

                  You should simply create a new SQLStatement, or at least discrete event handlers for each Statement execution. A better way to do this, would be to use the Responder class, like this:

                  var stmt:SQLStatement = new SQLStatement();
                  stmt.sqlConnection = connection;
                  stmt.text = query;
                  
                  var token:Responder = new Responder(onResult, onFail);
                  stmt.execute(-1, token);
                  

                  不过可以共享 SQLConnection,如果您不介意始终保持与数据库的连接.

                  The SQLConnection can be shared though, if you don't mind keeping the connection to your database open all the time.

                  这篇关于Adobe Air:为什么 SQLStatement 的 getResult().data 为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:SQLite 和 Flex 下一篇:如何集成 Oracle 和 Kafka

                  相关文章

                  最新文章

                  1. <tfoot id='7PV2M'></tfoot>

                    <small id='7PV2M'></small><noframes id='7PV2M'>

                    <i id='7PV2M'><tr id='7PV2M'><dt id='7PV2M'><q id='7PV2M'><span id='7PV2M'><b id='7PV2M'><form id='7PV2M'><ins id='7PV2M'></ins><ul id='7PV2M'></ul><sub id='7PV2M'></sub></form><legend id='7PV2M'></legend><bdo id='7PV2M'><pre id='7PV2M'><center id='7PV2M'></center></pre></bdo></b><th id='7PV2M'></th></span></q></dt></tr></i><div id='7PV2M'><tfoot id='7PV2M'></tfoot><dl id='7PV2M'><fieldset id='7PV2M'></fieldset></dl></div>
                    <legend id='7PV2M'><style id='7PV2M'><dir id='7PV2M'><q id='7PV2M'></q></dir></style></legend>

                      • <bdo id='7PV2M'></bdo><ul id='7PV2M'></ul>