Array type mapping method and device, equipment and medium

By mapping array type for databases that do not support array type, the storage problem of array type data in databases is solved, efficient array type operation and data consistency are achieved, and adaptability and conversion accuracy are improved.

CN119719200APending Publication Date: 2025-03-28WUHAN DAMENG DATABASE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411816074.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When storing array-type data to a database that does not support array-type, there are problems such as reduced query and processing speed and difficult to guarantee data consistency and integrity.

Method used

By obtaining the original array and operation request, the input parameters of the array type are determined, including the instance object of the class, the mapping type and the keyword parameters, and the array type is mapped based on the setting function to obtain the mapping result of the target type, and then the corresponding operation is performed on the mapping result according to the operation request.

Benefits of technology

It realizes the creation, insertion, modification and deletion of array types in a database that does not support array types, reduces the complexity of the array type conversion process, improves the adaptability of array types and the accuracy of the conversion process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719200A_ABST
    Figure CN119719200A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an array type mapping method and device, equipment and a medium, and the method comprises the steps: obtaining input information which comprises an original array and an operation request; if the column type of the original array contains an array type, determining an input parameter of the array type, the input parameter including an instance object of a class, a mapping type and a keyword parameter; mapping the array type based on a set function according to the input parameter to obtain a mapping result of a target type; and executing a corresponding operation on the mapping result based on the operation request. According to the technical scheme, the array type is mapped based on the set function, and the corresponding operation is executed on the mapping result based on the obtained operation request, so that the array of the array type can be stored in the database which does not support the array type, the adaptability of the array type is improved, the interaction of the database is simplified, and the user experience is improved. And the data processing efficiency and the data processing accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of database technology, and in particular to an array type mapping method, device, equipment and medium. Background Art

[0002] Object-Relational Mapping (ORM) is a programming technique that allows programmers to use object-oriented programming languages ​​to operate relational databases. The ORM framework maps the object model in the program to the table structure of the database, and converts database operations into operations on these objects. The role of object-relational mapping is to make a mapping between the relational database and the business entity objects, so that when operating specific business objects, there is no need to deal with complex structured query languages ​​(SQL), and only simple operations on the properties and methods of the objects are required. SQL Alchemy is a popular python object-relational mapping library. By implementing the dialect of a specific database in SQLAlchemy, the application can interact with the database through SQL Alchemy.

[0003] Arrays of array type are often used in Python programs, but most databases except PostgreSQL do not support arrays of array type or the use of arrays of array type. Therefore, when using array type, some strategies need to be adopted to implement the mapping of array type. Traditional mapping methods include serializing array types and using association tables to store array types. When the number of array types is large or the operations are frequent, the traditional mapping method reduces the speed of array query and processing. When using association tables to store array types, the consistency and integrity of array data cannot be ensured. Summary of the invention

[0004] The embodiments of the present disclosure provide an array type mapping method, apparatus, device and medium, so that an array of the array type can be stored in a database that does not support the array type.

[0005] In a first aspect, a mapping method of an array type is provided, comprising:

[0006] Obtaining input information, wherein the input information includes an original array and an operation request;

[0007] If the column type of the original array includes an array type, determining input parameters of the array type, the input parameters including an instance object of a class, a mapping type, and keyword parameters, the keyword parameters being used to accept an indefinite number of keyword parameters;

[0008] According to the input parameters, the array type is mapped based on a set function to obtain a mapping result of a target type;

[0009] A corresponding operation is performed on the mapping result based on the operation request.

[0010] In a second aspect, an array type mapping device is provided, comprising:

[0011] An information acquisition module, used to acquire input information, wherein the input information includes an original array and an operation request;

[0012] A definition module, used for determining input parameters of the array type if the column type of the original array includes an array type, the input parameters including an instance object of a class, a mapping type, and a keyword parameter, the keyword parameter being used to accept an indefinite number of keyword parameters;

