how can move to previous JdbcResultSet. Now, for count (recordcount), i count one by one the records: Do While Cursor.NextRow Cuenta = Cuenta+ 1 loop but, then i need show the first record to user, and next, and next, an previous ( Move into recordset). how? If this is...
www.b4x.com
I think move into records from Sql server and this is not posible (view previous link).
My new idea is to clone JDBCResultSet to ResulSet or other object in memory.
1) If you look at the jRDC2 source, the ExecuteQuery2 method of the RDCHanlder class takes the result of an ExecQuery type call and places it in a list of arrays. Each list entry is a record and the array elements are the columns. It has some other code in there to store column names, but than can be stripped out if not needed. You would not even have to keep track of record count, since the number of records would be the size of the list generated.
RDC is a middleware server that makes it simple to safely connect clients and remote SQL database servers. jRDC2 is the latest version. All new projects should use this version. jRDC2 is made of two components: - B4J server. The server receives the requests from the clients, issues the SQL...
www.b4x.com
2) You could do the above, but instead of storing the information in a list, you could store it in an in-memory SQLite database. Then you would have the ability to query the information to your hearts content. Since the data is locally in memory, re-querying the information will be fast (no trip to the server required). In memory SQLite is used by B4XTable.
3) If it is a lot of data, store in SQLite locally (not in-memory). Should still be faster than fetching all the data over the network again and again.
4) If all it is (as you mentioned in the previous post) that you need a record count of fetched values, then why not just
B4X:
Cursor = modSQLServer.SQLGetRecordSet("Select count(matricula) from vehiculos")
before doing
B4X:
Cursor2 = modSQLServer.SQLGetRecordSet("Select matricula from vehiculos")
?
Unless there are a lot of changes to the underlying data between the two calls, this may work just as well. The extra call to the server should be negligible to the server.
5) Actually, for calls that do not have grouping clauses, you can just add an extra column that contains the count of the records returned. Who cares that each record has the same number
B4X:
Cursor = modSQLServer.SQLGetRecordSet("Select count(*), matricula from vehiculos")
or
B4X:
Cursor = modSQLServer.SQLGetRecordSet("Select count(matricula), matricula from vehiculos")
how can move to previous JdbcResultSet. Now, for count (recordcount), i count one by one the records: Do While Cursor.NextRow Cuenta = Cuenta+ 1 loop but, then i need show the first record to user, and next, and next, an previous ( Move into recordset). how? If this is...
www.b4x.com
In SQL SERVER is NOT posible do COUNT and get fields in same sql. And this sql command are executed by Sql Server Service in Server machine. But i did not know do this in other sql system.