Title: Support detection of CRUD operations and queries for JDBC · Issue #112 · codellm-devkit/codeanalyzer-java · GitHub
Open Graph Title: Support detection of CRUD operations and queries for JDBC · Issue #112 · codellm-devkit/codeanalyzer-java
X Title: Support detection of CRUD operations and queries for JDBC · Issue #112 · codellm-devkit/codeanalyzer-java
Description: Parent: #100 Is your feature request related to a problem? Please describe Yes, for issue #100, support JDBC database operations. Describe the solution you'd like The generated analysis.json must be able to capture JDBC including operati...
Open Graph Description: Parent: #100 Is your feature request related to a problem? Please describe Yes, for issue #100, support JDBC database operations. Describe the solution you'd like The generated analysis.json must b...
X Description: Parent: #100 Is your feature request related to a problem? Please describe Yes, for issue #100, support JDBC database operations. Describe the solution you'd like The generated analysis.json mu...
Opengraph URL: https://github.com/codellm-devkit/codeanalyzer-java/issues/112
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support detection of CRUD operations and queries for JDBC","articleBody":"# Parent: #100 \n\n### Is your feature request related to a problem? Please describe\n\nYes, for issue #100, support JDBC database operations.\n\n### Describe the solution you'd like\n\nThe generated `analysis.json` must be able to capture JDBC including operations using `Connection`, `Statement`, `PreparedStatement`, and `ResultSet`.\n\n#### 1. If the callsite ReceiverType is **`Statement`**, **`PreparedStatement`**, and **`CallableStatement`**\nWe want to look for the following methods:\n\n**Class** | **Method** | **Description** | **CRUD Operation**\n-- | -- | -- | --\n**`Statement`** | `addBatch(String sql)` | Adds an SQL command to batch. | ANY (C/U/D)\n | `execute(String sql)` | Executes an SQL statement that may return multiple results. | ANY (C/R/U/D)\n | `executeBatch()` | Executes a batch of SQL commands. | ANY (C/U/D)\n | `executeLargeBatch()` | Executes a large batch of SQL commands. | ANY (C/U/D)\n | `executeLargeUpdate(String sql)` | Executes `INSERT`, `UPDATE`, `DELETE`, or DDL statements. | C/U/D\n | `executeQuery(String sql)` | Executes a `SELECT` query and returns a ResultSet. | READ\n | `executeUpdate(String sql)` | Executes `INSERT`, `UPDATE`, `DELETE`, or DDL statements. | C/U/D\n | `getResultSet()` | Retrieves the current ResultSet. | READ\n | `getGeneratedKeys()` | Retrieves auto-generated keys from an `INSERT` operation. | READ (post-C)\n | `getUpdateCount()` | Returns the number of rows affected by an `UPDATE`, `INSERT`, or `DELETE`. | READ (post-U/D)\n**`PreparedStatement`** | addBatch() | Adds the current parameters to the batch of commands. | ANY (C/U/D)\n | `execute()` | Executes any SQL statement. | ANY (C/R/U/D)\n | `executeLargeUpdate()` | Executes `INSERT`, `UPDATE`, `DELETE`, or DDL statements. | C/U/D\n | `executeQuery()` | Executes a `SELECT` query and returns a ResultSet. | READ\n | `executeUpdate()` | Executes `INSERT`, `UPDATE`, or `DELETE` statements. | C/U/D\n | `getMetaData()` | Retrieves metadata about the ResultSet. | READ\n | `getParameterMetaData()` | Retrieves metadata about parameters. | READ\n**`CallableStatement`** | execute() | Executes a stored procedure. | ANY (C/R/U/D)\n | `executeQuery()` | Executes a stored procedure that returns a ResultSet. | READ\n | `executeUpdate()` | Executes a stored procedure that performs `INSERT`, `UPDATE`, or `DELETE`. | C/U/D\n | `getXxx(int parameterIndex)` | Retrieves output parameters from the stored procedure (e.g., `getInt`, `getString`). | READ\n | `registerOutParameter(...)` | Registers output parameters for stored procedures. | Setup (not CRUD)\n | `setXxx(...)` | Sets parameters for the SQL command (e.g., setString, setInt). | Setup (not CRUD)\n\n#### 2. **`CONNECTION`** and **`TRANSACTIONAL`**\n\nClass | Method | Description | CRUD Operation | Transactional Operation\n-- | -- | -- | -- | --\nConnection | abort(Executor executor) | Terminates an open connection. | None | Abort\n | clearWarnings() | Clears all warnings for this Connection object. | None | None\n | close() | Closes the connection and releases JDBC resources. | None | End Connection\n | commit() | Commits the current transaction, making all changes permanent. | Commit (Post-C/U/D) | Commit\n | createArrayOf(String typeName, Object[] elements) | Creates an Array object. | CREATE | None\n | createBlob() | Creates a Blob object. | CREATE | None\n | createClob() | Creates a Clob object. | CREATE | None\n | createNClob() | Creates an NClob object. | CREATE | None\n | createSQLXML() | Creates an SQLXML object. | CREATE | None\n | createStatement() | Creates a Statement object for executing SQL. | None (Setup) | None\n | createStatement(int, int) | Creates a Statement with specified ResultSet type and concurrency. | None (Setup) | None\n | createStatement(int, int, int) | Creates a Statement with specified type, concurrency, and holdability. | None (Setup) | None\n | createStruct(String typeName, Object[] attributes) | Creates a Struct object. | CREATE | None\n | getAutoCommit() | Retrieves the current auto-commit mode. | None | Transaction Mode Inquiry\n | getCatalog() | Retrieves the current catalog name. | None | None\n | getClientInfo() | Retrieves client info properties. | None | None\n | getClientInfo(String name) | Retrieves a specific client info property. | None | None\n | getHoldability() | Retrieves the current ResultSet holdability. | None | None\n | getMetaData() | Retrieves database metadata. | READ | None\n | getNetworkTimeout() | Retrieves the network timeout setting. | None | None\n | getSchema() | Retrieves the current schema. | None | None\n | getTransactionIsolation() | Retrieves the transaction isolation level. | None | Transaction Mode Inquiry\n | getTypeMap() | Retrieves the type map for this connection. | None | None\n | getWarnings() | Retrieves the first warning reported on this Connection. | None | None\n | isClosed() | Checks if the connection is closed. | None | Connection Status Inquiry\n | isReadOnly() | Checks if the connection is in read-only mode. | None | Transaction Mode Inquiry\n | isValid(int timeout) | Checks if the connection is valid. | None | Connection Status Inquiry\n | nativeSQL(String sql) | Converts SQL to the system's native SQL grammar. | None | None\n | prepareCall(String sql) | Prepares a callable statement for stored procedures. | None (Setup) | None\n | prepareCall(String sql, int, int) | Prepares a callable statement with specified ResultSet type and concurrency. | None (Setup) | None\n | prepareCall(String sql, int, int, int) | Prepares a callable statement with specified type, concurrency, and holdability. | None (Setup) | None\n | prepareStatement(String sql) | Prepares a parameterized SQL statement. | None (Setup) | None\n | prepareStatement(String sql, int autoGeneratedKeys) | Prepares a statement capable of returning auto-generated keys. | None (Setup) | None\n | prepareStatement(String sql, int[] columnIndexes) | Prepares a statement capable of returning specified columns' auto-generated keys. | None (Setup) | None\n | prepareStatement(String sql, int, int) | Prepares a statement with specified ResultSet type and concurrency. | None (Setup) | None\n | prepareStatement(String sql, int, int, int) | Prepares a statement with specified type, concurrency, and holdability. | None (Setup) | None\n | prepareStatement(String sql, String[] columnNames) | Prepares a statement capable of returning specified columns' auto-generated keys. | None (Setup) | None\n | releaseSavepoint(Savepoint savepoint) | Releases a specified savepoint. | None | Savepoint Management\n | rollback() | Rolls back all changes made in the current transaction. | Rollback (Undo C/U/D) | Rollback\n | rollback(Savepoint savepoint) | Rolls back changes to the specified savepoint. | Rollback (Undo C/U/D) | Rollback (to Savepoint)\n | setAutoCommit(boolean autoCommit) | Sets the auto-commit mode. | None | Transaction Mode Setting\n | setCatalog(String catalog) | Sets the catalog name for the connection. | None | None\n | setClientInfo(Properties properties) | Sets client info properties. | None | None\n | setClientInfo(String name, String value) | Sets a specific client info property. | None | None\n | setHoldability(int holdability) | Sets the default holdability for ResultSet objects. | None | None\n | setNetworkTimeout(Executor executor, int ms) | Sets the maximum period to wait for a database response. | None | None\n | setReadOnly(boolean readOnly) | Puts the connection in read-only mode. | None | Transaction Mode Setting\n | setSavepoint() | Creates an unnamed savepoint in the current transaction. | None (Setup) | Savepoint Management\n | setSavepoint(String name) | Creates a named savepoint in the current transaction. | None (Setup) | Savepoint Management\n | setSchema(String schema) | Sets the current schema name. | None | None\n | setTransactionIsolation(int level) | Sets the transaction isolation level. | None | Transaction Mode Setting\n | setTypeMap(Map\u003cString, Class\u003c?\u003e\u003e map) | Sets the type map for custom mapping of SQL types to Java objects. | None | None\n\n#### 3. **`ResultSet`**\n\nClass | Method | Description | CRUD Operation | Transactional Operation\n-- | -- | -- | -- | --\nResultSet | next() | Moves the cursor forward one row from its current position. | READ | Cursor Movement\n | previous() | Moves the cursor to the previous row. | READ | Cursor Movement\n | first() | Moves the cursor to the first row. | READ | Cursor Movement\n | last() | Moves the cursor to the last row. | READ | Cursor Movement\n | absolute(int row) | Moves the cursor to the specified row number. | READ | Cursor Movement\n | relative(int rows) | Moves the cursor relative to its current position. | READ | Cursor Movement\n | beforeFirst() | Positions the cursor before the first row. | READ | Cursor Movement\n | afterLast() | Positions the cursor after the last row. | READ | Cursor Movement\n | getXxx(int columnIndex) | Retrieves the value of the specified column (e.g., getString, getInt). | READ | \n | getXxx(String columnLabel) | Retrieves the value of the specified column by name. | READ | \n | updateXxx(int columnIndex, value) | Updates the specified column in the current row with the given value. | UPDATE | \n | updateXxx(String columnLabel, value) | Updates the specified column by name in the current row with the given value. | UPDATE | \n | updateRow() | Updates the current row in the database. | UPDATE | \n | deleteRow() | Deletes the current row from the database. | DELETE | \n | insertRow() | Inserts the current row into the database. | CREATE | \n | moveToInsertRow() | Moves the cursor to the insert row for adding a new row. | CREATE | Cursor Movement (Insert Mode)\n | moveToCurrentRow() | Moves the cursor back to the current row from the insert row. | READ | Cursor Movement\n | cancelRowUpdates() | Cancels updates made to the current row. | | Rollback (Row Level)\n | refreshRow() | Refreshes the current row with the latest data from the database. | READ/UPDATE | \n | rowInserted() | Checks if the current row has been inserted. | READ | \n | rowUpdated() | Checks if the current row has been updated. | READ | \n | rowDeleted() | Checks if the current row has been deleted. | READ | \n | isBeforeFirst() | Checks if the cursor is before the first row. | READ | Cursor State Inquiry\n | isAfterLast() | Checks if the cursor is after the last row. | READ | Cursor State Inquiry\n | isFirst() | Checks if the cursor is on the first row. | READ | Cursor State Inquiry\n | isLast() | Checks if the cursor is on the last row. | READ | Cursor State Inquiry\n | getRow() | Retrieves the current row number. | READ | Cursor State Inquiry\n\n\n#### 4. **`CachedRowSet`, `FilteredRowSet`, `JdbcRowSet`, `JoinRowSet`, `RowSet`, `SyncResolver`, `WebRowSet`**\n\n| **Class** | **`Method`** | **Description** | **CRUD Operation** | **Transactional Operation** |\n|--------------------------|--------------------------------------------------|---------------------------------------------------------------------------------------------------------|-------------------------|---------------------------------|\n| **`RowSet`** | `execute()` | Populates the `RowSet` with data. | **READ** | |\n| **`CachedRowSet`** | `acceptChanges()` | Accepts changes made to the `RowSet` and commits them to the database. | **UPDATE/CREATE/DELETE** | **Commit (Row Level)** |\n| | `restoreOriginal()` | Reverts the `RowSet` to its original state before modifications. | **Rollback** | **Rollback (Row Level)** |\n| **`FilteredRowSet`** | `setFilter(Predicate predicate)` | Applies a filter to the rows in the `RowSet`. | **READ** | |\n| **`JoinRowSet`** | `addRowSet(RowSet rowset)` | Adds a `RowSet` to be joined. | **READ** | |\n| | `setJoinType(int joinType)` | Specifies the type of SQL join (e.g., `INNER JOIN`, `LEFT JOIN`). | **READ** | |\n| **`SyncResolver`** | `getConflictValue(int columnIndex)` | Retrieves the value causing a conflict during synchronization. | **READ** | **Conflict Resolution** |\n| | `setResolvedValue(int columnIndex, Object value)`| Resolves a conflict by setting a new value for the conflicting column. | **UPDATE** | **Conflict Resolution** |\n| **`WebRowSet`** | `writeXml(Writer writer)` | Writes the `WebRowSet` data to XML format. | **READ** | |\n| | `readXml(Reader reader)` | Reads XML data into the `WebRowSet`. | **READ** | |\n\n### Describe alternatives you've considered\n\nSame as #100 \n\n### Additional context\n\n- Use Daytrader8 to test. \n- Other contexts are the same as #100 \n- May need to create new Entity classes and Enums for Transactions as below:\n\n```java\n@Data\n@NoArgsConstructor\n@AllArgsConstructor\npublic class TransactionOperation {\n private int lineNumber = -1;\n private TransactionOperationType operationType;\n\n @NotImplemented\n private String savepointName;\n \n @NotImplemented\n private String transactionIsolationLevel;\n \n @NotImplemented\n private boolean autoCommitEnabled;\n}\n```\n```java\npackage com.ibm.cldk.javaee.utils.enums;\n\npublic enum TransactionOperationType {\n COMMIT,\n ROLLBACK,\n SAVEPOINT,\n SET_AUTOCOMMIT,\n SET_ISOLATION_LEVEL,\n ABORT,\n OTHER;\n}\n```\n\n### References\n\n- https://cs.au.dk/~amoeller/papers/strings/strings.pdf","author":{"url":"https://github.com/rahlk","@type":"Person","name":"rahlk"},"datePublished":"2025-02-09T19:53:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/112/codeanalyzer-java/issues/112"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:31922ad7-b136-93ff-67ba-2418bffbbcb3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B728:F4FE8:86CBD:B3EFB:698DF3B5 |
| html-safe-nonce | 30b4c2b246a5cd9083015386a0137d889e76b361e5469e99e1fe42c37ce31968 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzI4OkY0RkU4Ojg2Q0JEOkIzRUZCOjY5OERGM0I1IiwidmlzaXRvcl9pZCI6Ijg5MDA2NDM3NTUwMDgwNjIzODkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 60a035561f64e85f70eeb5186fdca46959435783fdabd03c1867ed0aca3f2b1a |
| hovercard-subject-tag | issue:2840918727 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/codellm-devkit/codeanalyzer-java/112/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8f99dbff60565f4faec7302d6575adad2532b26c39a0790c2d793c5a1b6473f2/codellm-devkit/codeanalyzer-java/issues/112 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8f99dbff60565f4faec7302d6575adad2532b26c39a0790c2d793c5a1b6473f2/codellm-devkit/codeanalyzer-java/issues/112 |
| og:image:alt | Parent: #100 Is your feature request related to a problem? Please describe Yes, for issue #100, support JDBC database operations. Describe the solution you'd like The generated analysis.json must b... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rahlk |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae22ef6ad27c5aeb770c5acd314c5724055bb23a663877aafdaaa50ed317ba34 |
| turbo-cache-control | no-preview |
| go-import | github.com/codellm-devkit/codeanalyzer-java git https://github.com/codellm-devkit/codeanalyzer-java.git |
| octolytics-dimension-user_id | 197800760 |
| octolytics-dimension-user_login | codellm-devkit |
| octolytics-dimension-repository_id | 731300153 |
| octolytics-dimension-repository_nwo | codellm-devkit/codeanalyzer-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 731300153 |
| octolytics-dimension-repository_network_root_nwo | codellm-devkit/codeanalyzer-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e545f5becd5b3ce9b429b68c3f994ad93c680ddb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width