Re: IDS Feature Request List (including potential new requests).
Posted in 2006
Topics: Java & JDBC Development
I thought of another feature that I would like.
Named server side prepared statements. Basically the ability to
prepare SQL and attach it to a name that could be used by application
servers.
You could do it two ways. (the following is very quickly cobbled
together java like pseudo code and or SQL.):
1) add the capability to SQL:
CREATE NAMED PREPARED STATEMENT fetch_employee(employee_id) as select *
from employee where employee_id = ? ;
You could even assign priveledges to it.
then in the application you would have something like:
pStatement = getPreparedNamedStatement("fetch_employee");
for loop executing pStatement or save it in a hash table for later use.
pStatement.assignParameter(1,1000) ; //First paremeter its value is
1000.
pStatement.execute() ;
for pStatement.getResulSet();
Or you could have no change to SQL but a change to the API. It would
create named statements on the server side with some way to check if
they exist.
PreparedStatement pStatement = null ;
if (hmCurrentUsedNamedStatement.exists("fetch_employee")) { // Is the
prepared statement in my local hashmap of statements I've already
prepared or used
pStatement = hmCurrentStatements("fetch_employee");
else { // Check server to see if it exists up there.
try {
pStatement = connection.getNamedPreparedStatement("fetch_employee");
} catch(NamedPreparedStatementDoesNotExists) {
pStatement = connection.CreateNamedPreparedStatement(...);
}
You might also need to have away of updating the statistics for a
prepared statement:
update statistics for named prepared statement <statement name or blankfor all>;
The first way the statements would exist between restarts of the server
the second way the statements would only exist as long as the server
was on line. The application would recreate them as needed. I could see
benefits for doing it both ways and downsides to both ways. What do you
think?
bozon said: > > I thought of another feature that I would like. > > Named server side prepared statements. Basically the ability to > prepare SQL and attach it to a name that could be used by application > servers. Why? -- Bye now, Obnoxio "C'est pas parce qu'on n'a rien ' dire qu'il faut fermer sa gueule" - Coluche did i mention i like nulls? heck, i even go so far as to say that all columns in a table except the primary key could/should be nullable. this has certain advantages, for example, if you need to insert a child record and you don't have a parent row for it, just do an insert into the parent table with the primary key value (everything else null), and voila, relational integrity is preserved. but this is, admittedly, a bit controversial among modellers. --r937, dbforums.com