CN111367937B - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN111367937B
CN111367937B CN202010130431.5A CN202010130431A CN111367937B CN 111367937 B CN111367937 B CN 111367937B CN 202010130431 A CN202010130431 A CN 202010130431A CN 111367937 B CN111367937 B CN 111367937B
Authority
CN
China
Prior art keywords
statement
sql
processed
sentence
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010130431.5A
Other languages
Chinese (zh)
Other versions
CN111367937A (en
Inventor
詹奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Appeon Technology Shenzhen Co ltd
Original Assignee
Appeon Technology Shenzhen Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Appeon Technology Shenzhen Co ltd filed Critical Appeon Technology Shenzhen Co ltd
Priority to CN202010130431.5A priority Critical patent/CN111367937B/en
Publication of CN111367937A publication Critical patent/CN111367937A/en
Application granted granted Critical
Publication of CN111367937B publication Critical patent/CN111367937B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2438Embedded query languages

Abstract

The embodiment of the application discloses a data processing method, which comprises the following steps: acquiring a statement to be processed, wherein the statement to be processed is an embedded Structured Query Language (SQL) statement; SQL conversion processing is carried out on the statement to be processed, and an SQL processing result of the statement to be processed is generated; determining an execution interface of the target sentence according to the SQL processing result of the sentence to be processed; determining a first parameter of a target sentence according to the SQL processing result of the sentence to be processed; determining a second parameter of the target sentence according to the input host variable included in the sentence to be processed, wherein the second parameter is a standard SQL variable; and outputting the target statement according to the execution interface, the first parameter and the second parameter. The development efficiency of programmers can be remarkably improved.

Description

Data processing method and device
Technical Field
The present application relates to the field of software development technologies, and in particular, to a data processing method and apparatus.
Background
The embedded structured query language (embedded structured query language, ESQL) is a method of writing structured query language (structured query language, SQL) statements directly into source code of programming languages such as PowerBuilder, C, COBOL, FORTRAN, or Ada. It is used in a large number of conventional programming languages because it provides many functions such as SQL grammar checking at compile time.
With the advancement of database development technology, the use of object relational mapping (object relational mapping, ORM) framework is becoming the dominant method of database application development. At present, both NET and Java no longer provide support for embedded SQL. Many applications currently running are still developed in embedded SQL, and in order to maintain and extend these applications, these applications need to be migrated to a new development platform.
Therefore, a data processing method is needed to convert the statement of the embedded SQL.
Disclosure of Invention
The first aspect of the present application provides a data processing method, including:
acquiring a statement to be processed, wherein the statement to be processed is an embedded Structured Query Language (SQL) statement;
SQL conversion processing is carried out on the statement to be processed, and an SQL processing result of the statement to be processed is generated;
determining an execution interface of a target sentence according to the SQL processing result of the sentence to be processed;
determining a first parameter of the target sentence according to the SQL processing result of the sentence to be processed;
determining a second parameter of the target sentence according to an input host variable and/or an output host variable included in the sentence to be processed, wherein the second parameter is a standard SQL variable;
and outputting the target statement according to the execution interface, the first parameter and the second parameter.
A second aspect of the present application provides a data processing apparatus comprising:
the acquisition module is used for acquiring a statement to be processed, wherein the statement to be processed is an embedded Structured Query Language (SQL) statement;
the processing module is used for carrying out SQL conversion processing on the statement to be processed and generating an SQL processing result of the statement to be processed;
the processing module is further used for determining an execution interface of a target sentence according to the SQL processing result of the sentence to be processed;
the processing module is further used for determining a first parameter of the target sentence according to the SQL processing result of the sentence to be processed;
the processing module is further configured to determine a second parameter of the target sentence according to an input host variable and/or an output host variable included in the sentence to be processed, where the second parameter is a standard SQL variable;
and the output module is used for outputting the target statement according to the execution interface, the first parameter and the interface calling result.
In a third aspect, the present application provides a data processing apparatus, which may include one or more processors, memory, and a communication interface.
The processor, the memory and the communication interface are connected through a bus.
The memory is used for storing program instructions, and the processor calls the program instructions stored in the memory to execute the steps in the data processing method of the first aspect.
The fourth aspect of the present application also provides a computer apparatus, including a processor, where the processor is configured to implement the data processing method provided in the first aspect of the present application when executing the computer program stored on the memory.
In a fifth aspect, the present application also provides a readable storage medium having stored thereon a computer program for implementing the data processing method provided in the first aspect of the embodiment of the present application when the computer program is executed by a processor.
From the above technical solutions, the embodiment of the present application has the following advantages:
the application provides a data processing method by which a user can automatically convert a statement to be processed into a target statement, wherein the statement to be processed can be an ESQL code, and the target statement can be an SQL code. Therefore, the development efficiency of the programmer can be remarkably improved.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a data processing method according to the present application;
FIG. 2 is a schematic diagram of an embodiment of a data processing apparatus according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules that are expressly listed or inherent to such process, method, article, or apparatus. The naming or numbering of the steps in the present application does not mean that the steps in the method flow must be executed according to the time/logic sequence indicated by the naming or numbering, and the execution sequence of the steps in the flow that are named or numbered may be changed according to the technical purpose to be achieved, so long as the same or similar technical effects can be achieved. The division of the modules in the present application is a logical division, and may be implemented in another manner in practical applications, for example, a plurality of modules may be combined or integrated in another system, or some features may be omitted or not implemented, and further, coupling or direct coupling or communication connection between the modules shown or discussed may be through some interfaces, and indirect coupling or communication connection between the modules may be electrical or other similar manners, which are not limited in the present application. The modules or sub-modules described as separate components may be physically separated or not, or may be distributed in a plurality of circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present application.
The embodiment of the application provides a data processing method, through which a user can automatically convert a statement to be processed into a target statement, wherein the statement to be processed can be an ESQL code, and the target statement can be an SQL code. Therefore, the development efficiency of the programmer can be remarkably improved.
Referring to fig. 1, fig. 1 is a schematic diagram of an embodiment of a data processing method according to the present application, where the data processing method includes:
101. and acquiring a statement to be processed.
In this embodiment, a device running the data processing method proposed by the present application is referred to as a data processing device. First, the data processing apparatus acquires a statement to be processed. Alternatively, the statement to be processed may be an embedded SQL statement (ESQL statement), which is commonly used in conventional programming languages, such as "PowerBuilder".
Specifically, the statement to be processed may be a query SQL statement, an add SQL statement, a delete SQL statement, and/or a modify SQL statement. The statement to be processed may also be a Cursor (Cursor) statement set. The statement to be processed may also be a set of Stored Procedure (Stored Procedure) statements, not limited herein. The cursor statement set comprises various cursor statements, and the storage process statement set comprises various storage process statements.
For ease of understanding, the statement to be processed is illustrated below in pseudo code:
int li_id, li_age// defines the output host variable
string ls_name= "Zhang Sano"// define input host variables).
In general, the to-be-processed sentence includes an input host variable (host variable) and an output host variable, and optionally, the data processing method provided by the embodiment of the present application may also be applied to processing an embedded SQL sentence including only the input host variable, which is not limited herein.
102. SQL conversion processing is carried out on the statement to be processed, and an SQL processing result of the statement to be processed is generated.
In this embodiment, the data processing apparatus performs SQL conversion processing on a statement to be processed, specifically: removing output host variables in the to-be-processed statement, converting the input host variables in the to-be-processed statement into standard SQL variables, and converting the to-be-processed statement (embedded SQL statement) into an SQL statement (executable SQL).
For example: the input host variable "ls_name" in the sentence to be processed is converted into: "@ ls_name", specifically, "SELECT Age INTO, li_age; FROM Student Where name =: ls_name "to" SELECT Age FROM Student Where name = @ ls_name ".
The data processing apparatus may further determine a type of the sentence to be processed in the process of performing the SQL conversion processing on the sentence to be processed, for example, determine that the type of the sentence to be processed is a query SQL sentence.
103. And determining the execution interface of the target statement according to the SQL processing result of the statement to be processed.
In this embodiment, the data processing apparatus determines the execution interface of the target sentence according to the SQL processing result of the sentence to be processed. Specifically, according to the SQL processing result, the type of the sentence to be processed is determined. And determining the execution interface of the target sentence according to the type of the sentence to be processed.
In an alternative implementation, when the data processing apparatus determines that the statement to be processed is a query SQL statement, the number of output host variables included in the statement to be processed is further detected.
When the number of the output host variables is 1 (i.e. the SQL processing result is a single Row (Column)), firstly, determining the corresponding type of the output host variables in the target sentence according to the type of the output host variables; then, the execution interface of the target statement is determined to be a Scalar scaler interface in an SQL executor.
When the number of the output host variables is greater than 1 (i.e., the SQL processing result is a single Row (Row) multi-Column (Column)), the execution interface of the target sentence is determined to be a Select interface in an SQL executor (SQL executor).
In an alternative implementation, when the data processing apparatus determines that the statement to be processed is a new add, delete and/or modify SQL statement, the execution interface of the target statement is determined to be an execution interface in an SQL executor.
In an alternative implementation, when the statement to be processed is a cursor statement set or a stored procedure statement set, the interface between the target statements is determined to be an execution interface in the SQL executor.
104. And determining a first parameter of the target sentence according to the SQL processing result of the sentence to be processed.
In this embodiment, the data processing apparatus determines, according to the SQL processing result of the statement to be processed, a first parameter of the target statement, where the first parameter may be a first parameter after the execution interface of the target statement.
Optionally, when the statement to be processed is a query SQL statement and the number of output host variables is 1, the data processing apparatus uses the type of the statement to be processed in the SQL processing result as a generic parameter of the execution interface. For example:
a statement to be processed: "SELECT Age INTO, li_age; FROM Student Where name =: ls_name; "convert to the target sentence" li_age=sqlxexebutor. Scaler < int > ("SELECT Age FROM Student Where name = @ ls_name", ls_name); ". Wherein the first parameter in the target statement is "SELECT Age".
Optionally, when the statement to be processed is a query SQL statement and the number of output host variables is greater than 1, the data processing apparatus uses a dynamic data model (dynamicodel) as a generic parameter of the target statement. For example:
a statement to be processed: "SELECT ID, age INTO: li_id,: li_ Age FROM Student Where name =: ls_name; "convert to target sentence" var result=sqlxexecutor. SELECT < dynamicmode > ("SELECT Id, age FROM Student Where name = @ ls_name", ls_name); li_id=result [0]; li_age=result [1]; ". Because the output host variables exist 'li_id' and 'li_age', the values of the columns of the result of executing the interface call need to be respectively assigned to the output host variables in the target statement.
Optionally, when the to-be-processed statement is an newly added SQL statement, a deleted SQL statement, and/or a modified SQL statement, the newly added SQL statement, the deleted SQL statement, and/or the modified SQL statement do not return an execution result, so that the statement does not include an output host variable. The process of inputting the host variable in the sentence is detailed in step 105.
Optionally, when the sentence to be processed is a vernier sentence set or a stored procedure sentence set, the method specifically includes the following steps: when the sentence to be processed is a Cursor statement set, extracting a query SQL sentence in the Cursor statement set, and performing SQL conversion processing on the query SQL sentence to generate the first parameter. The first parameter is an SQL statement generated by SQL conversion processing of the query SQL statement.
Optionally, when the to-be-processed sentence is a Stored Procedure sentence set, extracting a Stored Procedure execution sentence in the Stored Procedure sentence set, where a name of the Stored Procedure execution sentence in the Stored Procedure sentence set is used as the first parameter.
105. And determining a second parameter of the target sentence according to the SQL processing result of the sentence to be processed.
In this embodiment, the data processing apparatus determines, according to the SQL processing result of the statement to be processed, a second parameter of the target statement, where it is to be noted that the second parameter is a standard SQL variable, and the second parameter is one or more parameters.
Optionally, when the sentence to be processed is a query SQL sentence and the number of output host variables is 1, the data processing apparatus extracts an input host variable in the SQL processing result, and the input host variable is used as a second parameter of the target sentence and is transmitted to the execution interface.
Optionally, when the statement to be processed is a query SQL statement and the number of the output host variables is greater than 1, the data processing device extracts the input host variables in the SQL processing result, and the input host variables are used as the second parameters of the target statement and are transmitted to the execution interface.
Optionally, when the sentence to be processed is an newly added SQL sentence, an deleted SQL sentence, and/or an SQL sentence modified, the data processing apparatus extracts an input host variable in the SQL processing result, and the input host variable is used as a second parameter of the target sentence and is transmitted to the execution interface.
Optionally, when the to-be-processed statement is a Cursor statement set, first, the data processing device converts a Cursor definition statement and a Cursor opening statement in the Cursor statement set into a Cursor execution statement on the SQL executor.
And secondly, performing SQL conversion processing on the cursor execution statement, generating the SQL processing result of the cursor execution statement, and packaging the SQL processing result of the cursor execution statement into a dynamic model result set (DbResultSet), wherein the dynamic model result set is the second parameter of the target statement. The data processing apparatus defines the dynamic model result set as the output parameter type of the target sentence.
And if the cursor opening sentence in the cursor sentence set comprises the input parameter, the input parameter is used as a second parameter of the target sentence to be transmitted into the corresponding execution interface. Specifically, the interface is converted into a corresponding interface in the dynamic model result set object, and the interface is an interface positioned to the next line of data in the dynamic model result set object.
Optionally, when the to-be-processed statement is a set of stored procedure statements, first, the data processing apparatus converts the stored procedure declaration statement and the stored procedure execution statement in the set of stored procedure statements into a stored procedure execution statement on the SQL executor.
Secondly, carrying out SQL conversion processing on the stored procedure execution statement on the SQL executor, generating the SQL processing result of the stored procedure execution statement on the SQL executor, and packaging the SQL processing result into a dynamic model result set, wherein the dynamic model result set is the second parameter of the target statement. The data processing apparatus defines the dynamic model result set as the output parameter type of the target sentence.
And if the stored process statement set comprises an execution result, an output parameter and a return value extraction statement, the data processing device converts the execution result, the output parameter and the return value extraction statement into corresponding interfaces in the dynamic model result set. Specifically, the interface is converted into an interface for positioning the next line of data in the dynamic model result set object.
106. And determining a calling result of the execution interface according to the execution interface of the statement to be processed.
In this embodiment, the data processing apparatus determines, according to an execution interface of a statement to be processed, a call result of the execution interface.
Optionally, when the statement to be processed is a query SQL statement and the number of the output host variables is 1, the data processing apparatus directly assigns the calling result of the execution interface to the output host variables.
Optionally, when the statement to be processed is a query SQL statement and the number of output host variables is greater than 1, the data processing apparatus determines that the values of the columns on the dynamic data model object are assigned to the corresponding output host variables.
Optionally, when the sentence to be processed is a vernier sentence set, the data processing device extracts the result of the vernier execution in the vernier sentence set, and converts the result into a corresponding interface in the dynamic model result set object, where the interface is an interface positioned to the next line of data in the dynamic model result set object. The data processing device extracts the interfaces of the data of the current columns and respectively assigns the data to the corresponding output host variables.
Optionally, when the sentence to be processed is a set of stored procedure sentences, the data processing device converts output parameters and return value extraction sentences included in the set of stored procedure sentences into corresponding interfaces in the result set of dynamic models. Specifically, the interface is converted into an interface for positioning the next line of data in the dynamic model result set object. The data processing device extracts the interfaces of the data of the current columns and respectively assigns the data to the corresponding output host variables. If there is no execution result in the stored procedure sentence set, step 106 is not required to be executed.
107. And outputting the target statement according to the execution interface, the first parameter, the second parameter and the interface calling result.
In this embodiment, the data processing apparatus outputs the target sentence according to the execution interface, the first parameter, the second parameter, and the interface call result.
It should be noted that, when the to-be-processed sentence is a vernier sentence set, the target sentence further includes an execution state judgment sentence on the DbResultSet object and a closing sentence on the DbResultSet object. The executing state judgment statement on the DbResultset object is obtained by converting statement executing state judgment statement extracted from SQL processing results generated after SQL conversion processing is carried out on a vernier statement set. The closing statement on the DbResultset object is obtained by SQL conversion processing of cursor closing statements in a cursor statement set.
When the to-be-processed statement is a stored procedure statement set, the target statement also comprises an execution state judgment statement on the DbResultset object and a closing statement on the DbResultset object. The executing state judging statement on the DbResultset object is obtained by converting an executing result, an output parameter and a return value extracting statement in a stored process statement set. The closing statement on the DbResultset object is obtained by SQL conversion processing of a closing statement of a storage process in a storage process statement set.
For easy understanding, the following description will be given of two cases, i.e., a cursor statement set and a stored procedure statement set, respectively.
(1) The sentence to be processed is a cursor sentence set.
A statement to be processed:
“Declare lc_cursor Cursor For Select id,Name from student where age>:li_age;
Open lsp_cursor;
fetch lsp_cursor Into: li_id, li_name; execution result extraction Do While sqlca.sqlcode=0// execution result extraction status determination
Fetch lsp_cursor Into: li_id, li_name; the execution result extracts Loop Close lsp_cursor; "
After being processed by the data processing device, the output target sentence is:
“SqlExecutor.ExecuteCursor(“Select id,Name from student where age>@li_age”,
out DbResultSet resultSet, li_age); execution cursor resultset.next (); the value of the first column of the current line is obtained by locating/locating to the first line li_id=result set
li_name=result set. Getvalue < string > (1)// obtain the value of the second field of the current column
While (resultset.sqlnode= 0)// execution result extraction state judgment {
resultset.next (); data for next line of execution result
li_id=resultset.getvalue < int > (0); value of first column of current column is/is obtained
li_name=resultset.getvalue < string > (1); obtaining/obtaining the value of the second field of the current column
}
resultSet.Close();”。
It should be noted that this is only an alternative implementation, and is only illustrated here as an example.
(2) The sentences to be processed are a set of stored process sentences.
A statement to be processed:
“Declare lsp_proc Procedure For@rc=sp_students@age=:li_age,@count=:li_count output;
Execute lsp_proc;
fetch lsp_proc Into:li_id: ls_name; execution result extraction Do While sqlca.sqlcode=0// execution result extraction status determination
Fetch lsp_proc Into:li_id: ls_name; the execution result is extracted Loop Fetch lsp_proc Into: li_rc,: li_count; input/output parameter extraction
Close lsp_proc;”
After being processed by the data processing device, the output target sentence is:
“SqlExecutor.ExecuteProcedure(“sp_students”,out DbResultSet resultSet,
ParmValue.New(“age”,li_age),
ParmValue.New(“count”,ParmDirection.Output),
ParmValue.New(“rc”,ParmDirection.ReturnValue));
execution memory procedure
resultset.next (); the first line of execution result is/is positioned
li_id=result set. Getvalue < int > (0)// obtain the value of the first field of the current line
li_name=result set. Getvalue < string > (1)// obtain the value of the second field of the current column
While (resultset.sqlnode= 0)// execution result extraction state judgment {
resultset.next (); data for next line of execution result
li_id=resultset.getvalue < int > (0); value of first column of current column is/is obtained
li_name=resultset.getvalue < string > (1); obtaining/obtaining the value of the second field of the current column
}
resultset.next (); the position is/is to return value and output parameter li_rc=resultset. The return value li_count=resultset.getvalue < int > (1); obtaining a value resultset (); "
It should be noted that this is only an alternative implementation, and is only illustrated here as an example.
In the embodiment of the application, a user can automatically convert a statement to be processed into a target statement through the data processing method, wherein the statement to be processed can be an ESQL code, and the target statement can be an SQL code. Therefore, the development efficiency of the programmer can be remarkably improved.
The data processing method in this embodiment is described above, and the data processing apparatus provided in this embodiment of the present application is described below based on the data processing method. As shown in fig. 2, fig. 2 is a schematic diagram of an embodiment of a data processing apparatus according to an embodiment of the present application, and one embodiment of a data processing apparatus 200 includes:
an obtaining module 201, configured to obtain a statement to be processed, where the statement to be processed is an embedded structured query language SQL statement;
the processing module 202 is configured to perform SQL conversion processing on the to-be-processed statement, and generate an SQL processing result of the to-be-processed statement;
the processing module 202 is further configured to determine an execution interface of a target sentence according to the SQL processing result of the sentence to be processed;
the processing module 202 is further configured to determine a first parameter of the target sentence according to the SQL processing result of the to-be-processed sentence;
the processing module 202 is further configured to determine a second parameter of the target sentence according to an input host variable included in the sentence to be processed, where the second parameter is a standard SQL variable;
and the output module 203 is configured to output the target sentence according to the execution interface, the first parameter and the second parameter.
In some possible implementations of the application, the data processing apparatus 200 further comprises:
the processing module 202 is further configured to determine an interface call result of the execution interface according to the execution interface of the target statement, where the interface call result is assigned to the output host variable;
the output module 203 is further configured to output the target sentence according to the execution interface, the first parameter, the second parameter, and the interface call result.
In some possible implementations of the application, the data processing apparatus 200 further comprises:
the processing module 202 is further configured to detect, when the to-be-processed statement is a query SQL statement, the number of output host variables included in the to-be-processed statement;
the processing module 202 is further configured to determine, when the number of output host variables is 1, a type of the output host variable corresponding to the target sentence according to the type of the output host variable;
the processing module 202 is further configured to determine that the execution interface of the target statement is a Scalar scaler interface in an SQL executor;
in some possible implementations of the application, the data processing apparatus 200 further comprises:
the processing module 202 is further configured to detect, when the to-be-processed statement is a query SQL statement, the number of output host variables included in the to-be-processed statement;
the processing module 202 is further configured to determine that the execution interface of the target sentence is a Select interface in an SQL executor when the number of output host variables is greater than 1.
In some possible implementations of the application, the data processing apparatus 200 further comprises:
the processing module 202 is further configured to assign the interface call result of the selected interface to a dynamic model object, where the value of each field in the dynamic model object is an assignment of the output host variable.
In some possible implementations of the application, the data processing apparatus 200 further comprises:
the processing module 202 is further configured to determine that the execution interface of the target statement is an execution interface in an SQL executor when the statement to be processed is an SQL statement.
In some possible implementations of the application, the data processing apparatus 200 further comprises:
the processing module 202 is further configured to extract a query SQL statement in the Cursor statement set when the statement to be processed is the Cursor statement set, and perform the SQL conversion processing on the query SQL statement to generate the first parameter;
the processing module 202 is further configured to convert the cursor definition statement and the cursor opening statement in the cursor statement set into cursor execution statements on the SQL executor;
the processing module 202 is further configured to perform the SQL conversion process on the cursor execution statement, generate the SQL processing result of the cursor execution statement, and package the SQL processing result of the cursor execution statement into a dynamic model result set, where the dynamic model result set is the second parameter of the target statement;
the processing module 202 is further configured to convert each cursor statement in the cursor statement set into a corresponding interface in the dynamic model result set.
In some possible implementations of the application, the data processing apparatus 200 further comprises:
the processing module 202 is further configured to extract a Stored Procedure execution statement in the Stored Procedure statement set when the to-be-processed statement is the Stored Procedure store Procedure statement set, where a name of the Stored Procedure execution statement in the Stored Procedure statement set is used as the first parameter;
the processing module 202 is further configured to convert the stored procedure declaration statement and the stored procedure execution statement in the stored procedure statement set into a stored procedure execution statement on the SQL executor;
the processing module 202 is further configured to perform the SQL conversion process on the stored procedure execution statement on the SQL executor, generate the SQL processing result of the stored procedure execution statement on the SQL executor, and encapsulate the SQL processing result into a dynamic model result set, where the dynamic model result set is the second parameter of the target statement;
the processing module 202 is further configured to convert each stored procedure statement in the set of stored procedure statements into a corresponding interface in the result set of dynamic models.
Fig. 3 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application. The data processing apparatus 300 comprises a processor 301, a memory 302 and an input output (I/O) interface 303, the memory 302 may comprise read only memory and random access memory and provide operating instructions and data to the processor 301. A portion of the memory 302 may also include non-volatile random access memory (NVRAM).
Processor 301 controls the operation of data processing apparatus 300, and processor 301 may also be referred to as a CPU. Memory 302 may include read only memory and random access memory and provides instructions and data to processor 301. A portion of the memory 302 may also include non-volatile random access memory (NVRAM). The various components of data processing apparatus 300 are coupled together by bus system 304 in a particular application, where bus system 304 may include a power bus, a control bus, a status signal bus, and the like, in addition to a data bus. For clarity of illustration, however, the various buses are labeled in the drawing as bus system 304.
The method disclosed in the above embodiment of the present application may be applied to the processor 301 or implemented by the processor 301. The processor 301 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry of hardware in the processor 301 or instructions in the form of software. The processor 301 may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 302 and the processor 301 reads the information in the memory 302 and in combination with its hardware performs the steps of the above method.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (8)