[0013] A mapping module, used to map the array type according to the input parameters based on a set function to obtain a mapping result of a target type;

[0014] An execution module is used to execute a corresponding operation on the mapping result based on the operation request.

[0015] According to a third aspect, an electronic device is provided, the electronic device comprising:

[0016] one or more processors;

[0017] A storage device for storing one or more programs;

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the array type mapping method described in the first aspect above.

[0019] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the mapping method of the array type described in the first aspect of the embodiment of the present disclosure is implemented.

[0020] The disclosed embodiment discloses a mapping method, device, equipment and medium of an array type, the method comprising: obtaining input information, the input information including an original array and an operation request; if the column type of the original array includes an array type, determining the input parameters of the array type, the input parameters including an instance object of a class, a mapping type and a keyword parameter, the keyword parameter being used to accept an indefinite number of keyword parameters; mapping the array type based on a set function according to the input parameters to obtain a mapping result of a target type; and performing corresponding operations on the mapping result based on the operation request. The technical solution maps the array type based on a set function to obtain a mapping result, and performs corresponding operations on the mapping result based on the operation request. Compared with the prior art, the technical solution enables an array of an array type to be stored in a database that does not support the array type, and realizes the functions of creating, inserting, modifying, deleting and modifying the array type in a database that does not support the array type, thereby reducing the complexity of the array type conversion process, improving the adaptability of the array type, and improving the accuracy of the array type conversion process.

[0021] 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 disclosure, nor is it intended to limit the scope of the embodiments of the present disclosure. Other features of the embodiments of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 is a flowchart of an array type mapping method provided in the first embodiment of the present disclosure;

[0024] Figure 2 It is a schematic diagram of the process of creating table data provided in the first embodiment of the present disclosure;

[0025] Figure 3 It is a schematic diagram of the process of inserting table data provided in the first embodiment of the present disclosure;

[0026] Figure 4 It is a schematic diagram of the modification and deletion process of table data provided in the first embodiment of the present disclosure;

[0027] Figure 5 is a schematic diagram of a query process of table data provided in the first embodiment of the present disclosure;

[0028] Figure 6 It is a structural diagram of an array-type mapping device provided in Embodiment 2 of the present disclosure;

[0029] Figure 7 It is a structural diagram of an electronic device provided in Embodiment 3 of the present disclosure. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the solutions of the embodiments of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the embodiments of the present disclosure.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0032] Embodiment 1

[0033] Figure 1 This is a flowchart of an array type mapping method provided in the first embodiment of the present disclosure. This embodiment is applicable to the case of mapping array types. The method can be executed by an array type mapping device. The array type mapping device can be implemented in the form of hardware and / or software. The array type mapping device can be configured in an electronic device, including but not limited to computers, computers, terminals, servers and other devices with data processing capabilities. Figure 1 As shown, the method includes:

[0034] S110: Obtain input information, where the input information includes an original array and an operation request.

[0035] In this embodiment, this step can be used to obtain input information, and the input information can be information input by a user. The input information can include an original array and an operation request, wherein the original array can be an array input by a user that needs to be processed, and the operation request can be an operation that the user needs to perform on the original array. The operation request can include: a request to create table data, a request to insert table data, a request to modify and delete table data, and a request to query table data, etc.

[0036] It should be noted that table data can be a data structure stored in a database that does not support array types. Table data is the basic structure for storing information in a relational database. In a relational database, data is organized into one or more tables, each of which consists of rows (records) and columns (fields). Each row represents a data record, and each column represents an attribute or field of the record.

[0037] S120: If the column type of the original array includes an array type, determine input parameters of the array type, where the input parameters include an instance object of the class, a mapping type, and keyword parameters.

[0038] In this embodiment, this step can determine whether the column type of the original array contains an array type, where the column type can also be called a data type. In a database system, the column type defines the data type that can be stored in each column of a table, and can classify data uniformly. The array type can be a type of column type, and the array type is a data structure used to store a series of ordered data elements, which are usually of the same type.

