sqlite: can't update boolean values

944 views
Skip to first unread message

Tim Galebach

unread,
Nov 15, 2013, 4:24:25 AM11/15/13
to clojure...@googlegroups.com
Here is the relevant code, this error happens whenever I try to update a boolean value in my database.

(sql/db-update (sql/get-database db/schema :write) :reviews {:failed false} {}) 

where :failed is defined in the schema as:
 :failed {:type Boolean, :sql-type "boolean"}

When I call it, I get the error:
java.lang.IllegalArgumentException: Empty values
 at android.database.sqlite.SQLiteDatabase.updateWithOnConflict (SQLiteDatabase.java:1531)
    android.database.sqlite.SQLiteDatabase.update (SQLiteDatabase.java:1514)

However, when I run the same command on any other type of field (Double, String, Integer, etc), the database updates with no issue. This is true for all boolean fields; I have tried renaming them and messing with the schema to see if it was just a bad definition.

Tim Galebach

unread,
Nov 15, 2013, 4:54:30 AM11/15/13
to clojure...@googlegroups.com
Also, this is running neko 3.0.0-preview4; this is the first issue I've had so far.

Alexander Yakushev

unread,
Nov 16, 2013, 4:45:00 PM11/16/13
to clojure...@googlegroups.com
Hi Tim,

That is a very stupid and unlucky error of mine. I'm checking if key-value pair is in the map using regular Clojure mechanic (if ... ). So when value is false, it doesn't add it to the UPDATE expression!

I already pushed final 3.0.0, so this fix will go to the next minor release. Meanwhile you can try the fix out in 3.0.1-SNAPSHOT.

Thanks for the help, Tim!

Best regards,

Tim Galebach

unread,
Nov 17, 2013, 5:45:47 AM11/17/13
to clojure...@googlegroups.com
Alex, when I try to compile 3.0.1-SNAPSHOT (and 3.0.0) I get the following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: neko/ui/adapters/InterchangeableListAdapter : Unsupported major.minor version 51.0, compiling:(adapters.clj:12:1)


3.0.0-preview4 compiles with no problems.

Alexander Yakushev

unread,
Nov 17, 2013, 5:47:30 AM11/17/13
to clojure...@googlegroups.com
Yeah, that's because Android migrates to JDK7, and Neko does as well. Please if possible update your JDK, and also download the latest Android SDK/Build tools v19.

Przemysław Wojnowski

unread,
Nov 17, 2013, 6:19:05 AM11/17/13
to clojure...@googlegroups.com
My guess is that you are on JDK 6 and try to use a library compiled with JDK 7, hence unsupported class version: 51.


2013/11/17 Tim Galebach <tim.ga...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "clojure-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-andro...@googlegroups.com.
To post to this group, send email to clojure...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojure-android.
For more options, visit https://groups.google.com/groups/opt_out.

Przemysław Wojnowski

unread,
Nov 17, 2013, 6:19:49 AM11/17/13
to clojure...@googlegroups.com
Sorry, I haven't seen Alex's answer. :-)


2013/11/17 Przemysław Wojnowski <cum...@gmail.com>

Tim Galebach

unread,
Nov 18, 2013, 10:05:23 AM11/18/13
to clojure...@googlegroups.com
Ok, I've now updated the JDK to 1.7, downloaded v19 of the build tools, and changed the project.clj to the format produced by the latest leindroid. I still get the following error when compiling the DEX though:


UNEXPECTED TOP-LEVEL ERROR:

java.lang.OutOfMemoryError: Java heap space

at com.android.dx.util.IntList.<init>(IntList.java:87)

at com.android.dx.rop.code.RopMethod.calcPredecessors(RopMethod.java:173)

Alexander Yakushev

unread,
Nov 18, 2013, 10:07:50 AM11/18/13
to clojure...@googlegroups.com
Can you uncomment :dex-opts ["-JXmx4096M"] line in project.clj?

Tim Galebach

unread,
Nov 18, 2013, 10:19:30 AM11/18/13
to clojure...@googlegroups.com
Thanks, works now!

Also now was just able to retest the db code, and boolean values are updating fine for me.

Let the list know when you add any features to the SQLite adapter; I would love to test them out. Especially would be interested if support gets added for Longs as opposed to just Integers. I think that SQLite supports them, but currently I have to use Integer as the declared type in the schemas, so it is hard for me to translate data structures from the server into my apps.

Alexander Yakushev

unread,
Nov 18, 2013, 10:43:00 AM11/18/13
to clojure...@googlegroups.com


On Monday, November 18, 2013 4:19:30 PM UTC+1, Tim Galebach wrote:
 
Let the list know when you add any features to the SQLite adapter; I would love to test them out. Especially would be interested if support gets added for Longs as opposed to just Integers. I think that SQLite supports them, but currently I have to use Integer as the declared type in the schemas, so it is hard for me to translate data structures from the server into my apps.


Good point. As Clojure's default for numbers is Long, it will be easier to save them into database than to transform into Integers first. I will do it some time soon.

Reply all
Reply to author
Forward
0 new messages