on 08-14-2014 8:24 PM
Hi there,
I'm trying to get the query row count from the rs array of the following xsjs code:
var conn = $.db.getConnection();
var pstmt = conn.prepareStatement( "select * from DUMMY" );
var rs = pstmt.executeQuery();
Is there a property or method to call and get the row count? Something like rs.length or rs.size.
Thanks a lot!
Alejandro Fonseca.
Hi,
I don't think there is a property or method to get the row count. You can find the API here.
JSDoc: Class: ResultSetMetaData
Best regards,
Wenjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well in my case here,s what I did
I used a select statement
var ID=1;// set to 1 because in needed to use it for the next ID , this is not safe but just for fun
var conn = $.db.getConnection();
conn.prepareStatement("SET SCHEMA \"SYSTEM\"").execute();
//get ID
var pstmt = conn.prepareStatement(
"select * from \"SYSTEM\".\"MYTABLE\""
);
var rs = pstmt.executeQuery();
if(!rs.next())
{
body = "Failed Reteiving attribute view";
$.response.addBody(body);
}
else{
while (rs.next())
{
ID++;
}
}
.......
So you the ID value you can print out by attaching to a body tag or however you deem fit
the above code was done on a Severside .xsjs file
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.