Data storage method and device, electronic equipment and storage medium

By automatically generating data value insertion statements and storing data using preset interfaces, the problem of writing specific SQL statements for each type of data in the prior art is solved, and database storage efficiency is improved.

CN119201930APending Publication Date: 2024-12-27BEIJING CO WHEELS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310761699.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-26
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the prior art, when storing structured data to a database, specific SQL statements need to be written for each type of data, resulting in low storage efficiency.

Method used

By obtaining the correspondence between data members, data types and data values, data value insertion statements are automatically generated, and data value insertion statements are stored in the database using the preset interface to avoid writing specific SQL statements.

Benefits of technology

Improve the efficiency of structured data storage to the database, realize automatic data table creation and data value insertion, and reduce the need for writing SQL statements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201930A_ABST
    Figure CN119201930A_ABST
Patent Text Reader

Abstract

The invention provides a data storage method and device, electronic equipment and a storage medium, and relates to the technical field of data processing, and the main technical scheme comprises the following steps: obtaining a data member, a first data type and a data value; generating a data value insertion statement corresponding to the data value according to a pairwise corresponding relationship among the data member, the first data type and the data value; and according to the data value insertion statement, storing the data value in a database. Compared with the prior art, the embodiment of the invention can automatically generate the data value insertion statement and insert the data, and does not need to write a specific SQL statement for each type of data to insert the data, so that the efficiency of storing the structured data into the database is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for data storage, an electronic device, and a storage medium. Background Art

[0002] Structured data, also known as row data, is data that is logically expressed and implemented by a two-dimensional table structure. It strictly follows data format and length specifications and is mainly stored and managed through relational databases.

[0003] The general practice of storing structured data in a database can be divided into three parts: defining the data structure; creating a table in the database; and using Structured Query Language (SQL) statements to write the process of storing data. However, the storage method in the related art requires writing specific SQL statements for each type of data storage, resulting in low efficiency when storing structured data in the database. Summary of the invention

[0004] The present disclosure provides a data storage method, device, electronic device and storage medium, which are mainly intended to solve the problem that when storing structured data in a database, a specific SQL statement needs to be written for each type of data, resulting in low efficiency when storing structured data in the database.

[0005] According to a first aspect of the present disclosure, a method for data storage is provided, comprising:

[0006] Get the data member, the first data type and the data value;

[0007] Generate a data value insert statement corresponding to the data value according to a pairwise correspondence between the data member, the first data type and the data value;

[0008] According to the data value insert statement, the data value is stored in the database.

[0009] Optionally, generating a data value insert statement according to the correspondence between the data member, the first data type and the data value includes:

[0010] According to the data members, the pairwise correspondence between the first data type and the data value, and the mapping relationship between data types, a data value insertion statement corresponding to the data value is generated; the mapping relationship is a mapping relationship between a second data type and a third data type, the second data type is a data type customized in a preset data structure, including at least the first data type, and the third data type is a data type of the database.

[0011] Optionally, before storing the data value in the database according to the data value insert statement, the method further includes:

[0012] According to the correspondence between the data member and the first data type, a data table corresponding to the first data type is created in the database;

[0013] The step of storing the data value in a database according to the data value insert statement includes:

[0014] A first preset interface of the database is called, and the data value insertion statement is executed based on the first preset interface to insert the data value into the data table for storage in the database.

[0015] Optionally, creating a data table corresponding to the first data type in a database according to the correspondence between the data member and the first data type includes:

[0016] Generate a table creation statement according to the correspondence between the data member and the first data type and the mapping relationship;

[0017] A second preset interface of the database is called, and the table creation statement is executed based on the second preset interface to create a data table in the database.

[0018] Optionally, before obtaining the data member, the first data type and the data value, the method further includes:

[0019] According to the received configuration instruction, a preset data structure is configured, wherein the preset data structure is used to obtain the data member, the first data type and the data value;

[0020] The obtaining of the data member, the first data type and the data value includes:

[0021] The data member, the first data type and the data value are respectively obtained through the message interface of the preset data structure.

[0022] Optionally, configuring the preset data structure according to the received configuration instruction includes:

[0023] Generate the configuration instruction using a preset data serialization protocol;

