Composite array analysis method and device, equipment and storage medium

By converting the composite type array into a single type string in the C language processing layer and parsing it in the SQL processing layer, the problem of difficulty in obtaining composite array data in the database is solved, and the function of reading composite type arrays from the SQL database is realized.

CN118673040AInactive Publication Date: 2024-09-20WUHAN DAMENG DATABASE
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410806481.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-20
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the database, it is difficult for users to obtain composite array data directly from the SQL level, and traditional methods cannot obtain composite type array data through programming interfaces.

Method used

By converting the composite type input array into a single type of string to be parsed in the C language processing layer, parsing it in the SQL language processing layer, and obtaining the output array, the problem of directly reading composite type array data is solved.

Benefits of technology

It realizes the ability to directly read composite type array data from SQL database, and provides a solution to facilitate the acquisition of composite array data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673040A
    Figure CN118673040A
Patent Text Reader

Abstract

The invention discloses a composite array analysis method and device, equipment and a storage medium. The method comprises the steps of obtaining a composite type input array; according to a preset data format, packaging the array row number of the input array and the array data of each row to obtain a to-be-analyzed character string; and distributing an array memory space according to the array row number of the to-be-analyzed character string, and analyzing the to-be-analyzed character string according to the array memory space to obtain an output array. The method comprises the following steps: converting a composite type of input array into a single type of to-be-analyzed character string in a C language processing layer; one-step analysis is carried out on a single type of to-be-analyzed character string in an SQL language processing layer to obtain an output array, and a composite type of array can be read from an SQL database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a composite array parsing method, device, equipment and storage medium. Background Art

[0002] In database products, users often need to process the data in the database through programming interfaces and receive the returned data at the SQL level. In most cases, users can easily obtain simple single data, such as int, double and text data, through programming interfaces.

[0003] However, it is often difficult for users to directly obtain composite array data from SQL. In the use of traditional databases, this problem is often ignored; and from a programming perspective, it is also impossible for SQL to directly obtain composite array data through an interface. Summary of the invention

[0004] The present invention provides a composite array parsing method, device, equipment and storage medium to solve the problem of directly reading composite type array data from a SQL database.

[0005] According to one aspect of the present invention, a composite array parsing method is provided, comprising:

[0006] Get the input array of composite type;

[0007] Perform data type conversion and encapsulation processing on the number of array rows and array data of each row of the input array according to a preset data format to obtain a character string to be parsed;

[0008] Array memory space is allocated according to the number of array rows of the character string to be parsed, and the character string to be parsed is parsed according to the array memory space to obtain an output array.

[0009] Furthermore, the preset data format includes a header and a tail; the header is used to store the number of array rows of the input array; the tail is used to store array data of each row of the input array, and each row of array data includes: data length and data information.

[0010] Furthermore, the number of array rows and each row of array data of the input array are converted into data types and packaged according to a preset data format to obtain a string to be parsed, including:

[0011] Allocating a header string memory space for the header of the string to be parsed;

[0012] Convert the array row number of the input array into an array row number string, and write the array row number string into the header string memory space to obtain a header string;

[0013] Allocating tail string memory space for the tail of the string to be parsed;

[0014] Converting each row of array data of the input array into an array data string respectively, and writing each of the array data strings into the tail string memory space in sequence to obtain a tail string;

[0015] The head character string and the tail character string are encapsulated to obtain a character string to be parsed.

[0016] Further, the tail string memory space includes: a string memory space corresponding to each array data; allocating the tail string memory space for the tail of the string to be parsed includes:

[0017] For each row of array data in the input array, a character string memory space is allocated to the data information according to the length of each data information in the array data.

[0018] Furthermore, the array memory space includes: the array row number memory space and the array data memory space; allocating the array memory space according to the array row number of the character string to be parsed includes:

[0019] The head string of the string to be parsed is separated by a string segmentation function to obtain an array row number string;

[0020] Allocate memory space for the number of array rows according to the number of array row character string;

[0021] Convert the array row number string into integer type data, and write the integer type data into the array row number memory space to obtain the array row number;

[0022] Allocate array data memory space for the output array according to the number of array rows.

[0023] Further, the character string to be parsed is parsed according to the array memory space to obtain an output array, including:

[0024] Parse the tail string of the string to be parsed to obtain each line of array data;