[0039] If the column type of the original array includes an array type, the input parameter of the setting function may be defined, wherein the setting function may be a function for mapping the array type. In this embodiment, the setting function may be expressed as: visit_ARRAY.

[0040] Continuing with the above description, the input parameters may be the parameters required for setting the function to perform type mapping. Specifically, the input parameters include the instance object of the class, the mapping type, and the keyword parameter, wherein the keyword parameter may be able to receive any number of keyword parameters; the instance object of the class may be represented as self, which is usually used in the method definition of the class to represent the instance object of the class itself. When a new instance (object) of a class is created, self in the instance method represents a reference to this object.

[0041] Continuing with the above description, the mapping type can be represented as type_. In this embodiment, type_ can be represented as the CLOB (Character Large Object) type in the large field type (Large Object, LOB). It should be explained that in the database system, the LOB type can be understood as a data type that can store a large amount of data, and the CLOB type is one of the LOB types. The keyword parameter can be represented as **kw. In the definition of the function, **kw can be used to collect any number of keyword parameters.

[0042] S130. Map the array type based on the set function according to the input parameters to obtain a mapping result of the target type.

[0043] It can be known that after the input parameters are determined, the array type can be mapped based on the setting function according to the determined input parameters, and the mapping result of the target type can be obtained, wherein the target type can be a data type that can be stored in the database, and the target type can be a CLOB type. Exemplarily, mapping the array type using the setting function can be expressed as: visit_ARRAY(self, type_, **kw). By mapping the array type through the setting function, the array type of the array can be stored in a database that does not support the array type, thereby improving the adaptability of the array type.

[0044] S140: Perform a corresponding operation on the mapping result based on the operation request.

[0045] In this embodiment, after obtaining a mapping result by mapping an array of an array type, a corresponding operation may be performed on the mapping result based on an operation request of a user, wherein the corresponding operation may be an operation corresponding to the user request.

[0046] Specifically, when the user's operation request is a request to create table data, the corresponding operation may be to create a new table data with the mapping result; when the user's operation request is a request to insert table data, the corresponding operation may be to insert the mapping result into the table data; when the user's operation request is a request to modify or delete table data, the corresponding operation may be to modify the content in the table data based on the mapping result, or to delete the content in the table data; when the user's operation request is a request to query table data, the corresponding operation may be to restore the mapping result to an array type to facilitate user query.

[0047] This embodiment provides a mapping method for array types, including: obtaining input information, the input information including the original array and an operation request; if the column type of the original array includes the array type, determining the input parameters of the array type, the input parameters including the instance object of the class, the mapping type and the keyword parameter; mapping the array type based on the set function according to the input parameters to obtain a mapping result of the target type; performing corresponding operations on the mapping result based on the operation request. This technical solution maps the array type based on the set function to obtain a mapping result, and performs corresponding operations on the mapping result based on the operation request, so that the array of the array type can be stored in a database that does not support the array type, reducing the complexity of the array type conversion process and improving the adaptability of the array type.

[0048] As an optional implementation, the operation request may include a request to create table data;

[0049] The performing a corresponding operation on the mapping result based on the operation request includes:

[0050] Based on the request for creating the table data, the table data corresponding to the mapping result is created using a structured query statement, and the table data is saved.

[0051] Specifically, after mapping the array type to obtain a mapping result, when the user's operation request is a request to create table data, the table data corresponding to the mapping result can be created based on the user's request to create table data using a structured query statement, and the table data can be saved.

[0052] The structured query statement can encapsulate the query or operation in a function or method so as to be reused in the program. The mapping result is created by using the structured query statement, thereby improving the readability, maintainability and reusability of the code.

