Column-transmission-based data transmission method and apparatus, and terminal device and medium
Through the data transmission method based on column transmission, the custom protocol format uses columns as the smallest unit to fill packets, solving the problem of low data transmission efficiency in the prior art and achieving more efficient data transmission.
Patent Information
- Application Number
- PCT/CN2023/117171
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-03
- Filing Date
- 2023-09-06
- Publication Date
- 2025-02-06
AI Technical Summary
In the prior art, the smallest-behavior unit is used to fill messages for data transmission, resulting in a large number of messages transmitted and a low data transmission efficiency. Especially when a large amount of data is needed, the usage rate of messages is low, resulting in the data transmission length and Efficiency is limited.
Using a column transmission-based data transmission method, through a custom protocol format, the target data is filled with the column as the smallest unit, so that a row of data can not be bound to the same message for transmission, but can be Send separately in multiple batches of messages.
Maximize the use of message space, increase the effective amount of data sent in each frame, reduce the number of messages sent under the same data volume, improve the utilization rate of message transmission, and shorten the total time of data transmission , thus improving the data transmission efficiency.
Smart Images

Figure CN2023117171_06022025_PF_FP_ABST
Abstract
Description
Data transmission method, device, terminal equipment and medium based on column transmission
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on August 3, 2023, with application number 202310974232.6, and invention name “Data transmission method, device, terminal equipment and medium based on column transmission”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application is applicable to the field of communications, and in particular relates to a data transmission method, apparatus, terminal equipment, and medium based on column transmission. Background Art
[0003] In the prior art, a row transmission method (i.e., a transmission method that uses the smallest unit of a row) is usually used to transmit data between the client and the server. That is, one or more entire rows of data are filled in a message. The inventors realized that if the last row of data filled in the message is long, it cannot be filled into the currently unfilled message. When the amount of data to be transmitted is large, there will be a large number of messages that are not filled and sent immediately. The utilization rate of the message is low, resulting in a limited length and efficiency of the data transmission in a single transmission. From an objective performance perspective, this method will be reflected in the fact that under the same amount of data, more batches of messages must be sent to ensure that the data transmission is completed, and the transmission time is extended, resulting in lower data transmission efficiency. In addition, the existing row transmission method cannot handle the scenario where the row width exceeds the maximum length of the message, and cannot provide compatible transmission of overlong data.
[0004] Therefore, how to improve data transmission efficiency has become an urgent problem to be solved.
[0005] Summary of the Invention
[0006] In view of this, an embodiment of the present application provides a data transmission method, apparatus, terminal device and medium based on column transmission to solve the problem in the prior art of using behavioral minimum units to fill messages for data transmission, resulting in a large number of transmitted messages and low data transmission efficiency.
[0007] In a first aspect, a data transmission method based on column transmission is provided, which is applied to a server. The data transmission method includes the following steps:
[0008] Obtain the target data in the current i-th row and j-th column to be filled into the message, and determine whether the target data in the i-th row and j-th column is first type data; where i and j are positive integers;
[0009] When it is determined that the target data in the i-th row and j-th column is first type data, the target data in the i-th row and j-th column is filled into the message according to a set first protocol format; the first type data in the first protocol format includes a data segment, and the data segment includes: a first identifier for indicating a data type, a second identifier for indicating a data length, and specific data content;
[0010] Repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and then send the message;
[0011] The next message is filled according to the data filling process until the target data in each row and column are filled into the corresponding message according to the preset data row and column order, and the next message is sent.
[0012] In a second aspect, a data transmission method based on column transmission is provided, which is applied to a client. The data transmission method includes the following steps:
[0013] Receive the current message containing the target data sent by the server, and determine whether the received target data meets the preset number of rows;
[0014] When it is determined that the received target data does not meet the preset number of rows, obtaining target data of each column of the current row in the current message, and determining whether part of the first type of data is truncated to the next message;
[0015] When it is determined that part of the first type of data is truncated into the next message, a new message receiving request is sent to the server;
[0016] The above process is repeated until it is determined that no first type of data exists and is truncated into the next message.
[0017] According to a third aspect, a data transmission device based on column transmission is provided, the data transmission device comprising:
[0018] a data transmission acquisition and judgment module, configured to obtain the target data in the current i-th row and j-th column to be filled into the message, and to judge whether the target data in the i-th row and j-th column is first type data; wherein i and j are positive integers;
[0019] a data filling module, configured to, when determining that the target data in the i-th row and j-th column is first type data, fill the target data in the i-th row and j-th column into the message according to a set first protocol format; the first type data in the first protocol format includes a data segment, and the data segment includes: a first identifier for indicating the data type, a second identifier for indicating the data length, and specific data content;
[0020] A filling control module is used to control the acquisition and judgment module and the data filling module, repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and send the message; and is used to fill the next message according to the data filling process until the target data in each row and column are filled into the corresponding message according to the preset data row and column order, and send the next message.
[0021] In a fourth aspect, an embodiment of the present application provides a terminal device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0022] Obtain the target data in the current i-th row and j-th column to be filled into the message, and determine whether the target data in the i-th row and j-th column is first type data; where i and j are positive integers;
[0023] When it is determined that the target data in the i-th row and j-th column is first type data, the target data in the i-th row and j-th column is filled into the message according to a set first protocol format; the first type data in the first protocol format includes a data segment, and the data segment includes: a first identifier for indicating a data type, a second identifier for indicating a data length, and specific data content;
[0024] Repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and then send the message;
[0025] The next message is filled according to the data filling process until the target data in each row and column are filled into the corresponding message according to the preset data row and column order, and the next message is sent.
[0026] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0027] Obtain the target data in the current i-th row and j-th column to be filled into the message, and determine whether the target data in the i-th row and j-th column is first type data; where i and j are positive integers;
[0028] When it is determined that the target data in the i-th row and j-th column is first type data, the target data in the i-th row and j-th column is filled into the message according to a set first protocol format; the first type data in the first protocol format includes a data segment, and the data segment includes: a first identifier for indicating a data type, a second identifier for indicating a data length, and specific data content;
[0029] Repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and then send the message;
[0030] The next message is filled according to the data filling process until the target data in each row and column are filled into the corresponding message according to the preset data row and column order, and the next message is sent.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] The data transmission method, apparatus, terminal device and medium of the present application, through a customized first protocol format, uses a data segment consisting of two identifiers and data content to fill each target data in a column as the smallest unit for message filling, so that a row of data can be sent not by being bound together in the same message, but can be sent separately in multiple batches of messages, and each message is sent only after filling the target data of each column of the current row as much as possible. Compared with the existing technology, the present application can maximize the use of message space, increase the amount of effective data sent in each frame message, reduce the number of messages sent under the same data volume, improve the utilization rate of message sending, and shorten the total time of data transmission, thereby improving data transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0034] FIG1 is a schematic diagram of an application environment of a data transmission method based on column transmission provided by an embodiment of the present application;
[0035] FIG2 is a flow chart of a data transmission method based on column transmission according to an embodiment of the present application;
[0036] FIG3 is a schematic diagram of filling a first type of data message provided by an embodiment of the present application;
[0037] FIG4 is a flow chart of a data transmission method based on column transmission according to an embodiment of the present application;
[0038] FIG4-1 is a schematic diagram of filling first and second types of data packets provided by an embodiment of the present application;
[0039] FIG5 is a flow chart of a data transmission method based on FIG4 according to an embodiment of the present application;
[0040] FIG6 is a flow chart of a data transmission method based on FIG5 according to an embodiment of the present application;
[0041] FIG7 is a flow chart of a data transmission method applied to a client provided in one embodiment of the present application;
[0042] FIG8 is a flow chart of a data transmission method based on FIG7 according to an embodiment of the present application;
[0043] FIG9 is a schematic structural diagram of a data transmission device provided in one embodiment of the present application;
[0044] FIG10 is a schematic structural diagram of another data transmission device provided in an embodiment of the present application;
[0045] FIG11 is a schematic structural diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0047] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0048] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0049] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0050] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0051] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0052] It should be understood that the size of the serial numbers of the steps in the following embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0053] In order to illustrate the technical solution of the present application, specific embodiments are provided below.
[0054] An embodiment of the present application provides a data transmission method based on column transfer, which can be applied in an application environment such as Figure 1, wherein a client communicates with a server. The client includes, but is not limited to, a palmtop computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud terminal device, a personal digital assistant (PDA), and other terminal devices. The server can be implemented as a standalone server or a server cluster consisting of multiple servers.
[0055] Referring to FIG2 , which is a flow chart of a data transmission method based on column transmission provided by an embodiment of the present application, the above-mentioned data transmission method can be applied to the server in FIG1 , and the computer device corresponding to the server is connected to the corresponding database, rule base, etc. to obtain the corresponding data in the database. The above-mentioned computer device can also be connected to the client to collect requests sent by the client user and send messages to the client. As shown in FIG2 , the data transmission method based on column transmission can include the following steps:
[0056] Step S201, obtaining the target data in the current i-th row and j-th column to be filled into the message, and determining whether the target data in the i-th row and j-th column is first type data; wherein i and j are positive integers;
[0057] Among them, the target data to be filled in the message is N rows and M columns, and the target data in the i-th row and j-th column needs to be obtained in a certain order, where i = 1, 2, ..., N; j = 1, 2, ..., M; for example, first obtain the data in the 1st row and 1st column to determine whether the target data is the first type of data.
[0058] In this step, the first type of data refers to data whose data length does not exceed the first preset value, that is, ordinary data; when the length of the target data is greater than the second preset value, the target data is the second type of data, that is, extra-long data, wherein the first preset value and the second preset value can be set according to the specific situation. It should be pointed out in particular that the first preset value in this step is less than or equal to the second preset value, that is, the data length of the ordinary data is less than the data length of the extra-long data.
[0059] Step S202: When it is determined that the target data in the i-th row and j-th column is first type data, the target data in the i-th row and j-th column is filled into the message according to a set first protocol format; the first type data in the first protocol format includes a data segment, and the data segment includes: a first identifier for indicating a data type, a second identifier for indicating a data length, and specific data content;
[0060] The data structure of a data segment in the first protocol format is shown in the following table:
[0061] In the above table, Len represents the first identifier, longlen represents the second identifier, and Data represents the specific data content.
[0062] In one embodiment, the first identifier may be a placeholder 0xFE for the second type of data, used to indicate overlong data; the second identifier indicates the length of the data in the Data, for example, the maximum length of the data may be 32767.
[0063] In one embodiment, the first identifier may also be a length indicator 0xFD, indicating that the second identifier is used to represent the data length; correspondingly, the second identifier represents the data length within the Data. In other embodiments, the first identifier may also be a length indicator, such as <0xFD, indicating the data length within the Data, in which case the second identifier field is omitted.
[0064] Step S203, repeating the above data filling process, filling the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and then sending the message;
[0065] In which, in the data acquisition and filling process repeating the above-mentioned steps S201 and S202, the preset data row and column order for data acquisition and filling can be row first and column later, that is, first acquire and fill the target data of the 1st row and 1st column, then acquire and fill the target data of the 1st row and 2nd column, and so on, until the target data of the 1st row and 2nd column is acquired; then acquire and fill the target data of each column in the 2nd row in sequence from the 2nd row and 1st column to the 2nd row and 2nd column M; until the target data of each column in the Nth row is acquired and filled.
[0066] Step S204 , filling the next message according to the data filling process until the target data in each row and column are filled into the corresponding message according to the preset data row and column order, and sending the next message.
[0067] For example, take the result set data with three rows and three columns (i.e., target data) as an example, as shown in Figure 3, where the three columns are all first type data, i.e., ordinary data. According to the above steps S201 to S203, the target data of the first row and first column, the first row and second column, and the first row and third column are filled respectively until the target data of the second row and first column is filled, and then the first message is packed and sent; then step S204 is executed to fill the target data of the second row and second column, the second row and third column, the third row and first column, and the third row and second column into the second message respectively, and the second message is sent; finally, the remaining target data of the third row and third column is filled into the third message, and the message is sent.
[0068] Figure 3 shows the possible situation where each row of target data is truncated in the message, that is, the target data of the second row is divided into two parts, which are filled into the first message and the second message respectively and sent successively; the target data of the second row is also divided into two parts, which are filled into the second message and the third message respectively and sent successively.
[0069] The data transmission method of this embodiment uses a customized first protocol format to fill each target data into a column as the smallest unit in the form of a data segment consisting of two identifiers and data content, so that a row of data can be sent not in the same message, but can be sent separately in multiple batches of messages. Each message is sent only after filling the target data of each column of the current row as much as possible. Compared with the existing technology, this application can maximize the use of message space, increase the amount of effective data sent in each frame message, reduce the number of messages sent under the same data volume, improve the utilization rate of message sending, shorten the total time of data transmission, and thus improve data transmission efficiency.
[0070] 4 is a flow chart of a data transmission method based on column transmission according to an embodiment of the present application. After step S201 in FIG2 , the data transmission method may include the following steps:
[0071] Step S401: When it is determined that the target data in the i-th row and j-th column is second-type data, and the length of the second-type data is greater than the length of the first-type data, the target data in the i-th row and j-th column is filled into the message according to a set second protocol format; the second-type data in the second protocol format includes at least two data segments and a data end identifier;
[0072] The second type data structure of a second protocol format may be shown in the following table:
[0073] The table above indicates that the second type of data includes two data segments and a data end identifier 0. The structure of each data segment is described in step S202 of the previous embodiment and is not repeated in this embodiment. In other embodiments, the second type of data may also include three or more data segments, and the number of data segments can be set according to specific needs.
[0074] Step S402: When the message is determined to be full during the process of filling the data segments of the second type of data, the message is sent; and the remaining data segments of the second type of data and the data end identifier are continued to be filled in the next message.
[0075] In the process of filling the data segments of the second type of data in the current message, it is very likely that only part of the data segments of the second type of data are filled, and the message has been filled; therefore, it is necessary to continue filling the remaining data segments when filling the next message, as well as fill in the identifier used to indicate the end of the second type of data.
[0076] For example, as shown in FIG4-1, after the target data in the first row and first column is filled, according to step S201 in FIG2, it can be determined that the target data in the first row and second column is not first type data, but second type data (i.e., overlong data), and the placeholder 0xFE for the second type data is filled. The target data in the third column of the first row is then determined and filled. After the target data in the last column of the current row is filled, the above steps S401 and S402 are executed. After data segment 1 of the target data in the second row and second column is filled, the first message is immediately filled and sent. The remaining data segments of the target data in the first row and second column, i.e., data segment 2, data segment 3, and the terminator 0, are then filled in the second message. After all the target data (first type data and second type data) in the first row are filled, the first type data and second type data in each column of the second row are filled in the second message. The filling method is the same as the filling method for the data in each column of the first row, and will not be repeated here.
[0077] The data transmission method of this embodiment, when the target data is the second type of extra-long data, uses a customized second protocol format to include at least two data segments to expand the upper limit of message filling and transmission with columns as the minimum unit, so that the extra-long data can be sent not by being bundled in the same message, but by being sent separately in multiple batches of messages, and each message is sent only after filling the various data segments of the current row of extra-long data as much as possible. The present application can decouple the size of the business customized message from the size of a row and column of data, so that the protocol is no longer constrained by the upper limit of the customized message, avoiding the coupling of the row transmission business message size and the data length specification, and fundamentally solving the problem of data length being restricted by message size, thereby improving data transmission efficiency.
[0078] 5 , in one embodiment, based on step S401 in FIG. 4 , when it is determined that the target data in the i-th row and j-th column is the second type of data, the target data in the i-th row and j-th column is filled into the message according to the set second protocol format, specifically including:
[0079] Step S501: setting a placeholder identifier for the second type of data and filling it into the message;
[0080] For example, as shown in Figure 4-1, if the target data in the first row and second column is determined to be the second type of data, the placeholder identifier 0xFE is set and filled into the first message; when the target data in the second row and second column is determined to be the second type of data, the placeholder identifier 0xFE is set and filled into the second message after the target data in the second row and first column; when the target data in the third row and second column is determined to be the second type of data, since the data in the second message is already filled, the placeholder identifier 0xFE is set and filled into the third message.
[0081] Step S502, determining whether the target data of the remaining columns of the current row except the second type of data has been filled;
[0082] For example, as shown in Figure 4-1, taking the first row as the current row, after setting the placeholder identifier 0xFE and filling the first message, it can be determined that in addition to the second type of data, the current row also has target data in the third column of the first row that has not been filled, and returns to step S201 in Figure 2 for judgment. If it is determined to be the first type of data, execute according to steps S202 to S204; if it is determined to be the second type of data, execute according to the above steps S501 and S502 until it is determined that the target data of the remaining columns of the current row except for the second type of data have been filled.
[0083] Step S503, when it is determined that the filling is complete, determining whether there is any unfilled second type data;
[0084] For example, as shown in Figure 4-1, according to the above step S502, it has been determined that the target data of the remaining columns of the first row except the second type data have been filled, and then the above step S503 is executed, and it can be determined that there is still the second type data in the first row and the second column (including data segment 1, data segment 2 and data segment 3, and the terminator 0) that has not been filled.
[0085] Step S504, when it is determined that the unfilled second type of data exists, determining whether the current message is filled;
[0086] For example, as shown in Figure 4-1, according to the previous step S503, it can be determined that the second type of data in the first row and second column, including data segments 1, 2, and 3, and the terminator 0, are not filled. Then, based on the data filling status in the message, it can be determined that the first message is not yet full.
[0087] Step S505: If it is determined that the current message is not full, fill the current message with the second type of data in units of maximum bytes until the current message is full or the second type of data is completely filled.
[0088] For example, as shown in Figure 4-1, according to the previous step S503, it can be determined that the first message has not been filled, and then the data segments in the first row and second column are continued to be filled into the first message. After filling data segment 1, the first message is randomly filled, that is, not all data segments in the first row and second column are filled in the first message.
[0089] In another embodiment, as shown in FIG4-1, after the data in the second row and third column is filled into the third message, through the above steps S503 to S505, each data segment in the second row and second column is filled into the third message until all the data segments in the second row and second column are filled.
[0090] The data transmission method of this embodiment provides a streaming mechanism for padding and transmitting second-type data of any possible length when the length of the column data to be transmitted exceeds the client-defined upper limit of the message length. Furthermore, this application supports a custom communication protocol with multiple functions based on command words, allowing for customized data transmission between database clients and servers.
[0091] 6 , in one embodiment, based on step S502 of FIG. 5 , after determining that there are remaining columns of target data other than the second type of data that have not been filled, the following steps are further included:
[0092] Step S601, obtaining and determining whether the target data of the remaining columns is the second type of data;
[0093] The data type can be determined based on the target data length of the remaining columns. The specific determination method can be: setting a length threshold, data whose length exceeds the length threshold is the second type of data; data whose length does not exceed the length threshold is the first type of data.
[0094] Step S602: If it is determined that the data is not of the second type, then determine whether the current message is full; if it is determined that it is not full, fill the target data of the remaining columns into the current message according to the first protocol format;
[0095] According to step S601 above, the target data length is compared to the length threshold, and the target data in the remaining columns is determined to be of the first type, i.e., not of the second type. Then, based on the data filling status of the current message, it is determined whether the message is full. If not, the remaining columns of target data are filled accordingly.
[0096] Step S603: If it is determined to be the second type of data, determine whether the current message is full; if it is determined not to be full, return to the step of "setting a placeholder identifier for the second type of data and filling it into the message".
[0097] Among them, according to the above step S601, through the comparison result that the data length of the target data is greater than the length threshold, it can be determined that the target data of the remaining columns is the second type of data, and when it is determined that the current message is not filled, return to execute steps S501 to S505 in Figure 5.
[0098] The data transmission method of this embodiment prioritizes filling of the first type of data in the current message, and fills the second type of data in the current row after all the first type of data in the current row has been filled.
[0099] In one embodiment, based on step S203 in FIG. 2 , the order of data rows and columns for data filling may include:
[0100] First fill in the target data in each column of the first row, then fill in the target data in each column of the second row, and so on, and finally fill in the target data in each column of the last row.
[0101] Among them, the target data in each column of the first row can be filled in by first-type data in each column of the first row first, and then by second-type data in each column of the first row; the target data in each column of the second row to the target data in each column of the last row can be filled in by first-type data first and then by second-type data.
[0102] FIG7 is a flow chart illustrating a data transmission method based on column transmission according to an embodiment of the present application. The data transmission method can be applied to the client shown in FIG1 . The data transmission method may include the following steps:
[0103] Step S701: receiving a current message containing target data from a server, and determining whether the received target data meets a preset number of rows;
[0104] Among them, in step S701, it is necessary to receive the message sent by the server in any of the previous embodiments, and the client receives and parses the message and judges the target data obtained by parsing.
[0105] Step S702: When it is determined that the received target data does not meet the preset number of rows, the target data of each column of the current row in the current message is obtained, and it is determined whether part of the first type of data is truncated to the next message;
[0106] The first type of data in the current message can be copied to the user buffer. If the current data is truncated to the next message, a new message is requested from the server and then copied. If a 0xFE placeholder is encountered during the copying process, it is temporarily skipped.
[0107] Step S703: When it is determined that part of the first type of data is truncated into the next message, a new message receiving request is sent to the server;
[0108] Step S704: Repeat the above process until it is determined that no first type of data is truncated into the next message.
[0109] The data transmission method applied to the client in this embodiment cooperates with the data transmission method applied to the server in any of the above embodiments. The client is responsible for obtaining the message containing target data sent by the server, and then copying the target data in the message to the user's binding buffer.
[0110] Referring to FIG8 , in one embodiment, after step S702 shown in FIG7 , the data transmission method further includes the following steps:
[0111] Step S801: When it is determined that there is no first type data to be truncated to the next message, it is determined whether there is second type data at the end of the current row of target data;
[0112] Step S802: when it is determined that the second type of data exists at the end of the current row of target data, the second type of data in the current message is obtained; and it is determined whether the second type of data in the current row of target data has been obtained.
[0113] Step S803, when it is determined that the second type of data has not been obtained, a new message receiving request is sent to the server, and the second type of data in the new message is obtained, until the second type of data is determined to be obtained, and returns to the step of "determining whether the received target data meets the preset number of rows".
[0114] Among them, if the current line has second type data, the data is copied from the message to the user buffer in units of data segments. If it is determined that the current second type data is truncated to the next message, a new message is requested from the server and a new data segment is copied until the end symbol 0 of the second type data is obtained.
[0115] The data transmission method applied between the client and the server in the embodiment of the present application supports a custom communication protocol with multiple functions based on command words, allowing data transmission between the database client and the server in a custom form; supports target data transmission of data of any length and any custom message length combination, and the data transmission performance is higher than the traditional row transmission method.
[0116] Corresponding to the data transmission method applied to the server in the above embodiment, FIG9 shows a block diagram of a data transmission device based on column transmission provided in an embodiment of the present application. The above data transmission device is applied to the server, and the server is connected to the target database through a preset application program interface. When the target database is driven to perform the corresponding task, a corresponding task log is generated, and the above task log can be collected through the API. For ease of explanation, only the part related to the embodiment of the present application is shown.
[0117] Referring to FIG9 , the data transmission device includes:
[0118] The data acquisition and judgment module 91 is used to obtain the target data in the current i-th row and j-th column to be filled in the message, and judge whether the target data in the i-th row and j-th column is the first type of data; wherein i and j are positive integers;
[0119] The first type data filling module 92 is configured to fill the target data in the i-th row and j-th column into the message according to a set first protocol format when determining that the target data in the i-th row and j-th column is the first type data; the first type data in the first protocol format includes a data segment, and the data segment includes: a first identifier for indicating the data type, a second identifier for indicating the data length, and specific data content;
[0120] The first filling control module 93 is used to control the acquisition and judgment module and the data filling module, repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data of a certain row and column, and send the message; and fill the next message according to the data filling process until the target data of each row and column are filled into the corresponding message according to the preset data row and column order, and send the next message.
[0121] Optionally, the data transmission device further includes:
[0122] a second-type data filling module configured to, when determining that the target data in the i-th row and j-th column is second-type data and the length of the second-type data is greater than the length of the first-type data, fill the target data in the i-th row and j-th column into the message according to a set second protocol format; the second-type data in the second protocol format includes at least two data segments and a data end identifier;
[0123] The second filling control module is used to send the message when it is determined that the message is full during the process of filling the data segment of the second type of data; and continue to fill the remaining data segment of the second type of data and the data end identifier in the next message.
[0124] Optionally, the second type data filling module includes:
[0125] a placeholder generating and filling unit, configured to set a placeholder identifier for the second type of data and fill it into the message;
[0126] a first judging unit, configured to judge whether the target data of the remaining columns of the current row except the second type of data has been sent;
[0127] a second determining unit, configured to determine whether there is any unsent second type of data when it is determined that the sending is complete;
[0128] a third judging unit, configured to, when determining that the unsent second type of data exists, judge whether the current message is full;
[0129] The first filling unit is used to fill the second type data into the current message in units of maximum bytes if it is determined that the current message is not full, until the current message is full or the second type data is completely filled.
[0130] Optionally, the second type data filling module further includes:
[0131] a fourth determining unit, configured to obtain and determine whether the target data in the remaining columns is data of the second type;
[0132] a second filling unit, configured to, if it is determined that the data is not of the second type, determine whether the current message is full; and if it is determined that the data is not full, fill the target data of the remaining columns into the current message according to the first protocol format;
[0133] The fifth judgment unit is used to judge whether the current message is full if it is judged that it is the second type of data; if it is judged that it is not full, return to the placeholder generation and filling unit.
[0134] Optionally, the preset data row and column order includes:
[0135] First fill in the target data in each column of the first row, then fill in the target data in each column of the second row, and so on, and finally fill in the target data in each column of the last row.
[0136] Corresponding to the data transmission method applied to the client in the above embodiment, FIG10 shows a block diagram of a data transmission device based on column transmission provided in one embodiment of the present application, which is applied to the client. For ease of illustration, only the portion relevant to the embodiment of the present application is shown.
[0137] Referring to FIG10 , the data transmission device includes:
[0138] The data collection and judgment module 101 is used to receive the current message containing target data sent by the server and judge whether the received target data meets the preset number of rows;
[0139] The data truncation determination module 102 is configured to, when it is determined that the received target data does not meet the preset number of rows, obtain target data of each column of the current row in the current message and determine whether part of the first type of data is truncated to the next message;
[0140] A first message request module 103 is configured to send a new message receiving request to the server when it is determined that part of the first type of data is truncated into the next message;
[0141] The control module 104 is configured to control the above process to be repeated until it is determined that no first type of data exists and is truncated into the next message.
[0142] Optionally, the data transmission device further includes:
[0143] A second type data determination module is configured to determine whether there is second type data at the end of the current row of target data when it is determined that there is no first type data to be truncated to the next message;
[0144] The data extraction and judgment module is used to obtain the second type of data in the current message when it is determined that the second type of data exists at the end of the current row of target data; and to determine whether the second type of data in the current row of target data has been obtained;
[0145] The second message request module is used to send a new message receiving request to the server when it is determined that the second type of data has not been obtained, and obtain the second type of data in the new message, until it is determined that the second type of data has been obtained, and return to execute the data collection and judgment module.
[0146] It should be noted that the information interaction, execution process and other contents between the above modules are based on the same concept as the method embodiment of this application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0147] Figure 11 is a schematic diagram of the structure of a terminal device provided in one embodiment of the present application. As shown in Figure 11, the terminal device of this embodiment includes: at least one processor (only one is shown in Figure 11), a memory, and a readable storage medium stored in the memory and executable by the at least one processor. When the processor executes the readable storage medium, it implements the steps of any of the above-mentioned data transmission method embodiments.
[0148] The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that FIG5 is merely an example of a terminal device and does not limit the terminal device. The terminal device may include more or fewer components than shown in the figure, or may combine certain components or different components. For example, it may also include a network interface, a display screen, and an input device.
[0149] The processor may be a CPU, other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or any conventional processor, etc.
[0150] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory can be the internal memory of the terminal device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium can be the hard disk of the terminal device. In other embodiments, it can also be an external storage device of the terminal device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. equipped with the terminal device. Furthermore, the memory can also include both the internal storage unit of the terminal device and an external storage device. The memory is used to store the operating system, application programs, boot loaders (BootLoader), data, and other programs, such as the program code of computer programs. The memory can also be used to temporarily store data that has been output or is about to be output.
[0151] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned method embodiments by means of a computer program instructing the relevant hardware. The computer program may be stored in a computer-readable storage medium, which, when executed by a processor, implements the steps of the above-mentioned method embodiments. Furthermore, the computer-readable storage medium may be either non-volatile or volatile.
[0152] The term "computer program" includes computer program code, which may be in source code form, object code form, executable file, or some intermediate form. Computer-readable storage media may include at least: any entity or device capable of carrying computer program code, recording media, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunications signals, and software distribution media. Examples include USB flash drives, removable hard drives, magnetic disks, or optical disks. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunications signals.
[0153] The present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed through a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiment when executing it.
[0154] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0155] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0156] In the embodiments provided in this application, it should be understood that the disclosed devices / terminal devices and methods can be implemented in other ways. For example, the device / terminal device embodiments described above are merely illustrative. For example, the division of modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0157] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0158] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A data transmission method based on column transmission, applied to a server, wherein: The method comprises the following steps: Obtain the current i-th row and j-th column target data to be filled into the message, and determine whether the i-th row and j-th column target data is first type data; wherein i and j are positive integers; When it is determined that the target data in the i-th row and j-th column is the first type of data, the target data in the i-th row and j-th column is filled into the message according to a set first protocol format; the first type of data in the first protocol format includes a data segment, and the data segment includes: a first identifier for representing a data type, a second identifier for representing a data length, and specific data content; Repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and then send the message; The next message is filled according to the data filling process until the target data in each row and column is filled into the corresponding message according to the preset data row and column order, and the next message is sent.
2. The data transmission method based on column transmission according to claim 1, wherein: The data transmission method further comprises the following steps: When it is determined that the target data in the i-th row and j-th column is the second type of data, and the length of the second type of data is greater than the length of the first type of data; the target data in the i-th row and j-th column is filled into the message according to the set second protocol format; the second type of data in the second protocol format includes at least two data segments and a data end identifier; In the process of filling the data segment of the second type of data, when it is determined that the message is full, the message is sent; and the remaining data segment of the second type of data and the data end identifier are continuously filled in the next message.
3. The data transmission method based on column transmission according to claim 2, wherein: When it is determined that the target data in the i-th row and j-th column is the second type of data, filling the target data in the i-th row and j-th column into the message according to the set second protocol format includes: Setting a placeholder identifier for the second type of data and filling it into the message; Determine whether the target data of the remaining columns of the current row except the second type of data has been filled; When it is determined that the filling is complete, determining whether there is unfilled second type data; When it is determined that the unfilled second type of data exists, determining whether the current message is filled; If it is determined that the current message is not full, the second type of data is filled into the current message in units of maximum bytes until the current message is full or the second type of data is completely filled.
4. The data transmission method based on column transmission according to claim 3, wherein: After it is determined that there are remaining columns of target data other than the second type of data that have not been filled, the method further includes the following steps: Acquire and determine whether the target data of the remaining columns is the second type of data; If it is determined that it is not the second type of data, determining whether the current message is full; if it is determined that it is not full, filling the target data of the remaining columns into the current message according to the first protocol format; If it is determined to be the second type of data, determine whether the current message is full; if it is determined to be not full, return to the step of "setting a placeholder identifier for the second type of data and filling it into the message".
5. The data transmission method based on column transmission according to claim 2, wherein: The preset data row and column order includes: First fill in the target data in each column of the first row, then fill in the target data in each column of the second row, and so on, and finally fill in the target data in each column of the last row.
6. A data transmission method based on column transmission, applied to a client, wherein: The data transmission method comprises the following steps: Receive the current message containing the target data sent by the server, and determine whether the received target data meets the preset number of rows; When it is determined that the received target data does not meet the preset number of rows, the target data of each column of the current row in the current message is obtained, and it is determined whether part of the first type of data is truncated to the next message; When it is determined that part of the first type of data is truncated to the next message, a new message is sent to the server. Message receiving request; The above process is repeated until it is determined that no first type of data exists and is truncated into the next message.
7. The data transmission method based on column transmission according to claim 6, wherein: The data transmission method further comprises the following steps: When it is determined that there is no first type of data to be truncated to the next message, it is determined whether there is second type of data at the end of the current row of target data; When it is determined that the second type of data exists at the end of the current row of target data, the second type of data in the current message is acquired; and it is determined whether the second type of data in the current row of target data has been acquired; When it is determined that the second type of data has not been acquired, a new message receiving request is sent to the server, and the second type of data in the new message is acquired, until the second type of data is determined to be acquired, and the process returns to the step of "determining whether the received target data meets the preset number of rows".
8. A data transmission device based on column transmission, wherein: The data transmission device comprises: A data acquisition and judgment module, used to obtain the current i-th row and j-th column target data to be filled into the message, and judge whether the i-th row and j-th column target data is the first type of data; wherein i and j are positive integers; A first type data filling module is used for filling the target data in the i-th row and j-th column into the message according to a set first protocol format when determining that the target data in the i-th row and j-th column is the first type data; the first type data in the first protocol format includes a data segment, and the data segment includes: a first identifier for representing a data type, a second identifier for representing a data length, and specific data content; The first filling control module is used to control the acquisition and judgment module and the data filling module, repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data of a certain row and a certain column, and send the message; and fill the next message according to the data filling process, until the target data of each row and each column are filled into the corresponding message according to the preset data row and column order, and send the next message.
9. The data transmission device based on column transmission according to claim 8, wherein: The data transmission device also includes: A second type data filling module is used for filling the target data of the i-th row and j-th column into the message according to a set second protocol format when it is determined that the target data of the i-th row and j-th column is the second type data and the length of the second type data is greater than the length of the first type data; the second type data according to the second protocol format includes at least two data segments and a data end identifier; The second filling control module is used to send the message when it is determined that the message is full during the process of filling the data segment of the second type of data; and continue to fill the remaining data segment of the second type of data and the data end identifier in the next message.
10. The data transmission device based on column transmission according to claim 9, wherein: The second type data filling module includes: A placeholder generation and filling unit, used to set a placeholder identifier for the second type of data and fill it into the message; A first judging unit, used to judge whether the target data of the remaining columns of the current row except the second type of data has been sent; A second determination unit, configured to determine whether there is unsent second type data when it is determined that the sending is complete; A third judgment unit, configured to judge whether the current message is full when it is determined that the unsent second type of data exists; The first filling unit is used to fill the second type of data into the current message in units of maximum bytes if it is determined that the current message is not full, until the current message is full or the second type of data is completely filled.
11. The data transmission device based on column transmission according to claim 10, wherein: The second type data filling module also includes: A fourth judgment unit, used for acquiring and judging whether the target data of the remaining columns is the second type of data; The second filling unit is used to determine whether the current message is full if it is determined that the data is not of the second type; If the message is not filled, the target data of the remaining columns are filled into the current message according to the first protocol format; The fifth judgment unit is used to judge whether the current message is full if it is judged to be the second type of data; if it is judged to be not full, return to the placeholder generation filling unit.
12. The data transmission device based on column transmission according to claim 8, wherein: The preset data row and column order includes: First fill in the target data in each column of the first row, then fill in the target data in each column of the second row, and so on, and finally fill in the target data in each column of the last row.
13. A terminal device, wherein: The terminal device includes a processor, a memory, and a readable storage medium stored in the memory and executable on the processor, and the processor implements the following steps when executing the readable storage medium: Obtain the current i-th row and j-th column target data to be filled into the message, and determine whether the i-th row and j-th column target data is first type data; Where i and j are positive integers; When it is determined that the target data in the i-th row and j-th column is the first type of data, the target data in the i-th row and j-th column is filled into the message according to a set first protocol format; The first type of data in the first protocol format includes a data segment, wherein the data segment includes: a first identifier for representing a data type, a second identifier for representing a data length, and specific data content; Repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and then send the message; The next message is filled according to the data filling process until the target data in each row and column is filled into the corresponding message according to the preset data row and column order, and the next message is sent.
14. The terminal device according to claim 13, wherein: When the processor executes the readable storage medium, the following steps are implemented: When it is determined that the target data in the i-th row and j-th column is the second type of data, and the length of the second type of data is greater than the length of the first type of data; filling the target data in the i-th row and j-th column into the message according to the set second protocol format; The second type of data in the second protocol format includes at least two data segments and a data end identifier; In the process of filling the data segment of the second type of data, when it is determined that the message is filled, sending the message; And continue to fill the remaining data segments of the second type of data and the data end identifier in the next message.
15. The terminal device according to claim 14, wherein: When it is determined that the target data in the i-th row and j-th column is the second type of data, filling the target data in the i-th row and j-th column into the message according to the set second protocol format includes: Setting a placeholder identifier for the second type of data and filling it into the message; Determine whether the target data of the remaining columns of the current row except the second type of data has been filled; When it is determined that the filling is complete, determining whether there is unfilled second type data; When it is determined that the unfilled second type of data exists, determining whether the current message is filled; If it is determined that the current message is not full, the second type of data is filled into the current message in units of maximum bytes until the current message is full or the second type of data is completely filled.
16. The terminal device according to claim 15, wherein: After it is determined that there are remaining columns of target data other than the second type of data that have not been filled, the method further includes the following steps: Acquire and determine whether the target data of the remaining columns is the second type of data; If it is determined that it is not the second type of data, determining whether the current message is full; if it is determined that it is not full, filling the target data of the remaining columns into the current message according to the first protocol format; If it is determined to be the second type of data, determine whether the current message is full; if it is determined to be not full, return to the step of "setting a placeholder identifier for the second type of data and filling it into the message".
17. The terminal device according to claim 13, wherein: The preset data row and column order includes: First fill in the target data in each column of the first row, then fill in the target data in each column of the second row, and so on, and finally fill in the target data in each column of the last row.
18. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the following steps are implemented: Get the current i-th row and j-th column target data to be filled into the message, and determine whether the i-th row and j-th column target data is the first type of data; Where i and j are positive integers; When it is determined that the target data in the i-th row and j-th column is the first type of data, the target data in the i-th row and j-th column is filled into the message according to a set first protocol format; The first type of data in the first protocol format includes a data segment, wherein the data segment includes: a first identifier for representing a data type, a second identifier for representing a data length, and specific data content; Repeat the above data filling process, fill the next target data in the message according to the preset data row and column order, until the message is filled with the target data in a certain row and column, and then send the message; The next message is filled according to the data filling process until the target data in each row and column is filled into the corresponding message according to the preset data row and column order, and the next message is sent.
19. The computer-readable storage medium of claim 18, wherein: When the computer program is executed by a processor, the following steps are implemented: When it is determined that the target data in the i-th row and j-th column is the second type of data, and the length of the second type of data is greater than the length of the first type of data; filling the target data in the i-th row and j-th column into the message according to the set second protocol format; The second type of data in the second protocol format includes at least two data segments and a data end identifier; In the process of filling the data segment of the second type of data, when it is determined that the message is filled, sending the message; And continue to fill the remaining data segments of the second type of data and the data end identifier in the next message.
20. The computer-readable storage medium of claim 19, wherein: When it is determined that the target data in the i-th row and j-th column is the second type of data, filling the target data in the i-th row and j-th column into the message according to the set second protocol format includes: Setting a placeholder identifier for the second type of data and filling it into the message; Determine whether the target data of the remaining columns of the current row except the second type of data has been filled; When it is determined that the filling is complete, determining whether there is unfilled second type data; When it is determined that the unfilled second type of data exists, determining whether the current message is filled; If it is determined that the current message is not full, the second type of data is filled into the current message in units of maximum bytes until the current message is full or the second type of data is completely filled.
Citation Information
Patent Citations
Automatic testing method and device based on metadata
CN114238126A
Encapsulator and an associated method and computer program product for encapsulating data packets
US20060007953A1