[0025] Each row of array data is converted into output array data of a preset type, and each of the output array data is sequentially written into the array data memory space to obtain an output array.

[0026] Further, the tail string of the string to be parsed is parsed to obtain each line of array data, including:

[0027] Read each line of array data string in the tail string of the string to be parsed in sequence;

[0028] Get the data length and data information in each row of array data string.

[0029] According to another aspect of the present invention, there is provided a composite array parsing device, comprising:

[0030] The acquisition module is used to obtain the input array of composite type;

[0031] The encapsulation module is used to perform data type conversion and encapsulation processing on the number of array rows and array data of each row of the input array according to a preset data format to obtain a character string to be parsed;

[0032] The parsing module is used to allocate array memory space according to the number of array rows of the character string to be parsed, and parse the character string to be parsed according to the array memory space to obtain an output array.

[0033] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0034] at least one processor; and

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

[0036] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the composite array parsing method described in any embodiment of the present invention.

[0037] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the composite array parsing method described in any embodiment of the present invention when executed.

[0038] The technical solution of the embodiment of the present invention obtains a composite type input array; encapsulates the number of array rows and array data of each row of the input array according to a preset data format to obtain a string to be parsed; allocates array memory space according to the number of array rows of the string to be parsed, and parses the string to be parsed according to the array memory space to obtain an output array. The composite type input array is converted into a single type of string to be parsed at the C language processing layer; the single type of string to be parsed is parsed in one step at the SQL language processing layer to obtain an output array, thereby solving the problem of being unable to directly obtain composite array data from SQL and achieving the beneficial effect of facilitating direct acquisition of composite array data.

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

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

[0041] Figure 1 is a flow chart of a composite array parsing method provided in the first embodiment of the present invention;

[0042] Figure 2 is a flow chart of a composite array analysis method provided in Embodiment 2 of the present invention;

[0043] Figure 3 It is a structural schematic diagram of a composite array analysis device provided in Embodiment 3 of the present invention;

[0044] Figure 4 It is a schematic diagram of the structure of an electronic device for implementing the composite array analysis method according to an embodiment of the present invention. DETAILED DESCRIPTION

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

[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention 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.

[0047] Embodiment 1

[0048] Figure 1 This is a flow chart of a composite array analysis method provided by the first embodiment of the present invention. This embodiment is applicable to the case of analyzing a composite array read from a database. The method can be executed by a composite array analysis device. The composite array analysis device can be implemented in the form of hardware and / or software. The composite array analysis device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0049] S110. Obtain an input array of a composite type.

[0050] The input array can be understood as the data input at the C language processing level of the database, or can be considered as the data read from the database by the user. In this embodiment, the input array is a composite type, that is, the input array contains multiple elements of different types. The input array can be a one-dimensional, two-dimensional or multi-dimensional array.

[0051] Specifically, at the C language processing level of the database, an input array of a composite type may be obtained according to instructions input by a user.

[0052] Exemplarily, the composite type input array may be, for example, an array T (int, double, text), where the array T contains three array elements in each dimension, and the data types of the three array elements are respectively an integer type int, a floating point type double, and a string type text.

[0053] S120 , encapsulating the number of array rows and array data in each row of the input array according to a preset data format to obtain a character string to be parsed.

[0054] The string to be parsed is a string data of a single type. The preset data format is a predefined data format of the string to be parsed, for example, an integer int, a floating point double, or a string type text. The number of array rows is the number of rows in the input array, which can also be understood as the dimension of the input array. The array data is the data contained in the input array.

[0055] In this embodiment, since the SQL processing layer cannot directly obtain the composite type array at the C language processing layer, it is necessary to encapsulate the composite type array obtained at the C language processing layer of the data, and output a single type of string to be parsed to the SQL processing layer. The composite type input array is encapsulated as a string to be parsed, the number of array rows and array data in each row in the input array are obtained, and the number of array rows and array data in each row of the input array are converted and encapsulated based on a preset data format to generate strings to be parsed that are all string types.

[0056] Exemplarily, converting the data types of the array row number and each row of array data of the input array according to a preset data format includes: converting the array row number of the input array into an array row number string, and converting each row of array data of the input array into an array data string respectively.

[0057] S130 , allocating array memory space according to the number of array rows of the character string to be parsed, and parsing the character string to be parsed according to the array memory space to obtain an output array.