[0053] Figure 2 The schematic diagram of the process of creating table data given in this embodiment is as follows: Figure 2 As shown, when the column type contains an array type, the array type is mapped and converted into a large field type in the database, and then the table data is created using an assembled SQL statement; for column data that does not contain an array type, the table data can be created directly using an assembled SQL statement.

[0054] As an optional implementation manner, the operation request is a request to insert table data;

[0055] The performing a corresponding operation on the mapping result based on the operation request includes:

[0056] Based on the insertion request of the table data, the mapping result is inserted into the table data using a structured query statement.

[0057] Specifically, after mapping the array type to obtain a mapping result, when the user's operation request is a request to insert table data, the mapping result can be inserted into the table data using a structured query statement based on the user's request to insert table data.

[0058] It should be noted that the array type may also include an array subtype, which may include: Integer type and / or String type. Among them, the Integer type is a numerical type that can be used to store numbers; the String type is a text type that can be used to store text. Therefore, in order to accurately distinguish the Integer type and the String type in the array type in the mapping result and improve the accuracy of the array type in the conversion process, a preset identifier may be added to the mapping result, that is, the mapping result may include header data, a preset identifier and tail data. Among them, the header data may be the length of the string corresponding to each element in the original array, the tail data may be the data obtained by concatenating the strings corresponding to each element in the original array, and the preset identifier may be a pre-set array subtype for identifying the original array. At the same time, the preset identifier may also distinguish the header data and tail data of the mapping result. Exemplarily, the preset identifier may include "i" and "s"; among them, "i" may indicate that the current array type is an Integer type, and "s" may indicate that the current array type is a String type.

[0059] Exemplarily, the original array can be represented as [1,59,234]. After the setting function is used to map the original array of the array type, the mapping result obtained can be represented as a string: '1.2.3i159234'. The string '1.2.3i159234' is divided into a header and a tail. The header data and the tail data are distinguished by matching the first letter 'i' or 's', that is, the header data is '1.2.3i' and the tail data is '159234'. The header data is used to represent the number of elements in the original array by adding 1 to the number of '.', such as: '1.2.3i159234' represents that the number of elements in the original array is 3; the number before each '.' in the header data represents the string length of the current element of the original array, and the last letter 'i' and 's' represent the Integer type or the String type. For example, the header data '1.2.3i' represents the first, second and third elements in the original array, whose corresponding string lengths are 1, 2, and 3 respectively, and are of Integer type. The tail data is the concatenation of all elements in the original array converted into strings. For example, the tail data '159234' can be obtained by converting the elements in the original array [1,59,234] into strings and concatenating them.

[0060] Figure 3 This is a schematic diagram of the table data insertion process provided in this embodiment, as shown in FIG. Figure 3 As shown, when the column type contains an array type, the array type is mapped and converted into a large field type in the database, and an identifier is added to the mapped large field type to distinguish between the Integer type and the String type in the array type, and then the table data is created using the assembled SQL statement; for column data that does not contain an array type, the table data can be directly inserted using the assembled SQL statement.

[0061] As an optional implementation manner, the operation request is a request to modify or delete table data;

[0062] The performing a corresponding operation on the mapping result based on the operation request includes:

[0063] Based on the modification request of the table data, when the screening condition is the entire array, the table data is modified based on the mapping result.

[0064] Specifically, after mapping the array type to obtain the mapping result, when the user's operation request is a request to modify the table data, where the modification request may include requests for modification and / or deletion, the request to modify the table data can be understood as the user wanting to modify or delete the content of the table data, and therefore the content that the user needs to modify can be used as a filtering condition.

[0065] Continuing with the above description, when the filtering condition given by the user is the entire array, the entire array can be mapped, and the mapping result can be used as the filtering condition of the table data. The table data content can be modified according to the filtering condition of the table data, thereby realizing the use of array type filtering conditions to control the filtering of table data and simplifying the process of interaction between array type and data.

[0066] Optionally, the performing a corresponding operation on the mapping result based on the operation request may further include:

