IP Library Granted Patent US 8,276,117
Granted Patent B2
US 8,276,117 · App. 11/833,665 · Granted Sep 25, 2012

Displaying and refactoring programs that include database statements

Assignee: International Business Machines Corporation
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,276,117
App. No.
11/833,665
Granted
Sep 25, 2012
Kind
B2
Abstract

Embodiments of the invention provide techniques for displaying and refactoring of programs, including database statements. In one embodiment, database statements embedded in the program source are evaluated to identify statements of the source code affected by, or affecting, the changed element of the database. An indication of the statements of source code affected by or affecting the changed element of the database may be presented to a user.

Claims (78)

1. A computer-implemented method for refactoring source code of an application in response to changes to a database accessed by the application, comprising:

detecting, by operation of one or more processors, a change to an element of the database;

identifying one or more database statements embedded in the source code of the application;

examining each of the one or more database statements embedded in the source code of the application using a mapping data structure to at least one of: identify statements of the source code affected by the changed element of the database, and identify statements of the source code affecting the changed element of the database, wherein the mapping data structure is configured to store relationships between elements of the database, the one or more database statements and the statements of the source code; and

presenting an indication of the identified statements of the source code.

2. The method of claim 1 , wherein the element of the database comprises one of a table, a column, and an index of the database.

3. The method of claim 1 , wherein presenting an indication of the identified statements of the source code comprises displaying the identified statements in a graphical interface provided by an integrated development environment (IDE) tool.

4. The method of claim 1 , further comprising:

determining a proposed refactoring for at least one of the identified statements of the source code; and

displaying the proposed refactoring.

5. The method of claim 4 , wherein the proposed refactoring is determined according to one or more predefined refactoring rules.

6. The method of claim 1 , further comprising:

receiving a selection of a first statement of the source code;

determining at least one of: one or more elements of the database affected by the selected first statement, and one or more elements of the database affecting the selected first statement; and

presenting an indication of the determined one or more elements of the database.

7. The method of claim 6 , wherein the first statement of the source code specifies an opening of a database resource, and wherein the method further comprises:

determining, for each execution path through the source code, whether a second statement of the source code specifies exactly one closing of the database resource; and

upon determining that a second statement of the source code does not specify exactly one closing of the database resource for each execution path through the source code, presenting an indication that the database resource is not properly closed in the source code.

8. The method of claim 1 , further comprising:

identifying one or more source code statements, each opening a database resource;

for each of the one or more source code statements, determining a status indicating whether:

(i) the database resource is not closed,

(ii) the database resource is closed more than once in an execution path through the source code,

or

(iii) the database resource is not closed in each execution path through the source code; and

notifying a user of the determined status for each of the one or more source code statements.

9. A computer-readable storage medium containing a program, which, when executed performs an operation for refactoring source code of an application in response to changes to a database accessed by the application, the operation comprising:

detecting a change to an element of the database;

identifying one or more database statements embedded in the source code of the application;

evaluating each of the one or more database statements embedded in the source code of the application using a mapping data structure to at least one of: identify statements of the source code affected by the changed element of the database and identify statements of the source code affecting the changed element of the database, wherein the mapping data structure is configured to store relationships between elements of the database, the one or more database statements and the statements of the source code; and

presenting an indication of the identified statements of the source code.

10. The computer-readable storage medium of claim 9 , wherein the element of the database comprises one of a table, a column, and an index of the database.

11. The computer-readable storage medium of claim 9 , wherein presenting an indication of the identified statements of the source code comprises displaying the identified statements in a graphical interface provided by an integrated development environment (IDE) tool.

12. The computer-readable storage medium of claim 9 , wherein the operation further comprises:

determining a proposed refactoring for at least one of the identified statements of the source code; and

displaying the proposed refactoring.

13. The computer-readable storage medium of claim 12 , wherein the proposed refactoring is determined according to one or more predefined refactoring rules.

14. The computer-readable storage medium of claim 9 , wherein the operation further comprises:

receiving a selection of a first statement of the source code;

determining at least one of: one or more elements of the database affected by the selected first statement, and one or more elements of the database affecting the selected first statement; and

presenting an indication of the determined one or more elements of the database.

15. The computer-readable storage medium of claim 14 , wherein the first statement of the source code specifies an opening of a database resource, and wherein the operation further comprises:

determining, for each execution path through the source code, whether a second statement of the source code specifies exactly one closing of the database resource; and

upon determining that a second statement of the source code does not specify exactly one closing of the database resource for each execution path through the source code, presenting an indication that the database resource is not properly closed in the source code.

16. The computer-readable storage medium of claim 9 , wherein the operation further comprises:

identifying one or more source code statements, each opening a database resource;

for each of the one or more source code statements, determining a status indicating whether:

(i) the database resource is not closed,

(ii) the database resource is closed more than once in an execution path through the source code, or

(iii) the database resource is not closed in each execution path through the source code; and

notifying a user of the determined status for each of the one or more source code statements.

17. A system, comprising:

a processor; and

a memory containing a program, which when executed on the processor, is configured to perform an operation for refactoring source code of an application in response to changes to a database accessed by the application, by performing steps of:

detecting a change to an element of the database;

identifying one or more database statements embedded in the source code of the application;

evaluating each of the one or more database statements embedded in the source code of the application using a mapping data structure to at least one of: identify statements of the source code affected by the changed element of the database, and identify statements of the source code affecting the changed element of the database, wherein the mapping data structure is configured to store relationships between elements of the database, the one or more database statements and the statements of the source code; and

presenting an indication of the identified statements of the source code.

18. The system of claim 17 , wherein the element of the database comprises one of a table, a column, and an index of the database.

19. The system of claim 17 , wherein presenting an indication of the identified statements of the source code comprises displaying the identified statements in a graphical interface provided by an integrated development environment (IDE) tool.

20. The system of claim 17 , wherein the steps further comprise:

determining a proposed refactoring for at least one of the identified statements of the source code; and

displaying the proposed refactoring.

21. The system of claim 20 , wherein the proposed refactoring is determined according to one or more predefined refactoring rules.

22. The system of claim 17 , wherein the steps further comprise:

receiving a selection of a first statement of the source code;

determining at least one of: one or more elements of the database affected by the selected first statement, and one or more elements of the database affecting the selected first statement; and

presenting an indication of the determined one or more elements of the database.

23. The system of claim 22 , wherein the first statement of the source code specifies an opening of a database resource, and wherein the steps further comprise:

determining, for each execution path through the source code, whether a second statement of the source code specifies exactly one closing of the database resource; and

upon determining that a second statement of the source code does not specify exactly one closing of the database resource for each execution path through the source code, presenting an indication that the database resource is not properly closed in the source code.

24. The system of claim 17 , wherein the steps further comprise:

identifying one or more source code statements, each opening a database resource;

for each of the one or more source code statements, determining a status indicating whether:

(i) the database resource is not closed,

(ii) the database resource is closed more than once in an execution path through the source code, or

(iii) the database resource is not closed in each execution path through the source code; and

notifying a user of the determined status for each of the one or more source code statements.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 15, 2007
From: AHADIAN, AZADEH; BRODSKY, STEPHEN ANDREW; BURKE, MICHAEL GEORGE; NIN, REBECCA B.; PESHANSKY, IGOR; RAGHAVACHARI, MUKUND; SURANGE, SONALI
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 019963/0984 →
Continuity (1)
Related Publication 20090037873A1 · Feb 5, 2009