1. A data processing method is characterized in that,
acquiring a statement to be processed, wherein the statement to be processed is an embedded Structured Query Language (SQL) statement;
SQL conversion processing is carried out on the statement to be processed, and an SQL processing result of the statement to be processed is generated;
determining an execution interface of a target sentence according to the SQL processing result of the sentence to be processed;
determining a first parameter of the target sentence according to the SQL processing result of the sentence to be processed;
determining a second parameter of the target sentence according to an input host variable included in the sentence to be processed, wherein the second parameter is a standard SQL variable;
outputting the target sentence according to the execution interface, the first parameter and the second parameter;
the statement to be processed further includes an output host variable, the method further including:
determining an interface calling result of the execution interface according to the execution interface of the target statement, wherein the interface calling result is assigned to the output host variable;
outputting the target statement according to the execution interface, the first parameter, the second parameter and the interface calling result;
when the statement to be processed is a vernier statement set, extracting a query SQL statement in the vernier statement set, and performing SQL conversion processing on the query SQL statement to generate the first parameter;
converting cursor definition sentences and cursor opening sentences in the cursor sentence sets into cursor execution sentences on an SQL executor;
performing the SQL conversion processing on the cursor execution statement, generating the SQL processing result of the cursor execution statement, and packaging the SQL processing result of the cursor execution statement into a dynamic model result set, wherein the dynamic model result set is the second parameter of the target statement;
and converting each cursor statement in the cursor statement set into a corresponding interface in the dynamic model result set.
2. The method according to claim 1, wherein the determining the execution interface of the target sentence according to the SQL processing result of the sentence to be processed comprises:
when the statement to be processed is a query SQL statement, detecting the number of output host variables included in the statement to be processed;
when the number of the output host variables is 1, determining the corresponding type of the output host variables in the target statement according to the type of the output host variables;
the execution interface of the target statement is determined to be a Scalar scaler interface in an SQL executor.
3. The method according to claim 1, wherein the determining the execution interface of the target sentence according to the SQL processing result of the sentence to be processed comprises:
when the statement to be processed is a query SQL statement, detecting the number of output host variables included in the statement to be processed;
and when the number of the output host variables is greater than 1, determining the execution interface of the target statement to be a selection interface in an SQL executor.
4. A method according to claim 3, characterized in that the method further comprises:
and assigning the interface calling result of the selected interface to a dynamic model object, wherein the value of each column in the dynamic model object is the assignment of the output host variable.
5. The method according to claim 1, wherein the determining the execution interface of the target sentence according to the SQL processing result of the sentence to be processed comprises:
when the statement to be processed is an SQL statement, determining that the execution interface of the target statement is an execution interface in an SQL executor.
6. The method according to claim 1, wherein the method further comprises:
when the to-be-processed sentence is a Stored Procedure sentence set, extracting a Stored Procedure execution sentence in the Stored Procedure sentence set, wherein the name of the Stored Procedure execution sentence in the Stored Procedure sentence set is used as the first parameter;
converting the stored procedure declaration statement and the stored procedure execution statement in the stored procedure statement set into a stored procedure execution statement on an SQL executor;
performing the SQL conversion processing on the stored procedure execution statement on the SQL executor, generating the SQL processing result of the stored procedure execution statement on the SQL executor, and packaging the SQL processing result into a dynamic model result set, wherein the dynamic model result set is the second parameter of the target statement;
and converting each stored procedure statement in the stored procedure statement set into a corresponding interface in the dynamic model result set.
7. A data processing apparatus, characterized in that,
the acquisition module is used for acquiring a statement to be processed, wherein the statement to be processed is an embedded Structured Query Language (SQL) statement;
the processing module is used for carrying out SQL conversion processing on the statement to be processed and generating an SQL processing result of the statement to be processed;
the processing module is further used for determining an execution interface of a target sentence according to the SQL processing result of the sentence to be processed;
the processing module is further used for determining a first parameter of the target sentence according to the SQL processing result of the sentence to be processed;
the processing module is further configured to determine a second parameter of the target sentence according to an input host variable included in the sentence to be processed, where the second parameter is a standard SQL variable;
the output module is used for outputting the target statement according to the execution interface, the first parameter and the second parameter;
the statement to be processed further includes an output host variable, the apparatus further comprising:
the processing module is further configured to determine an interface calling result of the execution interface according to the execution interface of the target statement, where the interface calling result is assigned to the output host variable;
the output module is further configured to output the target sentence according to the execution interface, the first parameter, the second parameter, and the interface call result;
the processing module is further configured to extract a query SQL statement in the vernier statement set when the statement to be processed is the vernier statement set, and perform SQL conversion processing on the query SQL statement to generate the first parameter; converting cursor definition sentences and cursor opening sentences in the cursor sentence sets into cursor execution sentences on an SQL executor; performing the SQL conversion processing on the cursor execution statement, generating the SQL processing result of the cursor execution statement, and packaging the SQL processing result of the cursor execution statement into a dynamic model result set, wherein the dynamic model result set is the second parameter of the target statement; and converting each cursor statement in the cursor statement set into a corresponding interface in the dynamic model result set.
8. A data processing apparatus comprising a processor and a memory, the processor being arranged to implement the steps of the method according to any of claims 1-6 when executing a computer program stored in the memory.
CN202010130431.5A 2020-02-28 2020-02-28 Data processing method and device Active CN111367937B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010130431.5A CN111367937B (en) 2020-02-28 2020-02-28 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010130431.5A CN111367937B (en) 2020-02-28 2020-02-28 Data processing method and device