[0067] a1) based on a request to modify the table data, when the screening condition is an element in an array, screening the table data using the element to obtain a first screening result;

[0068] It should be noted that, when the user's operation request is a request to modify table data, the filtering condition provided by the user may also be an element in the entire array. When the filtering condition is an element in the array, the table data may be filtered based on the element, and the data in the table data containing the element may be taken as the first filtering result.

[0069] For example, if '3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561' is filtered, when the filter condition is the data with the 10th bit as '23' in the array column, the 10th data element cannot be directly determined because the table data is stored as CLOB type. Therefore, you can call SQL Alchemy calls the SQL statement containing "like" to filter the data containing "23" in the table database. It can be seen that "3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561" contains "23", so "3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561" can be used as the first screening result.

[0070] b1) filtering the first screening result based on preset characteristic information of the element to obtain data in the table to be operated; the preset characteristic information includes a preset element position, a preset character string length and a preset element content;

[0071] Specifically, after obtaining the first filtering result through screening, the first filtering result can be screened based on the preset characteristic information of the element, wherein the preset characteristic information of the element may be pre-set characteristic information, such as: the characteristic information of the element may include a preset element position, a preset string length and a preset element content; wherein the preset element position may be the position of the element in the original array, the preset string length may be the number of characters contained in the element, and the preset element content may be the specific content of the characters contained in the element.

[0072] Exemplarily, when the screening condition is data with the 10th bit in the array column being '23', the preset characteristic information of the element may include: the preset element position is 10, the preset string length is 2, and the preset element content is 23. When the screening condition is data with the 8th bit in the array column being 'ab', the preset characteristic information of the element may include: the preset element position is 8, the preset string length is 2, and the preset element content is ab.

[0073] Specifically, characteristic information of elements in the first screening result may be calculated, and the calculated characteristic information of elements in the first screening result may be compared with preset characteristic information, and the first screening result having the same characteristic information as the preset characteristic information may be used as the data in the table to be operated.

[0074] c1) modifying the data in the table to be operated.

[0075] Specifically, after obtaining the data in the table to be operated, the data in the table to be operated may be modified according to the operation request of the user.

[0076] Optionally, the filtering the first filtering result based on the characteristic information of the element to obtain the filtering result includes:

[0077] a2) comparing the target string length in the first screening result with the preset string length to determine the second screening result; the target string length is the string length at the same position as the preset element position in the header data of the first screening result;

[0078] Specifically, the target string length in the first screening result can be obtained, wherein the target string length is the string length at the same position as the preset element position in the header data of the first screening result. The target string length is compared with the preset string length, and the first screening result corresponding to the target string length that is the same as the preset string length is determined as the second screening result.

[0079] Exemplarily, when '3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561' is screened, when the screening condition is data with the 10th bit being '23', the preset element position is 10, and the preset string length is 2. The target string length of '3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561' is the string length of the 10th bit in the header data, that is, 2, which is the same as the preset string length, and '3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561' can be determined as the second screening result.

[0080] b2) Comparing the target element content in the second screening result with the preset element content to determine the table data to be operated, wherein the target element content is the content of the tail data corresponding to the preset element position of the header data of the first screening result.

[0081] In this embodiment, after filtering the first filtering result by the preset element position and the preset string length to obtain the second filtering result, the target element content of the second filtering result can be obtained, wherein the target element content is the content of the tail data corresponding to the preset element position of the header data of the first filtering result.

[0082] Exemplarily, when the screening condition is data with the 10th bit being '23', the preset element content is '23'. The target element content of '3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561' is the content of the tail data corresponding to the preset element position (10th bit) of the header data. The length of the string before the preset element position in the header data can be added: 3+2+3+4+4+3+2+1+1=23, that is, in the tail data, starting from the 24th bit is the content of the tail data corresponding to the preset element position (10th bit), that is, the target element content is '44'. Because the target element content '44' is inconsistent with the preset element content '23', '3.2.3.4.4.3.2.1.1.2.3.1i12321456122345861221123445561' can be deleted.

