You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Mark Hortman <ma...@jcafeinc.com> on 2001/06/21 19:10:38 UTC

JDBCDescriptorStore efficiency

I was just wondering if it would make sense to change JDBCDescriptorsStore
to make it 
much more efficient, by changing where the prepared statements are being
created and closed, here
is an example....

from createObject:

            // Inserting children
            Enumeration children = object.enumerateChildren();
            while (children.hasMoreElements()) {
                statement = connection.prepareStatement
                    ("insert into children values(?,?)");
                statement.setString(1, uri.toString());
                statement.setString(2, (String) children.nextElement());
                statement.execute();
                closeStatement(statement);
            }

Change to 
            // Inserting children
		statement = null;
            Enumeration children = object.enumerateChildren();
            while (children.hasMoreElements()) {
		    if (statement == null){
                     statement = connection.prepareStatement
                        ("insert into children values(?,?)");
                }
                statement.setString(1, uri.toString());
                statement.setString(2, (String) children.nextElement());
                statement.execute();
            }
            closeStatement(statement);

I have done this for the while file and posted it on our website at:
http://www.jcafeinc.com/jdbcdescriptorsstore.java

I can't test it, because I am not set up to, but if someone could, this
could dramatically improve
the speed of these methods.


Re: JDBCDescriptorStore efficiency

Posted by Remy Maucherat <re...@betaversion.org>.
Quoting Mark Hortman <ma...@jcafeinc.com>:

> I was just wondering if it would make sense to change
> JDBCDescriptorsStore
> to make it 
> much more efficient, by changing where the prepared statements are
> being
> created and closed, here
> is an example....

Yes, very good patch. I'm committing it :)

Thanks,
Remy