Publications (2)

Publication Number Publication Date
CN111367937A CN111367937A (en) 2020-07-03
CN111367937B true CN111367937B (en) 2023-09-19

Family

ID=71206338

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010130431.5A Active CN111367937B (en) 2020-02-28 2020-02-28 Data processing method and device

Country Status (1)

Country Link
CN (1) CN111367937B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111880977B (en) * 2020-07-16 2022-02-08 北京天维信通科技有限公司 Fault self-healing method and device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102541521A (en) * 2010-12-17 2012-07-04 中国银联股份有限公司 Automatic operating instruction generating device based on structured query language and method
CN102968333A (en) * 2011-06-30 2013-03-13 国际商业机器公司 Method for native program to inherit same transaction content when invoked by primary program running in separate environment
CN110209395A (en) * 2019-06-04 2019-09-06 沈阳欧瑞科技有限公司 A kind of method, equipment and medium by SQL insertion high-level language
CN110633292A (en) * 2019-09-19 2019-12-31 上海依图网络科技有限公司 Query method, device, medium, equipment and system for heterogeneous database

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6877000B2 (en) * 2001-08-22 2005-04-05 International Business Machines Corporation Tool for converting SQL queries into portable ODBC
US8601016B2 (en) * 2011-08-30 2013-12-03 International Business Machines Corporation Pre-generation of structured query language (SQL) from application programming interface (API) defined query systems
US10216826B2 (en) * 2014-09-02 2019-02-26 Salesforce.Com, Inc. Database query system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102541521A (en) * 2010-12-17 2012-07-04 中国银联股份有限公司 Automatic operating instruction generating device based on structured query language and method
CN102968333A (en) * 2011-06-30 2013-03-13 国际商业机器公司 Method for native program to inherit same transaction content when invoked by primary program running in separate environment
CN110209395A (en) * 2019-06-04 2019-09-06 沈阳欧瑞科技有限公司 A kind of method, equipment and medium by SQL insertion high-level language
CN110633292A (en) * 2019-09-19 2019-12-31 上海依图网络科技有限公司 Query method, device, medium, equipment and system for heterogeneous database

