JP6866270B2 - SQL statement extraction device, SQL statement extraction method and program - Google Patents

SQL statement extraction device, SQL statement extraction method and program Download PDF

Info

Publication number
JP6866270B2
JP6866270B2 JP2017201233A JP2017201233A JP6866270B2 JP 6866270 B2 JP6866270 B2 JP 6866270B2 JP 2017201233 A JP2017201233 A JP 2017201233A JP 2017201233 A JP2017201233 A JP 2017201233A JP 6866270 B2 JP6866270 B2 JP 6866270B2
Authority
JP
Japan
Prior art keywords
dao
sql statement
sql
sqlid
source code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2017201233A
Other languages
Japanese (ja)
Other versions
JP2019074966A (en
Inventor
玄太 是木
玄太 是木
前岡 淳
淳 前岡
秀行 鹿糠
秀行 鹿糠
仁 芳ケ迫
仁 芳ケ迫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Systems Ltd
Original Assignee
Hitachi Systems Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Systems Ltd filed Critical Hitachi Systems Ltd
Priority to JP2017201233A priority Critical patent/JP6866270B2/en
Publication of JP2019074966A publication Critical patent/JP2019074966A/en
Application granted granted Critical
Publication of JP6866270B2 publication Critical patent/JP6866270B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Description

本発明は、ソースコードを静的に解析し、DAO(Data Access Object)メソッドに対応するSQL文を抽出する技術に関する。 The present invention relates to a technique for statically analyzing a source code and extracting an SQL statement corresponding to a DAO (Data Access Object) method.

3層アーキテクチャのWebアプリケーションでは、プログラムの動作不良や脆弱性等の原因箇所の特定を、静的解析で行う事が困難である。中でも、データアクセスを伴うプログラムでは、SQL文がプログラムの実行によって動的に構成される事があるため、DAOメソッドに対応するSQL文について静的解析を行う事は難しい。 In a Web application with a three-layer architecture, it is difficult to identify the cause of a program malfunction or vulnerability by static analysis. Above all, in a program involving data access, since the SQL statement may be dynamically configured by executing the program, it is difficult to perform static analysis on the SQL statement corresponding to the DAO method.

特許文献1には、ソースコードを静的に解析(APフロー解析とSQLフロー解析)して、SQL文を構成する変数が取り得る値の集合を生成する技術が開示され、APフローに対応するSQL文を挙げる方法が提案されている。 Patent Document 1 discloses a technique for statically analyzing a source code (AP flow analysis and SQL flow analysis) to generate a set of possible values of variables constituting an SQL statement, and corresponds to the AP flow. A method of listing SQL statements has been proposed.

特開2011−253363号公報Japanese Unexamined Patent Publication No. 2011-253363

しかしながら、上記特許文献1の方法は、静的解析の精度の問題により、SQL文を構成する変数が取り得る値の集合の生成漏れが発生する事があり、引いてはAPフローとしてのDAOメソッドに対応するSQL文の抽出漏れが発生する事があった。 However, in the method of Patent Document 1, due to the problem of the accuracy of static analysis, the generation omission of a set of values that can be taken by the variables constituting the SQL statement may occur, and by extension, the DAO method as an AP flow. In some cases, the extraction of the SQL statement corresponding to the above was omitted.

そこで本発明は、上記問題点に鑑みてなされたもので、解析精度が低い場合であっても、DAOメソッドに対応するSQL文を抽出することを目的とする。 Therefore, the present invention has been made in view of the above problems, and an object of the present invention is to extract an SQL statement corresponding to the DAO method even when the analysis accuracy is low.

本発明は、プロセッサとメモリを有してソースコードを静的解析するSQL文抽出装置であって、ソースコードを静的解析してDAOメソッドに対応するSQL文を抽出する解析及び可視化部を有し、前記解析及び可視化部は、予め設定されたSQLマップ及びSQLID向け連絡情報を取得して、当該SQLマップを解析し、前記SQLID向け連絡情報からSQLIDを生成し、前記SQLIDとSQL文のマップデータを生成する検索対象整形マップ生成部と、前記ソースコードを解析してDAOメソッドの定義を抽出し、当該DAOメソッドの定義からDAO検索式を生成するDAO検索式生成部と、前記SQLIDとSQL文のマップデータと前記DAO検索式を用いて前記DAOメソッドに対応するSQL文の候補を抽出するSQL文候補抽出部と、を有する。 The present invention is an SQL statement extraction device that has a processor and a memory and statically analyzes the source code, and has an analysis and visualization unit that statically analyzes the source code and extracts the SQL statement corresponding to the DAO method. Then, the analysis and visualization unit acquires the preset SQL map and the contact information for the SQL ID, analyzes the SQL map, generates the SQL ID from the contact information for the SQL ID, and maps the SQL ID and the SQL statement. A search target shaping map generation unit that generates data, a DAO search expression generation unit that analyzes the source code to extract the DAO method definition and generates a DAO search expression from the DAO method definition, and the SQL ID and SQL. It has a SQL statement candidate extraction unit that extracts SQL statement candidates corresponding to the DAO method using the statement map data and the DAO search formula.

本発明によれば、たとえ解析精度が低い場合であっても、DAOメソッドに対応するSQL文を抽出する事が出来る。 According to the present invention, even if the analysis accuracy is low, the SQL statement corresponding to the DAO method can be extracted.

本発明の実施例を示し、計算機システムのハードウェア構成の一例を示すブロック図である。It is a block diagram which shows the Example of this invention and shows an example of the hardware structure of a computer system. 本発明の実施例を示し、計算機システムの機能の一例を示すブロック図である。It is a block diagram which shows the Example of this invention and shows an example of the function of a computer system. 本発明の実施例を示し、SQL−Mapの一例を示す図である。It is a figure which shows the Example of this invention and shows an example of SQL-Map. 本発明の実施例を示し、DAOメソッドの一例を示す図である。It is a figure which shows the Example of this invention and shows an example of the DAO method. 本発明の実施例を示し、SQLIDとSQL文のマップデータの一例を示す図である。It is a figure which shows the Example of this invention and shows an example of the map data of the SQL ID and the SQL statement. 本発明の実施例を示し、DAOメソッドとSQLIDの対応表の一例を示す図である。It is a figure which shows the Example of this invention and shows an example of the correspondence table of DAO method and SOURCE. 本発明の実施例を示し、ソースコードを解析して、DAOメソッドに対応するSQL文を抽出し、抽出したSQLを可視化する処理の一例を示すフローチャートである。It is a flowchart which shows an example of the process which shows the Example of this invention, analyzes the source code, extracts the SQL statement corresponding to the DAO method, and visualizes the extracted SQL. 本発明の実施例を示し、ソースコードを解析して、DAOメソッドに対応するSQL文を抽出し、抽出したSQLを可視化する処理の一例を示すフローチャートである。It is a flowchart which shows an example of the process which shows the Example of this invention, analyzes the source code, extracts the SQL statement corresponding to the DAO method, and visualizes the extracted SQL. 本発明の実施例を示し、ソースコードのユーザ選択メソッドをシーケンス図として可視化した後に、選択されたSQL文をシーケンス図上に表示する処理の一例を示すフローチャートである。It is a flowchart which shows an example of the process which shows the Example of this invention, visualizes the user selection method of a source code as a sequence diagram, and then displays the selected SQL statement on the sequence diagram. 本発明の実施例を示し、生成されたシーケンス図の一例を示す図である。It is a figure which shows the Example of this invention and shows an example of the generated sequence diagram. 本発明の実施例を示し、SQL文の候補がシーケンス図上に表された例を示す図である。It is a figure which shows the Example of this invention, and shows the example which the candidate of the SQL sentence is represented on the sequence diagram. 本発明の実施例を示し、ユーザに選択されたSQL文がシーケンス図上でオーバーレイ表示された例を示す図である。It is a figure which shows the Example of this invention and shows the example which the SQL statement selected by the user is overlaid on the sequence diagram. 本発明の実施例を示し、SQLID向け連結表の一例を示す図である。It is a figure which shows the Example of this invention and shows an example of the concatenation table for SQLID. 本発明の実施例を示し、DAO検索式アップデート表の一例を示すである。An embodiment of the present invention is shown, and an example of a DAO search type update table is shown.

以下、本発明によるSQL文抽出装置、SQL文抽出方法、及びSQL文抽出プログラムに関する一実施形態を、図面を用いて詳細に説明する。 Hereinafter, an embodiment relating to the SQL statement extraction device, the SQL statement extraction method, and the SQL statement extraction program according to the present invention will be described in detail with reference to the drawings.

本実施例では、ソースコードを解析して、DAO(Data Access Object)メソッドに対応するSQL文を抽出し、抽出したSQL文を、同じくソース解析を行い生成したシーケンス図上に可視化表示する方法の一例を記す。 In this embodiment, the source code is analyzed, the SQL statement corresponding to the DAO (Data Access Object) method is extracted, and the extracted SQL statement is visualized and displayed on the sequence diagram generated by the same source analysis. Here is an example.

尚、本実施例では、アプリケーションフレームワークとしてSpringフレームワーク(登録商標)と、またO/Rマッピング(Object-relational mapping)フレームワークとしてmyBatis(登録商標)の利用を意識して記述しているが、本発明は特定のフレームワークや言語に依存するものではない。 In this embodiment, the Spring framework (registered trademark) is used as the application framework, and myBatis (registered trademark) is used as the O / R mapping (Object-relational mapping) framework. , The present invention is not dependent on any particular framework or language.

また、本実施例ではシーケンス図を生成し、シーケンス図上にSQL文をオーバーレイ表示する例を挙げるが、出力する図はシーケンス図に限定される事はなく、シーケンス図、コミュニケーション図、クラス図、その他UML図、その他オリジナル図等何であってもよい。 Further, in this embodiment, an example of generating a sequence diagram and overlaying an SQL statement on the sequence diagram will be given, but the output diagram is not limited to the sequence diagram, and the sequence diagram, communication diagram, class diagram, etc. Any other UML diagram, other original diagram, etc. may be used.

図1は、本発明の実施例に係る情報処理装置100のハードウェア構成の一例を示すブロック図である。情報処理装置100のハードウェアとして、中央処理装置101と、キーボードやマウス等の入力装置102と、二次記憶装置103と、主記憶装置104と、ディスプレイ等の表示装置105、及び通信装置107を有する。 FIG. 1 is a block diagram showing an example of the hardware configuration of the information processing apparatus 100 according to the embodiment of the present invention. As the hardware of the information processing device 100, a central processing unit 101, an input device 102 such as a keyboard and a mouse, a secondary storage device 103, a main storage device 104, a display device 105 such as a display, and a communication device 107 are used. Have.

尚、各装置は、バス106によって接続され、各装置間で相互にデータの送受信が可能である。通信装置107はネットワーク120に接続される。ネットワーク120には、情報処理装置やネットワークストレージといった、データを保存する事が可能な情報装置A110が接続されている。 Each device is connected by a bus 106, and data can be transmitted and received between the devices. The communication device 107 is connected to the network 120. An information device A110 capable of storing data, such as an information processing device or network storage, is connected to the network 120.

図2は、本発明の実施例に係る情報処理装置100と、情報装置A110の機能の一例を示すブロック図である。尚、本実施例においては、情報処理装置100の機能の全てが中央処理装置101によって実行または操作されるソフトウェアプログラムやデータであるものとして説明するが、一部または全ては、ハードウェアとして実現されても良い。 FIG. 2 is a block diagram showing an example of the functions of the information processing device 100 and the information device A110 according to the embodiment of the present invention. In this embodiment, all the functions of the information processing device 100 will be described as software programs and data executed or operated by the central processing unit 101, but some or all of them are realized as hardware. You may.

また、本来は、これらの機能に加え、各機能の起動や管理等を行うOS(Operating System)や制御プログラム等が存在する。本実施例では、これらの機能の連携処理を適宜説明することとし、OSや制御プログラムがここで適宜説明された連携処理に必要となる機能ブロックの起動や実行管理を行う事は自明であるので、これらのOSや制御プログラムについては説明及び記載を省略する。 In addition to these functions, there are an OS (Operating System), a control program, and the like that start and manage each function. In this embodiment, the cooperation processing of these functions will be described as appropriate, and it is obvious that the OS and the control program start and execute the functional blocks required for the cooperation processing described here as appropriate. , The description and description of these OSs and control programs will be omitted.

本発明の実施例に係る情報処理装置100は、機能のブロックとして、図2に示すように構成される。解析及び可視化実行部200が、検索対象整形マップ生成部201と、DAO検索式生成部202と、SQL文候補抽出部203とを含み、SQLIDとSQL文のマップデータ204と、DAOメソッドとSQLIDの対応表205と、SQLID向け連結表206、及びDAO検索式アップデート表207を生成又は参照する。 The information processing apparatus 100 according to the embodiment of the present invention is configured as a functional block as shown in FIG. The analysis and visualization execution unit 200 includes a search target shaping map generation unit 201, a DAO search expression generation unit 202, and a SQL statement candidate extraction unit 203, and includes map data 204 of SQLID and SQL statements, and DAO method and SQLID. Generate or refer to Correspondence Table 205, Concatenation Table 206 for SQL, and DAO Search Expression Update Table 207.

情報装置A110は、XML形式のSQL−Map230、及びソースコード(Java(登録商標))231を有する。尚、SQL−Map230、及びソースコード231は必ずしも上述の装置にある必要はなく、情報処理装置100、及び情報装置A110のいずれに格納されていても良い。 The information device A110 has an XML format SQL-Map230 and a source code (Java (registered trademark)) 231. The SQL-Map 230 and the source code 231 do not necessarily have to be in the above-mentioned device, and may be stored in either the information processing device 100 or the information device A110.

検索対象整形マップ生成部201と、DAO検索式生成部202と、SQL文候補抽出部203を含む解析及び可視化実行部200の各機能部は、プログラムとして主記憶装置104にロードされ、中央処理装置101によって実行される。 Each functional unit of the analysis and visualization execution unit 200 including the search target shaping map generation unit 201, the DAO search formula generation unit 202, and the SQL statement candidate extraction unit 203 is loaded into the main storage device 104 as a program and is a central processing unit. Performed by 101.

中央処理装置101は、各機能部のプログラムに従って処理することによって、所定の機能を提供する機能部として稼働する。例えば、中央処理装置101は、解析及び可視化プログラムに従って処理することで解析及び可視化実行部200として機能する。他のプログラムについても同様である。さらに、中央処理装置101は、各プログラムが実行する複数の処理のそれぞれの機能を提供する機能部としても稼働する。計算機及び計算機システムは、これらの機能部を含む装置及びシステムである。 The central processing unit 101 operates as a functional unit that provides a predetermined function by processing according to the program of each functional unit. For example, the central processing unit 101 functions as an analysis and visualization execution unit 200 by processing according to an analysis and visualization program. The same applies to other programs. Further, the central processing unit 101 also operates as a functional unit that provides each function of a plurality of processes executed by each program. A computer and a computer system are devices and systems including these functional parts.

情報処理装置100の各機能を実現するプログラム、テーブル等の情報は、二次記憶装置103や不揮発性半導体メモリ、ハードディスクドライブ、SSD(Solid State Drive)等の記憶デバイス、または、ICカード、SDカード、DVD等の計算機読み取り可能な非一時的データ記憶媒体に格納することができる。 Information such as programs and tables that realize each function of the information processing device 100 can be stored in a secondary storage device 103, a non-volatile semiconductor memory, a hard disk drive, a storage device such as an SSD (Solid State Drive), or an IC card or SD card. , DVD or the like can be stored in a computer-readable non-temporary data storage medium.

上記プログラムを実行することで、情報処理装置100はSQL文抽出装置として機能することができる。また、上記SQLID向け連結表206及びDAO検索式アップデート表207と、QL−Map230及びソースコード231は、予め設定された情報である。 By executing the above program, the information processing device 100 can function as an SQL statement extraction device. In addition, the above-mentioned concatenation table 206 and DAO search formula update table 207 for SQL ID, QL-Map 230, and source code 231 are preset information.

図3は、SQL−Map230の一例を示す図である。本実施例では、SQL−Map230はXMLで記述した例を示す。SQL−Map230には、namespace属性“com.hitachi.user”を含むmapperタグ要素が存在し、その子要素として、“SELECT id, name FROM user”という文字列を内容として含む、id属性“test”のselectタグ要素が存在している。 FIG. 3 is a diagram showing an example of SQL-Map230. In this embodiment, SQL-Map230 shows an example described in XML. In SQL-Map230, there is a mapper tag element including the namespace attribute "com.hitachi.user", and as a child element thereof, the id attribute "test" including the character string "SELECT id, name FROM user" is included. The select tag element is present.

情報処理装置100はSQL−Map230の情報を利用して、SQLIDとSQL文のマップデータ204を生成するが、その生成方法に関しては後述する。 The information processing apparatus 100 uses the information of SQL-Map 230 to generate map data 204 of SQL ID and SQL statement, and the generation method thereof will be described later.

図4は、ソースコード231のDAOに関する記述例を示す図である。ソースコード231には、Daoクラスのメソッドとして“test“メソッドが記載されている。DAOクラスのメソッドを解析して、DAO検索式を生成し、DAOメソッドとSQLIDの対応表205へ格納するが、その方法に関しては後述する。 FIG. 4 is a diagram showing a description example of the DAO of the source code 231. In the source code 231, the "test" method is described as a method of the Dao class. A DAO class method is analyzed to generate a DAO search expression, which is stored in the correspondence table 205 between the DAO method and SOURCE, and the method will be described later.

図5は、SQLIDとSQL文のマップデータ204の一例を示す図である。SQLIDとSQL文のマップデータ204には、SQLID2041、及び該SQLIDに対応するSQL文2042を格納する。本実施例では、SQLID2041の“com.hitachi.user.test”に対応するSQL文2042として、“SELECT id, name FROM user”という文字列が格納されている。本SQLIDとSQL文のマップデータ204の生成方法は後述する。 FIG. 5 is a diagram showing an example of map data 204 of SQLID and SQL statement. In the map data 204 of the SQL and the SQL statement, the SQL ID 2041 and the SQL statement 2042 corresponding to the SQL ID are stored. In this embodiment, the character string "SELECT id, name FROM user" is stored as the SQL statement 2042 corresponding to "com.hitachi.user.test" of SQLID2041. The method of generating the map data 204 of the present SQL and SQL statements will be described later.

図6は、DAOメソッドとSQLIDの対応表205の一例を示す図である。DAOメソッドとSQLIDの対応表205には、DAOメソッド名2051と、DAO検索式2052と、SQLID2053と、及び選択回数2054をひとつのエントリに格納する。 FIG. 6 is a diagram showing an example of the correspondence table 205 between the DAO method and the SOURCE. Correspondence table 205 of DAO method and EQUID stores DAO method name 2051, DAO search expression 2052, EQULID 2053, and the number of selections 2054 in one entry.

本実施例では、DAOメソッド名2051として“test()”が格納され、DAO検索式2052として“com¥.hitachi¥..*.test”が格納され、SQLID2053として、“com.hitachi.user.test”と“com.hitachi.user2.test”の二つが格納され、選択回数2054として、“com.hitachi.user.test”が5、“com.hitachi.user2.test”が2として格納されている。本DAOメソッドとSQLIDの対応表205の生成方法は後述する。 In this embodiment, "test ()" is stored as the DAO method name 2051, "com \ .hitachi \ ... *. Test" is stored as the DAO search expression 2052, and "com.hitachi.user. "Test" and "com.hitachi.user2.test" are stored, and "com.hitachi.user.test" is stored as 5 and "com.hitachi.user2.test" is stored as 2 as the number of selections 2054. There is. The method of generating the correspondence table 205 between this DAO method and SOURCE will be described later.

図13は、SQLID向け連結表206の一例を示す図である。SQLID向け連結表206は、SQLIDとSQL文のマップデータ204を生成するにあたり、SQL−Map230の、どの要素をどの順番で連結してSQLIDを生成し、どの部分がSQL文にあたるかを予め設定している。 FIG. 13 is a diagram showing an example of the connection table 206 for SQLID. The concatenation table 206 for SQL ID sets in advance which elements of SQL-Map230 are concatenated in what order to generate SQLID and which part corresponds to SQL statement when generating map data 204 of SQLID and SQL statement. ing.

SQLID向け連結表206は、番号#2061と、タグと属性を含むSQLID2062と、SQL文2063とをひとつのエントリに含む。本実施例では、#1のタグ“mapper”の属性“namespace”の値と、#2のタグ“select”の属性“id”の値、またはタグ“insert”の属性“id”の値を、この順番で連結して、SQLIDを生成する。 The concatenation table 206 for SQL ID includes the number # 2061, the SQL ID 2062 including tags and attributes, and the SQL statement 2063 in one entry. In this embodiment, the value of the attribute "namespace" of the tag "mapper" of # 1 and the value of the attribute "id" of the tag "select" of # 2 or the value of the attribute "id" of the tag "insert" are set. SQLID is generated by concatenating in this order.

生成した該SQLIDに対応するSQL文は、SQLID向け連結表206のSQL文の項目に○が付いているところの内容がそれに該当する。例えば、#1、#2aと連結してSQLIDを生成した場合は、selectタグの内容がSQL文となり、#1、#2bと連結してSQLIDを生成した場合は、insertタグの内容がSQL文となる。 The generated SQL statement corresponding to the SQL ID corresponds to the content in which the item of the SQL statement in the connection table 206 for SQL ID is marked with a circle. For example, when the SQLID is generated by connecting with # 1 and # 2a, the content of the select tag becomes the SQL statement, and when the SQLID is generated by connecting with # 1 and # 2b, the content of the insert tag is the SQL statement. It becomes.

図14は、DAO検索式アップデート表207の一例を示す図である。DAO検索式アップデート表207は、項目2071と、回数2072と、閾値2073と、実施2074とをひとつのエントリに含む。 FIG. 14 is a diagram showing an example of the DAO search type update table 207. The DAO search formula update table 207 includes an item 2071, a number of times 2072, a threshold value 2073, and an implementation 2074 in one entry.

DAO検索式アップデート表207には、DAO検索式のアップデートにあたりどのような項目2071を解析するか、その項目2071で正しく解析出来た回数2072と、項目の閾値2073、及びアップデートを実施したか否か(2074)を格納する。詳細については後述するが、本実施例では、項目2071で正しく解析出来た回数2072が項目の閾値2073以上の場合に、DAO検索式をアップデートするものと判断する。 In the DAO search formula update table 207, what kind of item 2071 is analyzed when updating the DAO search formula, the number of times 2072 that can be analyzed correctly in the item 2071, the threshold value 2073 of the item, and whether or not the update is performed (2074) is stored. Details will be described later, but in this embodiment, it is determined that the DAO search formula is updated when the number of times 2072 that can be correctly analyzed in item 2071 is equal to or greater than the item threshold value 2073.

図7は、情報処理装置100で行われる処理の一例を示すフローチャートである。情報処理装置100の解析及び可視化実行部200は、ソースコード231を解析して、DAOメソッドに対応するSQL文を抽出し、シーケンス図を生成して表示装置105に出力する。この処理は、情報処理装置100の利用者などが解析及び可視化実行部200を実行させることで開始される。 FIG. 7 is a flowchart showing an example of processing performed by the information processing apparatus 100. The analysis and visualization execution unit 200 of the information processing device 100 analyzes the source code 231, extracts the SQL statement corresponding to the DAO method, generates a sequence diagram, and outputs the sequence diagram to the display device 105. This process is started when a user of the information processing apparatus 100 or the like executes the analysis and visualization execution unit 200.

まず、ステップ700では、解析及び可視化実行部200が、DAOメソッドに対応するSQL文の抽出、及びシーケンス図の生成と表示を開始する。 First, in step 700, the analysis and visualization execution unit 200 starts extracting the SQL statement corresponding to the DAO method, and generates and displays the sequence diagram.

ステップ701では、解析及び可視化実行部200が、SQL−Map230及びソースコード231を情報装置A110から取得する。 In step 701, the analysis and visualization execution unit 200 acquires the SQL-Map 230 and the source code 231 from the information device A110.

ステップ702では、解析及び可視化実行部200が、DAOメソッドとSQL文の対応付けが完了しているか否かを判定する。判定が真であれば、ステップ704へ進む。判定が偽であれば、ステップ703へ進む。 In step 702, the analysis and visualization execution unit 200 determines whether or not the association between the DAO method and the SQL statement is completed. If the determination is true, the process proceeds to step 704. If the determination is false, the process proceeds to step 703.

尚、該判定方法として、本実施例では、図5と図6で示した、SQLID2041とSQL文のマップデータ204、及びDAOメソッドとSQLIDの対応表205が生成されているか否かで判定を行うものとする。しかし、判定方法はこれに限定されるものではなく、例えば、ステップ703の実施後にソース修正が発生している場合は対応付けが完了していないものとする、など複数考えられる。 As the determination method, in this embodiment, determination is made based on whether or not the map data 204 of the SQLID 2041 and the SQL statement shown in FIGS. 5 and 6 and the correspondence table 205 of the DAO method and the SQL statement are generated. It shall be. However, the determination method is not limited to this, and for example, if the source modification occurs after the execution of step 703, it is assumed that the association is not completed.

ステップ703では、解析及び可視化実行部200が、DAOメソッドとSQL文の対応付けを行う。尚、本処理は、図8を用いて後に詳述する。 In step 703, the analysis and visualization execution unit 200 associates the DAO method with the SQL statement. This process will be described in detail later with reference to FIG.

ステップ704では、解析及び可視化実行部200が、処理の対象となるメソッド名の入力をユーザから受け付ける。勿論、ソースコードに含まれるメソッド名のリストをソースコード解析の際などに予め生成しておき、該リストの中からユーザが選択する方法であっても良い。 In step 704, the analysis and visualization execution unit 200 receives the input of the method name to be processed from the user. Of course, a method may be used in which a list of method names included in the source code is generated in advance at the time of source code analysis and the user selects from the list.

ステップ705では、解析及び可視化実行部200が、ステップ704でユーザから受け付けたメソッドについて呼出関係を解析し、解析結果に基づいてシーケンス図を生成する。先にも述べたように、本実施例ではシーケンス図として可視化するが、可視化図はシーケンス図に限定される事はなく、シーケンス図、コミュニケーション図、クラス図、その他UML図、その他オリジナル図等何であってもよい。 In step 705, the analysis and visualization execution unit 200 analyzes the call relationship for the method received from the user in step 704, and generates a sequence diagram based on the analysis result. As described above, in this embodiment, the visualization diagram is visualized as a sequence diagram, but the visualization diagram is not limited to the sequence diagram, and the sequence diagram, communication diagram, class diagram, other UML diagram, other original diagram, etc. There may be.

図10は、シーケンス図による可視化の一例を示す図である。図10は、解析及び可視化実行部200が生成したシーケンス図を、表示装置105に出力した一例を示す。 FIG. 10 is a diagram showing an example of visualization by a sequence diagram. FIG. 10 shows an example in which the sequence diagram generated by the analysis and visualization execution unit 200 is output to the display device 105.

図10の例では、呼出関係の解析結果には、ControllerClass(251)と、ServiceClass(252)と、Daoクラス(253)と、DB(254)という4つのライフラインが存在する。そして、Controllerクラス(251)の“entry()”メソッドと、Serviceクラス(252)の“serv_a()”メソッドと、Daoクラス(253)の“test()”メソッドの順番にメソッドが呼ばれている例を示す。 In the example of FIG. 10, there are four lifelines in the analysis result of the call relationship: ControllerClass (251), ServiceClass (252), Dao class (253), and DB (254). Then, the methods are called in the order of the "entry ()" method of the Controller class (251), the "serv_a ()" method of the Service class (252), and the "test ()" method of the Dao class (253). Here is an example.

図7に戻って、ステップ706では、解析及び可視化実行部200が、DAOメソッドに対応するSQL文の抽出、及びシーケンス図の生成後に表示を終了する。 Returning to FIG. 7, in step 706, the analysis and visualization execution unit 200 ends the display after extracting the SQL statement corresponding to the DAO method and generating the sequence diagram.

尚、上記処理の順番は、シーケンス図を生成した後にDAOメソッドに対応するSQL文を抽出してもよく、つまり上記ステップ704とステップ705をステップ702に先駆けて実施する構成であっても良い。 The order of the above processing may be such that the SQL statement corresponding to the DAO method may be extracted after the sequence diagram is generated, that is, the above steps 704 and 705 may be executed prior to the step 702.

図8は、情報処理装置100で、ソースコードを解析して、DAOメソッドに対応するSQL文を抽出する処理の一例を示すフローチャートである。本フローチャートは、図7のステップ703で行われる処理を詳述したものである。 FIG. 8 is a flowchart showing an example of a process in which the information processing apparatus 100 analyzes the source code and extracts the SQL statement corresponding to the DAO method. This flowchart details the process performed in step 703 of FIG.

ステップ800では、解析及び可視化実行部200が、DAOメソッドに対応するSQL文の抽出を開始する。 In step 800, the analysis and visualization execution unit 200 starts extracting the SQL statement corresponding to the DAO method.

ステップ801では、検索対象整形マップ生成部201が、ステップ701で取得したSQL−Map230を解析して、予め定義されたSQLID向け連結表206に従って、SQLIDとSQL文のマップデータ204を生成する。 In step 801 the search target shaping map generation unit 201 analyzes the SQL-Map 230 acquired in step 701 and generates the map data 204 of the SQL and SQL statements according to the predefined connection table 206 for SQL ID.

図13に示すSQLID向け連結表206の例では、検索対象整形マップ生成部201が、#1と#2の順にタグの属性値を連結してSQLID2062を生成する。つまり、#1のタグ“mapper”の属性“namespace”の値と、#2のタグの“select”の属性“id”の値またはタグ“insert”の属性“id”の値を、この順番で連結して、SQLID2062を生成する。 In the example of the concatenation table 206 for SQLID shown in FIG. 13, the search target shaping map generation unit 201 concatenates the attribute values of the tags in the order of # 1 and # 2 to generate SQLID 2062. That is, the value of the attribute "namespace" of the tag "mapper" of # 1 and the value of the attribute "id" of the "select" of the tag # 2 or the value of the attribute "id" of the tag "insert" are set in this order. By concatenating, SQLID2062 is generated.

検索対象整形マップ生成部201が生成した該SQLIDに対応するSQL文2042は、SQLID向け連結表206のSQL文2063の項目に○が付いているところの内容に相当する。例えば、#1、#2aと連結してSQLIDを生成した場合は、selectタグの内容がSQL文となり、#1、#2bと連結してSQLIDを生成した場合は、insertタグの内容がSQL文となる。 The SQL statement 2042 corresponding to the SQL ID generated by the search target shaping map generation unit 201 corresponds to the content in which the item of the SQL statement 2063 in the connection table 206 for the SQL ID is marked with a circle. For example, when the SQLID is generated by connecting with # 1 and # 2a, the content of the select tag is the SQL statement, and when the SQLID is generated by connecting with the # 1 and # 2b, the content of the insert tag is the SQL statement. It becomes.

図3のSQL−Map230の例と図13のSQLID向け連結表206の例では、図5のSQLIDとSQL文のマップデータ204に記載の通り、SQLID2041が“com.hitachi.user.test”と、SQL文2042が“SELECT id, name FROM user”となる。 In the example of SQL-Map230 of FIG. 3 and the example of the connection table 206 for SQLID of FIG. 13, SQLID2041 is "com.hitachi.user.test" as described in the map data 204 of the SQLID and SQL statement of FIG. The SQL statement 2042 becomes "SELECT id, name FROM user".

ステップ802では、DAO検索式生成部202が、ステップ701で取得したソースコード231を解析して、DAOクラスのメソッド名と定義を抽出する。そして、DAO検索式生成部202は、抽出したDAOメソッドの定義部分を解析して、SQLIDを検索するためのDAO検索式を生成する。さらに、DAO検索式生成部202は、DAOメソッド名と合わせて、生成した該DAO検索式をDAOメソッドとSQLIDの対応表205へ格納する。 In step 802, the DAO search expression generation unit 202 analyzes the source code 231 acquired in step 701 and extracts the method name and definition of the DAO class. Then, the DAO search expression generation unit 202 analyzes the extracted definition part of the DAO method and generates a DAO search expression for searching the EQULID. Further, the DAO search expression generation unit 202 stores the generated DAO search expression together with the DAO method name in the correspondence table 205 of the DAO method and the SOURCE.

図4に示すDAOメソッド“test()”の例について、DAO検索式生成方法を説明する。DAO検索式生成部202は、ステップ801にて生成したSQLIDとSQL文のマップデータ204から、SQLIDのリストを取得出来るが、これらSQLIDのいずれかに部分一致または全体一致する引数で関数呼び出しが行われている部分(関数呼び出し部)をDAO検索式生成箇所として抽出する。 The DAO search expression generation method will be described with respect to the example of the DAO method “test ()” shown in FIG. The DAO search expression generation unit 202 can acquire a list of SQLIDs from the SQLID and the map data 204 of the SQL statement generated in step 801. However, a function call is made with an argument that partially matches or entirely matches any of these SQLIDs. The part (function call part) is extracted as the DAO search expression generation part.

すなわち、DAO検索式生成部202は、DAOメソッドの定義内の関数呼び出し部で、呼び出し関数の引数がSQLIDとSQL文のマップデータのSQLIDのいずれかと部分一致している場合に、呼び出し関数の引数部分をDAO検索式の生成対象とする。 That is, the DAO search expression generation unit 202 is a function call unit in the definition of the DAO method, and is an argument of the call function when the argument of the call function partially matches either SQLID or SQLID of the map data of the SQL statement. The part is the target for generating the DAO search expression.

本実施例では、図4に示したDAOメソッド“test()”内で、“getSqlSession().selectOne()”という関数呼び出しが行われており、該関数の引数として、“com.hitachi.”+ entity.getTableName() + “.test”が与えられている。 In this embodiment, a function call "getSqlSession (). SelectOne ()" is performed in the DAO method "test ()" shown in FIG. 4, and "com.hitachi." Is used as an argument of the function. + Something. getTableName () + ".test" is given.

この引数の“com.hitachi.”や“.test”は、SQLIDである“com.hitachi.user.test”と部分一致しているため、ここはDAO検索式生成箇所となる。DAO検索式は、この引数部分から生成する。本実施例では、“com.hitachi.”+ entity.getTableName() + “.test”であり、“com.hitachi.”と“.test”は良いが、“entity.getTableName()”の部分に入る文字列が静的解析では分からない事がある。 Since this argument "com.hitachi." And ".test" partially match the EQULID "com.hitachi.user.test", this is the DAO search expression generation location. The DAO search expression is generated from this argument part. In this embodiment, "com. Hitachi." + Something. GetTableName () + ".test", "com.hitachi." And ".test" are good, but the character string in the part of "entity.getTableName ()" may not be known by static analysis.

そのため、“entity.getTableName()”を“.*”という正規表現に置き換え、DAO検索式として“com¥.hitachi¥..*¥.test”とする。この際、“.”という文字列はエスケープ処理を行う。 Therefore, "entity.getTableName ()" is replaced with the regular expression ". *", And the DAO search expression is "com \ .hitachi \ .. * \. Test". At this time, the character string "." Is escaped.

ステップ803では、SQL文候補抽出部203が、SQLIDとSQL文のマップデータ204に格納されたSQLIDに対して、DAOメソッドとSQLIDの対応表205に格納されたDAO検索式を用いて、SQL文の候補を抽出する。抽出したSQL文の候補は、DAOメソッドとSQLIDの対応表205に格納する。この際、SQL文の候補に対する選択回数として0を合わせて格納する。 In step 803, the SQL statement candidate extraction unit 203 uses the DAO search formula stored in the correspondence table 205 between the DAO method and the SQLID for the SQLID stored in the map data 204 of the SQL statement and the SQL statement, and uses the SQL statement. Candidates are extracted. The extracted SQL statement candidates are stored in the correspondence table 205 of the DAO method and SQL ID. At this time, 0 is also stored as the number of selections for the SQL statement candidate.

ステップ804では、解析及び可視化実行部200が、次のDAOメソッドが存在するか否かを判定する。判定が真であれば、ステップ802へ進む。判定が偽であれば、ステップ805へ進む。ステップ805では、解析及び可視化実行部200が、DAOメソッドに対応するSQL文の抽出を終了する。 In step 804, the analysis and visualization execution unit 200 determines whether or not the next DAO method exists. If the determination is true, the process proceeds to step 802. If the determination is false, the process proceeds to step 805. In step 805, the analysis and visualization execution unit 200 finishes the extraction of the SQL statement corresponding to the DAO method.

図9は、情報処理装置100が、指定されたSQL文をシーケンス図上にオーバーレイ表示する処理の一例を示すフローチャートである。情報処理装置100は、ソースコードのユーザ選択メソッドをシーケンス図として可視化した後に、シーケンス図上で利用されるDAOメソッドのSQL文をユーザが選択し、該SQL文をシーケンス図上にオーバーレイ表示する。尚、本フローチャートは、図7のステップ706でシーケンス図の生成が完了した後に、ユーザが任意のタイミングで行う事を想定している。 FIG. 9 is a flowchart showing an example of a process in which the information processing apparatus 100 overlays and displays the designated SQL statement on the sequence diagram. The information processing apparatus 100 visualizes the user selection method of the source code as a sequence diagram, then the user selects the SQL statement of the DAO method used on the sequence diagram, and overlays the SQL statement on the sequence diagram. It is assumed that this flowchart is performed by the user at an arbitrary timing after the generation of the sequence diagram is completed in step 706 of FIG.

ステップ900では、解析及び可視化実行部200が、DAOメソッドに対応するSQL文をシーケンス図上にオーバーレイ表示するフローチャートを開始する。尚、本実施例では、本フローチャート開始のトリガーイベントとして、「ユーザがDAOメソッド上をマウスオーバーした時」を想定しているが、これに限定されるものではなく、DAOメソッドを表すオブジェクトをクリックした時等、所定のイベントであれば良い。 In step 900, the analysis and visualization execution unit 200 starts a flowchart for overlaying and displaying the SQL statement corresponding to the DAO method on the sequence diagram. In this embodiment, "when the user mouses over the DAO method" is assumed as the trigger event for starting this flowchart, but the present invention is not limited to this, and the object representing the DAO method is clicked. It may be a predetermined event such as when it is done.

ステップ901では、解析及び可視化実行部200が、ステップ900でユーザがマウスオーバーしたDAOメソッドに対応するSQL文を、ユーザが候補から選び直すか否か、入力を受け付ける。判定が真であれば、ステップ903へ進む。判定が偽であれば、ステップ902へ進む。尚、本処理は、ユーザクリックなどを契機として任意のタイミングで実施出来るようにしても構わない。 In step 901, the analysis and visualization execution unit 200 accepts an input as to whether or not the user reselects the SQL statement corresponding to the DAO method that the user has moused over in step 900 from the candidates. If the determination is true, the process proceeds to step 903. If the determination is false, the process proceeds to step 902. It should be noted that this process may be executed at an arbitrary timing triggered by a user click or the like.

ステップ902では、解析及び可視化実行部200が、ステップ900でユーザがマウスオーバーしたDAOメソッドに対応するSQL文を、DAOメソッドとSQLIDの対応表205に格納された、該DAOメソッドに対するSQL文候補の中からユーザが既にSQL文を選んでいるか否かを判定する。該判定方法として、本実施例では、DAOメソッドとSQLIDの対応表205に格納されている該DAOメソッドに対するSQLID2053で選択回数2054が1以上のものがあるか否か、または該DAOメソッドに対するSQLID2053の候補が単数か否かで判定する。 In step 902, the analysis and visualization execution unit 200 stores the SQL statement corresponding to the DAO method that the user has moused over in step 900 in the correspondence table 205 of the DAO method and the SQL ID, and is a SQL statement candidate for the DAO method. It is determined whether or not the user has already selected the SQL statement from the list. As the determination method, in the present embodiment, whether or not there is a SQLID2053 for the DAO method stored in the correspondence table 205 of the DAO method and the EQUID with a selection count of 2054 of 1 or more, or whether or not there is a SQLID2053 for the DAO method Judge whether the candidate is singular or not.

図6の例では、DAOメソッド名2051の“test()”上をユーザがマウスオーバーしている時、“test()”のSQLID2053の候補である“com.hitachi.user.test”の選択回数は5、また“com.hitachi.user2.test”の選択回数は2なので、既に選択されていると判定する。判定が真であれば、ステップ904へ進む。判定が偽であれば、ステップ903へ進む。 In the example of FIG. 6, when the user is hovering over the “test ()” of the DAO method name 2051, the number of selections of “com.hitachi.user.test” which is a candidate for the SQLID2053 of the “test ()” Is 5, and the number of times "com.hitachi.user2.test" is selected is 2, so it is determined that the item has already been selected. If the determination is true, the process proceeds to step 904. If the determination is false, the process proceeds to step 903.

ステップ903では解析及び可視化実行部200が、シーケンス図上に、該DAOメソッドに対応するSQL文の候補を表示し、表示されたSQL文候補の中からユーザが一つを選択するのを受け付ける。ユーザがSQL文を選択すると、ステップ908に進む。 In step 903, the analysis and visualization execution unit 200 displays SQL statement candidates corresponding to the DAO method on the sequence diagram, and accepts the user to select one from the displayed SQL statement candidates. When the user selects the SQL statement, the process proceeds to step 908.

ステップ908では、解析及び可視化実行部200が、シーケンス図上に、選択されたSQL文をDAOメソッド上にオーバーレイ表示する。また、解析及び可視化実行部200は、DAOメソッドとSQLIDの対応表205のうち該選択されたSQL文の選択回数2054を1増やす。 In step 908, the analysis and visualization execution unit 200 overlays the selected SQL statement on the DAO method on the sequence diagram. Further, the analysis and visualization execution unit 200 increases the number of selections 2054 of the selected SQL statement in the correspondence table 205 of the DAO method and the SQL ID by 1.

図11は、SQL文の候補をシーケンス図上に表示する例を示す図である。ポップアップウィンドウ255内に、DAOのメソッド“test()”のSQL文の候補が二つ表示され、ユーザが#1の候補を選択してOKボタンを押せば、#1のSQL文が選択される。 FIG. 11 is a diagram showing an example of displaying SQL sentence candidates on a sequence diagram. Two SQL statement candidates for the DAO method "test ()" are displayed in the pop-up window 255. If the user selects the # 1 candidate and presses the OK button, the # 1 SQL statement is selected. ..

ステップ904では、解析及び可視化実行部200が、ユーザが選択したSQL文を、マウスオーバーしているDAOメソッド上にオーバーレイ表示する。 In step 904, the analysis and visualization execution unit 200 overlays the SQL statement selected by the user on the DAO method over which the mouse is over.

図12は、ユーザが選択したSQL文がシーケンス図上でオーバーレイ表示されている例を示す図である。ステップ902において、図11で、SQL文候補のうち#1がユーザに選択された例を挙げたが、図12では当該選択されたSQL文256がDAOメソッド上にオーバーレイ表示されている。 FIG. 12 is a diagram showing an example in which the SQL statement selected by the user is overlaid on the sequence diagram. In step 902, FIG. 11 gives an example in which # 1 of the SQL statement candidates is selected by the user, but in FIG. 12, the selected SQL statement 256 is overlaid on the DAO method.

図9のステップ902の判定で真となりステップ904へ進んだ場合にも、DAOメソッドとSQLIDの対応表205に格納されている該DAOメソッドに対するSQLの文候補のうち選択回数2054が最も多いものがオーバーレイ表示される。また、SQL文候補が単数の場合は、該SQL文の候補がオーバーレイ表示される。 Even when the determination in step 902 in FIG. 9 is true and the process proceeds to step 904, the SQL sentence candidate for the DAO method stored in the correspondence table 205 of the DAO method and the SQL ID has the largest number of selections 2054. It is displayed as an overlay. If there is only one SQL statement candidate, the SQL statement candidate is overlaid.

ステップ905では、DAO検索式生成部202が、DAOメソッドとSQLIDの対応表205をアップデートするか否かを判定する。該判定方法として、オーバーレイ表示しているSQL文のSQLIDとマウスオーバーしたDAOメソッドのDAO検索式とを比較し、DAO検索式に“.*”が含まれる場合に、「*」(ワイルドカード)の部分をSQLIDが対応する部分に置き換える。 In step 905, the DAO search expression generation unit 202 determines whether or not to update the correspondence table 205 between the DAO method and the SOURCE. As the determination method, the SQLID of the SQL statement displayed as an overlay is compared with the DAO search formula of the DAO method that is moused over, and when the DAO search formula contains ". *", "*" (Wild card) Replace with the part corresponding to SQLID.

そして、DAO検索式生成部202は、置き換えた部分の文字列(以後、置換文字列A)が、DAO検索式アップデート表207に格納された項目2071により静的解析で取得可能か否かをチェックし、取得可能であった場合にDAO検索式アップデート表207の回数2072に1(または所定値)を加算し、当該回数2072が予めシステムで設定した、またはユーザが入力した閾値2073以上か否かで判定する。 Then, the DAO search expression generation unit 202 checks whether or not the replaced character string (hereinafter referred to as the replacement character string A) can be acquired by static analysis by the item 2071 stored in the DAO search expression update table 207. If it can be obtained, 1 (or a predetermined value) is added to the number of times 2072 in the DAO search expression update table 207, and whether or not the number of times 2072 is set in advance by the system or is equal to or more than the threshold 2073 input by the user. Judge with.

図6を用いて説明すると、“com¥.hitachi¥..*¥.test”というDAO検索式2052に対して、図11の画面でオーバーレイ表示されるSQL文のSQLIDは“com.hitachi.user.test”である。このため、上述の置換文字列Aは、“user”となる。 Explaining with reference to FIG. 6, the SQL ID of the SQL statement overlaid on the screen of FIG. 11 is “com.hitachi.user” with respect to the DAO search formula 2052 “com \ .hitachi \ .. * \ .test”. .Test ”. Therefore, the above-mentioned replacement character string A becomes "user".

ステップ905では、この“user”が静的解析で取得可能か否を判定するわけである。ここで、置換文字列Aが静的解析で取得可能か否かの判定では、DAO検索式アップデート表207を利用する。 In step 905, it is determined whether or not this "user" can be acquired by static analysis. Here, the DAO search expression update table 207 is used in determining whether or not the replacement character string A can be acquired by static analysis.

DAO検索式アップデート表207の項目2071は「コンストラクタ」と「セッターメソッド」が格納されている。このため、上述の“.*”に対応するDAOメソッドの定義箇所が、DAOメソッドの引数で与えられたオブジェクトがゲッターメソッドの場合(図4の例では、“entity.getTableName()”)、DAO検索式生成部202が、引数のオブジェクト生成部を解析して、コンストラクタ部で置換文字列Aが利用されているか、またはオブジェクトのメソッド(セッターメソッドなど)を利用して置換文字列が利用されているか、をチェックする。 Item 2071 of the DAO search expression update table 207 stores a "constructor" and a "setter method". Therefore, when the DAO method definition part corresponding to the above ". *" Is the getter method for the object given by the argument of the DAO method (in the example of FIG. 4, "entity.getTableName ()"), DAO The search expression generation unit 202 analyzes the object generation unit of the argument, and the replacement character string A is used in the constructor part, or the replacement character string is used by using the object method (setter method, etc.). Check if it is.

DAO検索式生成部202は、上述の“user”がどちらかで利用されていれば、DAO検索式アップデート表207の対応する項目2071の回数2072に1を加算する。図14では、項目2071=“コンストラクタ”で置換文字列“user”が利用されていたものと想定し、回数2072に1が加算されて3となっている。更に、閾値が3のためDAO検索式のアップデートが実施されると判定され、ステップ906へ進む。 The DAO search formula generation unit 202 adds 1 to the number of times 2072 of the corresponding item 2071 in the DAO search formula update table 207 if the above-mentioned "user" is used in either of them. In FIG. 14, it is assumed that the replacement character string “user” is used in the item 2071 = “constructor”, and 1 is added to the number of times 2072 to obtain 3. Further, since the threshold value is 3, it is determined that the update of the DAO search formula is performed, and the process proceeds to step 906.

ステップ906では、DAO検索式生成部202が、ステップ905で閾値2073を超えた項目2071の解析を“.*”という正規表現を含む全DAOメソッドに対して行い、DAO検索式を更新する。 In step 906, the DAO search expression generation unit 202 analyzes the item 2071 that exceeds the threshold value 2073 in step 905 for all DAO methods including the regular expression ". *", And updates the DAO search expression.

本実施例では、ステップ905にて、図14のように項目2071=“コンストラクタ”の回数2072が閾値2073を超えたため、この解析を全てのDAOメソッドに対して行い、DAO検索式を更新する。 In this embodiment, since the number of items 2071 = “constructor” 2072 exceeds the threshold value 2073 in step 905 as shown in FIG. 14, this analysis is performed for all DAO methods and the DAO search formula is updated.

換言すれば、DAO検索式生成部202は、SQL文の候補の中からユーザの選択を受け付けて、選択されたSQL文のSQLIDとDAO検索式の置換文字列Aの一部または全てが、所定の条件を満たしている場合に、DAO検索式アップデート表207の項目2071の回数2072に1を加算し、当該項目2071の回数2072が予め設定された閾値2073を超えた場合に、DAO検索式のアップデートを行う。なお、本実施例では、所定の条件として、対応するDAOメソッドの引数がオブジェクトである場合に、当該オブジェクトのゲッターメソッドで取得可能な文字列と置換文字列が一致していれば、当該オブジェクトのコンストラクタまたはセッターメソッドを解析して当該文字列を利用することを示す。 In other words, the DAO search expression generation unit 202 accepts the user's selection from the SQL statement candidates, and a part or all of the SQLID of the selected SQL statement and the replacement character string A of the DAO search expression is predetermined. When the condition of is satisfied, 1 is added to the number of times 2072 of item 2071 in the DAO search formula update table 207, and when the number of times 2072 of the item 2071 exceeds the preset threshold 2073, the DAO search formula Update. In this embodiment, as a predetermined condition, when the argument of the corresponding DAO method is an object, if the character string that can be obtained by the getter method of the object and the replacement character string match, the object is used. Indicates that the constructor or setter method is parsed and the string is used.

DAO検索式の更新後、SQLIDとSQL文のマップデータ204に格納されたSQLID2041に対して、DAOメソッドとSQLIDの対応表205に格納されたDAO検索式2052を用いて、SQL文の候補を抽出する。抽出したSQL文の候補は、DAOメソッドとSQLIDの対応表205に格納する。 After updating the DAO search formula, for the SQLID 2041 stored in the map data 204 of the SQL and SQL statements, the candidates of the SQL statement are extracted using the DAO search formula 2052 stored in the correspondence table 205 of the DAO method and the SQL ID. To do. The extracted SQL statement candidates are stored in the correspondence table 205 of the DAO method and SQL ID.

ステップ907では解析及び可視化実行部200が、DAOメソッドに対応するSQL文をシーケンス図上にオーバーレイ表示するフローチャートを終了する。 In step 907, the analysis and visualization execution unit 200 ends the flowchart for overlaying and displaying the SQL statement corresponding to the DAO method on the sequence diagram.

以上のように、本実施例によれば、上述した特許文献1に存在した課題、すなわち静的解析の精度の問題により、SQL文を構成する変数が取り得る値の集合の生成漏れが発生し、引いてはDAOメソッドに対応するSQL文の抽出漏れが発生する事があった、という課題を解決する。 As described above, according to the present embodiment, due to the problem existing in Patent Document 1 described above, that is, the problem of the accuracy of static analysis, the generation omission of the set of possible values of the variables constituting the SQL statement occurs. As a result, the problem that the extraction of the SQL statement corresponding to the DAO method may be omitted may occur.

また、抽出したSQL文候補の中からユーザが選択したSQL文を、優先的に可視化時に利用する事で、3層アーキテクチャのWebアプリケーションにおけるプログラムの動作不良や脆弱性等の原因箇所の特定を容易に行うことが可能となる。 In addition, by preferentially using the SQL statement selected by the user from the extracted SQL statement candidates at the time of visualization, it is easy to identify the cause of program malfunction or vulnerability in the Web application of the three-layer architecture. It becomes possible to do it.

なお、本発明は上記した実施例に限定されるものではなく、様々な変形例が含まれる。例えば、上記した実施例は本発明を分かりやすく説明するために詳細に記載したものであり、必ずしも説明した全ての構成を備えるものに限定されるものではない。また、ある実施例の構成の一部を他の実施例の構成に置き換えることが可能であり、また、ある実施例の構成に他の実施例の構成を加えることも可能である。また、各実施例の構成の一部について、他の構成の追加、削除、又は置換のいずれもが、単独で、又は組み合わせても適用可能である。 The present invention is not limited to the above-described examples, and includes various modifications. For example, the above-described embodiment is described in detail in order to explain the present invention in an easy-to-understand manner, and is not necessarily limited to the one including all the configurations described. Further, it is possible to replace a part of the configuration of one embodiment with the configuration of another embodiment, and it is also possible to add the configuration of another embodiment to the configuration of one embodiment. Further, for a part of the configurations of each embodiment, any of addition, deletion, or replacement of other configurations can be applied alone or in combination.

また、上記の各構成、機能、処理部、及び処理手段等は、それらの一部又は全部を、例えば集積回路で設計する等によりハードウェアで実現してもよい。また、上記の各構成、及び機能等は、プロセッサがそれぞれの機能を実現するプログラムを解釈し、実行することによりソフトウェアで実現してもよい。各機能を実現するプログラム、テーブル、ファイル等の情報は、メモリや、ハードディスク、SSD(Solid State Drive)等の記録装置、または、ICカード、SDカード、DVD等の記録媒体に置くことができる。 Further, each of the above configurations, functions, processing units, processing means and the like may be realized by hardware by designing a part or all of them by, for example, an integrated circuit. Further, each of the above configurations, functions, and the like may be realized by software by the processor interpreting and executing a program that realizes each function. Information such as programs, tables, and files that realize each function can be stored in a memory, a hard disk, a recording device such as an SSD (Solid State Drive), or a recording medium such as an IC card, an SD card, or a DVD.

また、制御線や情報線は説明上必要と考えられるものを示しており、製品上必ずしも全ての制御線や情報線を示しているとは限らない。実際には殆ど全ての構成が相互に接続されていると考えてもよい。 In addition, the control lines and information lines indicate those that are considered necessary for explanation, and do not necessarily indicate all the control lines and information lines in the product. In practice, it can be considered that almost all configurations are interconnected.

100 情報処理装置
101 中央処理装置
104 主記憶装置
200 解析及び可視化実行部
201 検索対象整形マップ生成部
202 DAO検索式生成部
203 SQL文候補抽出部
204 SQLIDとSQL文のマップデータ
205 DAOメソッドとSQLIDの対応表
206 SQLID向け連結表
207 DAO検索式アップデート表
230 SQL−Map
100 Information processing device 101 Central processing device 104 Main storage device 200 Analysis and visualization execution unit 201 Search target shaping map generation unit 202 DAO search formula generation unit 203 SQL statement candidate extraction unit 204 SQL and SQL statement map data 205 DAO method and SQL ID Correspondence table 206 SQL concatenation table 207 DAO search formula update table 230 SQL-Map

Claims (11)

プロセッサとメモリを有してソースコードを静的解析するSQL文抽出装置であって、
ソースコードを静的解析してDAOメソッドに対応するSQL文を抽出する解析及び可視化部を有し、
前記解析及び可視化部は、
予め設定されたSQLマップ及びSQLID向け連絡情報を取得して、当該SQLマップを解析し、前記SQLID向け連絡情報からSQLIDを生成し、前記SQLIDとSQL文のマップデータを生成する検索対象整形マップ生成部と、
前記ソースコードを解析してDAOメソッドの定義を抽出し、当該DAOメソッドの定義からDAO検索式を生成するDAO検索式生成部と、
前記SQLIDとSQL文のマップデータと前記DAO検索式を用いて前記DAOメソッドに対応するSQL文の候補を抽出するSQL文候補抽出部と、
を有することを特徴とするSQL文抽出装置。
An SQL statement extractor that has a processor and memory to statically analyze source code.
It has an analysis and visualization unit that statically analyzes the source code and extracts the SQL statement corresponding to the DAO method.
The analysis and visualization unit
Search target formatting map generation that acquires preset SQL map and contact information for SQL, analyzes the SQL map, generates SQLID from the contact information for SQL, and generates map data of the SQL and SQL statements. Department and
A DAO search expression generator that analyzes the source code, extracts the definition of the DAO method, and generates a DAO search expression from the definition of the DAO method.
An SQL statement candidate extraction unit that extracts SQL statement candidates corresponding to the DAO method using the SQLID and SQL statement map data and the DAO search expression, and an SQL statement candidate extraction unit.
An SQL statement extraction device characterized by having.
請求項1に記載のSQL文抽出装置であって、
前記解析及び可視化部は、
前記ソースコードを静的解析して可視化図を生成する可視化図生成部を、さらに有し、
前記可視化図生成部は、
受け付けたトリガーイベントを契機として前記SQL文の候補を出力することを特徴とするSQL文抽出装置。
The SQL statement extraction device according to claim 1.
The analysis and visualization unit
It also has a visualization diagram generation unit that statically analyzes the source code to generate a visualization diagram.
The visualization diagram generation unit
An SQL statement extraction device characterized by outputting a candidate for the SQL statement triggered by a received trigger event.
請求項1に記載のSQL文抽出装置であって、
前記DAO検索式生成部は、
前記DAOメソッドの定義の関数呼び出し部で、呼び出し関数の引数が前記SQLIDとSQL文のマップデータのSQLIDのいずれかと部分一致している場合に、前記呼び出し関数の引数部分をDAO検索式の生成対象とすることを特徴とするSQL文抽出装置。
The SQL statement extraction device according to claim 1.
The DAO search formula generator
In the function call part of the definition of the DAO method, when the argument of the call function partially matches either the SQLID or the SQLID of the map data of the SQL statement, the argument part of the call function is the target for generating the DAO search expression. An SQL sentence extraction device characterized in that.
請求項3に記載のSQL文抽出装置であって、
前記DAO検索式生成部は、
前記DAO検索式の生成対象に対して、文字列以外の部分を“.*”で置換した置換文字列によりDAO検索式を生成することを特徴とするSQL文抽出装置。
The SQL statement extraction device according to claim 3.
The DAO search formula generator
An SQL statement extraction device characterized in that a DAO search expression is generated from a replacement character string in which a portion other than the character string is replaced with ". *" With respect to the generation target of the DAO search expression.
請求項2に記載のSQL文抽出装置であって、 The SQL statement extraction device according to claim 2.
前記可視化図生成部は、 The visualization diagram generation unit
前記抽出したSQL文候補の中から、DAOメソッドに合わせてSQL文の候補を出力する際に、過去に選択された回数の多いSQL文を優先して出力することを特徴とするSQL文抽出装置。 An SQL statement extraction device characterized in that when outputting SQL statement candidates in accordance with the DAO method from the extracted SQL statement candidates, priority is given to the SQL statement that has been selected many times in the past. ..
プロセッサとメモリを有する計算機が、ソースコードを静的解析するSQL文抽出方法であって、 A computer with a processor and memory is an SQL statement extraction method that statically analyzes source code.
前記計算機が、SQLマップと、SQLID向け連絡情報及びソースコードを取得する第1のステップと、 The first step in which the computer acquires the SQL map, the contact information for SQL ID, and the source code.
前記計算機が、前記SQLマップを解析し、前記SQLID向け連絡情報からSQLIDを生成し、前記SQLIDとSQL文のマップデータを生成する第2のステップと、 A second step in which the computer analyzes the SQL map, generates SQLID from the contact information for SQLID, and generates map data of the SQLID and SQL statement.
前記計算機が、前記ソースコードを解析してDAOメソッドの定義を抽出し、当該DAOメソッドの定義からDAO検索式を生成する第3のステップと、 A third step in which the computer analyzes the source code, extracts the definition of the DAO method, and generates a DAO search expression from the definition of the DAO method.
前記計算機が、前記SQLIDとSQL文のマップデータと前記DAO検索式を用いて前記DAOメソッドに対応するSQL文の候補を抽出する第4のステップと、 A fourth step in which the computer extracts a candidate for the SQL statement corresponding to the DAO method by using the map data of the SQLID and the SQL statement and the DAO search formula.
を含むことを特徴とするSQL文抽出方法。A SQL statement extraction method comprising.
請求項6に記載のSQL文抽出方法であって、 The SQL statement extraction method according to claim 6.
前記計算機が、前記ソースコードを静的解析して可視化図を生成する第5のステップを、さらに含み、 The computer further includes a fifth step of statically analyzing the source code to generate a visualization diagram.
前記第5のステップは、 The fifth step is
受け付けたトリガーイベントを契機として前記SQL文の候補を出力することを特徴とするSQL文抽出方法。 A SQL statement extraction method characterized in that a candidate for the SQL statement is output triggered by a received trigger event.
請求項6に記載のSQL文抽出方法であって、 The SQL statement extraction method according to claim 6.
前記第3のステップは、 The third step is
前記DAOメソッドの定義の関数呼び出し部で、呼び出し関数の引数が前記SQLIDとSQL文のマップデータのSQLIDのいずれかと部分一致している場合に、前記呼び出し関数の引数部分をDAO検索式の生成対象とすることを特徴とするSQL文抽出方法。 In the function call part of the definition of the DAO method, when the argument of the call function partially matches either the SQLID or the SQLID of the map data of the SQL statement, the argument part of the call function is the target for generating the DAO search expression. A SQL sentence extraction method characterized in that.
請求項8に記載のSQL文抽出方法であって、 The SQL statement extraction method according to claim 8.
前記第3のステップは、 The third step is
前記DAO検索式の生成対象に対して、文字列以外の部分を“.*”で置換した置換文字列によりDAO検索式を生成することを特徴とするSQL文抽出方法。 A SQL statement extraction method characterized in that a DAO search expression is generated from a replacement character string in which a part other than the character string is replaced with ". *" For the generation target of the DAO search expression.
請求項7に記載のSQL文抽出方法であって、 The SQL statement extraction method according to claim 7.
前記第5のステップは、 The fifth step is
前記抽出したSQL文候補の中から、DAOメソッドに合わせてSQL文の候補を出力する際に、過去に選択された回数の多いSQL文を優先して出力することを特徴とするSQL文抽出方法。 A SQL statement extraction method characterized in that when outputting SQL statement candidates in accordance with the DAO method from the extracted SQL statement candidates, priority is given to the SQL statement that has been selected many times in the past. ..
プロセッサとメモリを有する計算機で、ソースコードを静的解析させるためのプログラムであって、 A program that statically analyzes source code on a computer that has a processor and memory.
SQLマップと、SQLID向け連絡情報及びソースコードを取得する第1のステップと、 The first step to obtain the SQL map, contact information and source code for SQL, and
前記SQLマップを解析し、前記SQLID向け連絡情報からSQLIDを生成し、前記SQLIDとSQL文のマップデータを生成する第2のステップと、 The second step of analyzing the SQL map, generating the SQL ID from the contact information for the SQL ID, and generating the map data of the SQL ID and the SQL statement,
前記ソースコードを解析してDAOメソッドの定義を抽出し、当該DAOメソッドの定義からDAO検索式を生成する第3のステップと、 The third step of analyzing the source code, extracting the definition of the DAO method, and generating the DAO search expression from the definition of the DAO method, and
前記SQLIDとSQL文のマップデータと前記DAO検索式を用いて前記DAOメソッドに対応するSQL文の候補を抽出する第4のステップと、 A fourth step of extracting SQL sentence candidates corresponding to the DAO method using the SQLID and SQL statement map data and the DAO search expression, and
を前記計算機に実行させるためのプログラム。A program for causing the computer to execute.
JP2017201233A 2017-10-17 2017-10-17 SQL statement extraction device, SQL statement extraction method and program Active JP6866270B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017201233A JP6866270B2 (en) 2017-10-17 2017-10-17 SQL statement extraction device, SQL statement extraction method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017201233A JP6866270B2 (en) 2017-10-17 2017-10-17 SQL statement extraction device, SQL statement extraction method and program

Publications (2)

Publication Number Publication Date
JP2019074966A JP2019074966A (en) 2019-05-16
JP6866270B2 true JP6866270B2 (en) 2021-04-28

Family

ID=66544154

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017201233A Active JP6866270B2 (en) 2017-10-17 2017-10-17 SQL statement extraction device, SQL statement extraction method and program

Country Status (1)

Country Link
JP (1) JP6866270B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111797073A (en) * 2019-11-26 2020-10-20 北京京东尚科信息技术有限公司 Database management method, electronic device, and computer-readable storage medium
CN114519582A (en) * 2022-02-21 2022-05-20 中国邮政储蓄银行股份有限公司 Service preheating method, preheating device and service system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100714693B1 (en) * 2005-06-07 2007-05-04 삼성전자주식회사 System and method for implementing database application which are guaranteeing independence of software module
JP5190899B2 (en) * 2010-05-27 2013-04-24 Necシステムテクノロジー株式会社 Information processing apparatus, setting file generation method, and setting file generation program
JP5685205B2 (en) * 2012-01-13 2015-03-18 富士通フロンテック株式会社 Program, information processing apparatus and access support method

Also Published As

Publication number Publication date
JP2019074966A (en) 2019-05-16

Similar Documents

Publication Publication Date Title
JP4148527B2 (en) Functional test script generator
JP4396994B2 (en) Resource file translation verification method, apparatus, and program
CN111026470B (en) System and method for verification and conversion of input data
US8700998B2 (en) Foreign language translation tool
JP4395761B2 (en) Program test support apparatus and method
US8875103B2 (en) Method of testing multiple language versions of a software system using one test script
EP1890235A1 (en) Test case management
US20150169435A1 (en) Method and apparatus for mining test coverage data
US20120266131A1 (en) Automatic program generation device, method, and computer program
US20210208996A1 (en) Verification automation apparatus, verification automation method, and computer-readable recording medium
JP5303795B2 (en) Application analysis method, analysis system, and analysis program
JP5176478B2 (en) Data flow analysis device, data flow analysis method, and data flow analysis program
JP6440895B2 (en) Software analysis apparatus and software analysis method
US20080016488A1 (en) Output styling in an IDE console
JP6866270B2 (en) SQL statement extraction device, SQL statement extraction method and program
US8701086B2 (en) Simplifying analysis of software code used in software systems
JP4928848B2 (en) Message converter in computer system integrated management environment.
US11481546B2 (en) Screen discrimination apparatus, screen discrimination method and program
US10445290B1 (en) System and method for a smart configurable high performance interactive log file viewer
JP5758311B2 (en) Test code generation device, test code generation method, test code generation program
JP7260150B2 (en) WEBSITE DESIGN SUPPORT DEVICE, WEBSITE DESIGN SUPPORT METHOD, AND PROGRAM
US8775873B2 (en) Data processing apparatus that performs test validation and computer-readable storage medium
US11113359B1 (en) Method and system for navigation control
US20220164523A1 (en) Resembling transition identifying apparatus, resembling transition identifying method and program
US20220405196A1 (en) Operation pattern generation apparatus, operation pattern generation method and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200316

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210216

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210224

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210312

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210330

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210407

R150 Certificate of patent or registration of utility model

Ref document number: 6866270

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250