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

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

      <bdo id='JLOuP'></bdo><ul id='JLOuP'></ul>
    <tfoot id='JLOuP'></tfoot>

      1. android.database.sqlite.SQLiteDatabase.rawQuery() 没有使用 SQLit

        android.database.sqlite.SQLiteDatabase.rawQuery() is not updating a DATETIME column with a SQLite datetime() function(android.database.sqlite.SQLiteDatabase.rawQuery() 没有使用 SQLite datetime() 函数更新 DATETIME 列) - IT屋-程序员软件开发技
        <tfoot id='MIHhY'></tfoot>

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

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

                <tbody id='MIHhY'></tbody>
                <bdo id='MIHhY'></bdo><ul id='MIHhY'></ul>

                1. 本文介绍了android.database.sqlite.SQLiteDatabase.rawQuery() 没有使用 SQLite datetime() 函数更新 DATETIME 列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  public Cursor set_datetime_next(Reminder r) {       
                      String _newVal = "datetime('now', '+7 days')";
                      String[] args = { new Integer(r.getID()).toString() };
                      String query =
                          "UPDATE " + DBConst.TABLE
                        + " SET "   + DBConst.f_DATETIME_NEXT + "=" + _newVal
                        + " WHERE " + DBConst.f_ID +"=?";
                      Log.i(TAG, query);
                      return db.rawQuery(query, args);
                  }
                  

                  我也尝试过将 datetime('now', '+7 days') 作为绑定参数传递,这不起作用,因为 Android 文档 说:

                  I have also tried passing in datetime('now', '+7 days') as a bound parameter, that will not work, as the Android documentation says:

                  这些值将被绑定为字符串.

                  The values will be bound as Strings.

                  参考资料:

                  • http://developer.android.com/reference/android/数据库/sqlite/SQLiteDatabase.html
                  • http://www.sqlite.org/lang_datefunc.html

                  推荐答案

                  光标没有关闭.

                  public void set_datetime_next(Reminder r, String _newVal) {     
                      String[] args = { new Integer(r.getID()).toString() };
                      String query =
                          "UPDATE " + DBConst.TABLE
                        + " SET "   + DBConst.f_DATETIME_NEXT + "=" + _newVal
                        + " WHERE " + DBConst.f_ID +"=?";
                      Log.i(TAG, query);
                      Cursor cu = db.rawQuery(query, args);
                      cu.moveToFirst();
                      cu.close();     
                  }
                  

                  虽然这是有道理的,但真正让我感到困惑的是调用 moveToFirst() (或以某种方式使用"光标的其他函数)的要求.
                  如果没有同时调用 moveToFirst()close(),则该行永远不会更新.close() 本身,在 rawQuery() 之后,什么也没做.

                  While that makes sense, what really puzzles me is the requirement of calling moveToFirst() (or some other function which would "work with" the cursor in some way).
                  Without the call to both moveToFirst() and close(), the row was never updated. close() by itself, after the rawQuery(), did nothing.

                  这篇关于android.database.sqlite.SQLiteDatabase.rawQuery() 没有使用 SQLite datetime() 函数更新 DATETIME 列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Cannot solve SonarQube error quot;Make this line start at column 3quot;(无法解决 SonarQube 错误“使此行从第 3 列开始)
                  SonarQube for multi module project for Android(适用于 Android 的多模块项目的 SonarQube)
                  How to integrate sonarqube in android studio?(如何在 android studio 中集成 sonarqube?)
                  Android What is the easist way Upgrade Database for existing DB(Android 为现有数据库升级数据库的简单方法是什么)
                  Updating SQLite database android(更新 SQLite 数据库 android)
                  Android: onUpgrade not calling at database upgrade(Android:onUpgrade 不在数据库升级时调用)

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

                  <tfoot id='eu2tD'></tfoot>

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