Patent Publication Number: US-2022229835-A1

Title: Database language re-issue device

Description:
FIELD 
     This invention relates to a database language re-issue device. 
     BACKGROUND 
     PTL 1 discloses a database language re-issue device. According to the database language re-issue device, even when a table name or the like of a database is changed, it is possible to use an existing database language issue device. 
     CITATION LIST 
     Patent Literature 
     
         
         [PTL 1] JP H9-231116 A 
       
    
     SUMMARY 
     Technical Problem 
     In the database language re-issue device according to PTL 1, however, it is necessary that a definition of a database is made for each system. Therefore, if a different database definition exists in a data obtainment target or the like, it is not possible to appropriately obtain data from the database. 
     This invention has been made to solve the above problem. An object of this invention is to provide a database language re-issue device capable of appropriately obtaining data from a database. 
     Solution to Problem 
     A database language re-issue device according to this invention includes: an obtainment target information extracting unit extracting a data obtainment target, a data request period and a data item from a query issued by an application; an update information obtaining unit obtaining information about a collection program of the data obtainment target for the data request period, extracted by the obtainment target information extracting unit; a table definition information obtaining unit obtaining definition information of a table that is a processing target of the collection program obtained by the update information obtaining unit; a database language changing unit changing the data item in the query to a data item for the data request period based on the definition information of the table obtained by the table definition information obtaining unit; a database querying unit executing a database query based on the data item changed by the database language changing unit; and a database query result merging unit returning obtained data from a database to the application, the data being based on the query executed by the database querying unit. 
     Advantageous Effects of Invention 
     According to this invention, a database language re-issue device executes a database query corresponding to a data obtainment target, a data request period and a data item. Therefore, it is possible to appropriately obtain data from a database. 
    
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
         FIG. 1  is a configuration diagram of a database language re-issue device in a first embodiment. 
         FIG. 2  is a diagram showing an example of a data collection program update history management table used by the database language re-issue device in the first embodiment. 
         FIG. 3  is a diagram showing an example of a table definition information change history management table used by the database language re-issue device in the first embodiment. 
         FIG. 4  is a flowchart for explaining an outline of an operation of the database language re-issue device in the first embodiment. 
         FIG. 5  is a hardware configuration diagram of the database language re-issue device in the first embodiment. 
         FIG. 6  is a flowchart for explaining an outline of an operation of a database language re-issue device in a second embodiment. 
         FIG. 7  is the flowchart for explaining the outline of the operation of the database language re-issue device in the second embodiment. 
         FIG. 8  is a configuration diagram of a database language re-issue device in a third embodiment. 
         FIG. 9  is a diagram showing a first example of a table definition information change history management table used by the database language re-issue device in the third embodiment. 
         FIG. 10  is a diagram showing a second example of the table definition information change history management table used by the database language re-issue device in the third embodiment. 
         FIG. 11  is a flowchart for explaining an outline of an operation of the database language re-issue device in the third embodiment. 
         FIG. 12  is the flowchart for explaining the outline of the operation of the database language re-issue device in the third embodiment. 
         FIG. 13  is the flowchart for explaining the outline of the operation of the database language re-issue device in the third embodiment. 
         FIG. 14  is a configuration diagram of a database language re-issue device in a fourth embodiment. 
         FIG. 15  is a configuration diagram of a virtual table creating unit of the database language re-issue device in the fourth embodiment. 
         FIG. 16  is a diagram showing an example of a virtual table used by the database language re-issue device in the fourth embodiment. 
     
    
    
     DESCRIPTION OF EMBODIMENTS 
     Embodiments for implementing this invention will be described according to accompanying drawings. In each figure, the same or corresponding parts are given the same reference sign. Duplicated description of the parts will be appropriately simplified or omitted. 
     First Embodiment 
       FIG. 1  is a configuration diagram of a database language re-issue device in a first embodiment. 
     As shown in  FIG. 1 , a database language re-issue device  1  is provided with an obtainment target information extracting unit  2 , an update information obtaining unit  3 , a table definition information obtaining unit  4 , a database language changing unit  5 , a database querying unit  6  and a database query result merging unit  7 . 
     The obtainment target information extracting unit  2  extracts a data obtainment target, a data request period, a table name and a column name from a database query issued by an application. 
     The update information obtaining unit  3  obtains information about a collection program of the data obtainment target for the data request period from a table A, which is a data collection program update history management table, based on an extraction result of the obtainment target information extracting unit  2 . 
     The table definition information obtaining unit  4  obtains definition information of a table corresponding to the collection program from a table B, which is a table definition information change history management table, based on an obtainment result of the update information obtaining unit  3 . 
     The database language changing unit  5  changes the table name and the column name in the issued database query to a table name and a column name for the data request period, based on the obtainment result of the update information obtaining unit  3  and the obtainment result of the table definition information obtaining unit  4 . 
     The database querying unit  6  executes the database query changed by the database language changing unit  5 . 
     The database query result merging unit  7  returns obtained data from a database to the application, the data being based on the database query of the database querying unit  6 . 
     Next, an example of the data collection program update history management table will be explained using  FIG. 2 . 
       FIG. 2  is a diagram showing an example of the data collection program update history management table used by the database language re-issue device in the first embodiment. 
     As shown in  FIG. 2 , in the data collection program update history management table, pieces of information, “building”, “elevator”, “collection program”, “start” and “end” are associated with each other. 
     The “building” is identification information about a building in which an elevator is provided. The “elevator” is identification information about the elevator. The “collection program” is information about a version of the collection program. The “start” is information about a date of starting application of the collection program. The “end” is information about a date of ending the application of the collection program. 
     Next, an example of the table definition information change history management table will be explained using  FIG. 3 . 
       FIG. 3  is a diagram showing an example of the table definition information change history management table used by the database language re-issue device in the first embodiment. 
     As shown in  FIG. 3 , in the table definition information change history management table, pieces of information, “initial table name”, “initial column name”, “collection program”, “table name” and “column name” are associated with each other. 
     The “initial table name” is information about an initial table name. The “initial column name” is information about an initial column name. The “collection program” is information about a version of the collection program. The “table name” is information about a changed table name. The “column name” is information about a changed column name. 
     For example, a column “AA” in a table “TABLE01” is changed to a column “AA2” in a table “TABLE01_8” in the “8th” version of the collection program. 
     For example, a column “CC” in the table “TABLE01” is deleted in columns of the table “TABLE01_8” in the “8th” version of the collection program. 
     A column added in the 8th version of the collection program does not exist in the collection program before the 8th version. 
     Next, an outline of an operation of the database language re-issue device  1  will be explained using  FIG. 4 . 
       FIG. 4  is a flowchart for explaining the outline of the operation of the database language re-issue device in the first embodiment. 
     At step S 1 , the database language re-issue device  1  accepts a database query from the application. After that, the database language re-issue device  1  performs an operation of step S 2 . At step S 2 , the database language re-issue device  1  extracts a data obtainment target, a data request period, a table name and a column name. 
     After that, the database language re-issue device  1  performs an operation of step S 3 . At step S 3 , the database language re-issue device  1  obtains information about a collection program for the data request period. After that, the database language re-issue device  1  performs an operation of step S 4 . At step S 4 , the database language re-issue device  1  obtains definition information of a table. 
     After that, the database language re-issue device  1  performs an operation of step S 5 . At step S 5 , the database language re-issue device  1  judges whether or not there is a part that needs to be rewritten in the table name or the column name. 
     If there is a part that needs to be rewritten at step S 5 , the database language re-issue device  1  performs an operation of step S 6 . At step S 6 , the database language re-issue device  1  rewrites the table name and the column name of the database query. 
     If there is not a part that needs to be rewritten at step S 5 , or after step S 6 , the database language re-issue device  1  performs an operation of step S 7 . At step S 7 , the database language re-issue device  1  executes the database query. 
     After that, the database language re-issue device  1  performs an operation of step S 8 . At step S 8 , the database language re-issue device  1  returns obtained data. After that, the database language re-issue device  1  ends the operation. 
     According to the first embodiment explained above, the database language re-issue device  1  executes a database query corresponding to a data obtainment target, a data request period and a data item. Therefore, it is possible to appropriately obtain data from a database. At this time, it is unnecessary to change a database language on a side calling the database language re-issue device  1 . Therefore, it is possible to make it unnecessary to change the application that issues a query. 
     Especially, in the case of an elevator, a worker updates the collection program for each elevator. Therefore, collection program update timings are different among a plurality of elevators. As a result, a definition of a table differs for each data obtainment target and a date request period. If the database language re-issue device  1  of the first embodiment is applied at the time of collecting data of such elevators, it is possible to appropriately obtain the data of the elevators from a database. 
     Further, if the database language re-issue device  1  of the first embodiment is applied when data that can be measured differs according to models, it is possible to appropriately obtain data without necessity to change the application that issues a query. 
     Further, if the database language re-issue device  1  of the first embodiment is applied when data that can be obtained differs according to contracts, it is possible to appropriately obtain data without necessity to change the application that issues a query. 
     Further, if the database language re-issue device  1  of the first embodiment is applied when an amount of data that can be obtained differs according to data transmission paths, it is possible to appropriately obtain data without necessity to change the application that issues a query. 
     Next, an example of the database language re-issue device  1  will be explained using  FIG. 5 . 
       FIG. 5  is a hardware configuration diagram of the database language re-issue device in the first embodiment. 
     Each function of the database language re-issue device  1  can be realized by processing circuitry. For example, the processing circuitry is provided with at least one processor  100   a  and at least one memory  100   b . For example, the processing circuitry is provided with at least one piece of dedicated hardware  200 . 
     When the processing circuitry is provided with the at least one processor  100   a  and the at least one memory  100   b , each function of the database language re-issue device  1  is realized by software, firmware or a combination of software and firmware. At least either the software or the firmware is written as a program. At least either the software or the firmware is stored in the at least one memory  100   b . The at least one processor  100   a  realizes each function of the database language re-issue device  1  by reading out and executing the program stored in the at least one memory  100   b . The at least one processor  100   a  is also referred to as a central processing unit, a processing device, an arithmetic device, a microprocessor, a microcomputer or a DSP. For example, the at least one memory  100   b  is a nonvolatile or volatile semiconductor memory such as a RAM, a ROM, a flash memory, an EPROM or an EEPROM, a magnetic disk, a flexible disk, an optical disk, a compact disk, a mini disk, a DVD or the like. 
     When the processing circuitry is provided with the at least one piece of dedicated hardware  200 , the processing circuitry is realized, for example, by a single circuit, a composite circuit, a programmed processor, a parallel-programmed processor, an ASIC, an FPGA or a combination thereof. For example, the functions of the database language re-issue device  1  are realized by multiple processing circuitry, respectively. For example, the functions of the database language re-issue device  1  are collectively realized by a piece of processing circuitry. 
     For the functions of the database language re-issue device  1 , a part may be realized by the dedicated hardware  200 , and other parts may be realized by the software or firmware. For example, it is possible to realize a function of the obtainment target information extracting unit  2  by processing circuitry as the dedicated hardware  200  and realize functions other than the function of the obtainment target information extracting unit  2  by the at least one processor  100   a  reading out and executing the program stored in the at least one memory  100   b.    
     Thus, the processing circuitry realize each function of the database language re-issue device  1  by the hardware  200 , software, firmware or a combination thereof. 
     Second Embodiment 
       FIGS. 6 and 7  are a flowchart for explaining an outline of an operation of a database language re-issue device in a second embodiment. Parts that are the same or corresponding to parts of the first embodiment are given the same reference signs. Explanation of the parts will be omitted. 
     In the embodiment, steps S 11  to S 16  are the same as steps S 1  to S 6  in  FIG. 4 . After step S 16 , the database language re-issue device  1  performs an operation of step S 17 . At step S 17 , the database language re-issue device  1  judges whether any column item has disappeared or not. 
     If any column item has disappeared at step S 17 , the database language re-issue device  1  performs an operation of step S 18 . At step S 18 , the database language re-issue device  1  rewrites the database query with a value determined in advance instead of a column name. 
     If no column item has disappeared at step S 17 , or after step S 18 , the database language re-issue device  1  performs an operation of step S 19 . 
     Steps S 19  and S 20  are the same as steps S 7  and S 8  in  FIG. 4 . 
     According to the second embodiment explained above, if a data item for a data request period corresponding to a data item in a query does not exist, the database language re-issue device  1  returns a value determined in advance as the data item for the data request period. Even if a data item is changed, it is possible to prevent an error from being outputted. 
     Third Embodiment 
       FIG. 8  is a configuration diagram of a database language re-issue device in a third embodiment. Parts that are the same or corresponding to parts of the first embodiment are given the same reference signs. Explanation of the parts will be omitted. 
     The update information obtaining unit  3  obtains pieces of information about all collection programs of a data obtainment target for a data request period and corresponding data periods from the table A. 
     The table definition information obtaining unit  4  obtains pieces of definition information of tables corresponding to all the collection programs from the table B. 
     The database language changing unit  5  changes a table name, a column name and a data request period in an issued database query for each collection program, based on an obtainment result of the update information obtaining unit  3  and an obtainment result of the table definition information obtaining unit  4 , and changes the one database query to a plurality of database queries. 
     The database querying unit  6  executes the plurality of database queries changed by the database language changing unit  5 . 
     The database query result merging unit  7  merges a plurality of pieces of obtained data from databases into one and returns the merged data to the application, the plurality of pieces of data being based on the database queries of the database querying unit  6 . 
     Next, a first example of the table definition information change history management table will be explained using  FIG. 9 . 
       FIG. 9  is a diagram showing the first example of the table definition information change history management table used by the database language re-issue device in the third embodiment. 
     For a data request period in a database query at an upper part of  FIG. 9 , the “8th” and “9th” versions of the collection program correspond, in the table definition information change history management table at a lower part of  FIG. 9 . 
     In this case, as a data period for the “8th” version of the collection program, a period of “2017/7/1” to “2017/8/23” is applied. As a data period for the “9th” version of the collection program, a period of “2017/8/24” to “2017/10/23” is applied. 
     Next, a second example of the table definition information change history management table will be explained using  FIG. 10 . 
       FIG. 10  is a diagram showing the second example of the table definition information change history management table used by the database language re-issue device in the third embodiment. 
     To elevators “1” and “2” as query targets of a database query at an upper part of  FIG. 10 , the “9th” and “7th” versions of the collection program correspond, in the table definition information change history management table at a lower part of  FIG. 9 . 
     In this case, to the elevator “1” of a building “003”, the “9th” version of the collection program is applied. To the elevator “2” of a building “015”, the “7th” version of the collection program is applied. 
     Next, an outline of an operation of the database language re-issue device  1  will be explained using  FIGS. 11 to 13 . 
       FIGS. 11 to 13  are a flowchart for explaining the outline of the operation of the database language re-issue device in the third embodiment. 
     Steps S 21  to S 23  are the same as steps S 1  to S 3  in  FIG. 4 . 
     After step S 23 , the database language re-issue device  1  performs an operation of step S 24 . At step S 24 , the database language re-issue device  1  judges whether all of obtainment target tables have been processed or not. 
     If all of the obtainment target tables have not been processed at step S 24 , the database language re-issue device  1  performs an operation of step S 25 . At step S 25 , the database language re-issue device  1  obtains definition information of the tables. After that, the database language re-issue device  1  performs an operation of step S 26 . At step S 26 , the database language re-issue device  1  judges whether or not there are a table name and a column name that need to be rewritten. 
     If there are a table name and a column name that need to be rewritten at step S 26 , the database language re-issue device  1  performs an operation of step S 27 . At step S 27 , the database language re-issue device  1  rewrites the table name and the column name in the database query. 
     If there are neither a table name nor a column name that needs to be rewritten at step S 26 , or after step S 27 , the database language re-issue device  1  performs an operation of step S 28 . At step S 28 , the database language re-issue device  1  judges whether it is necessary to rewrite a data request period. 
     If it is necessary to rewrite the data request period at step S 28 , the database language re-issue device  1  performs an operation of step S 29 . At step S 29 , the database language re-issue device  1  rewrites the data request period in the database query. 
     If it is not necessary to rewrite the data request period at step S 28 , or after step S 29 , the database language re-issue device  1  performs an operation of step S 30 . At step S 30 , the database language re-issue device  1  judges whether it is necessary to rewrite a data obtainment target. 
     If it is necessary to rewrite the data obtainment target at step S 30 , the database language re-issue device  1  performs an operation of step S 31 . At step S 31 , the database language re-issue device  1  rewrites the data obtainment target in the database query. 
     If it is not necessary to rewrite the data obtainment target at step S 30 , or after step S 31 , the database language re-issue device  1  performs an operation of step S 32 . At step S 32 , the database language re-issue device  1  executes the database query. After that, the database language re-issue device  1  performs an operation of step S 24 . 
     If all the data obtainment target tables have been processed at step S 24 , the database language re-issue device  1  performs an operation of step S 33 . At step S 33 , the database language re-issue device  1  judges whether there are a plurality of pieces of obtained data. 
     If there are a plurality of pieces of obtained data at step S 33 , the database language re-issue device  1  performs an operation of step S 34 . At step S 34 , the database language re-issue device  1  merges the pieces of obtained data. 
     If there are not a plurality of pieces of obtained data at step S 33 , or after step S 34 , the database language re-issue device  1  performs an operation of step S 35 . At step S 35 , the database language re-issue device  1  returns the obtained data. After that, the database language re-issue device  1  ends the operation. 
     According to the third embodiment explained above, the database language re-issue device  1  changes a data item in a query to a plurality of data items for a data request period, based on obtained pieces of definition information of a plurality of tables. Therefore, even if there are a plurality of collection programs, it is possible to appropriately obtain data from a database. 
     Fourth Embodiment 
       FIG. 14  is a configuration diagram of a database language re-issue device in a fourth embodiment. Parts that are the same or corresponding to parts of the first embodiment are given the same reference signs. Explanation of the parts will be omitted. 
     A database language re-issue device  1  is provided with a virtual table creating unit  8 , a database language changing unit  9 , a database querying unit  10  and a database query result merging unit  11 . 
     The virtual table creating unit  8  creates a virtual table including all table definitions within a requested range of an issued database query. 
     The database language changing unit  9  changes a table name in the issued database query to a table name of a virtual table. 
     The database querying unit  10  executes the changed database query. 
     The database query result merging unit  11  returns obtained data from a database to the application. 
     Next, the virtual table creating unit  8  will be explained using  FIG. 15 . 
       FIG. 15  is a configuration diagram of the virtual table creating unit of the database language re-issue device in the fourth embodiment. 
     As shown in  FIG. 15 , the virtual table creating unit  8  is provided with an update information obtaining unit  12 , a table definition information obtaining unit  13 , a virtual table definition creating unit  14  and a virtual table creation database querying unit  15 . 
     The update information obtaining unit  12  obtains pieces of information about all collection programs from the table A. 
     The table definition information obtaining unit  13  obtains pieces of definition information of all tables corresponding to all the collection programs from the table B. 
     The virtual table definition creating unit  14  creates a definition of a virtual table that includes definitions of all the tables, based on an obtainment result of the update information obtaining unit  12  and an obtainment result of the table definition information obtaining unit  13 . 
     The virtual table creation database querying unit  15  creates a virtual table that has the definition created by the virtual table definition creating unit  14  and is for referring to pieces of information in all the tables, in a database. 
     Next, an example of the virtual table will be explained using  FIG. 16 . 
       FIG. 16  is a diagram showing an example of the virtual table used by the database language re-issue device in the fourth embodiment 
     As shown in  FIG. 16 , in change from a “query target table TABLE01” to a “query target table TABLE02”, a column “AA” is changed to a column “A2”. A column “BB” has disappeared. 
     In change from the “query target table TABLE02” to a “query target table TABLE03”, a column “DD” and a column “EE” are added. 
     In this case, on the virtual table, the change from the column “AA” to the column “A2”, the deletion of the column “BB” and the addition of the column “DD” and the column “EE” are reflected. 
     According to the fourth embodiment explained above, the database language re-issue device  1  creates a virtual table that includes all table definitions within a requested range of a query. Therefore, it is possible to appropriately obtain data from a database. 
     In the first to fourth embodiments, the various kinds of data may be managed by files. 
     INDUSTRIAL APPLICABILITY 
     As described above, a database language re-issue device according to the present invention can be used for a data analysis system. 
     REFERENCE SIGNS LIST 
     
         
           1  Database language re-issue device 
           2  Obtainment target information extracting unit 
           3  Update information obtaining unit 
           4  Table definition information obtaining unit 
           5  Database language changing unit 
           6  Database querying unit 
           7  Database query result merging unit 
           8  Virtual table creating unit 
           9  Database language changing unit 
           10  Database querying unit 
           11  Database query result merging unit 
           12  Update information obtaining unit 
           13  Table definition information obtaining unit 
           14  Virtual table definition creating unit 
           15  Virtual table creation database querying unit 
           100   a  Processor 
           100   b  Memory 
           200  Hardware