[0083] Specifically, when the target element content in the second screening result is the same as the preset element content, the second screening result corresponding to the target element content may be used as the to-be-operated table data.

[0084] Figure 4 The schematic diagram of the modification and deletion process of the table data given in this embodiment is as follows: Figure 4As shown, when the column type contains an array type, it can be determined whether the filtering condition is the entire array of the array type; when the filtering condition is the entire array of the array type, the array type can be mapped in the same way as the insertion process of the table data, and the mapped result can be used as the filtering condition of the table data, and then the assembled SQL statement can be used to modify and delete the table data; when the filtering condition is an element in the entire array of the array type, the SQL statement can be used to filter out the data that does not contain the element in the table data, and the data that will contain the element can be filtered according to the information of the header data and the tail data to obtain the filtering result, and the filtering result can be used as the filtering condition of the table data, and then the assembled SQL statement can be used to modify and delete the table data; for column data that does not contain an array type, the assembled SQL statement can be directly used to create the table data.

[0085] As an optional implementation, the operation request is a query request for table data;

[0086] The performing a corresponding operation on the mapping result based on the operation request includes:

[0087] a3) based on a query request for table data, reading the preset identifier and determining that the original array is an array type according to the preset identifier;

[0088] In this embodiment, the query request for table data may be a user's need to query the content of the table data. When the column type that the user needs to query is an array type, the type of the mapped result stored in the table data (such as: large field type) needs to be restored back to the array type for the user to query.

[0089] Specifically, the mapping result may include header data, a preset identifier and tail data. The preset identifier may be used to distinguish the array type (such as a large field type) corresponding to the mapped mapping result. For example, the preset identifier may be used to distinguish the array type corresponding to the large field type into an Integer type and a String type.

[0090] b3) splitting the tail data according to the header data to obtain an original array.

[0091] Specifically, after using the preset identifier to distinguish the array type, the tail data can be segmented based on the head data in the mapping result, and then the original array can be obtained, thereby realizing the mutual conversion between the array type and the table data stored in the database.

[0092] Exemplarily, the mapping result is '1.2.3i159234', and the preset identifier is the first letter that matches 'i' or 's', that is: 'i', and then it can be determined that the header data is '1.2.3i' and the tail data is '159234'. The number before each '.' in the header data represents the string length of the current element of the original array, and the number of '.' plus 1 is used to represent the number of elements in the original array. According to the content of the header data, it can be known that there are three elements in the original array, the string length corresponding to the first element is 1, the string length corresponding to the second element is 2, and the string length corresponding to the third element is 3, that is, the tail data can be divided into '1', '59' and '234', so that the original data of the array type can be obtained as: [1,59,234].

[0093] Optionally, after the tail data is cut according to the header data to obtain the original array, the method further includes:

[0094] The original array of the corresponding type is displayed using a structured query statement toolkit and an object relational mapping tool.

[0095] Specifically, after obtaining the original array of the array type, the structured query statement toolkit and the object relational mapping tool can be used to display the original array of the corresponding type, so that the user can query the data whose original array in the content of the table data is the array type.

[0096] Figure 5 The schematic diagram of the query process of table data given in this embodiment is as follows: Figure 5 As shown, all column data are traversed. If the column type queried by the user contains an array type, the data in the table data corresponding to the column type queried by the user is exported, and the Integer type and the String type in the array type are distinguished according to the identifier stored in the exported data, and then converted into the corresponding array type; if the column type queried by the user does not contain an array type, the next column type can be traversed until all column types have been traversed, and the query result set is returned.

[0097] Embodiment 2

[0098] Figure 6 is a structural diagram of an array type mapping device provided in the second embodiment of the present disclosure; Figure 6 As shown, the device includes: an information acquisition module 210, a definition module 220, a mapping module 230, and an execution module 240.

