CN112148746A - Method and device for generating database table structure document, electronic device and storage medium - Google Patents

Method and device for generating database table structure document, electronic device and storage medium Download PDF

Info

Publication number
CN112148746A
CN112148746A CN202010847755.0A CN202010847755A CN112148746A CN 112148746 A CN112148746 A CN 112148746A CN 202010847755 A CN202010847755 A CN 202010847755A CN 112148746 A CN112148746 A CN 112148746A
Authority
CN
China
Prior art keywords
database table
table structure
generate
generating
entity
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.)
Granted
Application number
CN202010847755.0A
Other languages
Chinese (zh)
Other versions
CN112148746B (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.)
Hangzhou Dbappsecurity Technology Co Ltd
Original Assignee
Hangzhou Dbappsecurity Technology 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 Hangzhou Dbappsecurity Technology Co Ltd filed Critical Hangzhou Dbappsecurity Technology Co Ltd
Priority to CN202010847755.0A priority Critical patent/CN112148746B/en
Publication of CN112148746A publication Critical patent/CN112148746A/en
Application granted granted Critical
Publication of CN112148746B publication Critical patent/CN112148746B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models

Abstract

The application relates to a method, a device, an electronic device and a storage medium for generating a database table structure document, wherein the method for generating the database table structure document comprises the following steps: configuring an entity class needing to generate a database table structure in a configuration file; acquiring an absolute path of an entity class needing to generate a database table structure; acquiring the attribute of the entity class needing to generate the database table structure by using a Java reflection principle and an absolute path; and generating a corresponding database table structure document according to the configuration file and the attributes of the entity class. By the method and the device, the problem that memory resources are occupied due to a large amount of redundancy of the SQL file when the database table structure document is generated in the related technology is solved, and the generation of the database table structure document is realized on the premise of not creating the SQL file.

Description

Method and device for generating database table structure document, electronic device and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a database table structure document, an electronic apparatus, and a storage medium.
Background
Databases are collections of data that are stored together in a manner that can be shared with multiple users, have as little redundancy as possible, and are independent of applications. Nowadays, relational databases (SQL) and non-relational databases (NoSQL) are commonly used in various large scenes, and Oracle, mySQL and SQLServer are still mainstream databases of various application products in the market. In the known technology, the creation of the database table structure document is to generate the database table structure document in the form of an SQL file. However, generating database table structure documents using the form of SQL files may result in a large number of SQL files being stored in the project deployment package, resulting in a large amount of redundancy of the SQL files. In addition, if the fields need to be modified or added at the later stage of database maintenance, in the case of more documents in the database table structure, it is difficult to locate the SQL file that created the table before, and the new SQL file also makes the file structure more and more disordered and difficult to correspond to the entity class attributes in the code.
At present, no effective solution is provided for the massive redundancy of SQL files when generating database table structure documents in the related technology.
Disclosure of Invention
The embodiment of the application provides a method, a device, an electronic device and a storage medium for generating a database table structure document, so as to at least solve the problem of large redundancy of an SQL (structured query language) file when the database table structure document is generated in the related technology.
In a first aspect, an embodiment of the present application provides a method for generating a database table structure document, where the method includes:
configuring an entity class needing to generate a database table structure in a configuration file;
acquiring an absolute path of the entity class needing to generate the database table structure;
acquiring the attribute of the entity class needing to generate the database table structure by using a Java reflection principle and the absolute path;
and generating the corresponding database table structure document according to the configuration file and the attribute of the entity class.
In some of these embodiments, the configuration file comprises:
and the identification information of the entity class needing to generate the database table structure is obtained.
In some embodiments, the obtaining an absolute path of the entity class for which the database table structure needs to be generated includes:
reading the configuration file into a computer memory through a Property class, and then acquiring the identification information of the entity class needing to generate the database table structure;
obtaining the path names of all entity classes according to the configuration file to obtain the full paths of all the entity classes;
and searching all the entity classes according to the full path, judging whether the entity classes are the entity classes needing to generate the database table structure according to the identification information, and writing the absolute paths of the entity classes needing to generate the database table structure into a computer memory if the entity classes are the entity classes needing to generate the database table structure.
In some embodiments, the obtaining the attribute of the entity class by using Java reflection principle includes:
obtaining the entity class needing to generate the database table structure by using the absolute path;
and circularly traversing the entity class, and acquiring the attribute of the entity class according to the Java reflection principle.
In some embodiments, the generating the corresponding database table structure document according to the configuration file and the attribute of the entity class includes:
generating the SQL sentence of the database table structure of the entity class needing to generate the database table structure, and writing the SQL sentence into a memory of a computer;
and executing the SQL statement, generating the database table structure document, emptying the memory of the computer, and finishing the creation of the database table structure document.
In some of these embodiments, executing the SQL statement to generate the database table structure document comprises:
and converting the SQL statement into the database table structure document through ACCESS application software.
In a second aspect, an embodiment of the present application provides an apparatus for generating a document with a database table structure, where the apparatus includes:
the configuration module is used for configuring the entity class needing to generate the database table structure;
the acquisition module is used for acquiring various data for generating the database table structure document;
and the computer memory module is used for storing data.
In some embodiments, the obtaining module comprises:
the first acquisition module is used for acquiring the absolute path of the entity class needing to generate the database table structure;
and the second acquisition module is used for acquiring the attribute of the entity class needing to generate the database table structure.
In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the processor implements the method for generating a database table structure document according to the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the method for generating a database table structure document as described in the first aspect above.
Compared with the related art, the method for generating the database table structure document provided by the embodiment of the application solves the problem of a large amount of redundancy of SQL files when the database table structure document is generated in the related art by a Java reflection principle, and realizes the generation of the database table structure document.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a flow diagram of a method of generating a database table structure document according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for generating a database table structure document according to a first preferred embodiment of the present application;
FIG. 3 is a flowchart of a method for generating a database table structure document according to the second preferred embodiment of the present application;
FIG. 4 is a block diagram of an apparatus for generating database table structure documents according to an embodiment of the present application;
fig. 5 is a hardware structure diagram of an apparatus for generating a database table structure document according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The embodiment provides a method for generating a database table structure document. FIG. 1 is a flow chart of a method of generating a database table structure document according to an embodiment of the present application, as shown in FIG. 1, the flow includes the following steps:
step S101, configuring entity classes needing to generate database table structures in configuration files.
In this embodiment, the operation and maintenance personnel writes the identification information of the entity class that needs to generate the database table structure into the configuration file, at this time, the entity class that needs to generate the database table structure is used as a data source for subsequently generating a database table structure document, and the operation and maintenance personnel can select the size of the data volume and the data source by themselves.
Step S102, acquiring an absolute path of an entity class needing to generate a database table structure.
In this embodiment, the configuration file already contains identification information of the entity class that needs to generate the database table structure, but does not contain an absolute path of the entity class that needs to generate the database table structure, so that a computer storage location path of the entity class that needs to generate the database table structure needs to be obtained by a certain technical means.
And step S103, acquiring the attribute of the entity class needing to generate the database table structure by using the Java reflection principle and the absolute path.
And step S104, generating a corresponding database table structure document according to the configuration file and the attribute of the entity class.
In some of these embodiments, the database table structure is made up of three parts, a table name, fields in the table, and records of the table. Designing a data table structure is to define the file name of the data table, determine which fields the data table contains, the field name, the field type, and the width of each field, and input these data into the computer. There are many different types of database table structures, including: text type, remark type, numeric type, OLE object type, and the like. The database table structure generated by the present application may be of any of the types described above.
In some of these embodiments, the configuration file includes: identification information of the entity class of the database table structure needs to be generated. In this embodiment, the configuration file already contains identification information of all entity classes whose data need to be used as a database table structure, where the identification information may include, but is not limited to, names, storage paths, and other characteristic information that can be distinguished from other entity classes, of all entity classes whose data need to be used as a database table structure.
In some embodiments, the method for obtaining the attribute of the entity class by using the Java reflection principle specifically includes: obtaining an entity class needing to generate a database table structure by using the absolute path; and circularly traversing the entity class, and acquiring the attribute of the entity class according to the Java reflection principle. In this embodiment, the attribute information of the entity class is acquired by adopting a Java reflection principle, so that the attribute of a specified part of the entity class can be quickly checked and acquired in an operating state, and a data basis is provided for generating a database table structure document in subsequent steps. The action mechanism of the Java reflection principle is as follows: compiling, namely generating class byte code files after the java files are compiled; loading, wherein the class loader is responsible for reading binary bytes of the class according to the fully qualified name of the class, reading the binary bytes into the JVM, storing the binary bytes in a method area of a runtime memory area, and converting the binary bytes into a java.lang.class object instance corresponding to the target type; connecting, namely verifying, performing format (class file specification) semantic (whether a final class has a subclass) operation and preparation, assigning an initial value and a memory space to a static variable, directly assigning an original value to the final modified memory space, wherein the original value is not an initial value and analysis specified by a user, converting symbol reference into direct reference, and allocating an address; initializing, namely, initializing a parent class by using the parent class, and then initializing the self; executing the static modification code once, and if the static modification code is a static variable, covering the original initial value with a value specified by a user; if it is a code block, one pass operation is performed. The above Java reflection principle operates using the class file loaded into jvm. Class files contain all the information of java class, when specific information of a certain class is not known, the class can be obtained by reflection, and then various operations are carried out. To summarize, see: the Java reflection principle is that in a running state, all attributes and methods of any class can be known; for any object, any method and attribute of the object can be called; and can change its properties. Reflection is the mapping of various components in a Java class into individual Java objects and allows operations to be performed.
Through the steps, the database table structure document file can be generated on the premise of not creating the SQL file by using a reflection principle mechanism of Java, and the data volume and the data source of the database table structure document can be independently selected and generated. Compared with the prior art, the database table structure document file is generated on the premise of not creating the SQL file, so that the redundancy of the SQL file can be effectively avoided, and the occupation of a computer memory caused by the fact that a large number of SQL files are stored in a computer memory system is avoided. In addition, if the database table structure field needs to be modified or added in the later stage of the database operation and maintenance, the database table structure field can be modified by modifying the entity type attribute, so that the later operation and maintenance are facilitated.
The embodiments of the present application are described and illustrated below by means of preferred embodiments.
FIG. 2 is a flowchart of a method for generating a database table structure document according to the first preferred embodiment of the present application. As shown in FIG. 2, the method for generating a document with a database table structure comprises the following steps:
step S201, configuring an entity class that needs to generate a database table structure in a configuration file.
Step S202, reading the configuration file into a computer memory through the Property class, and then acquiring the identification information of the entity class needing to generate the database table structure.
Step S203, obtaining the path names of all the entity classes according to the configuration file, and obtaining the full paths of all the entity classes.
In this embodiment, the path names of all the entity classes are obtained according to the configuration file, specifically, the configuration file is read into the computer memory through the Property class, the package names of all the entity classes are obtained from the computer memory, and the path is obtained during the operation, so that the full path of all the entity classes is obtained. The Property class refers to a class Property keyword, that is, a Property identifier, and is used for identifying a Property of a certain control.
Step S204, all entity classes are searched according to the full path.
And step S205, judging whether the entity class is the entity class needing to generate the database table structure according to the identification information.
In this embodiment, the determining process of determining whether the entity class needs to generate the database table structure according to the identification information includes traversing and comparing the identification information read previously with the identification information of the entity class, and determining that the current entity class needs to generate the database table structure when the identification information read previously includes the identification information of the current entity class.
Step S206, if the entity class needs to generate the database table structure, writing the absolute path of the entity class needing to generate the database table structure into the memory of the computer.
Step S207, if the entity class does not need to generate the database table structure, writing the absolute path of the entity class that needs to generate the database table structure into the memory of the computer.
In this embodiment, it is determined which entity classes are the entity classes that need to generate the database table structure, and the absolute paths thereof are obtained at the same time, so that the entity classes are used as the data sources of the database table structure generated in the subsequent steps.
And step S208, acquiring the attribute of the entity class needing to generate the database table structure by using the Java reflection principle and the absolute path.
Step S209, generating a corresponding database table structure document according to the configuration file and the attribute of the entity class.
In one embodiment, the full path of all entity class packages refers to the storage location and path of all entity classes in the current computer storage space; an absolute path refers to the storage location and path of all entity classes in the current computer storage space that need to generate the database table structure. In the Java programming language, an entity class refers to a class that has Set and Get methods. Entity classes are usually always associated with databases and the like (persistent layer data), and this association is established by means of a framework (e.g., Hibernate). The entity class is mainly used as a category existing on the data management and business logic processing level, the entity class is mainly distinguished in the analysis stage, and the main responsibility of the entity class is to store and manage information in the system.
Through the traversal screening of all entity classes in the computer storage space in the steps, all absolute paths of the entity classes needing to generate the database table structure can be screened out, then the absolute paths are used for acquiring files of the corresponding entity classes, and file resources are provided for acquiring the attributes of the entity classes by utilizing the Java reflection principle subsequently.
FIG. 3 is a flowchart of a method for generating a database table structure document according to the second preferred embodiment of the present application, and as shown in FIG. 3, the method for generating a database table structure document includes the following steps:
step S301, configuring entity classes needing to generate database table structures in configuration files.
Step S302, acquiring an absolute path of an entity class needing to generate a database table structure.
Step S303, acquiring the attribute of the entity class needing to generate the database table structure by using the Java reflection principle and the absolute path.
Step S304, generating an SQL statement for generating the database table structure of the entity class needing to generate the database table structure, and writing the SQL statement into a memory of the computer.
Step S305, SQL sentences are executed, database table structure documents are generated, the computer memory is emptied, and the creation of the database table structure documents is completed.
In one embodiment, executing the SQL statement to generate the database table structure document includes:
and converting the SQL statement into a database table structure document through ACCESS application software. The present embodiment is to convert the SQL statements obtained in the previous step into a database table structure document, and the conversion manner includes, but is not limited to, using ACCESS, uledit, and other application software that has the function of converting the SQL program statements into the database table structure document. SQL refers to Structured Query Language (Structured Query Language), is a special purpose programming Language, and is a database Query and programming Language for accessing data and querying, updating, and managing a relational database system. The structured query language is a high-level non-procedural programming language that allows users to work on high-level data structures without requiring the user to specify the method of storing the data and without requiring the user to know the specific data storage manner, so that different database systems with completely different underlying structures can use the same structured query language as an interface for data input and management. The structured query language statements can be nested, which allows for great flexibility and powerful functionality.
Through the steps, the class attribute of the entity class needing to generate the database table structure is written into the SQL program statement, the SQL program statement is converted into the database table structure document by using the application software which converts the SQL program statement into the database table structure document, the database table structure document is generated on the premise of not creating the SQL file, and the computer memory occupation caused by the redundancy of the SQL file and the storage of a large number of SQL files in a computer memory system is avoided. In addition, if the database table structure field needs to be modified or added in the later stage of the database operation and maintenance, the database table structure field can be modified by modifying the entity type attribute, so that the later operation and maintenance are facilitated.
The embodiment also provides a device for generating a database table structure document, which is used for implementing the foregoing embodiment and the preferred embodiments, and the description of the device that has been already made is omitted. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
The embodiment also provides a device for generating the database table structure document, which comprises a memory and a processor, and is characterized in that the memory stores a computer program, and the processor is configured to run the computer program to generate the database table structure document according to any one of the steps. Fig. 4 is a block diagram of an apparatus for generating a database table structure document according to an embodiment of the present application, as shown in fig. 4, the apparatus including:
and the configuration module 41 is used for configuring the entity class required to generate the database table structure.
And an obtaining module 42, coupled to the configuration module 41, for obtaining various data for generating the database table structure document.
A computer memory module 43 coupled to the acquisition module 42 for storing data.
In one embodiment, the obtaining module further comprises: the first acquisition module is used for acquiring the absolute path of the entity class needing to generate the database table structure; and the second acquisition module is used for acquiring the attribute of the entity class needing to generate the database table structure.
In one embodiment, the obtaining module comprises: the reading subunit is used for acquiring the identification information of the entity class needing to generate the database table structure; the judging subunit is used for searching all the entity classes according to the full path and judging whether the entity classes are the entity classes needing to generate the database table structure according to the identification information; and the traversal subunit is used for circularly traversing the entity class and acquiring the attribute of the entity class according to the Java reflection principle.
In one embodiment, the computer storage module comprises: the reading subunit is used for reading the configuration file into a computer memory through the Property class; the first writing subunit is used for writing the absolute path of the entity class needing to generate the database table structure into the memory of the computer; the second writing subunit is used for writing the SQL statement generating the database table structure into the memory of the computer; and the memory clearing unit is used for clearing the computer memory after the database table structure document is generated.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
and S1, configuring the entity class needing to generate the database table structure in the configuration file.
S2, obtaining the absolute path of the entity class needed to generate the database table structure.
And S3, acquiring the attribute of the entity class needing to generate the database table structure by using the Java reflection principle and the absolute path.
And S4, generating a corresponding database table structure document according to the configuration file and the attribute of the entity class.
It should be noted that, for specific examples in this embodiment, reference may be made to examples described in the foregoing embodiments and optional implementations, and details of this embodiment are not described herein again.
The embodiment also provides a storage medium for generating the database table structure document, wherein the storage medium stores a computer program, and the computer program is set to execute the method for generating the database table structure document in any one of the steps when running.
In addition, the method for generating the database table structure document in the embodiment of the application described in conjunction with fig. 1 can be realized by the equipment for generating the database table structure document. Fig. 5 is a hardware structure diagram of an apparatus for generating a database table structure document according to an embodiment of the present application.
The apparatus for generating a database table structure document may include a processor 51 and a memory 52 having stored thereon computer program instructions.
Specifically, the processor 51 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 52 may include, among other things, mass storage for data or instructions. By way of example, and not limitation, memory 52 may include a Hard Disk Drive (Hard Disk Drive, abbreviated to HDD), a floppy Disk Drive, a Solid State Drive (SSD), flash memory, an optical Disk, a magneto-optical Disk, magnetic tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 52 may include removable or non-removable (or fixed) media, where appropriate. The memory 52 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 52 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, Memory 52 includes Read-Only Memory (ROM) and Random Access Memory (RAM). The ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), Electrically rewritable ROM (EAROM), or FLASH Memory (FLASH), or a combination of two or more of these, where appropriate. The RAM may be a Static Random-Access Memory (SRAM) or a Dynamic Random-Access Memory (DRAM), where the DRAM may be a Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), an Extended data output Dynamic Random-Access Memory (EDODRAM), a Synchronous Dynamic Random-Access Memory (SDRAM), and the like.
The memory 52 may be used to store or cache various data files that need to be processed and/or used for communication, as well as possible computer program instructions executed by the processor 51.
The processor 51 implements any of the above described embodiments of the method of generating a database table structure document by reading and executing computer program instructions stored in the memory 52.
In some of these embodiments, the device that generates the database table structure document may also include a communication interface 53 and bus 50. As shown in fig. 5, the processor 51, the memory 52, and the communication interface 53 are connected via the bus 50 to complete mutual communication.
The communication interface 53 is used for implementing communication between modules, apparatuses, units and/or devices in the embodiments of the present application. The communication interface 53 may also enable communication with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
The bus 50 comprises hardware, software, or both that couple the components of the device that generates the database table structure document to each other. Bus 50 includes, but is not limited to, at least one of the following: data Bus (Data Bus), Address Bus (Address Bus), Control Bus (Control Bus), Expansion Bus (Expansion Bus), and Local Bus (Local Bus). By way of example, and not limitation, Bus 50 may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (Front Side Bus), an FSB (FSB), a Hyper Transport (HT) Interconnect, an ISA (ISA) Bus, an InfiniBand (InfiniBand) Interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a microchannel Architecture (MCA) Bus, a PCI (Peripheral Component Interconnect) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a Video Electronics Bus (audio Association) Bus, abbreviated VLB) bus or other suitable bus or a combination of two or more of these. Bus 50 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
The device for generating the database table structure document can execute the method for generating the database table structure document in the embodiment of the application based on the acquired data information, so that the method for generating the database table structure document described in conjunction with fig. 1 is realized.
In addition, by combining the method for generating a database table structure document in the above embodiment, the embodiment of the present application may provide a storage medium to implement. The storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the above-described embodiments of a method of generating a database table structure document.
In summary, the above embodiments or preferred embodiments provided by the present application have the following beneficial effects:
1. according to the method and the system, the database table structure document is generated by a method without creating the SQL file, a large number of SQL files are removed, the file structure is optimized, and meanwhile, the storage resources of a computer are saved.
2. According to the method and the device, the SQL sentences are generated in the process of generating the database table structure document, and the displayed SQL sentences are removed, so that the safety of the database can be guaranteed.
3. According to the method and the device, the database table structure document is generated on the premise of not creating the SQL file, reading of file streams in the process of creating the database table structure document and the process of operating and maintaining the database table structure document can be reduced, and waste of computer performance is avoided.
4. Compared with the method for generating the database table structure document by creating the SQL file, the method for generating the database table structure document by the entity type attributes can quickly search the entity type attributes corresponding to the database fields when the fields need to be modified or added in the later maintenance period of the database, and the complexity of database maintenance is reduced.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of generating a database table structure document, the method comprising:
configuring an entity class needing to generate a database table structure in a configuration file;
acquiring an absolute path of the entity class needing to generate the database table structure;
acquiring the attribute of the entity class needing to generate the database table structure by using a Java reflection principle and the absolute path;
and generating the corresponding database table structure document according to the configuration file and the attribute of the entity class.
2. The method of generating a database table structure document according to claim 1, wherein the configuration file includes:
and the identification information of the entity class needing to generate the database table structure is obtained.
3. The method for generating a database table structure document according to claim 1, wherein the obtaining of the absolute path of the entity class that needs to generate the database table structure comprises:
reading the configuration file into a computer memory through a Property class, and then acquiring the identification information of the entity class needing to generate the database table structure;
obtaining the path names of all entity classes according to the configuration file to obtain the full paths of all the entity classes;
and searching all the entity classes according to the full path, judging whether the entity classes are the entity classes needing to generate the database table structure according to the identification information, and writing the absolute paths of the entity classes needing to generate the database table structure into a computer memory if the entity classes are the entity classes needing to generate the database table structure.
4. A method of generating a database table structure document according to claim 1, wherein said obtaining attributes of said entity classes using Java reflection principle comprises:
obtaining the entity class needing to generate the database table structure by using the absolute path;
and circularly traversing the entity class, and acquiring the attribute of the entity class according to the Java reflection principle.
5. A method of generating a database table structure document according to claim 1, wherein generating the corresponding database table structure document according to the attributes of the configuration file and the entity class, the method comprising:
generating the SQL sentence of the database table structure of the entity class needing to generate the database table structure, and writing the SQL sentence into a memory of a computer;
and executing the SQL statement, generating the database table structure document, emptying the memory of the computer, and finishing the creation of the database table structure document.
6. The method of generating a database table structure document according to claim 5, wherein executing the SQL statement to generate the database table structure document includes:
and converting the SQL statement into the database table structure document through ACCESS application software.
7. An apparatus for generating a database table structure document, the apparatus comprising:
the configuration module is used for configuring the entity class needing to generate the database table structure;
the acquisition module is used for acquiring various data for generating the database table structure document;
and the computer memory module is used for storing data.
8. The apparatus of claim 7, wherein the obtaining module comprises:
the first acquisition module is used for acquiring the absolute path of the entity class needing to generate the database table structure;
and the second acquisition module is used for acquiring the attribute of the entity class needing to generate the database table structure.
9. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and the processor is configured to execute the computer program to perform a method of generating a database table structure document as claimed in any one of claims 1 to 6.
10. A storage medium having stored thereon a computer program, wherein the computer program is arranged to, when executed, perform a method of generating a database table structure document according to any of claims 1 to 6.
CN202010847755.0A 2020-08-21 2020-08-21 Method, device, electronic device and storage medium for generating database table structure document Active CN112148746B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010847755.0A CN112148746B (en) 2020-08-21 2020-08-21 Method, device, electronic device and storage medium for generating database table structure document

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010847755.0A CN112148746B (en) 2020-08-21 2020-08-21 Method, device, electronic device and storage medium for generating database table structure document

Publications (2)

Publication Number Publication Date
CN112148746A true CN112148746A (en) 2020-12-29
CN112148746B CN112148746B (en) 2024-03-26

Family

ID=73888852

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010847755.0A Active CN112148746B (en) 2020-08-21 2020-08-21 Method, device, electronic device and storage medium for generating database table structure document

Country Status (1)

Country Link
CN (1) CN112148746B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051272A (en) * 2021-03-30 2021-06-29 深圳红途创程科技有限公司 Database table structure construction method and device, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339559A (en) * 2008-07-18 2009-01-07 北京航空航天大学 Long lasting implementing method for data
CN103246743A (en) * 2013-05-21 2013-08-14 浪潮集团山东通用软件有限公司 Method for achieving simple data base by writing entity class attributes
CN105278961A (en) * 2015-10-28 2016-01-27 广州华多网络科技有限公司 Method and system for generating database table structure document
CN106126224A (en) * 2016-06-21 2016-11-16 浪潮软件集团有限公司 Tool, system and method for generating program object
CN108509199A (en) * 2018-03-09 2018-09-07 平安科技(深圳)有限公司 Automatically generate the method, apparatus, equipment and storage medium of Chinese annotation
CN109857387A (en) * 2019-01-03 2019-06-07 中国银行股份有限公司 A kind of method and electronic equipment generating JAVA class object
CN111026777A (en) * 2019-12-13 2020-04-17 中国南方电网有限责任公司 Entity class code generation method and device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339559A (en) * 2008-07-18 2009-01-07 北京航空航天大学 Long lasting implementing method for data
CN103246743A (en) * 2013-05-21 2013-08-14 浪潮集团山东通用软件有限公司 Method for achieving simple data base by writing entity class attributes
CN105278961A (en) * 2015-10-28 2016-01-27 广州华多网络科技有限公司 Method and system for generating database table structure document
CN106126224A (en) * 2016-06-21 2016-11-16 浪潮软件集团有限公司 Tool, system and method for generating program object
CN108509199A (en) * 2018-03-09 2018-09-07 平安科技(深圳)有限公司 Automatically generate the method, apparatus, equipment and storage medium of Chinese annotation
CN109857387A (en) * 2019-01-03 2019-06-07 中国银行股份有限公司 A kind of method and electronic equipment generating JAVA class object
CN111026777A (en) * 2019-12-13 2020-04-17 中国南方电网有限责任公司 Entity class code generation method and device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051272A (en) * 2021-03-30 2021-06-29 深圳红途创程科技有限公司 Database table structure construction method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112148746B (en) 2024-03-26

Similar Documents

Publication Publication Date Title
US9218169B2 (en) Callpath finder
US8863082B2 (en) Transformational context-aware data source management
US9940229B2 (en) Technologies for persistent memory programming
CN106462425B (en) Method and system for using complex constants
US8745584B2 (en) Dependency injection by static code generation
US9400700B2 (en) Optimized system for analytics (graphs and sparse matrices) operations
US11157251B2 (en) Automatic reference counting
US10817495B2 (en) Systems and methods for performing data processing operations using variable level parallelism
CN110673839B (en) Distributed tool configuration construction generation method and system
US20230289187A1 (en) Method and apparatus for rectifying weak memory ordering problem
CN112148746B (en) Method, device, electronic device and storage medium for generating database table structure document
CN111694992B (en) Data processing method and device
CN115878654A (en) Data query method, device, equipment and storage medium
US11200203B1 (en) Accessing files stored in a firmware volume from a pre-boot application
CN111881220A (en) Data operation method and device under list storage, electronic equipment and storage medium
US8943471B2 (en) Initialization safety
CN112286509A (en) Java generation method, system, electronic device and readable storage medium
He et al. STrans: A comprehensive framework for structure transformation
EP3164800B1 (en) Bridging a module system and a non-module system
CN116700840A (en) File execution method, device, electronic equipment and readable storage medium
CN114138240A (en) Java object generation method, system, computer equipment and readable storage medium
WO2021174232A2 (en) Constraint set merge and subtraction
US10289713B2 (en) Logical validation for metadata builder
CN115422122A (en) Deep analysis method and system for mirror image file
CN113495727A (en) Business component development method and device, electronic equipment and medium

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
GR01 Patent grant
GR01 Patent grant