[0058] The output array can be understood as the array output at the SQL language processing level of the database, and the array memory space can be understood as the memory space occupied by the output array.

[0059] In this embodiment, the number of array rows is obtained from the string to be parsed, array memory space is allocated to the output array according to the number of array rows, the string to be parsed is parsed, and each row of array data obtained by the parsing is written into the array memory space to obtain the output array.

[0060] This embodiment converts the composite type input array into a single type of string to be parsed in the C language processing layer, which makes it convenient for the SQL language processing layer to parse the single type of string to be parsed in one step to obtain an output array, thereby realizing reading of the composite type array from the SQL database.

[0061] The technical solution of the embodiment of the present invention obtains a composite type input array; encapsulates the number of array rows and array data of each row of the input array according to a preset data format to obtain a string to be parsed; allocates array memory space according to the number of array rows of the string to be parsed, and parses the string to be parsed according to the array memory space to obtain an output array. By converting the composite type input array into a single type of string to be parsed at the C language processing layer; and parsing the single type of string to be parsed in one step at the SQL language processing layer to obtain an output array, it is possible to read a composite type array from an SQL database.

[0062] Embodiment 2

[0063] Figure 2 It is a flow chart of a composite array parsing method provided in the second embodiment of the present invention. Based on the above embodiment, this embodiment further refines the preset data format to include a header and a tail; the header is used to store the number of array rows of the input array; the tail is used to store each row of array data of the input array, and each row of array data includes: data length and data information.

[0064] In this embodiment, in order to facilitate the SQL language processing of the single type of to-be-parsed string mirror parsing, it is necessary to define the data format of the to-be-parsed string. The preset data format of the to-be-parsed string includes: a header and a tail. The header is used to store the number of array rows of the input array, and the tail is used to store each row of array data of the input array. Each row of array data includes multiple data information and the data length of each data information.

[0065] For example, in the C language processing layer, taking the composite type input array T (int, double, text) as T_Array,

[0066]

[0067] The output string to be parsed is:

[0068]

[0069]

[0070] In the above example, the header of the data to be parsed corresponding to the input array T (int, double, text) is used to store the number of array rows of the input array, that is, 4 rows, indicating that there are 4 rows of array data. The header can be represented by 8 bits, 16 bits, etc. Each row of array data contains three array data, and the first bit of each array data represents the data length of the data information, and the bits after the first bit represent the data information. For example, for the first row of array data, the array data "11" means that the data length of the array information is 1, and the data information is "1"; the array data "31.0" means that the data length of the array information is 3, and the data information is "1.0"; the array data "4hust" means that the data length of the array information is 4, and the data information is "hust".

[0071] Based on the definition of the preset data format, the second embodiment of the present invention provides a composite array parsing method as follows: Figure 2 As shown, the method includes:

[0072] S210, obtaining an input array of a composite type.

[0073] S220, allocating a header string memory space for the header of the string to be parsed; converting the array row number of the input array into an array row number string, and writing the array row number string into the header string memory space to obtain the header string.

[0074] The header string memory space can be understood as a memory space for storing the header string. The header string can be understood as a string corresponding to the header of the string to be parsed.

[0075] In this embodiment, a header string memory space, such as an 8-bit string memory space, is allocated to the header of the string to be parsed through the C language processing layer. Generally, in the input array, the number of array rows is represented by an integer int type, and the number of array rows of the input array is converted from an integer int type to a string type to obtain an array row number string. The array row number string is written into the header string memory space to obtain a header string.

[0076] Exemplarily, the code for obtaining the header string may be:

[0077] / / result output string

[0078] rst_len = 8;

[0079] rst = (char*)malloc(sizeof(char)*rst_len); / / allocate memory space for header string

[0080] sprintf(rst,"%8d",result->num).

[0081] In this example, string memory space is allocated to the number of array rows according to the data length of the number of array rows in the input array to obtain the header string memory space.

[0082] S230, allocating a tail string memory space for the tail of the string to be parsed; converting each row of array data of the input array into an array data string respectively, and writing each array data string into the tail string memory space in sequence to obtain a tail string.

[0083] The tail string memory space may be understood as a memory space for storing the tail string, and the tail string may be understood as a string corresponding to the tail of the string to be parsed.

