1

Is there a particular way to identify whether two result sets are equal?

problem is that I can't access two result set at the same time. So it's better for me to create a hashvalue for resultset1 and store it and get the later resultset2 and create hashvalue2 and check whther they are equal.

I tried to serialize the resultset objects and get a hashvalue of that object. But that didn't work since ResultSet objects can't be serialized. (I tried using java)

Aruna Karunarathna
  • 981
  • 2
  • 23
  • 55
  • 3
    you should use ResultSetCompare class.see this article http://incubator.apache.org/jena/documentation/javadoc/arq/com/hp/hpl/jena/sparql/resultset/ResultSetCompare.html – Zaz Gmy Apr 18 '12 at 04:55
  • 1
    [Comparing result sets ][1] Please check this link, it might help your cause. [1]: http://stackoverflow.com/questions/6582093/comparing-resultsets-in-jdbc – chandan.khatri Apr 18 '12 at 04:58
  • @ZazGmy thanks for the answers guys. I have a little problem here since I can't directly access two resultsets at the same time.It's better if I can create a hashvalue1 for a ResultSet1 and then later execute the query2 to get the ResultSet2 and generate the hashvalue2 see whether the two hash values are equal. (I edited the question) – Aruna Karunarathna Apr 18 '12 at 05:05

1 Answers1

1

You'll need to store one or both of the hash values in a variable or table: for example, you could find the first value and store it in a global variable, then pull that value into the end of the code to find the 2nd value and then compare the two. If you store them in a table with a datetime stamp, you can track when changes are made over time.

Russell Fox
  • 5,273
  • 1
  • 24
  • 28
  • Yes that's the problem I'm having. But I need a fast mechanism to create a hash value. Since if the resultset is large in size, the time to create a hashvalue may take very long. There is a built in function called DBMS_SQLHASH to do this but unfortunately I'm using MySQL database in my application. – Aruna Karunarathna Apr 18 '12 at 06:19