This document was generated from CDN thread
Created by: null on 01-03-2007 08:50:02 PM
Was just wondering if someone could share a simple code snipped w/ me on how to access the session variable that holds the ResultSetList from a 'multily' type database element.
I have imported com.audium.server.action.database.* into my java project. I tried something like this...
ResultSetList rs = new ResultSetList();
but it didn't like that. I'm trying to define a var as ResultSetList and then as the session variable to my new variable. I'm not sure if this principal is correct or not. I'm new w/ java, so forgive me if this is something that should be super easy.
Thanx,
ryan.
Subject: RE: ResultSetList Question
Replied by: null on 02-03-2007 05:01:45 PM
Hi Ryan,
You would typically not create a new instance of ResultSetList yourself, it is automatically created by the Database element to store the result of a multiple-row SQL query. If you want to store your own information in a data structure, I would suggest creating your own class.
Here is how you would use ResultSetList with the Database element:
1) In the Database element, you have to chose the type as "multiple". This will make another setting named "Session Data Key" in which you put a session data name, lets say it is "myDatabaseResults". This session data variable created by the Database element will contain a ResultSetList object.
2) In another element that appears afterwards in the callflow, you access that session data value and cast it to a ResultSetList object by doing:
ResultSetList myResult = (ResultSetList) api.getSessionData("myDatabaseResults");
3) You can now access the methods of ResultSetList from the myResult object normally.
Hope that helps!