CN110908979A - Code item database archiving method and device, electronic equipment and storage medium - Google Patents

Code item database archiving method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110908979A
CN110908979A CN201911210097.8A CN201911210097A CN110908979A CN 110908979 A CN110908979 A CN 110908979A CN 201911210097 A CN201911210097 A CN 201911210097A CN 110908979 A CN110908979 A CN 110908979A
Authority
CN
China
Prior art keywords
database
code item
code
connection information
data
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.)
Pending
Application number
CN201911210097.8A
Other languages
Chinese (zh)
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.)
Beijing Mininglamp Software System Co ltd
Original Assignee
Beijing Mininglamp Software System Co 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 Beijing Mininglamp Software System Co ltd filed Critical Beijing Mininglamp Software System Co ltd
Priority to CN201911210097.8A priority Critical patent/CN110908979A/en
Publication of CN110908979A publication Critical patent/CN110908979A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The disclosure provides a code project database archiving method and device, electronic equipment and a storage medium, and relates to the technical field of software. The method comprises the following steps: the method comprises the steps of obtaining database connection information included in a code item, obtaining at least one of a data structure and database data of a corresponding database based on the database connection information, and storing the at least one of the data structure and the database data to a specified storage position. The method and the system can reduce the cost of archiving the database and improve the efficiency and reliability.

Description