[0024] The preset data structure is configured based on the configuration instruction.

[0025] According to a second aspect of the present disclosure, there is provided a data storage device, comprising:

[0026] An acquisition unit, used for acquiring a data member, a first data type and a data value;

[0027] A generating unit, configured to generate a data value insert statement corresponding to the data value according to a pairwise correspondence between the data member, the first data type and the data value;

[0028] A storage unit is used to store the data value in a database according to the data value insert statement. Optionally, the generation unit is also used to generate a data value insert statement corresponding to the data value according to the data member, the two-to-two correspondence between the first data type and the data value, and the mapping relationship between data types; the mapping relationship is a mapping relationship between a second data type and a third data type, the second data type is a data type defined in a preset data structure and at least includes the first data type, and the third data type is a data type of the database.

[0029] Optionally, the device further comprises:

[0030] A creating unit, configured to create a data table corresponding to the first data type in a database according to a corresponding relationship between the data member and the first data type;

[0031] The storage unit comprises:

[0032] The execution module is used to call a first preset interface of the database, execute the data value insertion statement based on the first preset interface, insert the data value into the data table, and store it in the database.

[0033] Optionally, the creation unit includes:

[0034] A generating module, used for generating a table creation statement according to the corresponding relationship between the data member and the first data type and the mapping relationship;

[0035] An execution module is used to call a second preset interface of the database and execute the table creation statement based on the second preset interface to create a data table in the database.

[0036] Optionally, the device further comprises:

[0037] a configuration unit, configured to configure a preset data structure according to a received configuration instruction, wherein the preset data structure is used to obtain the data member, the first data type and the data value;

[0038] The acquisition unit is further used to respectively acquire the data member, the first data type and the data value through the message interface of the preset data structure.

[0039] Optionally, the configuration unit includes:

[0040] A generating module, used to generate the configuration instruction using a preset data serialization protocol;

[0041] A configuration module is used to configure the preset data structure based on the configuration instruction.

[0042] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0043] at least one processor; and

[0044] a memory communicatively connected to the at least one processor; wherein,

[0045] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect.

[0046] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect.

[0047] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method as described in the first aspect above.

[0048] The data storage method and device, electronic device and storage medium provided by the present disclosure obtain data members, a first data type and a data value; generate a data value insertion statement corresponding to the data value according to the two-to-two correspondence between the data members, the first data type and the data value; store the data value in a database according to the data value insertion statement. Compared with the related art, the embodiment of the present application can automatically generate a data value insertion statement and insert data, without having to write a specific SQL statement for each type of data to insert data, thereby improving the efficiency of storing structured data in a database.

[0049] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0051] Figure 1A schematic diagram of a data storage method provided by an embodiment of the present disclosure;

[0052] Figure 2 A schematic diagram of the structure of a data storage device provided by an embodiment of the present disclosure;

[0053] Figure 3 A schematic diagram of the structure of another data storage device provided by an embodiment of the present disclosure;

[0054] Figure 4 A schematic block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0055] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0056] The following describes the data storage method, device, electronic device, and storage medium according to the embodiments of the present disclosure with reference to the accompanying drawings.

[0057] Figure 1 A flowchart of a data storage method provided by an embodiment of the present disclosure.

[0058] like Figure 1 As shown, the method comprises the following steps:

[0059] Step 101, obtaining a data member, a first data type and a data value.

[0060] In the disclosed embodiment, data members, first data types and data values ​​are all customized. Customization of the first data type refers to: custom selection of data types corresponding to data members and data values. Customization of data members and data values ​​refers to: custom input of data members and data values. Step 102, based on the pairwise correspondence between the data members, the first data types and the data values, generates a data value insertion statement.

[0061] In the embodiment of the present disclosure, the data value insert statement is: a database execution statement, for example: INSERT INTO Person VALUES('Jonh',22), etc. For the format of the data value insert statement, please refer to the detailed description in the related art, so it will not be repeated here.

[0062] The two-to-two correspondences between data members, first data types, and data values ​​can be shown in Table 1:

[0063] Table 1

[0064] Data Members Data Value First data type name John string age 22 uint32 ……… ……… ………