[0084] In this embodiment, after determining the number of array rows, the C language processing layer allocates tail string memory space for the tail of the string to be parsed according to the number of array rows. In a composite type input array, each row of array data contains different types of data information, and the different types of data information in each row of array data need to be converted into a single string type to obtain an array data string; each array data string is sequentially written into the memory space allocated in the tail string memory space to obtain a tail string.

[0085] Optionally, the tail string memory space includes: a single line of string memory space corresponding to each line of array data; allocating tail string memory space for the tail of the string to be parsed includes: for each line of array data in the input array, allocating string memory space for the data information according to the length of each data information in the array data.

[0086] Exemplarily, the code for obtaining the tail string may be:

[0087] for(i=0;i <result->num;i++){

[0088] c = result->data[i];

[0089] sprintf(id,"%d",c.id); / / Convert int type data to string

[0090] sprintf(tol,"%d",c.id); / / Convert float type data to string

[0091] / / Apply for memory

[0092] rst_str=(char*)malloc(sizeof(int));

[0093] rst_str=(char*)malloc(sizeof(double));

[0094] rst_str=(char*)malloc(sizeof(char)*strlen(c[i]->text));

[0095] sprintf(rst_str,"%8d%s%8d%s%8d%s",strlen(id),id,strlen(tol),tol,strlen(c[i]->text),c[i]->text);

[0096] sprintf(rst,rst_str);

[0097] }.

[0098] In this example, for each row of array data, string memory space is allocated to the data information in turn according to the data length of each data information in the array data, until string memory space is allocated to the data information in each row of array data, forming the tail string memory space.

[0099] S240, encapsulate the head string and the tail string to obtain a string to be parsed.

[0100] In this embodiment, the C language processing layer encapsulates the header string corresponding to the header information (i.e., the number of array rows) of the input array and the tail string corresponding to the tail information (i.e., the data information) of the input array to obtain the string to be parsed, and transmits the string to be parsed to the SQL language processing layer.

[0101] S250, splitting the head string of the string to be parsed by a string splitting function to obtain an array row number string; and allocating array row number memory space according to the array row number string.

[0102] The array row number string is a string used to indicate the number of array rows.

[0103] In this embodiment, the string to be parsed that is input into the SQL language processing layer includes a head string and a tail string, and the number of array rows is included in the head string. Therefore, the head string of the string to be parsed is split out by a string splitting function according to a predefined length of the head string (for example, 8 characters), and an array row number string is obtained. Array row number memory space is allocated for the array row number according to the array row number string.

[0104] S260, splitting the head string of the string to be parsed by a string splitting function to obtain an array row number string; and allocating array row number memory space according to the array row number string.

[0105] The array row number memory space is a memory space used to store the array row number.

[0106] In this embodiment, after allocating the array row number memory space, the SQL language processing layer converts the array row number string into integer type data, writes the integer type data into the array row number memory space, and parses the array row number string processed by the C language processing layer to obtain the array row number.

[0107] Exemplarily, the code to obtain the memory space of the array rows is as follows:

[0108] pos=0;

[0109] data_string=substr(data,0,8);

[0110] pos=pos+8;

[0111] row_num=convert(int,datastring);

[0112] data = new T[row_num].

[0113] S270. Allocate array data memory space for the output array according to the number of array rows.

[0114] In this embodiment, the SQL language processing layer allocates array data memory space for the output array according to the number of array rows obtained by parsing, so as to store each row of array data.

[0115] S280, parsing the tail character string of the character string to be parsed to obtain each line of array data; converting each line of array data into output array data of a preset type, and writing each output array data into the array data memory space in sequence to obtain an output array.

[0116] The preset type is the data type of the array data in the input array.

[0117] In this embodiment, the SQL language processing layer parses the string to be parsed transmitted by the C language processing layer, and parses each row of array data from the tail string of the string to be parsed. The data information in each row of array data is sequentially converted into a preset type to obtain output array data, and each output array data is sequentially written into the array data memory space to obtain an output array.

[0118] Optionally, parsing the tail string of the string to be parsed to obtain each line of array data includes: sequentially reading each line of array data string in the tail string of the string to be parsed; and obtaining the data length and data information in each line of array data string.

[0119] In this embodiment, the SQL language processing layer parses the string to be parsed transmitted by the C language processing layer, cyclically reads each row of the array data string in the tail string of the string to be parsed, and reads the data length and data information of the data information from the array data string in turn.

[0120] Exemplarily, the code to obtain the output array may be:

[0121] for i in 1..row_num loop

