comparison src/main/java/org/monetdb/jdbc/MonetConnection.java @ 692:2233b172e06d

Add checks for sql String parameter to prevent NullPointerException or executing an empty sql String.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 17 Nov 2022 19:16:48 +0100 (2022-11-17)
parents f7946d36d1dd
children 07d60185eeb9
comparison
equal deleted inserted replaced
691:fb55e62c50f3 692:2233b172e06d
768 @Override 768 @Override
769 public CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) 769 public CallableStatement prepareCall(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability)
770 throws SQLException 770 throws SQLException
771 { 771 {
772 checkNotClosed(); 772 checkNotClosed();
773
774 if (sql == null || sql.isEmpty())
775 throw new SQLException("Missing SQL statement", "M1M05");
776
773 try { 777 try {
774 final CallableStatement ret = new MonetCallableStatement( 778 final CallableStatement ret = new MonetCallableStatement(
775 this, 779 this,
776 resultSetType, 780 resultSetType,
777 resultSetConcurrency, 781 resultSetConcurrency,
873 @Override 877 @Override
874 public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability) 878 public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability)
875 throws SQLException 879 throws SQLException
876 { 880 {
877 checkNotClosed(); 881 checkNotClosed();
882
883 if (sql == null || sql.isEmpty())
884 throw new SQLException("Missing SQL statement", "M1M05");
885
878 try { 886 try {
879 final PreparedStatement ret = new MonetPreparedStatement( 887 final PreparedStatement ret = new MonetPreparedStatement(
880 this, 888 this,
881 resultSetType, 889 resultSetType,
882 resultSetConcurrency, 890 resultSetConcurrency,