[0099] The information acquisition module 210 is used to acquire input information, wherein the input information includes the original array and the operation request;

[0100] A definition module 220, configured to determine input parameters of the array type if the column type of the original array includes an array type, wherein the input parameters include an instance object of a class, a mapping type, and a keyword parameter;

[0101] A mapping module 230, configured to map the array type according to the input parameter based on a set function to obtain a mapping result of a target type;

[0102] The execution module 240 is configured to execute a corresponding operation on the mapping result based on the operation request.

[0103] A second embodiment of the present disclosure provides an array type mapping device, which enables array types to be stored in a database that does not support array types, thereby improving the adaptability of array types.

[0104] Furthermore, the operation request includes a request to create table data; the execution module 240 may also be used to:

[0105] Based on the request for creating the table data, the table data corresponding to the mapping result is created using a structured query statement, and the table data is saved.

[0106] Furthermore, the operation request includes a request to insert table data; the execution module 240 may also be used to:

[0107] Based on the insertion request of the table data, the mapping result is inserted into the table data using a structured query statement.

[0108] Furthermore, the operation request includes a request to modify or delete table data; the execution module 240 may also be used to:

[0109] Based on the modification request of the table data, when the screening condition is the entire array, the table data is modified based on the mapping result.

[0110] Further, the operation request includes a request for modifying or deleting table data; the mapping result includes header data, a preset identifier, and tail data, the header data is the length of the string corresponding to each element in the original array, the tail data is the data of the concatenation of the strings corresponding to each element in the original array, and the preset identifier is used to identify the array subtype of the original array;

[0111] The execution module 240 may further include:

[0112] A first screening unit, configured to screen the table data based on a modification request of the table data and to obtain a first screening result by using the element when the screening condition is an element in an array;

[0113] A screening result determination unit, configured to screen the first screening result based on preset characteristic information of the element to obtain data in the table to be operated; the preset characteristic information includes a preset element position, a preset character string length, and a preset element content;

[0114] The modification unit is used to modify the data in the table to be operated.

[0115] Furthermore, the screening result determination unit can also be used to:

[0116] Compare the target string length in the first screening result with the preset string length to determine the second screening result; the target string length is the length of the string at the same position as the preset element position in the header data of the first screening result;

[0117] The target element content in the second screening result is compared with the preset element content to determine the table data to be operated, wherein the target element content is the content of the tail data corresponding to the preset element position of the header data of the first screening result.

[0118] Further, the operation request includes a query request for table data; the mapping result includes header data, a preset identifier and tail data, the header data is the length of the string corresponding to each element in the original array, the tail data is the data of the concatenation of the strings corresponding to each element in the original array, and the preset identifier is used to identify the array subtype of the original array;

[0119] The execution module 240 may also be used to:

[0120] Based on a query request for table data, read the preset identifier and determine that the original array is an array type according to the preset identifier;

[0121] The tail data is segmented according to the header data to obtain an original array.

[0122] Furthermore, the execution module 240 may also be used to:

[0123] The original array of the corresponding type is displayed using a structured query statement toolkit and an object relational mapping tool.

[0124] The array type mapping device provided in the embodiments of the present disclosure can execute the array type mapping method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0125] Embodiment 3

[0126] Figure 7A schematic diagram of the structure of an electronic device 10 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 components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present disclosure described and / or claimed herein.

[0127] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0128] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0129] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microprocessor, etc. The processor 11 executes the various methods and processes described above, such as an array type mapping method.

[0130] In some embodiments, the array type mapping method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the array type mapping method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the array type mapping method in any other appropriate manner (e.g., by means of firmware).

[0131] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can 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.

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

[0133] In the context of the disclosed embodiments, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0134] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device 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 a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0135] 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: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0136] A computing 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 client and server relationship 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.

