@@ -1080,7 +1080,10 @@ def poll(trans_id):
10801080 rows_affected = conn .rows_affected ()
10811081
10821082 st , result = \
1083- conn .async_fetchmany_2darray (data_result_rows_per_page )
1083+ conn .async_fetchmany_2darray (data_result_rows_per_page + 1
1084+ if trans_obj .server_cursor
1085+ else data_result_rows_per_page
1086+ )
10841087
10851088 # There may be additional messages even if result is present
10861089 # eg: Function can provide result as well as RAISE messages
@@ -1200,13 +1203,24 @@ def poll(trans_id):
12001203 data_obj ['db_id' ] = trans_obj .did \
12011204 if trans_obj is not None and hasattr (trans_obj , 'did' ) else 0
12021205
1206+
12031207 page_size = rows_fetched_to - rows_fetched_from + 1
1208+
1209+ # Check the next recordset/page is available or not for the server cursor
1210+ next_page = 0
1211+ if (trans_obj .server_cursor and len (result ) > 0 and len (result )
1212+ > data_result_rows_per_page ):
1213+ result = result [0 :len (result ) - 1 ]
1214+ next_page = 1
1215+ rows_fetched_to = rows_fetched_to - 1
1216+
12041217 pagination = {
12051218 'page_size' : page_size ,
12061219 'page_count' : math .ceil (conn .total_rows / page_size ),
12071220 'page_no' : math .floor ((rows_fetched_from - 1 ) / page_size ) + 1 ,
12081221 'rows_from' : rows_fetched_from ,
1209- 'rows_to' : rows_fetched_to
1222+ 'rows_to' : rows_fetched_to ,
1223+ 'next_page' : next_page
12101224 }
12111225
12121226 return make_json_response (
@@ -1275,7 +1289,7 @@ def fetch_window(trans_id, from_rownum=0, to_rownum=0):
12751289
12761290 page_size = to_rownum - from_rownum + 1
12771291
1278- # Check whether the next recordset/page is available or not
1292+ # Check the next recordset/page is available or not for the server cursor
12791293 next_page = 0
12801294 if trans_obj .server_cursor and len (result ) > 0 and len (result ) > page_size :
12811295 result = result [0 :len (result ) - 1 ]
0 commit comments