db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rijk van Haaften" <r.j.c.vanhaaf...@gmail.com>
Subject Re: PlatformImplBase.store() proposal
Date Thu, 21 Feb 2008 07:36:38 GMT
> Look at the fetch method implementation, it does similar things and
>  you can probably use it as a blueprint for the exists one.
I did and think the implementation should be:
Statement statement = null;
ResultSet resultSet = null;
boolean exists = false;
try
{
    statement = connection.createStatement();
    resultSet = statement.executeQuery(sql.toString());
    exists = resultSet.next();
    resultSet.close();
}
catch (SQLException ex)
{
    throw new DatabaseOperationException("Error while reading from the
database", ex);
}
finally
{
    closeStatement(statement);
}
return exists;

As I have no commit rights (and as far as I know, you are currently
the only committer), committing is up to you.

Mime
View raw message