Disclosure of Invention
In view of this, the present invention provides an operation method and system for a data table in a database, so as to solve the problems in the prior art that the original operation on the data table in the database needs to put forward higher technical requirements on operators, and the incorrect operation is easy to occur, which affects the correct storage of data.
In order to achieve the purpose, the invention provides the following technical scheme:
a method for operating a data table in a database, which is applied to LabVIEW software, comprises the following steps:
reading an original data table, and assigning original field information corresponding to the original data table to a corresponding original control on an interface for displaying;
determining a target control through a user instruction, and modifying first target field information of the target control to obtain second target field information;
and obtaining an updated data table according to the second target field information.
The reading of the original data table and the assignment of the original field information corresponding to the original data table to the corresponding original control on the interface for display includes:
reading the original data table, and reading a file to be configured corresponding to the original data table through a file operation function;
analyzing the content of the file to be configured, and converting the content of the file to be configured into original field information corresponding to the original data table through character string conversion;
and assigning the original field information to the corresponding original control on the interface, and displaying the name of the file to be configured and the original field information in the original control on the interface.
Wherein, obtaining the updated data table according to the second target field information includes:
creating SQL sentences containing all target field information corresponding to the target control in the LabVIEW software according to the second target field information;
and downloading a database operation function through a database tool to execute the SQL statement to obtain an updated data table.
Preferably, the method further comprises the following steps:
converting the second target field information in the updated data table into a character string format supported by the file operation function;
and storing the converted character strings into corresponding format files through the file operation function and storing the format files in a database.
And the first target field information is all target field information or part of target field information corresponding to the target control.
Wherein the original control comprises: field name, data type, data length, and whether NULL is allowed.
An operating system of a data table in a database, which is applied to LabVIEW software, and comprises:
the reading module is used for reading an original data table and assigning original field information corresponding to the original data table to a corresponding original control on an interface for displaying;
the modification module is used for determining a target control through a user instruction and modifying first target field information of the target control to obtain second target field information;
and the updating module is used for obtaining an updated data table according to the second target field information.
Wherein, the reading module comprises:
the reading unit is used for reading the original data table and reading a file to be configured corresponding to the original data table through a file operation function;
the analysis unit is used for analyzing the content of the file to be configured and converting the content of the file to be configured into original field information corresponding to the original data table through character string conversion;
and the assignment display unit is used for assigning the original field information to the corresponding original control on the interface and displaying the name of the file to be configured and the original field information in the original control on the interface.
Wherein the update module comprises:
the statement creating unit is used for creating SQL statements containing all target field information corresponding to the target control in the LabVIEW software according to the second target field information;
and the execution unit is used for downloading a database operation function through a database tool and executing the SQL statement to obtain an updated data table.
Preferably, the method further comprises the following steps:
a conversion module, configured to convert the second target field information in the updated data table into a string format supported by the file operation function;
and the storage module is used for storing the converted character strings into corresponding format files through the file operation function and storing the format files in a database.
Through the technical scheme, compared with the prior art, the invention discloses an operation method and a system of a data table in a database, which are applied to LabVIEW software, and the method comprises the following steps: reading an original data table, and assigning original field information corresponding to the original data table to a corresponding original control on an interface for displaying; determining a target control through a user instruction, and modifying first target field information of the target control to obtain second target field information; and obtaining an updated data table according to the second target field information. The method is developed based on LabVIEW language, firstly, original field information corresponding to an original data table is displayed in an original control on an interface, a target control needing to be modified is determined according to a user instruction, then, first target field information of the target control is modified according to the user requirement, modified second target field information is obtained, finally, an updated data table is obtained according to the second target field information, a user can directly display all field information of the data table on the interface control, then, operations such as modification, addition or deletion are carried out on the field information in the control according to test indexes, processing operation is carried out by professional personnel without using a database editing and management tool, the field information in the control can be directly operated, misoperation is not easy to occur, and correct storage of data is guaranteed.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating an operation method of a data table in a database according to an embodiment of the present invention. As shown in fig. 1, the present invention discloses an operation method of a data table in a database, which is applied to LabVIEW software, and the method specifically comprises the following steps:
s101, reading the original data table, and assigning the original field information corresponding to the original data table to the corresponding original control on the interface for displaying.
It should be noted that, in the present invention, the original data table needs to be read, and the original field information corresponding to the original data table is assigned to the corresponding original control on the interface for display. Specifically, as shown in fig. 2, fig. 2 is a schematic diagram of an original field information interface control of an original data table according to an embodiment of the present invention, and the present invention mainly aims to create and configure a data table, support importing a configuration file from the interface in fig. 2 and editing the configuration file directly on the interface, and support customizing a table name of the data table and configuring field information in the original control. As shown in fig. 2, the configurable original field information may mainly include: number of fields, field name, data type (string, long, single, double, date/time, binary), data length, whether NULL is allowed, etc.
S102, determining a target control through a user instruction, and modifying first target field information of the target control to obtain second target field information.
During configuration, a target control needs to be determined from original controls corresponding to an original data table displayed in an interface according to a user instruction, that is, a control corresponding to field information content which a user needs to modify, delete or add, and then the corresponding field information is used as target field information to be modified.
It should be noted that, after receiving a modification instruction of a target control from a user, modifying corresponding first target field information to obtain second target field information, where the first target field information may be all field information corresponding to the target control, or may be part of target field information corresponding to the target control.
And S103, obtaining an updated data table according to the second target field information.
It should be noted that, the data table is created and configured in the database according to the obtained second target field information, so as to obtain an updated data table, the updated data table is displayed in the corresponding target control, and the updated data table is generated in the database according to the modified second target field information, so as to implement creation and configuration of the data table.
Specifically, referring to fig. 3, fig. 3 is a flowchart illustrating a specific method of step S101 in fig. 1 according to an embodiment of the present invention. As shown in fig. 3, step S101, reading an original data table, and assigning original field information corresponding to the original data table to a corresponding original control on an interface for display, where the step specifically includes the following steps:
s301, reading the original data table, and reading the file to be configured corresponding to the original data table through the file operation function.
Referring to fig. 4, fig. 4 is a block diagram of a process of reading a configuration file and saving the configuration file according to an embodiment of the present invention. As shown in fig. 4, data is read in an xml data format and then a file is stored in the xml data format.
S302, analyzing the content of the file to be configured, and converting the content of the file to be configured into original field information corresponding to the original data table through character string conversion.
And converting the content of the read configuration file into original field information corresponding to the original data table through character string conversion. The original field information may mainly include: field name, data type (string, long, single, double, date/time, binary), data length, whether NULL is allowed, etc.
And S303, assigning the original field information to a corresponding original control on the interface, and displaying the name of the file to be configured and the original field information in the original control on the interface.
In this embodiment, the program reads the file to be configured, processes the data of the file to be configured, analyzes the data into the original field information of the original data table, assigns the original field information to the corresponding original control on the interface, and displays the name of the file to be configured and the original field information in the original control on the interface.
Specifically, referring to fig. 5, fig. 5 is a flowchart illustrating a specific method of step S103 in fig. 1 according to an embodiment of the present invention. As shown in fig. 5, step S103 obtains an updated data table according to the second target field information, and the step specifically includes the following steps:
s501, creating SQL sentences containing all target field information corresponding to the target control in LabVIEW software according to the second target field information.
In this embodiment, as shown in fig. 6, fig. 6 is a block diagram of a data table updating procedure provided in the embodiment of the present invention. And the user judges, analyzes and converts the interface configuration data, and creates an SQL (structured query language) statement containing all the target field information corresponding to the target control in LabVIEW software by connecting the second target field information with the character string to generate the SQL statement.
It should be noted that the SQL statement includes three parts: data table name: the data table name entered using the interface. Field information in data table: the method is characterized in that a cycle structure is used, and all interface custom column field cluster arrays are traversed; columns are separated by 'separation', the information of each field is separated by a blank space, and the data type is unified into a character string type; and calling a connection character string function, connecting all column field information into a character string statement, and removing the comma which is added at last. Data table attribute information: the table storage engine is added as "inodb", the default character set is "gbk", and the line storage form is "COMPACT".
S502, downloading a database operation function through a database tool to execute the SQL statement, and obtaining an updated data table.
In this embodiment, the program executes the SQL statement through a DB toolexecute Query function of a DB Tools (Database Tool), so as to complete creation and configuration of the data table, and obtain an updated data table.
Specifically, referring to fig. 7, fig. 7 is another flow chart illustrating an operation method of a data table in a database according to an embodiment of the present invention. As shown in fig. 7, an embodiment of the present invention discloses an operation method for a data table in a database, which specifically includes the following steps:
and S701, reading the original data table, and assigning the original field information corresponding to the original data table to the corresponding original control on the interface for displaying.
It should be noted that, in the present invention, the original data table needs to be read, and the original field information corresponding to the original data table is assigned to the corresponding original control on the interface for display. Specifically, as shown in fig. 2, fig. 2 is a schematic diagram of an original field information interface control of an original data table according to an embodiment of the present invention, and the present invention mainly aims to create and configure a data table, support importing a configuration file from the interface in fig. 2 and editing the configuration file directly on the interface, and support customizing a table name of the data table and configuring field information in the original control. As shown in fig. 2, the configurable original field information may mainly include: number of fields, field name, data type (string, long, single, double, date/time, binary), data length, whether NULL is allowed, etc.
S702, determining a target control through a user instruction, and modifying first target field information of the target control to obtain second target field information.
During configuration, a target control needs to be determined from controls in an original data table displayed in an interface control according to a user instruction, that is, a control corresponding to field information content which a user needs to modify, delete or add, and then the corresponding field information is used as target field information to be modified.
It should be noted that, after receiving a modification instruction of a target control from a user, modifying corresponding first target field information to obtain second target field information, where the first target field information may be all field information corresponding to the target control, or may be part of target field information corresponding to the target control. .
And S703, obtaining the updated data table according to the second target field information.
It should be noted that, the data table is created and configured in the database according to the obtained second target field information, so as to obtain an updated data table, the updated data table is displayed in the corresponding target control, and the updated data table is generated in the database according to the modified second target field information, so as to implement creation and configuration of the data table.
S704, converting the second target field information in the updated data table into a character string format supported by the file operation function.
S705, storing the converted character strings as corresponding format files in a database through a file operation function.
In the above process, the file operation function is different according to different formats of the configuration file, for example, when the configuration file is in an xml format, the file operation function is an xml function, and when the configuration file is in a txt format, the file operation function is a txt function.
The embodiment can store the updated data table, and can provide the user with the possibility of directly calling when a similar data table is used subsequently.
In the embodiment, when a user needs to use a new database, the user only needs to update the field information in the configuration file and then directly clicks the creation on the interface to create and configure the data table; or the configuration file is not selected to be updated, the configuration file stored before is reused, the configuration file is analyzed to obtain a data table, the data table is displayed in the interface control, and then the relevant data is automatically modified in the interface control. Taking an xml format configuration file as an example, loading the configuration file uses a read xml function to read the configuration file, then converts the read character string into a data table field information format, and assigns a value to an interface control to display; the configuration file is stored by firstly converting the interface control value into a character string format and then storing the interface control value by using a write-in xml file function.
The invention discloses an operation method and a system of a data table in a database, which are applied to LabVIEW software, and the method comprises the following steps: reading an original data table, and assigning original field information corresponding to the original data table to a corresponding original control on an interface for displaying; determining a target control through a user instruction, and modifying first target field information of the target control to obtain second target field information; and obtaining an updated data table according to the second target field information. The method is developed based on LabVIEW language, firstly, original field information corresponding to an original data table is displayed in an original control on an interface, a target control needing to be modified is determined according to a user instruction, then, first target field information of the target control is modified according to the user requirement, modified second target field information is obtained, finally, an updated data table is obtained according to the second target field information, a user can directly display all field information of the data table on the interface control, then, operations such as modification, addition or deletion are carried out on the field information in the control according to test indexes, processing operation is carried out by professional personnel without using a database editing and management tool, the field information in the control can be directly operated, misoperation is not easy to occur, and correct storage of data is guaranteed.
The invention also discloses a corresponding system based on the method.
Referring to fig. 8, fig. 8 is a schematic diagram of an operating system structure of a data table in a database according to an embodiment of the present invention. As shown in fig. 8, the present invention discloses an operating system for a data table in a database, which is applied to LabVIEW software, and the system specifically includes the following structure:
thereading module 801 is configured to read an original data table, and assign original field information corresponding to the original data table to a corresponding original control on an interface for display;
themodification module 802 is configured to determine a target control through a user instruction, and modify first target field information of the target control to obtain second target field information;
and theupdating module 803 is configured to obtain an updated data table according to the second target field information.
Since each module in this embodiment can execute the method shown in fig. 1, reference may be made to the related description of fig. 1 for a part of this embodiment that is not described in detail.
Specifically, as shown in fig. 9, thereading module 801 specifically includes the following structures:
areading unit 901, configured to read an original data table, and read a file to be configured corresponding to the original data table through a file operation function;
theparsing unit 902 is configured to parse the content of the file to be configured, and convert the content of the file to be configured into original field information corresponding to the original data table through character string conversion;
and theassignment display unit 903 is configured to assign the original field information to a corresponding original control on the interface, and display the name of the file to be configured and the original field information in the original control on the interface.
Since each module in this embodiment can execute the method shown in fig. 3, reference may be made to the related description of fig. 3 for a part not described in detail in this embodiment.
Specifically, as shown in fig. 10, theupdate module 803 specifically includes the following structure:
astatement creating unit 1001, configured to create, in LabVIEW software, an SQL statement that includes all pieces of target field information corresponding to the target control according to the second piece of target field information;
theexecution unit 1002 is configured to download a database operation function through a database tool and execute an SQL statement, so as to obtain an updated data table.
Since each module in this embodiment can execute the method shown in fig. 5, reference may be made to the related description of fig. 5 for a part of this embodiment that is not described in detail.
Referring to fig. 11, fig. 11 is another schematic structural diagram of an operating system for a data table in a database according to an embodiment of the present invention. As shown in fig. 11, an embodiment of the present invention discloses an operating system for a data table in a database, which is applied to LabVIEW software, and the system specifically includes the following structure:
thereading module 1101 is configured to read an original data table, and assign original field information corresponding to the original data table to a corresponding original control on an interface for display;
themodification module 1102 is configured to determine a target control through a user instruction, and modify first target field information of the target control to obtain second target field information;
anupdating module 1103, configured to obtain an updated data table according to the second target field information.
Aconversion module 1104, configured to convert the second target field information in the updated data table into a string format supported by the file operation function;
thestorage module 1105 is configured to store the converted character strings as corresponding format files in a database through a file operation function.
Since each module in this embodiment can execute the method shown in fig. 7, reference may be made to the related description of fig. 7 for a part of this embodiment that is not described in detail.
The invention discloses an operating system of a data table in a database, which is applied to LabVIEW software and is developed based on LabVIEW language, firstly, original field information corresponding to an original data table is displayed in an original control on an interface, a target control needing to be modified is determined according to a user instruction, then, first target field information of the target control is modified according to the requirement of a user to obtain modified second target field information, finally, an updated data table is obtained according to the second target field information, the user can directly display all field information of the data table on the interface control, then, the field information in the control is modified, added or deleted according to a test index, and the like, the processing operation is carried out by professional personnel without using a database editing and managing tool, the field information in the control can be directly operated, and misoperation is not easy to occur, the correct storage of data is ensured.
In summary, the present invention discloses a method and a system for operating a data table in a database, which are applied to LabVIEW software, and the method includes: reading an original data table, and assigning original field information corresponding to the original data table to a corresponding original control on an interface for displaying; determining a target control through a user instruction, and modifying first target field information of the target control to obtain second target field information; and obtaining an updated data table according to the second target field information. The method is developed based on LabVIEW language, firstly, original field information corresponding to an original data table is displayed in an original control on an interface, a target control needing to be modified is determined according to a user instruction, then, first target field information of the target control is modified according to the user requirement, modified second target field information is obtained, finally, an updated data table is obtained according to the second target field information, a user can directly display all field information of the data table on the interface control, then, operations such as modification, addition or deletion are carried out on the field information in the control according to test indexes, processing operation is carried out by professional personnel without using a database editing and management tool, the field information in the control can be directly operated, misoperation is not easy to occur, and correct storage of data is guaranteed.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
The method proposed by the present invention is described above by way of example with reference to the accompanying drawings, and the above description of the embodiments is only intended to help the understanding of the core ideas of the present invention. For those skilled in the art, variations can be made in the specific embodiments and applications without departing from the spirit of the invention. In view of the above, the present disclosure should not be construed as limiting the invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.