Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get row count in groovy sql

Tags:

groovy

Am new to groovy. Want to know how to get the number of rows from a given sql result returned form an sql query below. I have googled lot but didn't find the proper solution.

Here is my sql query class code

def sql = Sql.newInstance(dataSource);

    try
    {
        data = sql.rows("select field_value,form_table_column_name from 
               form_tbl where form_id=1");
        sql_one.close()

    } catch(Exception e) {

       System.out.println(e)      
    }
like image 915
jason Avatar asked Mar 27 '14 10:03

jason


1 Answers

To get the count or size of the records returned used data.size().

like image 127
Joshua Moore Avatar answered Oct 10 '22 02:10

Joshua Moore