Also Published As

Publication number Publication date
CN111367937A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
US7725883B1 (en) Program interpreter
CN107861728B (en) Method and system for converting traditional program language into modern program language
CN111078290B (en) Compiler and compiling method for extensible instruction set
CN108197027B (en) Software performance optimization method, storable medium, computer program
CN104965687A (en) Big data processing method and apparatus based on instruction set generation
CN111367937B (en) Data processing method and device
CN111190643A (en) Program code annotation generation method, system, electronic device and storage medium
US20020062478A1 (en) Compiler for compiling source programs in an object-oriented programming language
CN103942082A (en) Complier optimization method for eliminating redundant storage access operations
JP2008276735A (en) Program code converter and program code conversion method
CN113138755A (en) JSON serialization and deserialization optimization method and system
CN111158665B (en) Code generation method and device, electronic equipment and storage medium
US8108828B2 (en) System for generating optimized computer data field conversion routines
CN114579141A (en) Method and device for converting require frame into VUE frame
JP7391983B2 (en) Methods, decompiling devices, recompilation systems and computer program products for generating representations of program logic
CN116560667B (en) Splitting scheduling system and method based on precompiled delay execution
US20090112568A1 (en) Method for Generating a Simulation Program Which Can Be Executed On a Host Computer
JP2006202134A (en) Profile information collection method and device
CN111857678A (en) Code generation method and device, electronic equipment and computer storage medium
Turas Gradual C Programming for Typed Lua
JPH04248624A (en) Program conversion processor
CN115904383A (en) Defect analysis method and related device for dynamic language
CN115729528A (en) Dart compiled intermediate language processing method, apparatus, device and medium
CN114721665A (en) Webpage code generation method and device, electronic equipment and storage medium
JP2001344113A (en) Execution compiler system and execution compiling method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant