Skip to content

Commit d2e601f

Browse files
committed
Add CallableStatement support with IN parameters
Implement DatabricksCallableStatement extending DatabricksPreparedStatement to support stored procedure invocation via Connection.prepareCall(). - IN parameters work via inherited setXXX(int, value) methods - {call proc(?)} JDBC escape syntax converted to CALL proc(?) - OUT/INOUT params throw SQLFeatureNotSupportedException - Named parameters throw SQLFeatureNotSupportedException - {? = call ...} return-value syntax rejected at construction time - Wire up all 3 prepareCall() overloads in DatabricksConnection Signed-off-by: Gopal Lal <[email protected]> Co-authored-by: Isaac Signed-off-by: Gopal Lal <[email protected]>
1 parent 4119dff commit d2e601f

6 files changed

Lines changed: 1139 additions & 66 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [Unreleased]
44

55
### Added
6+
- Added `CallableStatement` support with IN parameters. `Connection.prepareCall()` now returns a working `DatabricksCallableStatement` that supports positional parameter binding and execution via `{call proc(?)}` JDBC escape syntax. OUT/INOUT parameters and named parameters throw `SQLFeatureNotSupportedException`.
67

78
### Updated
89

docs/JDBC_METHOD_INVENTORY.md

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -184,62 +184,34 @@
184184

185185
## 3. java.sql.CallableStatement
186186

187-
**Implementation:** NOT IMPLEMENTED
187+
**Implementation:** `DatabricksCallableStatement.java` — partial support (IN parameters only)
188188

189-
| Method Signature | Implemented | Exception Type | Deprecated? | Usage Category | Notes |
190-
|-----------------|-------------|----------------|-------------|----------------|-------|
191-
| `registerOutParameter(int, int)` | NO | - | No | COMMON | Stored procedures not implemented |
192-
| `registerOutParameter(int, int, int)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
193-
| `wasNull()` | NO | - | No | COMMON | Stored procedures not implemented |
194-
| `getString(int)` | NO | - | No | COMMON | Stored procedures not implemented |
195-
| `getBoolean(int)` | NO | - | No | COMMON | Stored procedures not implemented |
196-
| `getByte(int)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
197-
| `getShort(int)` | NO | - | No | COMMON | Stored procedures not implemented |
198-
| `getInt(int)` | NO | - | No | COMMON | Stored procedures not implemented |
199-
| `getLong(int)` | NO | - | No | COMMON | Stored procedures not implemented |
200-
| `getFloat(int)` | NO | - | No | COMMON | Stored procedures not implemented |
201-
| `getDouble(int)` | NO | - | No | COMMON | Stored procedures not implemented |
202-
| `getBigDecimal(int, int)` | NO | - | Yes | DEPRECATED | Stored procedures not implemented |
203-
| `getBytes(int)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
204-
| `getDate(int)` | NO | - | No | COMMON | Stored procedures not implemented |
205-
| `getTime(int)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
206-
| `getTimestamp(int)` | NO | - | No | COMMON | Stored procedures not implemented |
207-
| `getObject(int)` | NO | - | No | COMMON | Stored procedures not implemented |
208-
| `getBigDecimal(int)` | NO | - | No | COMMON | Stored procedures not implemented |
209-
| `getObject(int, Map)` | NO | - | No | RARE | Stored procedures not implemented |
210-
| `getRef(int)` | NO | - | No | RARE | Stored procedures not implemented |
211-
| `getBlob(int)` | NO | - | No | RARE | Stored procedures not implemented |
212-
| `getClob(int)` | NO | - | No | RARE | Stored procedures not implemented |
213-
| `getArray(int)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
214-
| `getDate(int, Calendar)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
215-
| `getTime(int, Calendar)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
216-
| `getTimestamp(int, Calendar)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
217-
| `registerOutParameter(int, int, String)` | NO | - | No | RARE | Stored procedures not implemented |
218-
| `registerOutParameter(String, int)` | NO | - | No | COMMON | Stored procedures not implemented |
219-
| `registerOutParameter(String, int, int)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
220-
| `registerOutParameter(String, int, String)` | NO | - | No | RARE | Stored procedures not implemented |
221-
| `getURL(int)` | NO | - | No | RARE | Stored procedures not implemented |
222-
| `setURL(String, URL)` | NO | - | No | RARE | Stored procedures not implemented |
223-
| `setNull(String, int)` | NO | - | No | COMMON | Stored procedures not implemented |
224-
| `setBoolean(String, boolean)` | NO | - | No | COMMON | Stored procedures not implemented |
225-
| `setByte(String, byte)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
226-
| `setShort(String, short)` | NO | - | No | COMMON | Stored procedures not implemented |
227-
| `setInt(String, int)` | NO | - | No | COMMON | Stored procedures not implemented |
228-
| `setLong(String, long)` | NO | - | No | COMMON | Stored procedures not implemented |
229-
| `setFloat(String, float)` | NO | - | No | COMMON | Stored procedures not implemented |
230-
| `setDouble(String, double)` | NO | - | No | COMMON | Stored procedures not implemented |
231-
| `setBigDecimal(String, BigDecimal)` | NO | - | No | COMMON | Stored procedures not implemented |
232-
| `setString(String, String)` | NO | - | No | COMMON | Stored procedures not implemented |
233-
| `setBytes(String, byte[])` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
234-
| `setDate(String, Date)` | NO | - | No | COMMON | Stored procedures not implemented |
235-
| `setTime(String, Time)` | NO | - | No | OCCASIONAL | Stored procedures not implemented |
236-
| `setTimestamp(String, Timestamp)` | NO | - | No | COMMON | Stored procedures not implemented |
237-
| ... (50+ more methods) | NO | - | No | VARIOUS | All CallableStatement methods not implemented |
189+
`DatabricksCallableStatement` extends `DatabricksPreparedStatement` and implements `CallableStatement`.
190+
All IN parameter binding (`setXXX(int, value)`) and execution methods are inherited from `PreparedStatement`.
191+
OUT/INOUT parameters, named parameters, and return-value syntax (`{? = call ...}`) throw `SQLFeatureNotSupportedException`.
192+
193+
| Method Signature | Implemented | Exception Type | Notes |
194+
|-----------------|-------------|----------------|-------|
195+
| *All `setXXX(int, value)` methods* | YES (inherited) | - | Inherited from DatabricksPreparedStatement |
196+
| *`executeQuery()`, `executeUpdate()`, `execute()`* | YES (inherited) | - | Inherited from DatabricksPreparedStatement |
197+
| *`addBatch()`, `executeBatch()`* | YES (inherited) | - | Inherited from DatabricksPreparedStatement |
198+
| *`clearParameters()`, `getParameterMetaData()`* | YES (inherited) | - | Inherited from DatabricksPreparedStatement |
199+
| `registerOutParameter(int, int)` | THROWS | `SQLFeatureNotSupportedException` | OUT params not supported |
200+
| `registerOutParameter(int, int, int)` | THROWS | `SQLFeatureNotSupportedException` | OUT params not supported |
201+
| `registerOutParameter(int, int, String)` | THROWS | `SQLFeatureNotSupportedException` | OUT params not supported |
202+
| `registerOutParameter(String, int)` | THROWS | `SQLFeatureNotSupportedException` | OUT params not supported |
203+
| `registerOutParameter(String, int, int)` | THROWS | `SQLFeatureNotSupportedException` | OUT params not supported |
204+
| `registerOutParameter(String, int, String)` | THROWS | `SQLFeatureNotSupportedException` | OUT params not supported |
205+
| `wasNull()` | THROWS | `SQLFeatureNotSupportedException` | OUT params not supported |
206+
| *All `getXXX(int)` methods (~30)* | THROWS | `SQLFeatureNotSupportedException` | OUT param retrieval not supported |
207+
| *All `getXXX(String)` methods (~30)* | THROWS | `SQLFeatureNotSupportedException` | OUT param retrieval not supported |
208+
| *All `setXXX(String, value)` methods (~35)* | THROWS | `SQLFeatureNotSupportedException` | Named parameters not supported |
238209

239210
**Summary for CallableStatement:**
240211
- **Total Methods:** 100+ (approx)
241-
- **Fully Implemented:** 0
242-
- **Note:** Driver throws `DatabricksSQLFeatureNotImplementedException` in `Connection.prepareCall()` - "Callable statements are not implemented in OSS JDBC"
212+
- **Fully Implemented (inherited):** ~45 (all setXXX by index, execute, batch, lifecycle)
213+
- **Throws SQLFeatureNotSupportedException:** ~100 (registerOutParameter, getXXX, named setXXX)
214+
- **Note:** `Connection.prepareCall()` creates `DatabricksCallableStatement`. `{call proc(?)}` escape syntax is converted to `CALL proc(?)`. `{? = call ...}` return-value syntax is rejected at construction time.
243215

244216
---
245217

0 commit comments

Comments
 (0)