On 27/01/2015 10:45pm, Andrus Adamchik wrote:
> List<Object> is a confusing data structure. When iterating through it you 
> will need to do instanceof/cast on every entry, and more importantly, you 
> will need to know upfront what are the valid entries in there. 
> 
> With List<QueryResult> you don't do instanceof/cast, and also if say tomorrow 
> we add/change something in the entry format/type, we simply alter QueryResult 
> API, making the change visible to the user. 

OK, so let's examine your example:

List<QueryResult> result = SQLExec
     .query("INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME) VALUES (#bind($id), 
#bind($name))")
     .paramsArray(55, "a3")
     .execute(context);

Let's say I want to get the number of rows added. I do this:

count = result.get(0).getBatchUpdateResult()[0]; or
count = result.get(0).getUpdateResult();

except that I didn't run an "UPDATE", I ran an "INSERT". But perhaps that can 
be solved with enough javadocs to explain the naming...


Now, for a result set:

List<QueryResult> result = SQLExec.query("CALL 
getContacts_proc()").execute(context);

List<Contact> contact = (List<Contact>) result.get(0).getSelectResult();



Am I missing the point here?


Ari



-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Reply via email to