[0122] datalength_string=substr(data,pos,8);

[0123] pos=pos+8;

[0124] datalength=convert(int,datalength_string);

[0125] data_string=substr(data,pos,datalength);

[0126] pos=pos+datalength;

[0127] data[i].id=convert(int,data_string);

[0128] datalength_string=substr(data,pos,8);

[0129] pos=pos+8;

[0130] datalength=convert(int,datalength_string);

[0131] data_string=substr(data,pos,datalength);

[0132] pos=pos+datalength;

[0133] data[i].version=convert(double,data_string);

[0134] datalength_string=substr(data,pos,8);

[0135] pos=pos+8;

[0136] datalength=convert(int,datalength_string);

[0137] data_string=substr(data,pos,datalength);

[0138] pos=pos+datalength;

[0139] data[i].name = data_string;

[0140] end loop.

[0141] The technical solution of the embodiment of the present invention obtains a composite type input array; encapsulates the number of array rows and array data of each row of the input array according to a preset data format to obtain a string to be parsed; allocates array memory space according to the number of array rows of the string to be parsed, and parses the string to be parsed according to the array memory space to obtain an output array. By converting the composite type input array into a single type of string to be parsed at the C language processing layer; and parsing the single type of string to be parsed in one step at the SQL language processing layer to obtain an output array, it is possible to read a composite type array from an SQL database.

[0142] Embodiment 3

[0143] Figure 3 This is a schematic diagram of the structure of a composite array analysis device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: an acquisition module 310, a packaging module 320 and a parsing module 330; wherein,

[0144] An acquisition module 310 is used to acquire an input array of a composite type;

[0145] The encapsulation module 320 is used to perform data type conversion and encapsulation processing on the number of array rows and array data of each row of the input array according to a preset data format to obtain a character string to be parsed;

[0146] The parsing module 330 is used to allocate array memory space according to the number of array rows of the character string to be parsed, and parse the character string to be parsed according to the array memory space to obtain an output array.

[0147] The technical solution of the embodiment of the present invention obtains a composite type input array; encapsulates the number of array rows and array data of each row of the input array according to a preset data format to obtain a string to be parsed; allocates array memory space according to the number of array rows of the string to be parsed, and parses the string to be parsed according to the array memory space to obtain an output array. By converting the composite type input array into a single type of string to be parsed at the C language processing layer; and parsing the single type of string to be parsed in one step at the SQL language processing layer to obtain an output array, it is possible to read a composite type array from an SQL database.

[0148] Optionally, the preset data format includes a header and a tail; the header is used to store the number of array rows of the input array; the tail is used to store each row of array data of the input array, and each row of array data includes: data length and data information.

[0149] Optionally, the encapsulation module 320 includes:

[0150] A header memory allocation unit, used to allocate a header string memory space for the header of the string to be parsed;

[0151] A header string generating unit, used for converting the array row number of the input array into an array row number string, and writing the array row number string into the header string memory space to obtain a header string;

[0152] A tail memory allocation unit, used to allocate tail string memory space for the tail of the string to be parsed;

[0153] A tail string generating unit, used for converting each row of array data of the input array into an array data string respectively, and writing each array data string into the tail string memory space in sequence to obtain a tail string;

[0154] The encapsulation unit is used to encapsulate the head character string and the tail character string to obtain a character string to be parsed.

[0155] Optionally, the tail string memory space includes: a string memory space corresponding to each array data; and a tail memory allocation unit, specifically used for:

[0156] For each row of array data in the input array, a character string memory space is allocated to the data information according to the length of each data information in the array data.

[0157] Optionally, the array memory space includes: the array row memory space and the array data memory space; the parsing module 330 includes:

[0158] A segmentation unit, used for segmenting the head string of the string to be parsed by using a string segmentation function to obtain an array row number string;

[0159] A first memory allocation unit, configured to allocate array row number memory space according to the array row number character string;

[0160] An array row number parsing unit, used for converting the array row number character string into integer type data, and writing the integer type data into the array row number memory space to obtain the array row number;

[0161] The second memory allocation unit is used to allocate array data memory space for the output array according to the number of array rows.

[0162] Optionally, the parsing module 330 includes:

[0163] A parsing unit, used for parsing the tail character string of the character string to be parsed to obtain each line of array data;

[0164] The array output unit is used to convert each row of array data into output array data of a preset type, and write each of the output array data into the array data memory space in sequence to obtain an output array.

[0165] Optional, parsing unit, specifically used for:

[0166] Read each line of array data string in the tail string of the string to be parsed in sequence;

[0167] Get the data length and data information in each row of array data string.

[0168] The composite array parsing device provided in the embodiment of the present invention can execute the composite array parsing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0169] Embodiment 4

[0170] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention 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 (such as helmets, glasses, watches, etc.) 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 invention described and / or required herein.

[0171] like Figure 4 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.

[0172] 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.

[0173] 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, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the parsing method of the composite array.

[0174] In some embodiments, the composite array parsing 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 composite array parsing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the composite array parsing method in any other appropriate manner (e.g., by means of firmware).

[0175] 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.

[0176] Computer programs for implementing the methods of the present invention 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 and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0177] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination 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.

[0178] 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).

[0179] 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.

[0180] 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.

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

[0182] The above specific implementations do not constitute a limitation on the protection scope of the present invention. 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 invention should be included in the protection scope of the present invention.

Claims

1. A composite array analysis method, characterized in that: include: Get the input array of composite type; Perform data type conversion and encapsulation processing on the number of array rows and array data of each row of the input array according to a preset data format to obtain a character string to be parsed; Array memory space is allocated according to the number of array rows of the character string to be parsed, and the character string to be parsed is parsed according to the array memory space to obtain an output array.

2. The method according to claim 1, characterized in that The preset data format includes a header and a tail; the header is used to store the number of array rows of the input array; the tail is used to store array data of each row of the input array, and each row of array data includes: data length and data information.

3. The method according to claim 2, characterized in that The number of array rows and array data of each row of the input array are converted into data types and packaged according to a preset data format to obtain a string to be parsed, including: Allocating a header string memory space for the header of the string to be parsed; Convert the array row number of the input array into an array row number string, and write the array row number string into the header string memory space to obtain a header string; Allocating tail string memory space for the tail of the string to be parsed; Converting each row of array data of the input array into an array data string respectively, and writing each of the array data strings into the tail string memory space in sequence to obtain a tail string; The head character string and the tail character string are encapsulated to obtain a character string to be parsed.

4. The method according to claim 3, characterized in that The tail string memory space includes: a string memory space corresponding to each array data; allocating the tail string memory space for the tail of the string to be parsed includes: For each row of array data in the input array, a character string memory space is allocated to the data information according to the length of each data information in the array data.

5. The method according to claim 1, characterized in that The array memory space includes: the array row number memory space and the array data memory space; allocating the array memory space according to the array row number of the character string to be parsed includes: The head string of the string to be parsed is separated by a string segmentation function to obtain an array row number string; Allocate memory space for the number of array rows according to the array row number character string; Convert the array row number string into integer type data, and write the integer type data into the array row number memory space to obtain the array row number; Allocate array data memory space for the output array according to the number of array rows.

6. The method according to claim 5, characterized in that Parsing the string to be parsed according to the array memory space to obtain an output array includes: Parse the tail string of the string to be parsed to obtain each line of array data; Each row of array data is converted into output array data of a preset type, and each of the output array data is sequentially written into the array data memory space to obtain an output array.

7. The method according to claim 6, characterized in that Parse the tail string of the string to be parsed to obtain each line of array data, including: Read each line of array data string in the tail string of the string to be parsed in sequence; Get the data length and data information in each row of array data string.

8. A composite array analysis device, characterized in that: include: The acquisition module is used to obtain the input array of composite type; The encapsulation module is used to perform data type conversion and encapsulation processing on the number of array rows and array data of each row of the input array according to a preset data format to obtain a character string to be parsed; The parsing module is used to allocate array memory space according to the number of array rows of the character string to be parsed, and parse the character string to be parsed according to the array memory space to obtain an output array.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the composite array parsing method described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the composite array parsing method according to any one of claims 1 to 7 when executed.

Citation Information

Patent Citations

  • Data storing, managing and inquiring method and system for distributed key-value storage system

    CN102332030A

  • Large-scale data processing method and device based on stream computing

    CN115269218A

  • Serialization and deserialization method and system for generating APP data based on SomeIp protocol

    CN116366729A

  • Serialization and deserialization method and electronic equipment

    CN116560669A

  • Array analysis method and device, equipment and medium

    CN116737751A