[0065] It should be noted that the data members, first data types and data values ​​listed in Table 1 are only used as examples and do not limit the protection scope of the embodiments of the present disclosure. The format and style of the table can be determined according to actual conditions, and the embodiments of the present disclosure do not limit it.

[0066] Step 103: store the data value in a database according to the data value insert statement.

[0067] In the embodiment of the present disclosure, the result of storing the data value in the database may be as shown in Table 2:

[0068] Table 2

[0069] member value name John age 22 ……… ………

[0070] It should be noted that the data members and data values ​​listed in Table 2 are only used as examples and do not limit the protection scope of the embodiments of the present disclosure. The format and style of the table can be determined according to actual conditions and are not limited by the embodiments of the present disclosure.

[0071] The data storage method provided by the present disclosure obtains data members, a first data type and a data value; generates a data value insertion statement corresponding to the data value according to the pairwise correspondence between the data members, the first data type and the data value; stores the data value in a database according to the data value insertion statement. Compared with the related art, the embodiment of the present application can automatically generate a data value insertion statement and insert data, without having to write a specific SQL statement for each type of data to insert data, thereby improving the efficiency of storing structured data in a database.

[0072] In one implementable manner of the disclosed embodiment, as a refinement of the above step 102, when generating a data value insertion statement according to the correspondence between the data member, the first data type and the data value, it can be implemented in but not limited to the following manner: based on the pairwise correspondence between the data member, the first data type and the data value, and the mapping relationship between data types, a data value insertion statement corresponding to the data value is generated; the mapping relationship is a mapping relationship between a second data type and a third data type, the second data type is a data type customized in a preset data structure, at least including the first data type, and the third data type is a data type of the database.

[0073] In the embodiment of the present disclosure, the mapping relationship is established by the data type in the data structure and the data type in the database, wherein the mapping relationship between the second data type (the data type in the data structure) and the third data type (the data type in the database) can be as shown in Table 3:

[0074] Table 3

[0075] Second data type (data type in data structure) The third data type (data type in the database) int32 INT uint32 INT int64 BIGINT uint64 BIGINT float FLOAT double DOUBLE_PRECISION bool TINYINT string VARCHAR enum VARCHAR ……… ………

[0076] Among them, the second data type includes the first data type, the first data type is custom selected in the second data type, and the number of custom selected first data types in the second data type is the same as the number of data members. The mapping relationship between the second data type and the third data type cannot be changed after it is established. It should be noted here that the data types listed in the above Table 3 are only used as examples and do not constitute a limitation on the protection scope of the embodiments of the present disclosure. The format and style of the table can be determined according to actual conditions, and the embodiments of the present disclosure do not limit it.

[0077] In one implementable manner of the embodiment of the present disclosure, as a refinement of the above-mentioned step 103, in order to store the data value normally in the database, the data value needs to be inserted into a data table, and the data table into which the data value is inserted needs to be stored in the database. Therefore, before storing the data value in the database according to the data value insert statement, the following method may also be adopted but is not limited to: creating a data table corresponding to the first data type in the database according to the correspondence between the data member and the first data type; wherein, storing the data value in the database according to the data value insert statement includes: calling a first preset interface of the database, executing the data value insert statement based on the first preset interface, and inserting the data value into the data table for storage in the database.

[0078] In the embodiment of the present disclosure, the data table is a table that can be stored in a database and contains data members. The table can be as shown in Table 4:

[0079] Table 4

[0080]

[0081] It should be noted that the members listed in Table 4 are only used as examples and do not limit the protection scope of the embodiments of the present disclosure. The format and style of the table can be determined according to actual conditions and are not limited by the embodiments of the present disclosure.

[0082] The first preset interface of the database is: an interface for calling the database and executing database statements. Specifically, for the interface for calling the database and executing database statements, please refer to the detailed description in the relevant technology, so it will not be repeated here.

[0083] Related to the above embodiment, regarding the data table, it needs to be created in the database by executing a create table creation statement. Therefore, in order to successfully create a data table in the database, it can be implemented by but not limited to the following methods: generating a table creation statement based on the correspondence between the data member and the first data type and the mapping relationship; calling the second preset interface of the database, and executing the table creation statement based on the second preset interface to create a data table in the database.

[0084] The mapping relationship is established through the data type in the data structure and the data type in the database. The table creation statement is, for example: CREATE TABLE IF NOT EXISTS Person(name VARCHAR, age INT), etc. The second preset interface of the database is the same as the first preset interface of the above-mentioned database: an interface for the database to call and execute database statements. The difference is that the first preset interface of the database and the second preset interface of the database are responsible for calling and executing different types of database statements. The first preset interface of the database is responsible for calling and executing data value insertion statements, and the second preset interface of the database is responsible for calling and executing table creation statements.

[0085] In one implementable manner of the embodiment of the present disclosure, it is necessary to customize a data structure to automatically obtain data members, a first data type, and a data value. In order to automatically obtain data members, a first data type, and a data value, and generate table creation statements and data value insertion statements, before obtaining data members, a first data type, and a data value through a preset data structure, the following method may also be used but is not limited to: according to the received configuration instructions, the preset data structure is configured, and the preset data structure is used to obtain the data members, the first data type, and the data value; wherein, the obtaining of data members, the first data type, and the data value includes: respectively obtaining the data members, the first data type, and the data value through the message interface of the preset data structure. wherein, the configuration instruction is: an instruction for customizing input through a preset input device. The preset input device may be, but is not limited to: a keyboard, a touch screen, etc., and the specific customization of the configuration instruction is not limited by the embodiment of the present disclosure.

[0086] Related to the above-mentioned embodiment, in one possible implementation of the embodiment of the present disclosure, the configuration of the preset data structure according to the received configuration instruction can be implemented in the following manners, but not limited to: generating the configuration instruction using a preset data serialization protocol; configuring the preset data structure based on the configuration instruction. The preset data serialization protocol is a custom selected data serialization protocol, such as Protocol Buffers, etc. Specifically, the selection of the preset data serialization protocol can be determined according to the actual situation, and the embodiment of the present disclosure does not limit it.

[0087] In summary, the embodiments of the present disclosure can achieve the following effects:

[0088] 1. By automatically generating data tables and inserting data values, when structured data is stored in the database, there is no need to write specific SQL statements for each type of data to generate data tables and insert data values, which improves the efficiency of storing structured data in the database.

[0089] Corresponding to the above data storage method, the present invention also provides a data storage device. Since the device embodiment of the present invention corresponds to the above method embodiment, details not disclosed in the device embodiment can be referred to the above method embodiment, and will not be repeated in the present invention.

[0090] Figure 2 A schematic diagram of a data storage device provided in an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, including:

[0091] An acquisition unit 21, used for acquiring a data member, a first data type and a data value;

[0092] A generating unit 22, configured to generate a data value insert statement corresponding to the data value according to a pairwise correspondence between the data member, the first data type and the data value;

[0093] The storage unit 23 is used to store the data value in the database according to the data value insert statement. The data storage device provided by the present disclosure obtains data members, a first data type and a data value; generates a data value insert statement corresponding to the data value according to the pairwise correspondence between the data members, the first data type and the data value; and stores the data value in the database according to the data value insert statement. Compared with the related art, the embodiment of the present application can automatically generate a data value insert statement and insert data, without having to write a specific SQL statement for each type of data to insert data, thereby improving the efficiency of storing structured data in the database.

[0094] Furthermore, in a possible implementation of the embodiment of the present disclosure, the generation unit 22 is also used to generate a data value insertion statement corresponding to the data value based on the data member, the pairwise correspondence between the first data type and the data value, and the mapping relationship between data types; the mapping relationship is a mapping relationship between a second data type and a third data type, the second data type is a data type customized in a preset data structure, including at least the first data type, and the third data type is a data type of the database.

[0095] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 3 As shown, the device also includes:

[0096] A creating unit 24, configured to create a data table corresponding to the first data type in a database according to the corresponding relationship between the data member and the first data type;

[0097] The storage unit 23 includes:

[0098] The execution module 231 is used to call a first preset interface of the database, execute the data value insertion statement based on the first preset interface, insert the data value into the data table, and store it in the database.

