Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

How to deal with timestamp object in Select statement ? #24

Open
mohitbaskota opened this issue Dec 18, 2014 · 2 comments
Open

How to deal with timestamp object in Select statement ? #24

mohitbaskota opened this issue Dec 18, 2014 · 2 comments

Comments

@mohitbaskota
Copy link

I am trying to execute a select statement and the result is successful if there is no timestamp object in the result.

But if there's a timestamp in the result it cannot be added into the JSON object my the module and exception arises. Any suggestions how to use timestamp object in select statement ?

@timyates
Copy link
Owner

Does any of this help?

#7

You may be able to modify your timestamp to a string in the select?

@mohitbaskota
Copy link
Author

Thanks for the response.

I saw you casted timestamp to string in select itself like this :
SELECT id, TO_CHAR( time, 'YYYY-MM-DD HH24:MI:SS' ) AS TIME FROM test ORDER BY ID ASC"

But what if I want to use select * ??
When I use select * the following error arises. So basically when the module tries to cast the result from driver it cannot add timestamp to Json object

Caught error with SELECT: Cannot have objects of class class java.sql.Timestamp in JSON
org.vertx.java.core.VertxException: Cannot have objects of class class java.sql.Timestamp in JSON
at org.vertx.java.core.json.JsonElement.convertMap(JsonElement.java:60)
at org.vertx.java.core.json.JsonObject.(JsonObject.java:56)
at org.vertx.java.core.json.JsonObject.(JsonObject.java:45)
at com.bloidonia.vertx.mods.JsonUtils.listOfMapsToJsonArray(JsonUtils.java:61)
at com.bloidonia.vertx.mods.JdbcProcessor$4.process(JdbcProcessor.java:278)
at com.bloidonia.vertx.mods.JdbcProcessor$BatchHandler.handle(JdbcProcessor.java:595)
at com.bloidonia.vertx.mods.JdbcProcessor.doSelect(JdbcProcessor.java:263)
at com.bloidonia.vertx.mods.JdbcProcessor.doSelect(JdbcProcessor.java:252)
at com.bloidonia.vertx.mods.JdbcProcessor.handle(JdbcProcessor.java:204)
at com.bloidonia.vertx.mods.JdbcProcessor.handle(JdbcProcessor.java:47)
at org.vertx.java.core.eventbus.impl.DefaultEventBus$11.run(DefaultEventBus.java:951)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants