private PreparedStatement prepareBatchStatement(String sql)
    {
        String sqlCmd = sql.substring(0, 7);

        if (sqlCmd.equals("UPDATE ") || sqlCmd.equals("DELETE ") || (_useBatchInserts && sqlCmd.equals("INSERT ")))
        {
            PreparedStatement stmt = (PreparedStatement) _statements.get(sql);
            if (stmt == null)
            {
                // [olegnitz] for JDK 1.2 we need to list both PreparedStatement and Statement
                // interfaces, otherwise proxy.jar works incorrectly
                stmt = (PreparedStatement) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{
                        PreparedStatement.class, Statement.class, BatchPreparedStatement.class},
                        new PreparedStatementInvocationHandler(this, sql, m_jcd));
                _statements.put(sql, stmt);
            }
            return stmt;
        }
        else
        {
            return null;
        }
    }
private PreparedStatement prepareBatchStatement ( String sql ) { String sqlCmd = sql . substring ( 0 , 7 ) ; if ( sqlCmd . equals ( "UPDATE " ) || sqlCmd . equals ( "DELETE " ) || ( _useBatchInserts && sqlCmd . equals ( "INSERT " ) ) ) { PreparedStatement stmt = ( PreparedStatement ) _statements . get ( sql ) ; if ( stmt == null ) { stmt = ( PreparedStatement ) Proxy . newProxyInstance ( getClass ( ) . getClassLoader ( ) , new Class [ ] { PreparedStatement . class , Statement . class , BatchPreparedStatement . class } , new PreparedStatementInvocationHandler ( this , sql , m_jcd ) ) ; _statements . put ( sql , stmt ) ; } return stmt ; } else { return null ; } }
If UPDATE, INSERT or DELETE, return BatchPreparedStatement,
otherwise return null.