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
Post a Comment