title: Android room custom update @Query with String array crash with "sqlite syntax ? error"
body: <p>So I have a problem with UPDATE query inside @Query that tries to update a column that holds String[]. </p>
  
  <p>Converters:</p>
  
  <pre><code>@TypeConverter
  public static String[] fromString(String value) {
      Type listType = new TypeToken&lt;String[]&gt;() {
      }.getType();
      return new Gson().fromJson(value, listType);
  }
  
  @TypeConverter
  public static String fromArrayList(String[] list) {
      //Type listType = new TypeToken&lt;String[]&gt;() {
      //}.getType();
      Gson gson = new Gson();
      String json = gson.toJson(list);
      return json;
  }
  </code></pre>
  
  <p>Dao:</p>
  
  <pre><code>@Dao
  public interface CharacterDao {
  
      @Insert(onConflict = OnConflictStrategy.IGNORE)
      long[] insertCharacters(Character... characters);
  
      @Query("UPDATE characters SET name = :name, episodes = :episodes, createdDate = :createdDate " +
              "WHERE character_id = :character_id")
      void updateCharacter(String character_id, String name, String[] episodes, String createdDate);
  }
  </code></pre>
  
  <p>So to explain it deeper what im doing now is trying to do in my Repository.class is to <code>update</code> user when <code>insert</code> returns -1 (so there was a conflict). Also I added @TypeConverters for whole database, altought I tried to adding it to dao and entities etc. but it doesnt solve the issue. </p>
  
  <p>So the problem appears when calling characterDao.updateCharacter with proper arguments. When I remove the episodes array from both method call and @query it works perfectly, so the String[] is the problem here.</p>
  
  <p><strong>However, when I use @Update instead of custom @Query it works just fine. But it still bothers me and there is no answer for that anywhere.</strong></p>
  
  <p>FYI inserting works fine. The problem is only with updating</p>
  
  <p>The error I get is "syntax ? error"</p>
  
  <p>trace:</p>
  
  <pre><code>  --------- beginning of crash
  2019-05-15 14:29:23.556 20853-21022/pl.com.bubka.characs E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
      Process: pl.com.bubka.characs, PID: 20853
      android.database.sqlite.SQLiteException: near "?": syntax error (Sqlite code 1 SQLITE_ERROR): , while compiling: UPDATE characters SET name = ?, episodes = ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, createdDate = ? WHERE character_id = ?, (OS error - 0:Success)
          at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
          at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:948)
          at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:559)
          at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:603)
          at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:63)
          at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31)
          at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1166)
          at androidx.sqlite.db.framework.FrameworkSQLiteDatabase.compileStatement(FrameworkSQLiteDatabase.java:64)
          at androidx.room.RoomDatabase.compileStatement(RoomDatabase.java:249)
          at pl.com.bubka.characs.database.CharacterDao_Impl.updateCharacter(CharacterDao_Impl.java:465)
          at pl.com.bubka.characs.repositories.CharactersRepository$1.saveCallResult(CharactersRepository.java:50)
          at pl.com.bubka.characs.repositories.CharactersRepository$1.saveCallResult(CharactersRepository.java:39)
          at pl.com.bubka.characs.utils.NetworkBoundResources$3$1.run(NetworkBoundResources.java:69)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
          at java.lang.Thread.run(Thread.java:784)
  </code></pre>