[0099] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 3 As shown, the creation unit 24 includes:

[0100] A generating module 241, configured to generate a table creation statement according to the corresponding relationship between the data member and the first data type and the mapping relationship;

[0101] The execution module 242 is used to call a second preset interface of the database and execute the table creation statement based on the second preset interface to create a data table in the database.

[0102] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 3 As shown, the device also includes:

[0103] A configuration unit 25, configured to configure a preset data structure according to a received configuration instruction, wherein the preset data structure is used to obtain the data member, the first data type and the data value;

[0104] The acquisition unit 21 is further used to respectively acquire the data member, the first data type and the data value through the message interface of the preset data structure.

[0105] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 3 As shown, the configuration unit 25 includes:

[0106] A generating module 251, configured to generate the configuration instruction using a preset data serialization protocol;

[0107] The configuration module 252 is used to configure the preset data structure based on the configuration instruction.

[0108] It should be noted that the above explanation of the method embodiment is also applicable to the device of the embodiment of the present disclosure, and the principle is the same, which is no longer limited in the embodiment of the present disclosure.

[0109] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0110] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0111] like Figure 4 As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 402 or a computer program loaded from a storage unit 408 to a RAM (Random Access Memory) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An I / O (Input / Output) interface 405 is also connected to the bus 404.

[0112] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0113] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as a method for data storage. For example, in some embodiments, the method for data storage may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to execute the aforementioned data storage method in any other appropriate manner (for example, by means of firmware).

[0114] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0115] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0116] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or a flash memory, an optical fiber, a CD-ROM (Compact Dis sc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0117] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0118] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.

[0119] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0120] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0121] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0122] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for data storage, characterized in that: include: Get the data member, the first data type and the data value; Generate a data value insert statement corresponding to the data value according to a pairwise correspondence between the data member, the first data type and the data value; According to the data value insert statement, the data value is stored in the database.

2. The method according to claim 1, characterized in that: The generating of the data value insert statement according to the correspondence between the data member, the first data type and the data value comprises: According to the data members, the pairwise correspondence between the first data type and the data value, and the mapping relationship between data types, a data value insertion statement corresponding to the data value is generated; the mapping relationship is a mapping relationship between a second data type and a third data type, the second data type is a data type customized in a preset data structure, including at least the first data type, and the third data type is a data type of the database.

3. The method according to claim 1, characterized in that Before storing the data value in the database according to the data value insert statement, the method further includes: According to the correspondence between the data member and the first data type, a data table corresponding to the first data type is created in the database; The step of storing the data value in a database according to the data value insert statement includes: A first preset interface of the database is called, and the data value insertion statement is executed based on the first preset interface to insert the data value into the data table for storage in the database.

4. The method according to claim 3, wherein the step of creating a data table corresponding to the first data type in a database according to the corresponding relationship between the data member and the first data type comprises: Generate a table creation statement according to the correspondence between the data member and the first data type and the mapping relationship; A second preset interface of the database is called, and the table creation statement is executed based on the second preset interface to create a data table in the database.

5. The method according to any one of claims 1 to 4, characterized in that Before acquiring the data member, the first data type and the data value, the method further includes: According to the received configuration instruction, a preset data structure is configured, wherein the preset data structure is used to obtain the data member, the first data type and the data value; The obtaining of the data member, the first data type and the data value includes: The data member, the first data type and the data value are respectively obtained through the message interface of the preset data structure.

6. The method according to claim 5, characterized in that The configuring the preset data structure according to the received configuration instruction includes: Generate the configuration instruction using a preset data serialization protocol; The preset data structure is configured based on the configuration instruction.

7. A data storage device, characterized in that: include: An acquisition unit, used for acquiring a data member, a first data type and a data value; A generating unit, configured to generate a data value insert statement corresponding to the data value according to a pairwise correspondence between the data member, the first data type and the data value; The storage unit is used to store the data value in a database according to the data value insert statement.

8. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.

10. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method, device and equipment for operating relational database based on C language

    CN112015831A

  • Method and device for creating data table, equipment and storage medium

    CN113505128A

  • Database lake-entering configuration method and system, electronic equipment and storage medium

    CN115774750A