Code item database archiving method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of software, in particular to a code project database archiving method and device, electronic equipment and a storage medium.
Background
In the life cycle of software, a plurality of versions of a code item of the software usually exist, and databases on which code items of different versions depend are usually different, so in order to maintain and manage the code item, it is necessary to archive the databases corresponding to the code items of different versions.
In the prior art, developers of code projects can manually judge the database on which the code projects depend, so that the database is obtained and stored, the cost is high, the efficiency is low, wrong data is easy to miss or obtain, and the reliability is poor.
Disclosure of Invention
The invention aims to provide a code item database archiving method, a code item database archiving device, electronic equipment and a storage medium, so that the cost of archiving a database is reduced, and the efficiency and the reliability are improved.
In order to achieve the above purpose, the technical scheme adopted by the disclosure is as follows:
in a first aspect, the present disclosure provides a method for archiving a code project database, the method including:
acquiring database connection information included in the code item;
acquiring at least one of a data structure and database data of a corresponding database based on the database connection information;
storing at least one of the data structure and the database data to a specified storage location.
Optionally, the database connection information includes at least one of Java database connectivity (JDBC) and Object Relational Mapping (ORM) in the code item.
Optionally, if the database connection information includes the ORM, the obtaining of the database connection information included in the code item includes:
and acquiring the ORM from abstract classes, annotation information or code configuration information in the code project.
Optionally, the obtaining of the database connection information included in the code item includes:
and if the code item is determined to be started, acquiring the database connection information included in the code item.
Optionally, the specified storage location comprises a storage location associated with a storage location of the code item.
In a second aspect, the present disclosure also provides a code item database archiving apparatus, the apparatus including:
the first acquisition module is used for acquiring database connection information included in the code item;
the second acquisition module is used for acquiring at least one of a data structure and database data of a corresponding database based on the database connection information;
a storage module to store at least one of the data structure and the database data to a specified storage location.
Optionally, the database connection information includes obtaining at least one of JDBC and ORM in the code item.
Optionally, if the database connection information includes the ORM, the first obtaining module is further configured to:
and acquiring the ORM from abstract classes, annotation information or code configuration information in the code project.
Optionally, the first obtaining module is further configured to:
and if the code item is determined to be started, acquiring the database connection information included in the code item.
Optionally, the specified storage location comprises a storage location associated with a storage location of the code item.
In a third aspect, the present disclosure also provides an electronic device, including: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the method according to the first aspect.
In a fourth aspect, the present disclosure also proposes a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first aspect.
Compared with the prior art, the method has the following beneficial effects:
in the embodiment of the disclosure, the database connection information included in the code item may be acquired, so as to acquire at least one of the data structure and the database data of the corresponding database based on the database connection information, and store at least one of the data structure and the database data to the designated storage location, because at least one of the data structure and the database data in the database corresponding to the code item does not need to be acquired manually for filing, not only is the cost reduced, but also the efficiency is improved, the possibility of missing or acquiring the wrong data structure or database data is reduced, and the reliability of filing the database is improved.
Additional features and advantages of the disclosure will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the disclosure. The objectives and other advantages of the disclosure may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
To more clearly illustrate the technical solutions of the present disclosure, the drawings needed for the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present disclosure, and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 illustrates a flow diagram of a code item database archiving method provided by the present disclosure;
FIG. 2 illustrates a flow diagram of another code item database archiving method provided by the present disclosure;
FIG. 3 illustrates a functional block diagram of a code item database archive provided by the present disclosure;
fig. 4 shows a functional module schematic diagram of an electronic device provided by the present disclosure.
Detailed Description
The technical solution in the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the present disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
Referring to fig. 1, a flow chart of a code item database archiving method provided by the present disclosure is shown. The method is implemented by a plug-in, such as a maven (project object model) plug-in or an IDE (integrated development environment) plug-in, which can be provided in the code project. It should be noted that the code item database archiving method according to the present disclosure is not limited by the specific sequence shown in fig. 1 and described below, and it should be understood that, in other embodiments, the sequence of some steps in the code item database archiving method according to the present disclosure may be interchanged according to actual needs, or some steps may be omitted or deleted. The flow shown in fig. 1 will be explained in detail below.
Step 101, obtaining database connection information included in the code item.
Since the code item is connected to the corresponding database through the database connection information so as to acquire at least one of the required data structure and the database data from the database, the database connection information included in the code item may be acquired for the purpose of subsequently determining at least one of the required data structure and the database data of the code item.
The code item may comprise at least one piece of code, which may correspond to a plug-in, software or software system.
It should be noted that the category of the code item is not specifically limited in the embodiment of the present disclosure, for example, the code item may include a code item based on a Spring (an open source software development framework) framework.
A database, or data source, may be a source of data upon which a code item operates. The database may include at least one data structure, and each data structure may store database data.
It should be noted that the form of the data structure is not specifically limited in the embodiments of the present disclosure, for example, the data structure may include an SQL (Structured Query Language) table.
The database connection information is used to indicate the database to which the code item is connected or specific data in the database.
The database connection information included in the code item may be acquired from the code item, or related technicians may search and collect the included database connection information from the code item in advance, and store the collected database connection information to a preset storage location, and accordingly, the database connection information included in the code item may be acquired from the preset storage location.
Step 102, at least one of a data structure and database data of a corresponding database is obtained based on the database connection information.
Since the database connection information may indicate a database to which the code item is connected or specific data of the database, at least one of a data structure and database data of the database may be acquired based on the database connection information.
If the database connection information indicates that the database is connected with the code item, acquiring at least one of all data structures included in the database and database data stored in all the data structures as at least one of the data structures and the database data; if the database connection information indicates a data structure in the database to which the code item is connected, at least a part of the database data in the data structure and the data mechanism may be acquired as at least one of the data structure and the database data.
For example, the database includes a data structure as shown in table 1 below, the name and age columns of table 1, wherein the first row does not include column attributes for the columns, and the second through fourth rows include database data stored by the data structure, respectively stored names and ages of users. The data structure of the database may include 2, name, age and the database data include zhangyi 34, wanyi 10, lie 8.
TABLE 1
Name (I) Age (age)
Zhang-a 34
King of a certain 10
Lie somewhere 8
Note that, in the embodiment of the present disclosure, only the data structure and the database data in the database are described in table 1, and table 1 does not limit the database structure and the database data in the database.
Step 103, storing at least one of the data structure and the database data to a designated storage location.
In order to facilitate operation, maintenance and management of at least one of the data structure and the database data corresponding to the code item, at least one of the acquired data structure and the database data may be stored in a designated storage location. And because at least one of the data structure and the database data in the database corresponding to the code project does not need to be acquired manually, the cost is reduced, the efficiency is improved, the possibility of missing or acquiring wrong data structures or database data is reduced, and the reliability of archiving the database is improved.
Wherein the specified storage location can be obtained by setting in advance. Alternatively, the specified storage location may comprise a storage location associated with a storage location of the code item, for example, the specified storage location may be a root directory of the code item, thereby facilitating versioning of the version of the code item with the version of the database.
In the embodiment of the disclosure, the database connection information included in the code item may be acquired, so as to acquire at least one of the data structure and the database data of the corresponding database based on the database connection information, and store at least one of the data structure and the database data to the designated storage location, because at least one of the data structure and the database data in the database corresponding to the code item does not need to be acquired manually for filing, not only is the cost reduced, but also the efficiency is improved, the possibility of missing or acquiring the wrong data structure or database data is reduced, and the reliability of filing the database is improved.
Optionally, the database connection information includes at least one of JDBC and ORM in the acquisition code item.
JDBC is an application program interface in Java language that specifies how a client program accesses a database, providing methods such as querying and updating data in the database; the ORM is by using metadata describing the mapping between objects and databases, and may include at least one of mybatis (a persistent layer framework that supports SQL, stored procedures, and advanced mappings), jpa (Java persistent layer application program interface), and hiberate (an open source object relational mapping framework).
Alternatively, if the database connection information includes an ORM, the operation of obtaining the database connection information included in the code item in step 101 may include: the ORM is obtained from abstract classes, annotation information, or code configuration information in the code project.
To reduce the possibility of missing ORMs and improve the integrity and reliability of the data structure and database data obtained, ORMs may be obtained from abstract classes, annotation information, or code configuration information in the code project.
The abstract class can be used for representing abstract concepts obtained in the analysis and design of problem fields, and is an abstraction of a series of concrete concepts which look different but are the same in nature; the annotation information may be information used to label or explain the code item; the code configuration information can be used for explaining the relevant configuration of the running environment of the code item and the like.
Optionally, please refer to fig. 2, which is a flowchart illustrating a method for archiving a code item database according to the present disclosure. The operation of acquiring the database connection information included in the code item in step 101 may include: and if the code item is determined to be started, acquiring the database connection information included in the code item.
After the code item is started, at least one of the data structure and the database data in the database corresponding to the code item is obtained through the steps, so that the corresponding data structure and the database data can be obtained under the condition that the code item is ensured to run reliably in a correct running environment, the reliability of obtaining the data structure and the database data in the filing process is improved, and the cost consumed for checking due to errors in obtaining the data structure and the database data is saved.
The code item database filing method provided by the disclosure can be implemented by a Java tool, where the Java tool may include an @ Configuration class (a Configuration class), so as to monitor whether the code item is started, and after the code item is started, the above steps are executed to obtain at least one of a data structure in a corresponding database and database data for filing, and it is not necessary to modify an original code item, and thus the operation and maintenance cost of the code item is reduced.
Optionally, it may be obtained from the scan profile whether to export and store at least one of the data structure and the database data, and/or the above-mentioned specified storage location, and/or whether to obtain the data structure, and/or whether to obtain the database data.
Wherein, the scanning configuration file can be used for indicating the relevant configuration for executing the code item database filing method provided by the present disclosure, and the scanning configuration file can be obtained by the prior setting.
Referring to fig. 3, a functional module diagram of a code item database archiving device 300 according to the present disclosure is shown. It should be noted that the basic principle and the technical effect of the code item database archiving apparatus 300 provided in the present embodiment are the same as those of the corresponding method embodiments described above, and for the sake of brief description, reference may be made to corresponding contents in the method embodiments for parts that are not mentioned in the present embodiment. The code item database archive 300 comprises a first acquisition module 301, a second acquisition module 302, and a storage module 303.
A first obtaining module 301, configured to obtain database connection information included in the code item;
a second obtaining module 302, configured to obtain at least one of a data structure and database data of a corresponding database based on the database connection information;
a storage module 303, configured to store at least one of the data structure and the database data to a specified storage location.
Optionally, the database connection information includes at least one of JDBC and ORM in the acquisition code item.
Optionally, if the database connection information includes an ORM, the first obtaining module 301 is further configured to:
the ORM is obtained from abstract classes, annotation information, or code configuration information in the code project.
Optionally, the first obtaining module 301 is further configured to:
and if the code item is determined to be started, acquiring the database connection information included in the code item.
Optionally, the specified storage location comprises a storage location associated with a storage location of the code item.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when one of the above modules is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 4 is a schematic diagram of functional modules of an electronic device according to the present disclosure. The electronic device may include a processor 401, a computer-readable storage medium 402 and a bus 403, the computer-readable storage medium 402 stores machine-readable instructions executable by the processor 401, when the electronic device is operated, the processor 401 and the computer-readable storage medium 402 communicate through the bus 403, and the processor 401 executes the machine-readable instructions, so as to implement the above-mentioned method embodiments. The specific implementation and technical effects are similar, and are not described herein again.
Optionally, the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor when executed, so as to implement the above method embodiments.
In the several embodiments provided in the present disclosure, it should be understood that the above-described apparatus embodiments are merely illustrative, and the disclosed apparatus and method may be implemented in other ways. For example, the division of the unit is only a logical function division, and in actual implementation, there may be another division manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or may not be executed, for example, each unit may be integrated into one processing unit, each unit may exist alone physically, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure, and various modifications and changes may be made to the present disclosure by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (12)

1. A code item database archiving method, the method comprising:
acquiring database connection information included in the code item;
acquiring at least one of a data structure and database data of a corresponding database based on the database connection information;
storing at least one of the data structure and the database data to a specified storage location.
2. The method of claim 1, wherein the database connection information comprises obtaining at least one of Java database connectivity JDBC and object relational mapping ORM in the code item.
3. The method of claim 2, wherein if the database connection information includes the ORM, the obtaining the database connection information included in the code item includes:
and acquiring the ORM from abstract classes, annotation information or code configuration information in the code project.
4. The method of any one of claims 1-3, wherein said obtaining database connection information included in the code item comprises:
and if the code item is determined to be started, acquiring the database connection information included in the code item.
5. The method of any of claims 1-3, wherein the specified storage location comprises a storage location associated with a storage location of the code item.
6. A code item database archive apparatus, the apparatus comprising:
the first acquisition module is used for acquiring database connection information included in the code item;
the second acquisition module is used for acquiring at least one of a data structure and database data of a corresponding database based on the database connection information;
a storage module to store at least one of the data structure and the database data to a specified storage location.
7. The apparatus of claim 6, wherein the database connection information comprises obtaining at least one of JDBC and ORM in the code item.
8. The apparatus of claim 7, wherein if the database connection information includes the ORM, the first obtaining module is further to:
and acquiring the ORM from abstract classes, annotation information or code configuration information in the code project.
9. The apparatus of any of claims 6-8, wherein the first obtaining module is further configured to:
and if the code item is determined to be started, acquiring the database connection information included in the code item.
10. The apparatus of any of claims 6-8, wherein the specified storage location comprises a storage location associated with a storage location of the code item.
11. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the method of any of claims 1-5.
12. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, is adapted to carry out the steps of the method according to any one of the claims 1-5.
CN201911210097.8A 2019-11-29 2019-11-29 Code item database archiving method and device, electronic equipment and storage medium Pending CN110908979A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911210097.8A CN110908979A (en) 2019-11-29 2019-11-29 Code item database archiving method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911210097.8A CN110908979A (en) 2019-11-29 2019-11-29 Code item database archiving method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110908979A true CN110908979A (en) 2020-03-24

Family

ID=69821413

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911210097.8A Pending CN110908979A (en) 2019-11-29 2019-11-29 Code item database archiving method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110908979A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130218843A1 (en) * 2012-02-22 2013-08-22 International Business Machines Corporation Intelligent data archiving
CN105279261A (en) * 2015-10-23 2016-01-27 北京京东尚科信息技术有限公司 Dynamic extensible database filing method and system
CN109408493A (en) * 2018-10-17 2019-03-01 成都四方伟业软件股份有限公司 A kind of moving method and system of data source
CN109726174A (en) * 2018-12-28 2019-05-07 江苏满运软件科技有限公司 Data archiving method, system, equipment and storage medium
CN110032369A (en) * 2019-04-24 2019-07-19 成都市映潮科技股份有限公司 A kind of code automatic generation method, device and medium
CN110442596A (en) * 2019-07-30 2019-11-12 北京明略软件系统有限公司 Acquisition methods, device, storage medium and the electronic device of database information

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130218843A1 (en) * 2012-02-22 2013-08-22 International Business Machines Corporation Intelligent data archiving
CN105279261A (en) * 2015-10-23 2016-01-27 北京京东尚科信息技术有限公司 Dynamic extensible database filing method and system
CN109408493A (en) * 2018-10-17 2019-03-01 成都四方伟业软件股份有限公司 A kind of moving method and system of data source
CN109726174A (en) * 2018-12-28 2019-05-07 江苏满运软件科技有限公司 Data archiving method, system, equipment and storage medium
CN110032369A (en) * 2019-04-24 2019-07-19 成都市映潮科技股份有限公司 A kind of code automatic generation method, device and medium
CN110442596A (en) * 2019-07-30 2019-11-12 北京明略软件系统有限公司 Acquisition methods, device, storage medium and the electronic device of database information

Similar Documents

Publication Publication Date Title
Bacon et al. Spanner: Becoming a SQL system
CN110321254B (en) Software version rollback method, device, server and storage medium
US20060235899A1 (en) Method of migrating legacy database systems
US8010521B2 (en) Systems and methods for managing foreign key constraints
CN111797157B (en) Data processing method, system, electronic equipment and storage medium
US20230325368A1 (en) Automatic data store architecture detection
CN115543402B (en) Software knowledge graph increment updating method based on code submission
US9396218B2 (en) Database insert with deferred materialization
US10592400B2 (en) System and method for creating variants in a test database during various test stages
CN116226159A (en) Metadata blood-edge relationship analysis method, system, equipment and storage medium
CN113934750A (en) Data blood relationship analysis method based on compiling mode
CN114090613A (en) Program statement conversion method, device, equipment and storage medium
CN110908979A (en) Code item database archiving method and device, electronic equipment and storage medium
CN108399196B (en) Automatic sql execution method and system of database sql statement automatic generation tool
CN112817931B (en) Incremental version file generation method and device
CN109739835B (en) Data version preservation method and device
CN113792026A (en) Deployment method and device of database script and computer readable storage medium
Draheim et al. The schema evolution and data migration framework of the environmental mass database IMIS
CN112764829A (en) Index monitoring method for Linux system
CN116302206B (en) Presto data source hot loading method based on MQ
Rose et al. Concordance: A framework for managing model integrity
Mittra Database performance tuning and optimization: using Oracle
CN113486113B (en) Kettle-based incremental data synchronization method and terminal
CN116226168A (en) Method and system for verifying wide-table data
CN117111986A (en) Method capable of automatically completing enterprise management software database script upgrading

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200324