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

    1. <legend id='Zrfjw'><style id='Zrfjw'><dir id='Zrfjw'><q id='Zrfjw'></q></dir></style></legend>
      1. <small id='Zrfjw'></small><noframes id='Zrfjw'>

        Adobe Air:将 sqlite 的结果 [object Object] 转换为 Stri

        时间:2023-08-21
        • <tfoot id='VetvO'></tfoot>

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

            1. <small id='VetvO'></small><noframes id='VetvO'>

                  本文介绍了Adobe Air:将 sqlite 的结果 [object Object] 转换为 String?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我目前正在尝试从 sqlite 检索文本.我看到请求的数据量确实正确,但另一方面,内容的格式似乎不正确.我试过一些转换:

                  I am currently trying to do retrieve text from sqlite. I see that the amount of data requested do come correctly, but content, on the other hand, seems to be in an incorrect format. I've tried some conversion:

                  var data:Array = sqls.getResult().data;
                  
                  var stData:String = String(data[0]);
                  
                  Alert.show(stData); // <--- displays "[object Object]"
                  

                  字符串转换似乎不是我想要的.我只想要来自 sqlite 数据库的文本.在这种情况下,如何将 [object Object] 转换为正确的字符串?

                  String conversion does not seem to do what I want. I simply want the text from the sqlite database. How can I convert the [object Object] to the correct string in this case?

                  推荐答案

                  无论返回什么行(with(out))指定列,除非定义了 SQLStatement 的 itemClass 属性,否则它将始终返回一个匿名对象.这基本上就是远程处理与 AMF 一起工作的方式.

                  Irrespective of what rows are returned (with(out)) specifying columns, unless the itemClass property of the SQLStatement is defined, it will always return an anonymous object. This is essentially how remoting works with AMF.

                  您可以做两件事(取决于项目的复杂程度):

                  There are two things you can do (depending on the complexity of your project):

                  1. 指定一个 SQLStatement.itemClass - 这将定义 &使用与列名称相同的公共访问器(var 或 get/set)填充返回结果.
                  2. 如果保留匿名 - 列名称将附加到您在其中迭代对象的对象,就像定义对象一样.

                  超级基础示例:

                  Super basic example:

                  //SQL table schema
                  CREATE TABLE accounts (
                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                    num INTEGER NOT NULL,
                    name TEXT NOT NULL,
                    last_update DATE
                  );
                  
                  //Define an Account class:
                  public class Account {
                      public var id:int;
                      public var num:int;
                      public var name:String;
                      public var last_update:Date;
                  }
                  
                  //A statement to execute to get all accounts returned as an array of "Account"
                  var statement:SQLStatement = new SQLStatement();
                      statement.sqlConnection = myConn;
                      statement.itemClass = Account;
                      statement.text = 'SELECT * FROM accounts';
                      statement.addEventListener(SQLEvent.RESULT, onResults);
                      statement.execute();
                  
                   protected function onResults(event:SQLEvent):void
                   {
                        var statement:SQLStatement = SQLStatement(event.currentTarget);
                        var results:SQLResult = statement.getResult();
                        for each (var account:Account in results)
                        {
                            //do something useful like populate a model, grid, etc...
                        }
                   }
                  
                  
                   //Anonymous objects would iterate much the same way -when an item class isn't defined
                   protected function onResults(event:SQLEvent):void
                   {
                        var statement:SQLStatement = SQLStatement(event.currentTarget);
                        var results:SQLResult = statement.getResult();
                        for each (var account:Object in results)
                        {
                            //our 'Object' will have properties: id, num, name, last_update
                            //do something useful like populate a model, grid, etc...
                        }
                   }
                  

                  这篇关于Adobe Air:将 sqlite 的结果 [object Object] 转换为 String?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:sqlite &amp;flex - 如果不存在则插入? 下一篇:SQLite 和 Flex

                  相关文章

                  最新文章

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

                  <small id='gkrBK'></small><noframes id='gkrBK'>

                  <legend id='gkrBK'><style id='gkrBK'><dir id='gkrBK'><q id='gkrBK'></q></dir></style></legend>
                1. <tfoot id='gkrBK'></tfoot>

                      <bdo id='gkrBK'></bdo><ul id='gkrBK'></ul>