cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sonney <ke...@webslingerZ.com>
Subject Re: SQL taglib
Date Tue, 11 Apr 2000 18:12:41 GMT
On Tue, 11 Apr 2000, you wrote:
> yes, you're right. perhaps the top-level element should be execute-update
> to indicate that this should happen? or should we set an element child
> instead?

That's one option - another I thought of (while in the shower this morning)
was to do something like this :

Statement st = conn.getStatement();
boolean theResult = st.execute(queryString);
if (theResult) {
	ResultSet rs = st.getResultSet();
	//add code to turn resultset into XML here
} else {
	int returnval = st.getUpdateCount();
	//add code to return a meaningful result here in XML, 
	//or return a "nothing happened" message on null
}

Admiddedly, this is JDBC 2.0 (I'll have to re-track my brain to think in JDBC
1.x ) but it should work, shouldn't it?

Of course, my original idea was to parse the query string, and if the first
word was "SELECT" treat it as a query, and run everything else as an update.
But that would be bad in situations where a stored procedure was named
"GET_DATA_ON_USERS" or somesuch. *grin*

-- 
- Kevin Sonney
  kevin@webslingerZ.com

Mime
View raw message