How should I check if resultset is empty or null using datastax cassandra driver for java -



How should I check if resultset is empty or null using datastax cassandra driver for java -

how should check empty resultset using datastax java cassandra driver?

suppose i'm executing next query "select * my_table mykey=something"

there great chance query not matched. next code not work:

if (rs != null) rs.one().getstring("some_column");

you pretty close, right solution is:

row r = rs.one(); if (r != null) r.getstring("some_column");

the driver homecoming result set, whether or not there returned results. documentation one() states if no rows returned rs.one() returns null.

you can utilize getavailablewithoutfetching() returns number of rows in result set without fetching more rows. since pagesize has >= 1, can assured if there @ to the lowest degree 1 row homecoming value greater 0.

java cassandra datastax

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -