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

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

Info

Publication number
CN112148746B
CN112148746B CN202010847755.0A CN202010847755A CN112148746B CN 112148746 B CN112148746 B CN 112148746B CN 202010847755 A CN202010847755 A CN 202010847755A CN 112148746 B CN112148746 B CN 112148746B
Authority
CN
China
Prior art keywords
database table
table structure
generating
generate
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.)
Active
Application number
CN202010847755.0A
Other languages
Chinese (zh)
Other versions
CN112148746A (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.)
DBAPPSecurity Co Ltd
Original Assignee
DBAPPSecurity 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 DBAPPSecurity Co Ltd filed Critical DBAPPSecurity 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

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 structural document, wherein the method for generating the database table structural document comprises the following steps: configuring entity classes 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 attributes of entity classes needing to generate a database table structure by utilizing 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. According to the method and the device, the problem that memory resources are occupied due to the fact that a large amount of redundancy of the SQL file is caused when the database table structure document is generated in the related technology is solved, and the generation of the database table structure document is achieved on the premise that the SQL file is not created.

Description

Method, device, electronic device and storage medium for generating database table structure document
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for generating a database table structure document.
Background
A database is a collection of data stored together in a manner that can be shared with multiple users, with as little redundancy as possible, independent of the application. Today relational databases (SQL) and non-relational databases (NoSQL) are commonly used in large scenarios, oracle, mySQL, SQLServer is still the dominant database for various application products on the market. In the known art, the creation of a database table structured document is to generate the database table structured document using the form of an SQL file. However, generating database table structured documents using the form of SQL files can result in a large number of SQL files being stored in the project deployment package, resulting in a large amount of redundancy for the SQL files. In addition, if the field needs to be modified or added later in the database maintenance, under the condition that the database table structure documents are more, the SQL file of the table is difficult to be established before positioning, and the file structure becomes more and more chaotic due to the new SQL file, so that the SQL file is difficult to correspond to entity class attributes in the codes.
At present, no effective solution is proposed for a great deal of redundancy of SQL files when database table structural documents are generated in the related art.
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 structural document, which at least solve the problem of massive redundancy of SQL files when the database table structural 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 structural document, the method including:
configuring entity classes 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 utilizing a Java reflection principle and the absolute path;
and generating the corresponding database table structure document according to the configuration file and the attributes of the entity class.
In some of these embodiments, the configuration file includes:
and the identification information of the entity class needing to generate the database table structure.
In some embodiments, the obtaining the absolute path of the entity class that needs to generate the database table structure includes:
reading the configuration file into a computer memory through the Property class, and acquiring the identification information of the entity class needing to generate the database table structure;
obtaining path names of all entity classes according to the configuration file to obtain full paths of all entity classes;
and searching all entity classes according to the full path, judging whether the entity class is the entity class needing to generate the database table structure according to the identification information, and if so, writing the absolute path of the entity class needing to generate the database table structure into a computer memory.
In some embodiments, the acquiring 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 SQL sentences of the generated database table structures of the entity classes needing to generate the database table structures, and writing the SQL sentences into a computer memory;
executing the SQL sentence, generating the database table structure document, and clearing the memory of the computer to finish the creation of the database table structure document.
In some of these embodiments, executing the SQL statement, generating the database table structured document comprises:
the SQL statement is converted into the database table structured document by ACCESS application software.
In a second aspect, an embodiment of the present application provides an apparatus for generating a database table structural document, where the apparatus includes:
the configuration module is used for configuring entity classes needing to generate a database table structure;
the acquisition module is used for acquiring various data of the database table structural document;
and the computer memory module is used for storing data.
In some of these embodiments, the acquisition module comprises:
the first acquisition module is used for acquiring an absolute path of an entity class needing to generate a database table structure;
and the second acquisition module is used for acquiring the attributes 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, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements a method for generating a database table structure document according to the first aspect described above when the computer program is executed by the processor.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of 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 structural document solves the problem of massive redundancy of SQL files when the database table structural document is generated in the related art through the Java reflection principle, and realizes the generation of the database table structural 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 other features, objects, and advantages 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 embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a flow chart of a method of generating a database table structural document according to an embodiment of the present application;
FIG. 2 is a flowchart of a method of generating a database table structural document according to a preferred embodiment of the present application;
FIG. 3 is a flowchart of a method of generating a database table structural document according to a second preferred embodiment of the present application;
FIG. 4 is a block diagram of an apparatus for generating database table structural documents according to an embodiment of the present application;
fig. 5 is a schematic hardware structure of an apparatus for generating a database table structural 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 is described and illustrated below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden on the person of ordinary skill in the art based on the embodiments provided herein, are intended to be within the scope of the present application.
It is apparent that the drawings in the following description are only some examples or embodiments of the present application, and it is possible for those of ordinary skill in the art to apply the present application to other similar situations according to these drawings without inventive effort. Moreover, it should be appreciated that while such a development effort might be complex and lengthy, it would nevertheless be a routine undertaking of design, fabrication, or manufacture for those of ordinary skill having the benefit of this disclosure, and thus should not be construed as having the benefit of this disclosure.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases 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. It is to be expressly and implicitly understood by those of ordinary skill in the art that the embodiments described herein can be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar terms herein do not denote a limitation of quantity, but rather denote the singular or plural. The terms "comprising," "including," "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to only those steps or elements but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. The terms "connected," "coupled," and the like in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as used herein refers to two or more. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., "a and/or B" may mean: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. The terms "first," "second," "third," and the like, as used herein, are merely distinguishing between similar objects and not representing a particular ordering of objects.
The embodiment provides a method for generating a database table structure document. FIG. 1 is a flowchart of a method of generating a database table structured document, according to an embodiment of the present application, as shown in FIG. 1, the flowchart including the steps of:
step S101, configuring entity classes needing to generate a database table structure in a configuration file.
In this embodiment, the operation maintainer writes the identification information of the entity class that needs to generate the database table structure into the configuration file, and at this time, the entity class that needs to generate the database table structure is used as the data source for generating the database table structure document subsequently, so that the operation maintainer can select the size and the data source of the data volume by himself.
Step S102, obtaining an absolute path of an entity class needing to generate a database table structure.
In this embodiment, the configuration file already includes identification information of the entity class that needs to generate the database table structure, but does not include an absolute path of the entity class that needs to generate the database table structure, so it is necessary to obtain a computer storage location path of the entity class that needs to generate the database table structure through a certain technical means.
Step S103, obtaining the attributes of the entity class needing to generate the database table structure by utilizing the Java reflection principle and the absolute path.
Step S104, corresponding database table structure documents are generated according to the configuration files and the attributes of the entity classes.
In some of these embodiments, the database table structure is made up of three parts, a table name, a field in the table, and a record of the table. The design of the data table structure is to define the file name of the data table, determine which fields the data table contains, the field name, field type and width of each field, and input these data into the computer. There are a number of different types of database table structures, including: text type, remark type, digital type, OLE object type, etc. 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: it is necessary to generate identification information of the entity class of the database table structure. In this embodiment, the configuration file already includes identification information of all entity classes that need to use their data as the database table structure, where the identification information may be, but is not limited to, characteristic information that includes names, storage paths, and the like of all entity classes that need to use their data as the database table structure and can be distinguished from other entity classes.
In some embodiments, the method for acquiring the attribute of the entity class by using the Java reflection principle specifically comprises the following steps: obtaining entity classes needing to generate a database table structure by utilizing the absolute path; and circularly traversing the entity class, and acquiring the attribute of the entity class according to the Java reflection principle. In the embodiment, the Java reflection principle is adopted to acquire the attribute information of the entity class, so that the attribute of a part of the entity class can be quickly checked and acquired in the running state, and a data basis is provided for generating the database table structure document in the subsequent step. The Java reflection principle has the following action mechanism: compiling, namely compiling the java file to generate a class byte code file; the class loader is responsible for reading the binary byte stream of a class into the JVM according to the full-limit name of the class, storing the binary byte stream in a method area of a runtime memory area, and converting the binary byte stream into a java.lang.class object instance corresponding to a target type; connecting, subdividing into verification, performing operation and preparation of format (class file specification) semantics (whether a final class has subclasses or not), assigning a static variable initial value and a memory space, directly assigning a final modified memory space into an initial value, converting symbol references into direct references instead of user-specified initial values and parsing, and allocating addresses; initializing, namely initializing a parent class with the parent class, and then initializing the parent class; executing the static modifier once, and if the static modifier is a static variable, covering the original initial value with a user designated value; if it is a block of code, then a pass is performed. The Java reflection principle described above operates using the class file loaded into jvm. All the information of the java class is contained in the class file, and when specific information of a certain class is not known, the class can be acquired by using reflection, and then various operations are carried out. Summarizing, the following is true: the Java reflection principle is that in the running state, all the attributes and methods of any class can be known; any method and attribute of any object can be invoked; and can change its properties. Reflection is the mapping of various components in a Java class into individual Java objects and can operate on.
Through the steps, the database table structure document file can be generated on the premise of not creating the SQL file by utilizing a Java reflection principle mechanism, and the data size and the data source of the database table structure document can be automatically selected. 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 the memory of a computer caused by the fact that a large number of SQL files are stored in the memory system of the computer is avoided. In addition, if the database table structure field needs to be modified or added in the later period of the database operation and maintenance, the database table structure field can be modified by modifying the entity class attribute, so that the later period of the operation and maintenance is convenient.
The embodiments of the present application are described and illustrated below by means of preferred embodiments.
Fig. 2 is a flowchart of a method of generating a database table structural document according to a preferred embodiment of the present application. As shown in fig. 2, the method for generating a database table structural document includes the steps of:
in step S201, an entity class that needs to generate a database table structure is configured in a configuration file.
Step S202, reading the configuration file into the memory of the computer through the Property class, and acquiring the identification information of the entity class which needs 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, path names of all entity classes are obtained according to the configuration file, specifically, the Property class reads the configuration file into the computer memory, then obtains packet names of all entity classes from the computer memory, and obtains paths when running, so as to obtain full paths of all entity classes. The Property class refers to a class attribute keyword, that is, an attribute identifier, which is used to identify an attribute of a control.
Step S204, searching all entity classes according to the full path.
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 is the entity class that needs to generate the database table structure according to the identification information is to traverse and compare the previously read identification information with the identification information of the entity class, and determine that the current entity class is the entity class that needs to generate the database table structure when the previously read identification information contains the identification information of the current entity class.
In step S206, if the entity class is the entity class that needs to generate the database table structure, the absolute path of the entity class that needs to generate the database table structure is written into the computer memory.
In step S207, if the entity class is not required to generate the database table structure, the absolute path of the entity class required to generate the database table structure is written into the computer memory.
In this embodiment, it is determined which entity classes are entity classes that need to generate a database table structure, and the absolute paths thereof are obtained, so that these entity classes are conveniently used as data sources of the database table structure generated in the subsequent step.
In step S208, the attribute of the entity class that needs to generate the database table structure is obtained by using the Java reflection principle and the absolute path.
Step S209, corresponding database table structure documents are generated according to the configuration files and the attributes of the entity classes.
In one embodiment, the full path of all entity class packets refers to the storage locations and paths of all entity classes in the current computer storage space; absolute paths refer to the storage locations and paths of all the entity classes in the current computer storage space that need to generate the database table structure. In the Java programming language, the entity class refers to a class with Set and Get methods. Entity classes are often associated with databases or the like (persistent layer data) and such association is established by means of a framework (e.g., hibernate). The entity class is mainly used as the class 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 the information inside the system.
Through the steps of traversing and screening all entity classes in the storage space of the computer, absolute paths of all entity classes needing to generate a database table structure can be screened, and then files of the corresponding entity classes are acquired by utilizing the absolute paths, so that file resources are provided for acquiring the attributes of the entity classes by utilizing the Java reflection principle.
FIG. 3 is a flowchart of a method of generating a database table structural document according to a second preferred embodiment of the present application, as shown in FIG. 3, the method of generating a database table structural document comprising the steps of:
in step S301, entity classes that need to generate a database table structure are configured in a configuration file.
Step S302, obtaining an absolute path of an entity class needing to generate a database table structure.
In step S303, the attribute of the entity class that needs to generate the database table structure is obtained by using the Java reflection principle and the absolute path.
Step S304, generating SQL sentences of the generated database table structure of entity class which needs to generate the database table structure, and writing the SQL sentences into the computer memory.
Step S305, executing the SQL sentence, generating a database table structure document, and clearing the memory of the computer to complete the creation of the database table structure document.
In one embodiment, executing the SQL statement, generating the database table structured document comprises:
the SQL statement is converted into a database table structured document by the ACCESS application software. The present embodiment is to convert the SQL statement obtained in the previous step into a database table structured document, and the manner of conversion includes, but is not limited to, using ACCESS, ultraEdit or the like application software having the function of converting the SQL program statement into the database table structured document. Wherein SQL refers to structured query language (Structured Query Language), which is a special purpose programming language, is a database query and programming language for accessing data and querying, updating and managing relational database systems. The structured query language is a high-level non-procedural programming language that allows users to work on high-level data structures without requiring users to specify a method of storing data, nor requiring users to know a specific way of storing data, so that different database systems having disparate underlying structures can use the same structured query language as an interface for data input and management. The structured query language statement can be nested, which gives it great flexibility and powerful functionality.
Through the steps, the class attributes of the entity class needing to generate the database table structure are written into the SQL program statement, the SQL program statement is converted into the database table structure document by using the application software with the function of converting 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 redundancy of the SQL file and the occupation of the computer memory caused by storing a large amount of SQL files in the computer memory system are avoided. In addition, if the database table structure field needs to be modified or added in the later period of the database operation and maintenance, the database table structure field can be modified by modifying the entity class attribute, so that the later period of the operation and maintenance is convenient.
The embodiment also provides a device for generating the database table structural document, which is used for realizing the above embodiment and the preferred embodiment, and is not described in detail. As used below, the terms "module," "unit," "sub-unit," and the like may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The present embodiment also provides an apparatus for generating a database table structured document, comprising a memory and a processor, wherein the memory has a computer program stored therein, the processor being arranged to run the computer program to perform the method of generating the database table structured document according to any of the above-mentioned step descriptions. FIG. 4 is a block diagram of an apparatus for generating database table structural documents according to an embodiment of the present application, as shown in FIG. 4, the apparatus comprising:
a configuration module 41, configured to configure entity classes that need to generate a database table structure.
An acquisition module 42, coupled to the configuration module 41, for acquiring various data for generating the database table structural document.
A computer memory module 43 is coupled to the acquisition module 42 for storing data.
In one embodiment, the acquisition module further includes: the first acquisition module is used for acquiring an absolute path of an entity class needing to generate a database table structure; and the second acquisition module is used for acquiring the attributes of the entity class needing to generate the database table structure.
In one embodiment, the acquisition module includes: 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 entity classes according to the full path, and judging whether the entity classes are entity classes needing to generate a 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, a computer storage module includes: the reading subunit is used for reading the configuration file into the memory of the computer 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 emptying unit is used for emptying the memory of the computer after the database table structure document is generated.
The above-described respective modules may be functional modules or program modules, and may be implemented by software or hardware. For modules implemented in hardware, the various modules described above may be located in the same processor; or the above modules may be located in different processors in any combination.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, configuring entity classes needing to generate a database table structure in a configuration file.
S2, acquiring an absolute path of the entity class needing to generate the database table structure.
S3, obtaining the attributes of the entity class needing to generate the database table structure by utilizing the Java reflection principle and the absolute path.
S4, generating a corresponding database table structure document according to the configuration file and the attributes of the entity class.
It should be noted that, specific examples in this embodiment may refer to examples described in the foregoing embodiments and alternative implementations, and this embodiment is not repeated herein.
The present embodiment also provides a storage medium in which a computer program is stored, wherein the computer program is arranged to perform the method of generating a database table structured document according to any of the above steps when run.
In addition, the method for generating a database table structural document according to the embodiment of the present application described in connection with fig. 1 may be implemented by a device for generating a database table structural document. Fig. 5 is a schematic hardware structure of an apparatus for generating a database table structural document according to an embodiment of the present application.
The device for generating the database table structured document may comprise a processor 51 and a memory 52 storing computer program instructions.
In particular, the processor 51 may include a Central Processing Unit (CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, abbreviated as ASIC), or may be configured to implement one or more integrated circuits of 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 comprise a Hard Disk Drive (HDD), floppy Disk Drive, solid state Drive (Solid State Drive, SSD), flash memory, optical Disk, magneto-optical Disk, tape, or universal serial bus (Universal Serial Bus, USB) Drive, or a combination of two or more of the foregoing. 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 memory. In particular embodiments, memory 52 includes Read-Only Memory (ROM) and random access Memory (Random Access Memory, RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, abbreviated PROM), an erasable PROM (Erasable Programmable Read-Only Memory, abbreviated EPROM), an electrically erasable PROM (Electrically Erasable Programmable Read-Only Memory, abbreviated EEPROM), an electrically rewritable ROM (Electrically Alterable Read-Only Memory, abbreviated EAROM), or a FLASH Memory (FLASH), or a combination of two or more of these. The RAM may be Static Random-Access Memory (SRAM) or dynamic Random-Access Memory (Dynamic Random Access Memory DRAM), where the DRAM may be a fast page mode dynamic Random-Access Memory (Fast Page Mode Dynamic Random Access Memory FPMDRAM), extended data output dynamic Random-Access Memory (Extended Date Out Dynamic Random Access Memory EDODRAM), synchronous dynamic Random-Access Memory (Synchronous Dynamic Random-Access Memory SDRAM), or the like, as appropriate.
Memory 52 may be used to store or cache various data files that need to be processed and/or communicated, as well as possible computer program instructions for execution by processor 51.
The processor 51 implements the method of generating a database table structured document according to any of the above embodiments by reading and executing computer program instructions stored in the memory 52.
In some of these embodiments, the device that generates the database table structural document may also include a communication interface 53 and a bus 50. As shown in fig. 5, the processor 51, the memory 52, and the communication interface 53 are connected to each other through the bus 50 and perform communication with each other.
The communication interface 53 is used to implement communication between modules, devices, units, and/or units in the embodiments of the present application. The communication interface 53 may also enable communication with other components such as: and the external equipment, the image/data acquisition equipment, the database, the external storage, the image/data processing workstation and the like are used for data communication.
Bus 50 includes hardware, software, or both that couple the components of the device that generated the database table structural document to each other. Bus 50 includes, but is not limited to, at least one of: data Bus (Data Bus), address Bus (Address Bus), control Bus (Control Bus), expansion Bus (Expansion Bus), local Bus (Local Bus). By way of example, and not limitation, bus 50 may include a graphics acceleration interface (Accelerated Graphics Port), abbreviated AGP, or other graphics Bus, an enhanced industry standard architecture (Extended Industry Standard Architecture, abbreviated EISA) Bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an industry standard architecture (Industry Standard Architecture, ISA) Bus, a wireless bandwidth (InfiniBand) interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a micro channel architecture (Micro Channel Architecture, abbreviated MCa) Bus, a peripheral component interconnect (Peripheral Component Interconnect, abbreviated PCI) Bus, a PCI-Express (PCI-X) Bus, a serial advanced technology attachment (Serial Advanced Technology Attachment, abbreviated SATA) Bus, a video electronics standards association local (Video Electronics Standards Association Local Bus, abbreviated VLB) Bus, or other suitable Bus, or a combination of two or more of the foregoing. Bus 50 may include one or more buses, where appropriate. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
The device for generating the database table structural document can execute the method for generating the database table structural document according to the embodiment of the application based on the acquired data information, so as to realize a method for generating the database table structural document described in connection with fig. 1.
In addition, in combination with the method for generating the database table structural document in the above embodiment, the embodiment of the application may be implemented by providing a storage medium. The storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement a method of generating a database table structural document in accordance with any of the above embodiments.
In summary, through the above embodiments or preferred embodiments provided in the present application, the following beneficial effects are provided:
1. the database table structure document is generated by a method of not creating the SQL file, so that 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 structural document, the displayed SQL sentences are removed, and the safety of the database can be guaranteed.
3. The method and the device generate the database table structural document on the premise of not creating the SQL file, can reduce the reading of file streams in the process of creating the database table structural document and the process of operating and maintaining the database table structural document, and avoid the waste of computer performance.
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 class attributes can quickly search the entity class attributes corresponding to the database fields when the fields are required to be modified or added in the later period of database maintenance, and reduces the complexity of database maintenance.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (9)

1. A method of generating a database table structured document, the method comprising:
configuring entity classes 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 utilizing a Java reflection principle and the absolute path;
and generating the corresponding database table structure document according to the configuration file and the attributes of the entity class.
2. A method of generating a database table structural document according to claim 1, wherein said configuration file comprises:
and the identification information of the entity class needing to generate the database table structure.
3. A method of generating a database table structure document according to claim 1, wherein said obtaining an absolute path of said entity class for which a database table structure is to be generated comprises:
reading the configuration file into a computer memory through the Property class, and acquiring the identification information of the entity class needing to generate the database table structure;
obtaining path names of all entity classes according to the configuration file to obtain full paths of all entity classes;
and searching all entity classes according to the full path, judging whether the entity class is the entity class needing to generate the database table structure according to the identification information, and if so, writing the absolute path of the entity class needing to generate the database table structure into a computer memory.
4. A method of generating a database table structured document according to claim 1, wherein said obtaining attributes of said entity class using Java reflection principles, said method comprising:
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 structural document according to claim 1, wherein the corresponding database table structural document is generated from the configuration file and attributes of the entity class, the method comprising:
generating SQL sentences of the generated database table structures of the entity classes needing to generate the database table structures, and writing the SQL sentences into a computer memory;
executing the SQL sentence, generating the database table structure document, and clearing the memory of the computer to finish the creation of the database table structure document.
6. The method of generating a database table structured document as recited in claim 5, wherein executing the SQL statement generates the database table structured document comprising:
the SQL statement is converted into the database table structured document by ACCESS application software.
7. An apparatus for generating a database table structured document, the apparatus comprising:
the configuration module is used for configuring entity classes needing to generate a database table structure;
the acquisition module is used for acquiring various data of the database table structural document; the acquisition module comprises a first acquisition module and a second acquisition module; the first acquisition module is used for acquiring an absolute path of an entity class needing to generate a database table structure; the second acquisition module is used for acquiring the attribute of the entity class needing to generate the database table structure by utilizing the Java reflection principle and the absolute path;
and the computer memory module is used for storing data.
8. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to run the computer program to perform a method of generating a database table structure document as claimed in any one of claims 1 to 6.
9. A storage medium having a computer program stored therein, wherein the computer program is arranged to, when run, perform a method of generating a database table structured document as claimed in any one 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 CN112148746A (en) 2020-12-29
CN112148746B true 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)

Families Citing this family (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

Also Published As

Publication number Publication date
CN112148746A (en) 2020-12-29

Similar Documents

Publication Publication Date Title
US20200278875A1 (en) Dynamic loading method, and target file creation method and apparatus
US10042746B2 (en) Callpath finder
US11157251B2 (en) Automatic reference counting
CN110764748B (en) Code calling method, device, terminal and storage medium
CN112667415B (en) Data calling method and device, readable storage medium and electronic equipment
CN111694992B (en) Data processing method and device
CN112148746B (en) Method, device, electronic device and storage medium for generating database table structure document
CN116483859A (en) Data query method and device
CN111241040A (en) Information acquisition method and device, electronic equipment and computer storage medium
US11200203B1 (en) Accessing files stored in a firmware volume from a pre-boot application
CN113656830B (en) Database desensitization grammar parsing method, system, computer and readable storage medium
CN115878654A (en) Data query method, device, equipment and storage medium
CN112232003B (en) Method for simulating design, electronic device and storage medium
CN115629763A (en) Target code generation method and NPU instruction display method and device
US11609893B1 (en) Systems and methods for generating and modifying a pattern for pattern matching utilizing a hierarchical structure that stores one or more values
CN113741878A (en) GraphQL-based interface construction method and system, electronic equipment and storage medium
CN112860628A (en) File system scale management method and system
CN114490651A (en) Data storage method and device
CN111881220A (en) Data operation method and device under list storage, electronic equipment and storage medium
CN113779311A (en) Data processing method, device and storage medium
CN111241346A (en) Object serialization method, device, machine readable medium and system
JP3124318B2 (en) Logic circuit design equipment
CN112579627B (en) SQL time parameter configuration method, system, electronic equipment and storage medium
CN116521713B (en) Data query method, device, equipment and storage medium
US20220197682A1 (en) Native-image in-memory cache for containerized ahead-of-time applications

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