[0137] 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 the embodiments of the present disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions of the embodiments of the present disclosure can be achieved, and this document does not limit this.

[0138] The above specific implementations do not constitute a limitation on the protection scope of the embodiments 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 modifications, equivalent substitutions and improvements made within the spirit and principles of the embodiments of the present disclosure shall be included in the protection scope of the embodiments of the present disclosure.

Claims

1. A mapping method of array type, characterized in that: include: Obtaining input information, wherein the input information includes an original array and an operation request; If the column type of the original array includes an array type, determining input parameters of the array type, the input parameters including an instance object of a class, a mapping type, and keyword parameters; According to the input parameters, the array type is mapped based on a set function to obtain a mapping result of a target type; A corresponding operation is performed on the mapping result based on the operation request.

2. The method according to claim 1, characterized in that The operation request includes a request for creating table data; The performing a corresponding operation on the mapping result based on the operation request includes: Based on the request for creating the table data, the table data corresponding to the mapping result is created using a structured query statement, and the table data is saved.

3. The method according to claim 1, characterized in that The operation request includes a request to insert table data; The performing a corresponding operation on the mapping result based on the operation request includes: Based on the insertion request of the table data, the mapping result is inserted into the table data using a structured query statement.

4. The method according to claim 1, characterized in that The operation request includes a request to modify table data; The performing a corresponding operation on the mapping result based on the operation request includes: Based on the modification request of the table data, when the screening condition is the entire array, the table data is modified based on the mapping result.

5. The method according to claim 1, characterized in that The operation request includes a request to modify table data; The mapping result includes header data, a preset identifier and tail data, wherein the header data is the length of the string corresponding to each element in the original array, the tail data is the data of the concatenation of the strings corresponding to each element in the original array, and the preset identifier is used to identify the array subtype of the original array; The performing a corresponding operation on the mapping result based on the operation request includes: Based on the modification request of the table data, when the screening condition is an element in an array, the table data is screened using the element to obtain a first screening result; The first screening result is screened based on preset characteristic information of the element to obtain data in the table to be operated; the preset characteristic information includes a preset element position, a preset character string length and a preset element content; Modify the data in the table to be operated.

6. The method according to claim 5, characterized in that The step of filtering the first filtering result based on the preset characteristic information of the element to obtain the filtering result includes: Compare the target string length in the first screening result with the preset string length to determine the second screening result; the target string length is the string length at the same position as the preset element position in the header data of the first screening result; The target element content in the second screening result is compared with the preset element content to determine the table data to be operated, wherein the target element content is the content of the tail data corresponding to the preset element position of the header data of the first screening result.

7. The method according to claim 1, characterized in that The operation request includes a query request for table data; The mapping result includes header data, a preset identifier and tail data, wherein the header data is the length of the string corresponding to each element in the original array, the tail data is the data of the concatenation of the strings corresponding to each element in the original array, and the preset identifier is used to identify the array subtype of the original array; The performing a corresponding operation on the mapping result based on the operation request includes: Based on a query request for table data, read the preset identifier and determine that the original array is an array type according to the preset identifier; The tail data is segmented according to the header data to obtain an original array.

8. The method according to claim 7, characterized in that After the tail data is segmented according to the header data to obtain the original array, the method further includes: The original array of the corresponding type is displayed using a structured query statement toolkit and an object relational mapping tool.

9. An array type mapping device, characterized in that: include: An information acquisition module, used to acquire input information, wherein the input information includes an original array and an operation request; A definition module, configured to determine input parameters of the array type if the column type of the original array includes an array type, wherein the input parameters include an instance object of a class, a mapping type, and a keyword parameter; A mapping module, used to map the array type according to the input parameters based on a set function to obtain a mapping result of a target type; An execution module is used to execute a corresponding operation on the mapping result based on the operation request.

10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the array type mapping method as described in any one of claims 1-8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the mapping method of the array type as described in any one of claims 1 to 8 is implemented.