WO2015123956A1 - 一种数据处理方法及装置 - Google Patents

一种数据处理方法及装置 Download PDF

Info

Publication number
WO2015123956A1
WO2015123956A1 PCT/CN2014/081141 CN2014081141W WO2015123956A1 WO 2015123956 A1 WO2015123956 A1 WO 2015123956A1 CN 2014081141 W CN2014081141 W CN 2014081141W WO 2015123956 A1 WO2015123956 A1 WO 2015123956A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
code
source code
external routine
data processing
Prior art date
Application number
PCT/CN2014/081141
Other languages
English (en)
French (fr)
Inventor
孙东旺
文继军
王传廷
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP14856790.2A priority Critical patent/EP2937782B1/en
Priority to US14/753,232 priority patent/US9430198B2/en
Publication of WO2015123956A1 publication Critical patent/WO2015123956A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • 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/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6227Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database where protection concerns the structure of data, e.g. records, types, queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators

Definitions

  • the present invention relates to the field of computers, and in particular, to a data processing method and apparatus. Background technique
  • External Routine Usually refers to a program written in a high-level programming language and embedded in SQL (Structured Query Language) statements.
  • the source code of the external routine can be compiled for the database management system to facilitate the expansion of database functionality.
  • the database system includes a database and a database management system.
  • the database is used to store data, and the database management system is used to manage and maintain the database.
  • the database management system can be a structured query language database management system (MySQL), etc.
  • the database can be a structured query language database (Sql Server), a bone database (Oracle), etc., and the database provides a wide range of high-level programming languages.
  • the high-level programming language may be C language, C++ language, JAVA language, COBOL (Common Business Oriented Language).
  • the database system can compile the source code of the external routine written in the high-level programming language by using the embedded database management system and the embedded extended language compilation module to obtain the target code of the external routine, the database.
  • the management system may be MySQL, Teradata, etc.
  • the extended language compilation module may be DB2, Postgresql, or the like.
  • the object code of the external routine is stored to the database according to the target name and the target address set by the user, and the target name is used to uniquely identify the target code of the external routine, which is used to identify the target of the external routine Code
  • An address stored in the database to facilitate calling the object code of the external routine based on the target name and the target address.
  • Embodiments of the present invention provide a data processing method and apparatus, which can effectively improve the scalability of a database system.
  • a data processing method including:
  • the machine code is stored to a database.
  • the method before the receiving the source code of the external routine, the method further includes:
  • the first user equipment has the right to access the database, receiving source code of an external routine sent by the first user equipment, to implement converting the source code into the machine code and the machine The code is stored to the database.
  • the method before the compiling the source code to obtain the intermediate code, the method further includes: checking the source code to access the database Whether the scope of the object is within a range of pre-set access to objects in the database;
  • Compiling the source code to obtain the intermediate code if the source code accesses a range of objects in the database within the range of the pre-set access to objects in the database.
  • the method further includes: checking the source code pair Whether the operation of the object in the database is a preset operation on an object in the database, the operation comprising modifying, adding or deleting the object;
  • the source code operates on an object in the database in advance, the operation of the object in the database is compiled, and the source code is compiled to obtain the intermediate code.
  • the method further includes:
  • the intermediate code is stored to the database.
  • the method further includes: generating a target name of the intermediate code The target name is used to uniquely identify the intermediate code;
  • the method also includes:
  • the machine code is run to enable the external routine to be called from within the database.
  • a data processing apparatus including:
  • a first receiving unit configured to receive source code of an external routine, where the source code of the external routine is written by a high-level programming language
  • a compiling unit configured to compile the source code to obtain an intermediate code, where the intermediate code is a byte stream that can be recognized by any virtual machine running the platform;
  • a conversion unit configured to convert the intermediate code into a machine code that is convenient to run on the running platform according to an instruction set of the running platform
  • a storage unit configured to store the machine code into a database.
  • the data processing apparatus further includes:
  • a second receiving unit configured to receive a database access request sent by the first user equipment that sends the source code of the external routine
  • a first determining unit configured to determine, according to the database access request, the first use Whether the user device has permission to access the database
  • the first receiving unit is configured to: in the first determining unit, determine that the first user equipment has the right to access the database, and receive the source code of the external routine sent by the first user equipment, to Implementation converts the source code into the machine code and stores the machine code into the database.
  • the data processing apparatus further includes:
  • a first checking unit configured to check whether a range of the source code accessing an object in the database is within a range of a preset access object in the database
  • the compiling unit is specifically configured to: when the first checking unit detects that the source code accesses an object in the database, and compiles the source code within a range of the preset access object in the database The intermediate code.
  • the data processing apparatus further includes:
  • a second checking unit configured to check whether the operation of the object in the database by the source code is a preset operation on an object in the database, where the operation includes modifying, adding, or deleting the object;
  • the compiling unit is specifically configured to: when the second checking unit checks, that the operation of the object in the database by the source code is an operation of an object in the database, compiling the source code to obtain the middle code.
  • the storage unit is further configured to store the intermediate code Go to the database.
  • the data processing device further includes:
  • a first generating unit configured to generate a target name of the intermediate code, where the target name is used to uniquely identify the intermediate code
  • a second generating unit configured to generate a target address of the intermediate code, where the target address is used to identify an address of the intermediate code in the database.
  • the data processing apparatus further includes a calling unit:
  • the second receiving unit is further configured to receive a request sent by the second user equipment to invoke the external routine
  • the first determining unit is further configured to determine, according to the request for calling the external routine, whether the second user equipment has the right to invoke the external routine; the calling unit is used in the When the judging unit judges that the second user equipment has the right to invoke the external routine, the machine code is executed to implement calling the external routine from the database.
  • An embodiment of the present invention provides a data processing method and apparatus, the data processing method, including: receiving source code of an external routine, the source code of the external routine is written by a high-level programming language; compiling the source The code obtains a middle code, the intermediate code is a byte stream that can be recognized by any virtual machine running the platform; converting the intermediate code into a machine code that is convenient to run on the running platform according to an instruction set of the running platform; The machine code is stored to a database. In this way, the source code of the received external routine is compiled to obtain the intermediate code.
  • the intermediate code is independent of the running platform, and is a unified coding for the running platform, that is, an arbitrary running platform.
  • the virtual machine can recognize the intermediate code, so that the database system does not need to embed different compilers to compile the source code of the external routine, and convert the intermediate code into a convenient operation according to the instruction set of the running platform.
  • the machine code running on the platform effectively improves the scalability of the database system.
  • FIG. 1 is a flowchart of a data processing method according to an embodiment of the present invention
  • FIG. 2 is a flowchart of another data processing method according to an embodiment of the present invention
  • FIG. 2 is a flowchart of still another data processing method according to an embodiment of the present invention
  • FIG. 3 is a flowchart of still another data processing method according to an embodiment of the present invention
  • 4 is a flowchart of another data processing method according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of a data processing device according to an embodiment of the present invention
  • FIG. 6a is a schematic diagram of another data processing device according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present invention
  • FIG. 7 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present invention.
  • An embodiment of the present invention provides a data processing method. As shown in FIG. 1, the method includes the following steps: Step 104: Receive source code of an external routine, where source code of the external routine is written by a high-level programming language.
  • Step 105 Compile the source code to obtain an intermediate code, where the intermediate code is a byte stream that can be recognized by a virtual machine of any running platform.
  • compiling the source code to obtain the intermediate code may further comprise checking whether the operation of the object in the database by the source code is a preset operation on an object in the database, the operation comprising modifying the object Adding or deleting, if the operation of the source code on the object in the database is a preset operation on an object in the database, compiling the source code to obtain the intermediate code, so that any virtual machine running the platform The intermediate code can be identified.
  • compiling the source code to obtain the intermediate code may further comprise checking whether the operation of the object in the database by the source code is a preset operation on an object in the database, the operation comprising modifying the object Adding or deleting, if the operation of the source code on the object in the database is a preset operation on an object in the database, compiling the source code to obtain the intermediate code, so that any virtual machine running the platform The intermediate code can be identified.
  • After successfully compiling the source code to obtain the intermediate code storing the intermediate code in the database, generating a target name and a target
  • Step 106 Convert the intermediate code into a machine code that is convenient to run on the running platform according to an instruction set of the running platform.
  • the instruction set is a hard program that is stored inside the central processor to guide and optimize the central processor's operations.
  • the instruction set allows the central processor to run more efficiently.
  • Step 107 Store the machine code into a database.
  • Generating a target name and a target address of the machine code the target name being used to uniquely identify the machine code, and the target address is used to identify an address of the machine code in the database.
  • the source code of the external routine is received, and then the source code is compiled to obtain a middle code, which is a byte stream that can be recognized by the virtual machine of any running platform, compared to the prior art.
  • the intermediate code is independent of the running platform, and is a unified encoding for the running platform, that is, the virtual machine of any running platform can recognize the intermediate code, so that the database system does not need to embed different compilers to compile the external example.
  • the source code of the line program converts the intermediate code into a machine code that is convenient to run on the running platform according to the instruction set of the running platform, thereby effectively improving the expansion capability of the database system.
  • An embodiment of the present invention provides a data processing method, as shown in FIG. 1B, including: Step 1 1: Receive a first user setting that sends a source code of the external routine A database access request to be sent.
  • Step 1 12 Determine, according to the database access request, whether the first user equipment has the right to access the database.
  • Step 1 13 If the first user equipment has the right to access the database, receive the source code of the external routine sent by the first user equipment, to implement converting the source code into the machine code.
  • the machine code is stored to the database.
  • Receiving the source code of the external routine sent by the first user equipment if the first user equipment has the right to access the database including: parsing the data packet of the source code of the external routine, obtaining the Determining a first identifier of the data packet, the first identifier is used to indicate a source address of the data packet, determining whether the first identifier of the data packet is a preset identifier, and the preset identifier is used to mark the identifier An address of the first user equipment; if the first identifier of the data packet is a preset identifier, the data packet sent by the first user equipment is received, where the data packet includes a source code of an external routine, where The source code of the external routine is written by a high-level programming language, which may be C language, C++ language, JAVA language, or the like.
  • Step 1 14 Receive the source code of the external routine, the source code of the external routine is written in a high-level programming language.
  • Step 1 1 5 Compile the source code to obtain an intermediate code, where the intermediate code is a byte stream that can be recognized by a virtual machine of any running platform.
  • Step 1 1 Convert the intermediate code into a machine code that is convenient to run on the running platform according to an instruction set of the running platform.
  • Step 1 Store the machine code into a database.
  • the source code of the external routine before receiving the source code of the external routine, first, receiving a database access request sent by the first user equipment that sends the source code of the external routine, and then determining that the first user equipment owns the access point. After the authority of the database is received, receiving source code of the external routine sent by the first user equipment, to implement converting the source code into the machine code and storing the machine code into the database, effectively The security of the database is enhanced to prevent user devices from illegally accessing the database.
  • the embodiment of the present invention provides a data processing method, which is assumed that the source code of the external routine is written in C language, as shown in FIG. 2, and includes:
  • Step 201 Receive a database access request sent by the first user equipment.
  • the first user may send a database access request to the database by using the first user equipment, where the database access request sent by the first user equipment includes a user name, a login password, and a permission level, where the user name is a login name used by a user to log in to the database.
  • the login password is a login password used by the first user to log in to the database
  • the permission level is that the first user can log in to the database when the first user logs in to the database.
  • the level at which the database operates such as administrator, advanced user, intermediate user, or novice, has different operational privileges on the database.
  • an administrator can add or delete a user in the database, perform any deletion, addition, or modification of the source program or object in the database, and the advanced user can invoke the source program in the database to perform objects in the database.
  • Any compilation operation such as deleting, adding, or modifying, the novice can only access objects in the database.
  • the first user may first send an access request to the server where the database is located through the first user device, where the access request includes the IP of the server where the database is located (Internet Protocol, Internet Protocol) After the address and port number are successfully accessed, the first user can send a database access request to the database through the first user device.
  • the database access request includes the user name, login password, and permission level.
  • the user can access the database in the form of command input in the disk operating system DOS environment, and can add, delete or modify the source program or data in the database by means of command input; the user can also be in the visual window. Access the database under the interface.
  • Step 202 Determine, according to the database access request, whether the first user equipment has an access Ask the permissions of the database.
  • step 2021 is executed to prohibit the first user equipment from accessing the database.
  • step 203 is performed.
  • the database determines that the first user is an illegal user of the database, and prohibits the first user from accessing the database through the first user device.
  • the database determines that the first user is in the database. A legitimate user allows the first user to access the database through the first user device.
  • the source code of the external routine sent by the first user equipment is received, including: parsing the data packet of the source code of the external routine Obtaining a first identifier of the data packet, where the first identifier is used to indicate a source address of the data packet, that is, an address of a user equipment that sends the data packet. Determining whether the first identifier of the data packet is a preset identifier, where the preset identifier is used to indicate an address of the first user equipment; if the first identifier of the data packet is a preset identifier, Receiving a data packet sent by the first user equipment, where the data packet includes source code of an external routine.
  • Step 202 1 The first user equipment is prohibited from accessing the database.
  • step 203 is performed.
  • Step 203 Receive a source code of an external routine sent by the first user equipment.
  • Step 204 Check whether the scope of the object in the source code access database is within a range of pre-set access objects in the database.
  • step 2041 is executed to terminate the compilation of the source code. For example, there may be an object in the source code accessing the object in the database that includes access denied, resulting in illegal access to the database object. If the object accessed by the source code is commercially important data, it may lead to major commercial secret leaks, causing serious economic losses. If the source code accesses the scope of the object in the database within the range of the preset access object in the database, compiling the source code to obtain the intermediate code.
  • the privilege level of the object in the database is preset, and the privilege level of the object of different privilege levels is different, that is, the privilege level of the object may be set to be confidential, advanced, or low-level, for example, the confidential object is not freely accessible. Only programs or users with confidential permissions can access them.
  • the object may be data in a database, or may be classified into data of different types, and each type of data is a type of object, such as a data type, an information type, and the like.
  • the database receives the source code of the external routine, when compiling the source code, it is checked whether the object in the source program accessing the database is a preset database object that is allowed to be accessed, if the source program accesses the database
  • the object in the middle is a database object that is allowed to be accessed in advance, and the source code is compiled to obtain the intermediate code. If the source program accesses an object in the database that is a database object that is not set to be accessed by the database, the source code is terminated.
  • step 205 is performed to check whether the operation of the source code on the object in the database is preset in the database. The operation of the object.
  • Step 2041 Terminate compilation of the source code.
  • step 205 assumes that the scope of the object in the source code access database is within the range of the object in the pre-set access database, and then step 205 is performed.
  • Step 205 Check whether the operation of the source code on an object in the database is a preset operation on an object in the database. If it is checked that the operation of the source code on the object in the database is not a preset operation on the object in the database, then step 2041 is executed to terminate the compilation of the source code.
  • step 206 is performed.
  • pre-set permissions for operations on objects in the database the operations including modification, addition, or deletion of the objects. That is, important objects in the database can be accessed but cannot be modified or modified.
  • the important objects are objects of confidential or advanced privilege level, and some ordinary objects can be accessed or any modification can be made to the objects.
  • Delete or add operations, such as ordinary objects are objects of low privilege level.
  • the source code accesses the object in the database is a pre-set database object that is allowed to access, checking whether the operation of the source code on the object in the database is a preset operation on the database object, if The operation of the source code on the object in the database is a preset operation on the database object, and the source code is compiled to obtain an intermediate code. If the operation of the source code on the object in the database is not a preset operation on the database object, Terminate compilation of the source code.
  • the source code of the external routine is used to calculate the actual wages paid by the company's employees after the tax of more than 3,500.
  • the source code can access the basic salary of all employees in the database, and the basic salary of the employee includes 1000 to 5000. However, only the basic salary of the employee in the basic salary of the employee is more than 3500. Calculate and get the wages actually paid after the tax. If the source code calculates the basic salary of all the employees and obtains the wages actually paid after the tax, the actual wages of the employees whose basic salary is below 3,500 are actually paid after the tax. Failure to comply with national regulations, resulting in staff turnover errors.
  • the object in the database is set to the permission level and the setting of the object operation, and when the source code of the external routine is compiled, the external example is passed.
  • the source code of the line program accesses the check of the scope of the object in the database and the check of the operation of the object in the database by the source code of the external routine, and determines whether the access authority of the database object and the operation of the database object are met. , effectively enhance the security of database operations and the security of data in the database.
  • step 206 is executed to compile the source code to obtain an intermediate code.
  • Step 206 Compile the source code to obtain an intermediate code.
  • the source code can be obtained by compiling the source code through a language front end module
  • the language front end module can be a language front end module such as C language, Python language or Fortran language.
  • the source code of the external routine is written by the C language, and the source code is parsed by the C sub-language front-end module to obtain a parse tree, and then the parse tree is compiled to obtain an intermediate code, so as to facilitate any
  • the virtual machine running the platform can identify the intermediate code.
  • the parse tree includes a root node, a root element node, a node, and the like, that is, the source code is analyzed, and the process of generating the parse tree is a prior art, and the embodiment of the present invention is not described herein.
  • step 209 is executed, the intermediate code is stored in the database, and the intermediate code is further converted into a machine code, and step 207 is executed.
  • Step 207 Obtain a machine code of the intermediate code.
  • the operating platform includes an integrated circuit chipset centered on a central processing unit,
  • the virtual machine of the platform shields the instruction set of any running platform.
  • the instruction set is a hard program stored inside the central processor that guides and optimizes the central processor's operations.
  • the instruction set allows the central processor to run more efficiently.
  • the machine code of the intermediate code can be obtained by running the platform.
  • the running platform may be an x86 running platform, a PwoerPC running platform or an ARM running platform.
  • the intermediate code of the external routine generated by the language front-end module can be input to the running platform, and the running platform can convert the intermediate code of the external routine into an operating platform suitable for the x86 running platform, the PwoerPC running platform, or the ARM running platform.
  • the machine code that is running, that is, the machine code that runs on each running platform is different.
  • Step 208 Store the machine code into a database.
  • the database may generate a target name of the machine code, where the target name is used to uniquely identify the machine code, generate a target address of the machine code, and the target The address is used to identify the address of the machine code in the database.
  • the target name and the target address are invisible to the user and are stored in the database.
  • Step 209 Store the intermediate code into a database.
  • Step 209 Generate a target name of the intermediate code.
  • the target name is used to uniquely identify the intermediate code.
  • Step 2092 Generate a target address of the intermediate code.
  • the target address is used to identify an address of the intermediate code in the database. It should be noted that, when step 2091 and step 2092 are performed, the sequence may be indistinguishable, that is, the target address of the intermediate code may be formed, and the target name of the intermediate code may be generated.
  • the security of the intermediate code of the external routine is more secure.
  • the initiator of the external routine can also set the calling password, and both should have the call.
  • the intermediate code permission of the external routine and the user who invoked the password can call the intermediate code of the external routine.
  • the object code of the external routine is obtained, and when the object code of the external routine is stored in the database, the target name and the target address set by the user need to be received, according to The target name and destination address store the object code of the external routine to the database, so there may be risks such as deletion, replacement, or tampering when managing the target code of the external routine.
  • the database when the intermediate code of the external routine is stored in the database, the database generates a target name of the intermediate code, and the target name is used to uniquely identify the intermediate code, and generate the a target address of the intermediate code, the target address being used to identify an address of the intermediate code in the database.
  • the target name and the target address are invisible to the user and are stored in the database.
  • the intermediate code of the external routine is called, the intermediate code of the external routine is called according to the target name and the target address. Therefore, the database control method stores and manages the intermediate code of the external routine, effectively avoiding the risk of external routine being deleted, replaced or falsified when managing the intermediate code of the external routine, which improves management.
  • the rigor also increases the security of the data in the database.
  • the source code of the external routine described in the embodiment of the present invention is only a schematic description. In actual applications, it can also be written by other high-level programming languages, and the source code of the external routine written by other high-level programming languages is compiled to obtain the intermediate code.
  • the process of converting the intermediate code into the machine code is the same as the method described in the embodiment of the present invention, and details are not described herein again.
  • the data processing method of the embodiment of the present invention firstly receives a database access request sent by the first user equipment, and determines, according to the database access request, whether the first user equipment has the right to access the database, if the first user equipment has access to the database.
  • Authorizing receiving source code of the external routine sent by the first user equipment, and then, when compiling the source code, checking whether the scope of the object in the source code access database is in a preset access object in the database In the range, if the source code accesses a range of objects in the database, the pre-set access to the object in the database In the range, compiling the source code to obtain the intermediate code, and also checking whether the operation of the source code on the object in the database is a preset operation on the object in the database, if the source code is to the object in the database The operation is a preset operation on an object in the database, compiling the source code to obtain an intermediate code, acquiring a machine code of the intermediate code, storing the machine code in a database, and
  • the intermediate code is independent of the running platform, and is a unified encoding for the running platform, that is, the virtual machine of any running platform can recognize the intermediate code, so that different compilations are not required in the database system.
  • Compiling the source code of the external routine converting the intermediate code into a machine code that is convenient to run on the running platform according to the instruction set of the running platform, effectively improving the expansion capability of the database system, and compiling at the same time
  • the source code checks the scope of the source code accessing the database object and checks that the source code accesses the database object effectively enhances database security and data security in the database, as well as storing and managing external routines through database-controlled methods.
  • the middle code and machine code of the program effectively avoid the risk of the external routine being deleted, replaced or falsified when managing the intermediate code and machine code of the external routine, which not only improves the rigor of management but also improves the database.
  • the security of the data is independent of the running platform, and is a unified encoding for the running platform
  • the embodiment of the invention provides a data processing method, which assumes that the intermediate code of the external routine is stored in the database, and the external routine is written by the C language, as shown in FIG. 3, including:
  • Step 301 Receive a request sent by the second user equipment to invoke an external routine. It is assumed that the second user can be registered in the database by the second user equipment. When the second user accesses the database through the second user equipment, the database determines that the second user is a legitimate user in the database, and allows the second user to pass the first The two user devices access the database. Then, when the second user needs to call the external routine, the second user can send a request to the database to call the external routine through the second user device, and receive an external routine call request sent by the second user device.
  • Step 302 Determine a second use according to the request for calling the external routine Whether the user device has permission to call the external routine.
  • the administrator of the database may set the rights of the second user in the database. If the second user device does not have the right to invoke the external routine, that is, the second user who invokes the source program is an illegal user. Go to step 3021.
  • the external routine is invoked from the database if the second user device has permission to invoke the external routine.
  • the function name of the external routine is stored in the database, and the external routine can be called according to the function name of the external routine, and then, according to the intermediate code of the external routine stored in the database. Or the target name and destination address of the machine code to call the intermediate routine or machine code of the external routine to run the external routine, in order to return the result of the call to the user.
  • Step 302 Disable the second user equipment from calling the external routine.
  • the database system can prompt the second user device for an operational error and prohibit the second user device from invoking the external routine.
  • the external routine is the one that is required to make wages for the financial staff of the company's finance department.
  • the financial staff of the company's finance department produces the employee's salary for the company's employees each month
  • the external routine can be called to calculate and modify the employee's salary, and then the employee's salary table is stored in the database.
  • the table includes the monthly salary of each employee in the company.
  • the administrator of the database setting only the financial staff who made the employee salary table and the chairman of the company can access the employee salary table in the database through the user equipment, and can call the external routine to modify the employee salary table.
  • the department head of the company can access the database through the user equipment to view the salary of the employee in the employee's salary table and his salary.
  • the department head of the company cannot call the external routine to pay the salary of the employee in the department visited.
  • the operation of modifying the salary of the company the ordinary employees of the company can only view the salary of the employee's salary table through the user equipment access to the database, and can not call the external routine to modify his salary.
  • Embodiments of the present invention assume that the second user equipment has the call to the external routine Permission, go to step 303.
  • Step 303 Acquire a result of the call request.
  • Step 304 Call the virtual machine to execute the intermediate code of the external routine.
  • the virtual machine running the platform is called to execute the intermediate code of the external routine.
  • the user when the user invokes the external routine through the user equipment, it is first necessary to determine the user authority for calling the external routine, and only the user having the authority to invoke the external routine can pass the user equipment. Call this external routine. Compared with the prior art, before the user equipment calls the external routine, the user is determined to call the permission link, which effectively improves the security or stability of the database object.
  • the database is a structured query language database (Sql Server).
  • Sql Server structured query language database
  • the server with the Sql Server database installed checks whether user device A has permission to connect to the Sql Server database server, and if user device A has permission to connect to the Sql Server database server.
  • the Sql Server database checks whether the user has permission to log in to the Sql Server database. If the user has permission to log in to the Sql Server database, the user can operate on the object in the Sql Server database, and then The Sql Server database determines whether the user has permission to operate on the object. For example, you need to update or query a table.
  • the Sql Server database determines the user's permissions on the table, or the user needs to run a stored procedure.
  • the Sql Server database determines whether the user has execute permission on the stored procedure. For example, the permissions of the Sql Server database are shown in Table 1.
  • Table 1 Sql Server database permissions Permission level permissions database, table or index CREATE create database, table or index database or table DROP delete database or table database, table or saved program GRANT OPTION gives permission option table ALTER change table, such as add force field, index, etc.
  • table DELETE Delete data table INDEX index table INSERT insert table SELECT query table UPDATE update view CREATE VIEW create view view SHOW VIEW view view stored procedure ALTER ROUTINE change stored procedure stored procedure CREATE ROUTINE create stored procedure stored procedure EXECUTE execute stored procedure server host on file access FILE file access
  • the data processing method firstly receives an external routine call request sent by the second user equipment, and then determines, according to the external routine call request, whether the second user equipment has the call of the external instance.
  • the permission of the line program if the second user equipment has the right to invoke the external routine, invoke the external routine from the database, obtain the result of the call request, and invoke the virtual machine to execute the external routine.
  • the link of determining the user's calling authority is added, which effectively improves the security or stability of the database object.
  • the embodiment of the present invention provides a data processing method, which assumes that a machine code of an external routine is stored in the database, and that the external routine is written in C language, as shown in FIG. 4, and includes:
  • Step 401 Receive a request sent by the second user equipment to invoke an external routine. It is assumed that the second user can be registered in the database by the second user equipment. When the second user accesses the database through the second user equipment, the database determines that the second user is a legitimate user in the database, and allows the second user to pass the first The two user devices access the database. Then, when the second user needs to call the external routine, the second user can send a request to the database to call the external routine through the second user device, and receive an external routine call request sent by the second user device.
  • Step 402 Determine, according to the request for calling the external routine, whether the second user device has the right to invoke the external routine.
  • the administrator of the database can set the rights of the second user in the database, if the second user device does not have the right to invoke the external routine, that is, The second user who invokes the source program is an illegal user, and step 4021 is performed.
  • the external routine is invoked from the database if the second user device has permission to invoke the external routine.
  • the function name of the external routine is stored in the database, and the external routine can be called according to the function name of the external routine, and then, according to the intermediate code of the external routine stored in the database. Or the target name and destination address of the machine code to call the intermediate routine or machine code of the external routine to run the external routine, in order to return the result of the call to the user.
  • Step 402 Disable the second user equipment from calling the external routine.
  • the database system can prompt the second user device for an operational error and prohibit the second user device from invoking the external routine.
  • the embodiment of the present invention assumes that the second user equipment has the right to invoke the external routine, and performs step 403.
  • Step 403 Acquire a result of the call request.
  • Step 404 Directly execute the machine code of the external routine.
  • the machine code of the external routine is run using the corresponding running platform of the machine code.
  • the user when the user invokes the external routine through the user equipment, it is first necessary to determine the user authority for calling the external routine, and only the user having the authority to invoke the external routine can pass the user equipment. Call this external routine. Compared with the prior art, before the user equipment calls the external routine, the user is determined to call the permission link, which effectively improves the security or stability of the database object.
  • the data processing method firstly receives an external routine call request sent by the second user equipment, and then, according to the external routine call Requesting to determine whether the second user equipment has the right to invoke the external routine, and if the second user equipment has the right to invoke the external routine, calling the external routine from the database to obtain the call The result of the request, directly executing the machine code of the external routine.
  • the link for determining the user's calling permission is added, which effectively improves the security or stability of the database object.
  • the source code of the external routine is compiled by the logical framework diagram of the external routine to obtain the intermediate code or machine code, and the process of running the intermediate code or machine code is described.
  • the source code of the external routine is input to the language front end module 501, and the language front end module 501 parses and compiles the source code to obtain a parse tree, compiles the parse tree, and at the same time, judges the source code pair by the authentication module 502.
  • the intermediate code of the source code is obtained, and then the intermediate code is input to the intermediate code module 503, and the intermediate code module 503
  • the intermediate code of the source code is stored in the database by the storage management module 504.
  • the intermediate code module 503 inputs the intermediate code of the source code to the running platform 505, and the running platform 505 converts the intermediate code of the source code into the machine code. , in order to execute the external routine on the running platform to get the expected results.
  • the intermediate code of the source code is not converted into the machine code
  • the external routine needs to be called
  • the intermediate code of the source code is input to the virtual machine execution module 506, and the virtual machine execution module 506 outputs the source code.
  • the machine code is executed while the intermediate code is converted into machine code.
  • the language front end module 501 can be a language front end module such as C language, Python language or Fortran language.
  • the running platform 405 can be an x86 running platform, a PwoerPC running platform or an ARM running platform, and each running platform runs a different machine code.
  • the embodiment of the present invention provides a data processing device 60, as shown in FIG. 6a, including: The first receiving unit 63 is configured to receive source code of an external routine, and the source code of the external routine is written by a high-level programming language.
  • the compiling unit 66 is configured to compile the source code to obtain an intermediate code, where the intermediate code is a byte stream that can be recognized by a virtual machine of any running platform.
  • the converting unit 67 is configured to convert the intermediate code into a machine code that is convenient to run on the running platform according to an instruction set of the running platform.
  • the storage unit 68 is configured to store the machine code into a database.
  • the source code of the external routine is received, and then the source code is compiled to obtain a middle code, which is a byte stream that can be recognized by the virtual machine of any running platform, compared to the prior art.
  • the intermediate code is independent of the running platform, and is a unified encoding for the running platform, that is, the virtual machine of any running platform can recognize the intermediate code, so that the database system does not need to embed different compilers to compile the external example.
  • the source code of the line program converts the intermediate code into a machine code that is convenient to run on the running platform according to the instruction set of the running platform, thereby effectively improving the expansion capability of the database system.
  • the data processing apparatus 600 further includes:
  • the second receiving unit 601 is configured to receive a database access request sent by the first user equipment that sends the source code of the external routine.
  • the first determining unit 602 is configured to determine, according to the database access request, whether the first user equipment has the right to access the database.
  • the first receiving unit 603 is specifically configured to: at the first determining unit 602, determine that the first user equipment has the right to access the database, and receive the source code of the external routine sent by the first user equipment.
  • the implementation conversion unit 607 converts the source code into the machine code and stores the machine code into the database.
  • the data processing device 600 further includes:
  • the first checking unit 604 is configured to check whether the range of the source code accessing the object in the database is within a range of pre-set access to the object in the database.
  • the compiling unit 606 is specifically configured to:
  • the first checking unit 604 checks that the source code accesses the scope of the object in the database within the range of the preset access object in the database, compiling the source code to obtain the intermediate code.
  • the data processing device 600 further includes:
  • the second checking unit 605 is configured to check whether the operation of the object in the database by the source code is a preset operation on an object in the database, and the operation includes modifying, adding or deleting the object.
  • the compiling unit 606 is specifically configured to:
  • the second checking unit 605 checks that the operation of the object in the database by the source code is a preset operation on an object in the database, and compiles the source code to obtain the intermediate code.
  • the storage unit 608 is further configured to store the intermediate code to the database.
  • the data processing device 600 further includes:
  • the first generating unit 609 is configured to generate a target name of the intermediate code, where the target name is used to uniquely identify the intermediate code.
  • the second generating unit 6010 is configured to generate a target address of the intermediate code, where the target address is used to identify an address of the intermediate code in the database.
  • the first generating unit 609 generates a target name of the intermediate code, where the target name is used to uniquely identify the intermediate code
  • the second generating unit 6010 generates a target address of the intermediate code, where the target address is used to identify that the address of the intermediate code in the database can be simultaneously performed, and it is not necessary to distinguish the order in which the target name is generated and the target address is generated.
  • the data processing apparatus 600 further includes: a calling unit 601 1 ,
  • the second receiving unit 601 is further configured to receive a request sent by the second user equipment to invoke the external routine.
  • the first determining unit 602 is further configured to determine, according to the request for calling the external routine, whether the second user equipment has the right to invoke the external routine.
  • the calling unit 601 1 is configured to: when the first determining unit 602 determines that the second user equipment has the right to invoke the external routine, run the machine code to implement calling from the database The external routine.
  • the data processing apparatus of the embodiment of the present invention firstly receives a database access request sent by the first user equipment, determines, according to the database access request, that the first user equipment has the right to access the database, receives the source code of the external routine, and then When compiling the source code, checking that the source code accesses the scope of the object in the database within the range of the preset access object in the database, compiling the source code to obtain the intermediate code, and simultaneously Checking that the operation of the source code on the object in the database is a preset operation on an object in the database, compiling the source code to obtain an intermediate code, acquiring a machine code of the intermediate code, and storing the machine code To the database, while storing the intermediate code to the database, and after storing the intermediate code or machine code of the external routine, determining that the second user device has the right to invoke the external routine, running the machine code or the middle a code to implement calling the external routine from within the database.
  • the intermediate code is independent of the running platform, and is a unified encoding for the running platform, that is, the virtual machine of any running platform can recognize the intermediate code, so that different compilations are not required in the database system.
  • Compiling the source code of the external routine converting the intermediate code into a machine code that is convenient to run on the running platform according to the instruction set of the running platform, effectively improving the expansion capability of the database system, and compiling at the same time
  • the source code checks the scope of the source code accessing the database object and checks that the source code accesses the database object effectively enhances database security and data security in the database, as well as storing and managing external routines through database-controlled methods.
  • the embodiment of the present invention provides a data processing apparatus 70, as shown in FIG. 7, comprising: a receiver 701 for receiving source code of an external routine, the source code of the external routine being written by a high-level programming language.
  • the processor 702 is configured to compile the source code to obtain an intermediate code, where the intermediate code is a byte stream that can be recognized by a virtual machine of any running platform.
  • the processor 702 is further configured to convert the intermediate code into a machine code that is convenient to run on the operating platform according to an instruction set of the operating platform.
  • the processor 702 is further configured to store the machine code to a database.
  • the source code of the external routine is received, and then the source code is compiled to obtain a middle code, which is a byte stream that can be recognized by the virtual machine of any running platform, compared to the prior art.
  • the intermediate code is independent of the running platform, and is a unified encoding for the running platform, that is, the virtual machine of any running platform can recognize the intermediate code, so that the database system does not need to embed different compilers to compile the external example.
  • the source code of the line program converts the intermediate code into a machine code that is convenient to run on the running platform according to the instruction set of the running platform, thereby effectively improving the expansion capability of the database system.
  • the receiver 701 is further configured to:
  • a database access request sent by the first user equipment transmitting the source code of the external routine is received.
  • the processor 702 is further configured to:
  • the processor 702 is further configured to:
  • the processor 702 determines that the first user equipment has the right to access the database, and receives the source code of the external routine sent by the first user equipment, to implement converting the source code into the Machine code and storing the machine code to the Database.
  • the processor 702 parses the data packet of the source code of the external routine to obtain a first identifier of the data packet, where the first identifier is used to indicate a source address of the data packet. Then, it is determined whether the first identifier of the data packet is a preset identifier, and the preset identifier is used to indicate an address of the first user equipment.
  • the processor 702 is further configured to:
  • the processor 702 is specifically configured to:
  • the processor 702 checks that the source code accesses the scope of the object in the database within the range of the pre-set access to the object in the database, compiling the source code to obtain the intermediate code.
  • the processor 702 is further configured to:
  • the operation of the object in the database by the source code is a pre-set operation on an object in the database, the operation comprising modifying, adding or deleting the object.
  • the processor 702 is specifically configured to:
  • the processor 702 checks that the operation of the object in the database by the source code is a preset operation on an object in the database, and compiling the source code to obtain the intermediate code.
  • the processor 702 is further configured to:
  • the intermediate code is stored to the database.
  • the processor 702 is further configured to:
  • the processor 702 is further configured to:
  • the receiver 701 is further configured to:
  • the processor 702 is further configured to:
  • the processor 702 is further configured to:
  • the processor 702 determines that the second user device has the right to invoke the external routine, the machine code is executed to enable the external routine to be called from within the database.
  • the data processing apparatus of the embodiment of the present invention firstly receives a database access request sent by the first user equipment, determines, according to the database access request, that the first user equipment has the right to access the database, receives the source code of the external routine, and then When compiling the source code, checking that the source code accesses the scope of the object in the database within the range of the preset access object in the database, compiling the source code to obtain the intermediate code, and simultaneously Checking that the operation of the source code on the object in the database is a preset operation on an object in the database, compiling the source code to obtain an intermediate code, acquiring a machine code of the intermediate code, and storing the machine code To the database, while storing the intermediate code to the database, and after storing the intermediate code or machine code of the external routine, determining that the second user device has the right to invoke the external routine, running the machine code or the middle a code to implement calling the external routine from within the database.
  • the intermediate code is independent of the running platform, and is a unified encoding for the running platform, that is, the virtual machine of any running platform can recognize the intermediate code, so that different compilations are not required in the database system.
  • Compiling the source code of the external routine converting the intermediate code into a machine code that is convenient to run on the running platform according to the instruction set of the running platform, effectively improving the expansion capability of the database system, and compiling at the same time
  • the source code checks the source code to access the database object
  • the scope and checking the source code access to the database object effectively enhances the security of the database operation and the security of the data in the database, as well as the database control method to store and manage the intermediate code and machine code of the external routine, effectively avoiding
  • the external routine is deleted, replaced or tampered, which not only improves the rigor of management but also improves the security of the data in the database.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as the units may or may not be physical units, and may be located in one place or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiment of the present embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)
  • Devices For Executing Special Programs (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

提供一种数据处理方法及装置,涉及计算机领域,能够有效提高数据库系统的扩展能力。所述数据处理方法,包括:接收外部例行程序的源代码,所述外部例行程序的源代码由高级编程语言编写;编译所述源代码得到中间码,所述中间码是任意运行平台的虚拟机都能够识别的字节流;根据运行平台的指令集将所述中间码转化为便于在所述运行平台上运行的机器码;将所述机器码存储到数据库。提供的数据处理方法及装置用于处理数据。

Description

一种数据处理方法及装置 本申请要求于 2014 年 2 月 19 日提交中国专利局、 申请号为 20141005571 1 .9、 发明名称为 "一种数据处理方法及装置" 的中国专 利申请的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机领域, 尤其涉及一种数据处理方法及装置。 背景技术
夕卜部例行程序 ( External Routine ) 通常指使用高级编程语言编 写, 并可以嵌入 SQL ( Structured Query Language , 结构化查询语言) 语句的程序。 外部例行程序的源代码经过编译后可以供数据库管理 系统调用, 以便于扩展数据库功能。 数据库系统包括数据库和数据 库管理系统, 数据库用于存储数据, 数据库管理系统用于对数据库 的运行管理、 维护等。 通常情况下, 数据库管理系统可以是结构化 查询语言数据库管理系统 ( MySQL ) 等, 数据库可以是结构化查询 语言数据库 ( Sql Server )、 曱骨文数据库 ( Oracle ) 等, 数据库对高 级编程语言提供广泛支持, 所述高级编程语言可以是 C 语言、 C++ 语言、 JAVA语言、 COBOL ( Common Business Oriented Language , 面向商业的通用语言) 等。
现有技术中, 数据库系统可以通过内嵌数据库管理系统、 内嵌 扩展语言编译模块, 对使用高级编程语言编写的外部例行程序的源 代码进行编译得到外部例行程序的目标代码, 所述数据库管理系统 可以是 MySQL、 Teradata等, 所述扩展语言编译模块可以是 DB2、 Postgresql等。 然后, 根据用户设置的目标名称和目标地址将外部例 行程序的目标代码存储到数据库, 该目标名称用于唯一标识外部例 行程序的目标代码, 该目标地址用于标识外部例行程序的目标代码 存储在数据库中的地址, 以便于根据该目标名称和该目标地址调用 所述外部例行程序的目标代码。 也可以先通过高级编程语言的编程 工具编写、 编译外部例行程序的源代码后, 然后根据用户设置的目 标名称和目标地址将外部例行程序的目标代码复制到数据库, 且需 要将该目标名称和该目标地址等信息在数据库中注册, 以便于数据 库管理系统识别和调用外部例行程序的目标代码。
但是, 不同的运行平台的中央处理器不同, 不同中央处理器的 指令集也不同, 所以高级编程语言编写的外部例行程序在不同的运 行平台上运行时需要不同的编译器来编译, 得到适合在当前运行平 台运行的外部例行程序的目标代码, 所述运行平台为外部例行程序 的目标代码运行时所需要的硬件和 /或软件。 所述指令集用于将外部 例行程序转化为适合在运行平台上运行外部例行程序的目标代码。 例如, 当一外部例行程序编译成 x86 版本的目标代码时, 所述目标 代码只能在 x86 指令集的中央处理器上运行。 因此, 数据库系统中 需要内嵌不同的编译器来编译外部例行程序的源代码, 对数据库系 统的扩展能力受到限制, 且在编译外部例行程序时存在安全问题。 发明内容
本发明的实施例提供一种数据处理方法及装置, 能够有效提高 数据库系统的扩展能力。
为达到上述目 的, 本发明的实施例采用如下技术方案: 第一方面, 提供一种数据处理方法, 包括:
接收外部例行程序的源代码, 所述外部例行程序的源代码由高 级编程语言编写;
编译所述源代码得到中间码, 所述中间码是任意运行平台的虚 拟机都能够识别的字节流;
根据运行平台的指令集将所述中间码转化为便于在所述运行平 台上运行的机器码; 将所述机器码存储到数据库。
结合第一方面, 在第一种可实现方式中, 在所述接收外部例行 程序的源代码之前, 所述方法还包括:
接收发送所述外部例行程序的源代码的第一用户设备发送的数 据库访问请求;
根据所述数据库访问请求判断所述第一用户设备是否拥有访问 所述数据库的权限;
若所述第一用户设备拥有访问所述数据库的权限, 接收所述第 一用户设备发送的外部例行程序的源代码, 以实现将所述源代码转 化为所述机器码并将所述机器码存储到所述数据库。
结合第一方面或第一方面的第一种可实现方式, 在第二种可实 现方式中, 所述编译所述源代码得到中间码之前, 进一步包括: 检查所述源代码访问所述数据库中对象的范围是否在预先设置 的访问所述数据库中对象的范围内;
若所述源代码访问所述数据库中对象的范围在所述预先设置的 访问所述数据库中对象的范围内, 编译所述源代码得到所述中间码。
结合第一方面或第一方面的第一种可实现方式, 在第三种可实 现方式中, 所述编译所述源代码得到所述中间码之前, 进一步包括: 检查所述源代码对所述数据库中对象的操作是否是预先设置的 对所述数据库中对象的操作, 所述操作包括对所述对象的修改、 增 加或删除;
若所述源代码对所述数据库中对象的操作是预先设置的对所述 数据库中对象的操作, 编译所述源代码得到所述中间码。
结合第一方面或者第一方面的第一种可实现方式至第三种可实 现方式中的任意一种, 在第四种可实现方式中, 在所述编译所述源 代码得到中间码之后, 所述方法还包括:
将所述中间码存储到所述数据库。 结合第一方面的第四种可实现方式, 在第五种可实现方式中, 在所述将所述中间码存储到所述数据库之后, 所述方法还包括: 生成所述中间码的目标名称, 所述目标名称用于唯一标识所述 中间码;
生成所述中间码的目标地址, 所述目标地址用于标识所述中间 码在所述数据库中的地址。
结合第一方面或者第一方面的第一种可实现方式至第五种可实 现方式中任意一种, 在第六种可实现方式中, 在所述将所述机器码 存储到数据库之后, 所述方法还包括:
接收第二用户设备发送的调用所述外部例行程序的请求; 根据所述调用所述外部例行程序的请求判断所述第二用户设备 是否拥有调用所述外部例行程序的权限;
若所述第二用户设备拥有调用所述外部例行程序的权限, 则运 行所述机器码, 以实现从所述数据库内调用所述外部例行程序。
第二方面, 提供一种数据处理装置, 包括:
第一接收单元, 用于接收外部例行程序的源代码, 所述外部例 行程序的源代码由高级编程语言编写;
编译单元, 用于编译所述源代码得到中间码, 所述中间码是任 意运行平台的虚拟机都能够识别的字节流;
转化单元, 用于根据运行平台的指令集将所述中间码转化为便 于在所述运行平台上运行的机器码;
存储单元, 用于将所述机器码存储到数据库。
结合第二方面, 在第一种可实现方式中, 所述数据处理装置还 包括:
第二接收单元, 用于接收发送所述外部例行程序的源代码的第 一用户设备发送的数据库访问请求;
第一判断单元, 用于根据所述数据库访问请求判断所述第一用 户设备是否拥有访问所述数据库的权限;
所述第一接收单元具体用于在所述第一判断单元判断出所述第 一用户设备拥有访问所述数据库的权限, 接收所述第一用户设备发 送的外部例行程序的源代码, 以实现将所述源代码转化为所述机器 码并将所述机器码存储到所述数据库。
结合第二方面或第二方面的第一种可实现方式, 在第二种可实 现方式中, 所述数据处理装置还包括:
第一检查单元, 用于检查所述源代码访问所述数据库中对象的 范围是否在预先设置的访问所述数据库中对象的范围内;
所述编译单元具体用于在所述第一检查单元检查出所述源代码 访问所述数据库中对象的范围在所述预先设置的访问所述数据库中 对象的范围内, 编译所述源代码得到所述中间码。
结合第二方面或第二方面的第一实现方式, 在第三种可实现方 式中, 所述数据处理装置还包括:
第二检查单元, 用于检查所述源代码对所述数据库中对象的操 作是否是预先设置的对所述数据库中对象的操作, 所述操作包括对 所述对象的修改、 增加或删除;
所述编译单元具体用于在所述第二检查单元检查出所述源代码 对所述数据库中对象的操作是预先设置的对所述数据库中对象的操 作, 编译所述源代码得到所述中间码。
结合第二方面或者第二方面的第一种可实现方式至第三种可实 现方式中的任意一种, 在第四种可实现方式中, 所述存储单元还用 于将所述中间码存储到所述数据库。
结合第二方面的第四种可实现方式, 在第五种可实现方式中, 所述数据处理装置还包括:
第一生成单元, 用于生成所述中间码的目标名称, 所述目标名 称用于唯一标识所述中间码; 第二生成单元, 用于生成所述中间码的目标地址, 所述目标地 址用于标识所述中间码在所述数据库中的地址。
结合第二方面或者第二方面的第一种可实现方式至第五种可实 现方式中的任意一种, 在第六种可实现方式中, 所述数据处理装置 还包括调用单元:
所述第二接收单元还用于接收第二用户设备发送的调用所述外 部例行程序的请求;
所述第一判断单元还用于根据所述调用所述外部例行程序的请 求判断所述第二用户设备是否拥有调用所述外部例行程序的权限; 所述调用单元用于在所述第一判断单元判断出所述第二用户设 备拥有调用所述外部例行程序的权限时, 运行所述机器码, 以实现 从所述数据库内调用所述外部例行程序。
本发明的实施例提供一种数据处理方法及装置, 所述数据处理 方法, 包括: 接收外部例行程序的源代码, 所述外部例行程序的源 代码由高级编程语言编写; 编译所述源代码得到中间码, 所述中间 码是任意运行平台的虚拟机都能够识别的字节流; 根据运行平台的 指令集将所述中间码转化为便于在所述运行平台上运行的机器码; 将所述机器码存储到数据库。 这样一来, 将接收到的外部例行程序 的源代码编译得到中间码, 相对于现有技术, 所述中间码与运行平 台无关, 对于运行平台是一种统一的编码, 即任意的运行平台的虚 拟机能够识别该中间码, 使得数据库系统中不需要内嵌不同的编译 器来编译外部例行程序的源代码, 根据所述运行平台的指令集将所 述中间码转化为便于在该运行平台上运行的机器码, 有效地提高了 数据库系统的扩展能力。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下 面将对实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于 本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以 根据这些附图获得其他的附图。
图 1为本发明实施例提供一种数据处理方法流程图;
图 l a为本发明实施例提供另一种数据处理方法流程图; 图 2为本发明实施例提供又一种数据处理方法流程图; 图 3为本发明实施例提供再一种数据处理方法流程图; 图 4为本发明实施例提供另再一种数据处理方法流程图; 图 5为本发明实施例提供一种数据处理装置结构示意图; 图 6a为本发明实施例提供另一种数据处理装置结构示意图; 图 6b为本发明实施例提供又一种数据处理装置结构示意图; 图 7为本发明实施例提供再一种数据处理装置结构示意图。 具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术 方案进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明 一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本 领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他 实施例, 都属于本发明保护的范围。
本发明实施例提供一种数据处理方法, 如图 1所示, 包括: 步骤 104、 接收外部例行程序的源代码, 所述外部例行程序的 源代码由高级编程语言编写。
步骤 105、 编译所述源代码得到中间码, 所述中间码是任意运 行平台的虚拟机都能够识别的字节流。
在编译外部例行程序的源代码时, 首先, 检查所述源代码访问 所述数据库中对象的范围是否在预先设置的访问所述数据库中对象 的范围内, 若所述源代码访问所述数据库中对象的范围在所述预先 设置的访问所述数据库中对象的范围内, 编译所述源代码得到所述 中间码。 或者, 编译所述源代码得到中间码还可以包括检查所述源 代码对所述数据库中对象的操作是否是预先设置的对所述数据库中 对象的操作, 所述操作包括对所述对象的修改、 增加或删除, 若所 述源代码对所述数据库中对象的操作是预先设置的对所述数据库中 对象的操作, 编译所述源代码得到所述中间码, 使得任意的运行平 台的虚拟机能够识别所述中间码。 成功编译该源代码得到所述中间 码之后, 将该中间码存储到所述数据库, 生成所述中间码的目标名 称和目标地址, 所述目标名称用于唯一标识所述中间码, 所述目标 地址用于标识该中间码在所述数据库中的地址。
步骤 106、 根据运行平台的指令集将所述中间码转化为便于在 所述运行平台上运行的机器码。
指令集是存储在中央处理器内部, 对中央处理器运算进行指导 和优化的硬程序, 指令集可以使中央处理器更高效地运行。
步骤 107、 将所述机器码存储到数据库。
生成所述机器码的目标名称和目标地址, 所述目标名称用于唯 一标识所述机器码, 所述目标地址用于标识该机器码在所述数据库 中的地址。
这样一来, 首先, 接收外部例行程序的源代码, 然后, 编译所 述源代码得到中间码, 所述中间码是任意运行平台的虚拟机都能够 识别的字节流, 相对于现有技术, 所述中间码与运行平台无关, 对 于运行平台是一种统一的编码, 即任意的运行平台的虚拟机能够识 别该中间码, 使得数据库系统中不需要内嵌不同的编译器来编译外 部例行程序的源代码, 根据所述运行平台的指令集将所述中间码转 化为便于在该运行平台上运行的机器码, 有效地提高了数据库系统 的扩展能力。
本发明实施例提供一种数据处理方法, 如图 l a所示, 包括: 步骤 1 1 1、 接收发送所述外部例行程序的源代码的第一用户设 备发送的数据库访问请求。
步骤 1 12、 根据所述数据库访问请求判断所述第一用户设备是 否拥有访问所述数据库的权限。
步骤 1 13、 若所述第一用户设备拥有访问所述数据库的权限, 接收所述第一用户设备发送的外部例行程序的源代码, 以实现将所 述源代码转化为所述机器码并将所述机器码存储到所述数据库。
若该第一用户设备拥有访问所述数据库的权限, 才接收所述第 一用户设备发送的外部例行程序的源代码, 包括: 解析所述外部例 行程序的源代码的数据包, 获得所述数据包的第一标识, 所述第一 标识用于标示所述数据包的源地址; 判断所述数据包的第一标识是 否是预先设置的标识, 所述预先设置的标识用于标示所述第一用户 设备的地址; 若所述数据包的第一标识是预先设置的标识, 才接收 所述第一用户设备发送的数据包, 所述数据包包括外部例行程序的 源代码, 所述外部例行程序的源代码由高级编程语言编写, 所述高 级编程语言可以是 C语言、 C++语言、 JAVA语言等。
步骤 1 14、 接收外部例行程序的源代码, 所述外部例行程序的 源代码由高级编程语言编写。
步骤 1 1 5、 编译所述源代码得到中间码, 所述中间码是任意运 行平台的虚拟机都能够识别的字节流。
步骤 1 1 6、 根据运行平台的指令集将所述中间码转化为便于在 所述运行平台上运行的机器码。
步骤 1 17、 将所述机器码存储到数据库。
这样一来, 在接收外部例行程序的源代码之前, 首先, 接收发 送所述外部例行程序的源代码的第一用户设备发送的数据库访问请 求, 然后, 判断该第一用户设备拥有访问所述数据库的权限后, 接 收该第一用户设备发送的外部例行程序的源代码, 以实现将所述源 代码转化为所述机器码并将所述机器码存储到所述数据库, 有效地 增强了数据库的安全性, 避免用户设备非法访问该数据库。
本发明实施例提供一种数据处理方法, 假设外部例行程序的源 代码由 C语言编写, 如图 2所示, 包括:
步骤 201、 接收第一用户设备发送的数据库访问请求。
若第一用户为本地用户, 第一用户可以通过第一用户设备向数 据库发送数据库访问请求, 所述第一用户设备发送的数据库访问请 求包括用户名、 登录密码和权限级别, 该用户名为第一用户登录所 述数据库时所使用的登录名称, 该登录密码为第一用户登录所述数 据库时所使用的登录密码, 该权限级别为第一用户登录所述数据库 时该第一用户能够对该数据库进行操作的等级, 例如管理员、 高级 用户、 中级用户或初级用户等权限级别对该数据库存在不同的操作 权限。 示例的, 管理员可以在数据库中添加或删除用户, 对该数据 库中的源程序或对象等进行任何删除、 增加或修改等编译操作, 高 级用户可以调用数据库中的源程序对数据库中的对象进行任何删 除、 增加或修改等编译操作, 初级用户可以只能访问该数据库中的 对象。
若第一用户非本地用户, 需要远程访问该数据库时, 第一用户 可以先通过第一用户设备向数据库所在的服务器发送访问请求, 该 访问请求包括数据库所在的服务器的 IP ( Internet Protocol , 互联网 协议) 地址和端口号, 成功访问数据库所在的服务器后, 第一用户 可以再通过第一用户设备向数据库发送数据库访问请求, 此时该数 据库访问请求包括用户名、 登录密码和权限级别。
需要说明的是,用户可以在磁盘操作系统 DOS环境下通过命令 输入的形式访问数据库, 并可以通过命令输入的形式增加、 删除或 修改该数据库中的源程序或者数据; 用户还可以在可视化的窗口界 面下访问数据库。
步骤 202、 根据数据库访问请求判断第一用户设备是否拥有访 问数据库的权限。
若第一用户设备没有访问数据库的权限, 执行步骤 2021 , 禁止 第一用户设备访问数据库。
若第一用户设备拥有访问数据库的权限, 则执行步骤 203。
若第一用户没有在数据库注册, 当第一用户通过第一用户设备 访问该数据库时, 数据库判断第一用户是该数据库的非法用户, 则 禁止第一用户通过第一用户设备访问所述数据库。
若第一用户设备拥有访问数据库的权限, 即第一用户通过第一 用户设备在数据库中已经注册, 当第一用户通过第一用户设备访问 该数据库时, 数据库判断第一用户是该数据库中的合法用户, 则允 许第一用户通过第一用户设备访问该数据库。
具体的, 若该第一用户设备拥有访问所述数据库的权限, 才接 收所述第一用户设备发送的外部例行程序的源代码, 包括: 解析所 述外部例行程序的源代码的数据包, 获得所述数据包的第一标识, 所述第一标识用于标示所述数据包的源地址, 即发送该数据包的用 户设备的地址。 判断所述数据包的第一标识是否是预先设置的标识, 所述预先设置的标识用于标示所述第一用户设备的地址; 若所述数 据包的第一标识是预先设置的标识, 才接收所述第一用户设备发送 的数据包, 所述数据包包括外部例行程序的源代码。
步骤 202 1 , 禁止第一用户设备访问数据库。
本发明实施例假设第一用户设备拥有访问数据库的权限, 则执 行步骤 203。
步骤 203、 接收所述第一用户设备发送的外部例行程序的源代 码。
步骤 204、 检查所述源代码访问数据库中对象的范围是否在预 先设置的访问所述数据库中对象的范围内。
若所述源代码访问数据库中对象的范围不在预先设置的访问数 据库中对象的范围内, 则执行步骤 2041、 终止编译所述源代码。 例如, 可能存在该源代码访问该数据库中对象包括禁止访问的 对象, 造成对该数据库对象的非法访问。 假如所述源代码访问的对 象为商业上的重要数据, 则可能会导致重大商业机密泄露, 造成严 重的经济损失。 若所述源代码访问所述数据库中对象的范围在所述 预先设置的访问所述数据库中对象的范围内, 编译所述源代码得到 所述中间码。
具体的, 首先, 预先设置数据库中对象的权限级别, 不同权限 级别的对象的重要程度不同, 即可以将所述对象的权限级别设置为 机密、 高级或低级等, 例如, 机密对象不可随意访问, 只有具有机 密权限的程序或用户才能访问。 所述对象可以是数据库中的数据, 也可以是将数据库中所存储的数据进行分类, 划分成不同类型的对 象, 所述每类数据为一类对象, 例如数据类型, 信息类型等。 然后, 当数据库接收到外部例行程序的源代码后, 对所述源代码进行编译 时, 检查该源程序访问数据库中的对象是否是预先设置的允许访问 的数据库对象, 若该源程序访问数据库中的对象是预先设置的允许 访问的数据库对象, 编译所述源代码得到所述中间码。 若该源程序 访问数据库中的对象是数据库预先设置的不允许访问的数据库对 象, 终止编译所述源代码。
进一步的, 若所述源代码访问数据库中对象的范围在预先设置 的访问数据库中对象的范围内, 则执行步骤 205、 检查所述源代码 对数据库中对象的操作是否是预先设置的对数据库中对象的操作。
步骤 2041、 终止编译所述源代码。
本发明实施例假设所述源代码访问数据库中对象的范围在预先 设置的访问数据库中对象的范围内, 则执行步骤 205。
步骤 205、 检查所述源代码对数据库中对象的操作是否是预先 设置的对数据库中对象的操作。 若检查所述源代码对数据库中对象的操作不是预先设置的对数 据库中对象的操作, 则执行步骤 2041、 终止编译所述源代码。
若检查所述源代码对数据库中对象的操作是预先设置的对数据 库中对象的操作, 则执行步骤 206。
具体的, 首先, 预先设置的对数据库中对象的操作的权限, 所 述操作包括对所述对象的修改、 增加或删除等。 即数据库中有的重 要对象可以访问但不能对所述对象进行任何修改等操作, 所述重要 对象为机密或高级权限级别的对象, 有的普通对象可以访问也可以 对所述对象进行任何修改、 删除或增加等操作, 所述普通对象为低 级权限级别的对象。 然后, 当所述源代码访问所述数据库中的对象 是预先设置的允许访问的数据库对象的情况下, 检查所述源代码对 数据库中对象的操作是否是预先设置的对数据库对象的操作, 若所 述源代码对数据库中对象的操作是预先设置的对数据库对象的操 作, 编译所述源代码得到中间码, 若所述源代码对数据库中对象的 操作不是预先设置的对数据库对象的操作, 终止编译所述源代码。
示例的, 假设所述外部例行程序的源代码用于计算公司员工的 基本工资在 3500以上的税后实际发放的工资。 具体的, 假设所述源 代码能够访问数据库中所有员工的基本工资, 所述员工的基本工资 包括 1000 至 5000 , 但是, 只对所述所有员工的基本工资中员工的 基本工资在 3500以上的数据进行计算, 得到税后实际发放的工资。 若所述源代码对所述所有员工的基本工资都进行计算, 得到税后实 际发放的工资, 则会导致员工的基本工资在 3500以下的员工实际拿 到的工资为税后实际发放的工资, 不符合国家的规定, 造成员工工 资发放失误。
现有技术中, 在编译外部例行程序的源代码时, 不需要检查外 部例行程序的源代码访问数据库中对象的范围, 也没有对外部例行 程序的源代码访问数据库中对象的操作的检查, 这样可能影响数据 库中对象的稳定性或当数据库中其他源程序引用该源程序时造成数 据不一致。
本发明实施例所述的数据处理方法, 首先, 对数据库中的对象 进行权限级另 'J的设置和对所述对象操作的设置, 在编译外部例行程 序的源代码时, 通过对外部例行程序的源代码访问数据库中对象的 范围的检查和对外部例行程序的源代码访问数据库中对象的操作的 检查, 判断是否符合预先设置的数据库对象的访问权限和对所述数 据库对象的操作, 有效地增强了数据库运行安全和数据库中的数据 的安全。
本发明实施例假设所述源代码对所述数据库中对象的操作是预 先设置的对所述数据库中对象的操作, 执行步骤 206、 编译所述源 代码得到中间码。
步骤 206、 编译所述源代码得到中间码。
具体的, 可以通过语言前端模块编译所述源代码得到中间码, 所述语言前端模块可以是 C语言、 Python语言或 Fortran语言等语 言前端模块。
本发明实施例^^设外部例行程序的源代码由 C语言编写, 则采 用 C子语言前端模块对该源代码进行解析得到解析树, 然后再将解 析树经过编译得到中间码, 以便于任意的运行平台的虚拟机能够识 别所述中间码。 所述解析树包括根节点、 根元素节点、 节点等, 即 对该源代码进行分析, 所述生成解析树的过程为现有技术, 本发明 实施例在此不作赘述。
特别的, 在编译所述源代码得到中间码后, 执行步骤 209 , 将 所述中间码存储到数据库, 还可以将所述中间码转换成机器码, 执 行步骤 207。
步骤 207、 获取所述中间码的机器码。
运行平台包括以中央处理器为核心的集成电路芯片组, 所述运 行平台的虚拟机屏蔽任意运行平台的指令集。 指令集是存储在中央 处理器内部, 对中央处理器运算进行指导和优化的硬程序, 指令集 可以使中央处理器更高效地运行。 可以通过运行平台获取所述中间 码的机器码。 所述运行平台可以是 x86运行平台、 PwoerPC运行平 台或 ARM运行平台等。 具体的, 可以将语言前端模块生成的外部例 行程序的中间码输入给运行平台, 运行平台可以将外部例行程序的 中间码转换成适合 x86运行平台、 PwoerPC运行平台或 ARM运行平 台等运行平台运行的机器码, 即每个运行平台所运行的机器码不同。
步骤 208、 将所述机器码存储到数据库。
在获取所述中间码的机器码后, 同理, 数据库可以生成所述机 器码的目标名称, 所述目标名称用于唯一标识所述机器码, 生成所 述机器码的目标地址, 所述目标地址用于标识所述机器码在所述数 据库中的地址。 所述目标名称和目标地址是用户不可见的, 存储在 数据库内部, 当调用该外部例行程序的机器码时, 根据该目标名称 和目标地址调用该外部例行程序的机器码。
步骤 209、 将所述中间码存储到数据库。
步骤 209 1、 生成所述中间码的目标名称。
所述目标名称用于唯一标识所述中间码。
步骤 2092、 生成所述中间码的目标地址。
所述目标地址用于标识所述中间码在所述数据库中的地址。 需要说明的是, 在执行步骤 2091 与步骤 2092时, 可以不区分 先后顺序, 即可以先生成所述中间码的目标地址, 再生成所述中间 码的目标名称。
特别的, 在数据库生成所述中间码的目标名称和目标地址时, 为了外部例行程序的中间码的安全更有保障编写外部例行程序的创 始者还可以设置调用密码, 则既应该具有调用外部例行程序的中间 码权限和调用密码的用户才可以调用外部例行程序的中间码。 现有技术中, 编译外部例行程序的源代码后, 得到外部例行程 序的目标代码, 将外部例行程序的目标代码存储到数据库中时, 需 要接收用户设置的目标名称和目标地址, 根据所述目标名称和目标 地址将外部例行程序的目标代码存储到数据库, 这样在管理外部例 行程序的目标代码时可能存在被删除、 替换或篡改等风险。
本发明实施例所述的数据处理方法, 将外部例行程序的中间码 存储到数据库时, 数据库生成所述中间码的目标名称, 所述目标名 称用于唯一标识所述中间码, 生成所述中间码的目标地址, 所述目 标地址用于标识所述中间码在所述数据库中的地址。 所述目标名称 和目标地址是用户不可见的, 存储在数据库内部, 当调用该外部例 行程序的中间码时, 根据该目标名称和目标地址调用该外部例行程 序的中间码。 因此, 通过数据库控制的方法存储和管理外部例行程 序的中间码, 有效地避免了在管理外部例行程序的中间码时存在外 部例行程序被删除、 替换或篡改等风险, 既提高了管理的严谨性又 提高了数据库中数据的安全性。
本发明实施例所述的外部例行程序的源代码只是示意性说明, 实际应用中还可以由其他高级编程语言编写, 将其他高级编程语言 编写的外部例行程序的源代码进行编译得到中间码, 再将所述中间 码转换成机器码的过程与本发明实施例所述的方法相同, 在此不再 赘述。
本发明实施例所述的数据处理方法, 首先, 接收第一用户设备 发送的数据库访问请求, 根据该数据库访问请求判断第一用户设备 是否拥有访问数据库的权限, 若第一用户设备拥有访问数据库的权 限, 接收所述第一用户设备发送的外部例行程序的源代码, 然后, 在编译所述源代码时, 检查所述源代码访问数据库中对象的范围是 否在预先设置的访问数据库中对象的范围内, 若所述源代码访问所 述数据库中对象的范围在所述预先设置的访问所述数据库中对象的 范围内, 编译所述源代码得到中间码, 同时还可以检查所述源代码 对数据库中对象的操作是否是预先设置的对数据库中对象的操作, 若所述源代码对所述数据库中对象的操作是预先设置的对所述数据 库中对象的操作, 编译所述源代码得到中间码, 获取所述中间码的 机器码, 将所述机器码存储到数据库, 同时将所述中间码存储到数 据库。 相对于现有技术, 所述中间码与运行平台无关, 对于运行平 台是一种统一的编码, 即任意的运行平台的虚拟机能够识别该中间 码, 使得数据库系统中不需要内嵌不同的编译器来编译外部例行程 序的源代码, 根据所述运行平台的指令集将所述中间码转化为便于 在该运行平台上运行的机器码, 有效地提高了数据库系统的扩展能 力, 同时在编译该源代码时检查该源代码访问数据库对象的范围和 检查该源代码访问数据库对象的操作有效地增强了数据库运行安全 和数据库中的数据的安全, 以及通过数据库控制的方法存储和管理 外部例行程序的中间码和机器码, 有效地避免了在管理外部例行程 序的中间码和机器码时存在外部例行程序被删除、 替换或篡改等风 险, 既提高了管理的严谨性又提高了数据库中数据的安全性。
本发明实施例提供一种数据处理方法, 假设数据库中存储有外 部例行程序的中间码, 4艮设外部例行程序由 C语言编写, 如图 3所 示, 包括:
步骤 301、 接收第二用户设备发送的调用外部例行程序的请求。 假设第二用户可以通过第二用户设备在数据库中已经注册, 当 第二用户通过第二用户设备访问该数据库时, 数据库判断第二用户 是该数据库中的合法用户, 则允许第二用户通过第二用户设备访问 所述数据库。 然后, 当第二用户需要调用外部例行程序时, 第二用 户可以通过第二用户设备向数据库发送调用外部例行程序的请求, 接收第二用户设备发送的外部例行程序调用请求。
步骤 302、 根据所述调用所述外部例行程序的请求判断第二用 户设备是否拥有调用所述外部例行程序的权限。
该数据库的管理员可以对第二用户在数据库中的权限进行设 置, 若所述第二用户设备没有调用所述外部例行程序的权限, 即对 于调用该源程序的第二用户为非法用户, 执行步骤 3021。
若所述第二用户设备拥有调用所述外部例行程序的权限, 从数 据库调用所述外部例行程序。 需要说明的是, 数据库中存储有该外 部例行程序的函数名, 可以根据所述外部例行程序的函数名调用该 外部例行程序, 然后, 在数据库内部根据存储外部例行程序的中间 码或机器码的目标名称和目标地址来调用外部例行程序的中间码或 机器码来运行该外部例行程序, 以便于给用户返回调用结果。
步骤 302 1、 禁止第二用户设备调用所述外部例行程序。
数据库系统可以向第二用户设备提示操作错误, 禁止第二用户 设备调用所述外部例行程序。
示例的, 假设所述外部例行程序为公司的财务部门的财务工作 人员制作工资时所需要使用的程序。 每个月公司的财务部门的财务 工作人员为公司员工制作当月的员工工资时, 可以调用该外部例行 程序对员工的工资进行计算修改, 然后将员工工资表存储到数据库 中, 所述员工工资表包括公司 内每个员工当月的工资。 数据库的管 理员设置只有制作所述员工工资表的财务工作人员和公司的董事长 可以通过用户设备访问数据库中的员工工资表, 且可以调用该外部 例行程序对该员工工资表进行修改等操作, 而公司的部门领导可以 通过用户设备访问数据库查看员工工资表中该部门员工的工资和自 己的工资, 但是, 公司的部门领导不能调用该外部例行程序对所访 问的该部门员工的工资和自 己的工资进行修改等操作, 公司普通员 工通过用户设备访问数据库只能查看员工工资表中 自 己的工资, 也 不能调用该外部例行程序对自 己的工资进行修改等操作。
本发明实施例假设第二用户设备拥有调用所述外部例行程序的 权限, 执行步骤 303。
步骤 303、 获取所述调用请求的结果。
步骤 304、 调用虚拟机执行所述外部例行程序的中间码。
当调用请求的结果是该外部例行程序的中间码, 调用运行平台 的虚拟机执行所述外部例行程序的中间码。
现有技术中, 在用户通过用户设备调用外部例行程序时, 不需 要判断调用外部例行程序的用户权限, 直接调用所述外部例行程序, 这样可能影响数据库对象的安全性或稳定性。
本发明实施例所述的数据处理方法, 在用户通过用户设备调用 外部例行程序时, 首先需要判断调用外部例行程序的用户权限, 只 有拥有调用外部例行程序权限的用户, 才能通过用户设备调用该外 部例行程序。 相对于现有技术, 在用户设备调用外部例行程序之前, 增加了判断用户调用权限环节, 有效地提高了数据库对象的安全性 或稳定性。
示例的, 4艮设数据库为结构化查询语言数据库 ( Sql Server )。 当用户设备 A需要访问 Sql Server数据库时,首先,安装有 Sql Server 数据库的服务器检查用户设备 A是否有连接该 Sql Server数据库服 务器的权限, 若用户设备 A有连接 Sql Server数据库服务器的权限。 当用户设备 A成功访问 Sql Server数据库服务器后, Sql Server数据 库再检查用户是否有登录 Sql Server 数据库的权限, 若用户有登录 Sql Server数据库的权限, 用户可以对 Sql Server数据库中的对象进 行操作, 然后, Sql Server数据库判断用户是否有对该对象的操作的 权限。 例如, 需要更新或查询某个表, Sql Server数据库判断用户对 该表的权限, 或者用户需要运行某个存储过程, Sql Server数据库判 断用户对存储过程是否有执行权限等。 例如, Sql Server数据库的权 限如表 1 所示。
表 1 Sql Server数据库的权限 权限级别 权限 数据库、 表或索引 CREATE创建数据库、 表或索引 数据库或表 DROP删除数据库或表 数据库、 表或保存的程序 GRANT OPTION赋予权限选项 表 ALTER更改表, 如添力口字段、 索引 等 表 DELETE删除数据 表 INDEX索引 表 INSERT插入 表 SELECT查询 表 UPDATE更新 视图 CREATE VIEW创建视图 视图 SHOW VIEW查看视图 存储过程 ALTER ROUTINE更改存储过程 存储过程 CREATE ROUTINE创建存储过程 存储过程 EXECUTE执行存储过程 服务器主机上的文件访 FILE文件访问
问 服务器管理 CREATE TEMPORARY TABLES 创建临时表 服务器管理 LOCK TABLES锁表 服务器管理 CREATE USER创建用户 服务器管理 PROCESS查看进程 服务器管理 RELOAD执行重新安装命令 服务器管理 REPLICATION CLIENT复制 服务器管理 REPLICATION SLAVE复制 服务器管理 SHOW DATABASES查看数据库 服务器管理 SHUTDOWN关闭数据库 服务器管理 SUPER执行线程
本发明实施例所述的数据处理方法, 首先, 接收第二用户设备 发送的外部例行程序调用请求, 然后, 根据所述外部例行程序调用 请求判断第二用户设备是否拥有调用所述外部例行程序的权限, 若 所述第二用户设备拥有调用所述外部例行程序的权限, 从数据库调 用所述外部例行程序, 获取所述调用请求的结果, 调用虚拟机执行 所述外部例行程序的中间码。 相对于现有技术, 在用户设备调用外 部例行程序时, 增加了判断用户调用权限环节, 有效地提高了数据 库对象的安全性或稳定性。
本发明实施例提供一种数据处理方法, 假设数据库中存储有外 部例行程序的机器码, 假设外部例行程序由 C语言编写, 如图 4所 示, 包括:
步骤 401、 接收第二用户设备发送的调用外部例行程序的请求。 假设第二用户可以通过第二用户设备在数据库中已经注册, 当 第二用户通过第二用户设备访问该数据库时, 数据库判断第二用户 是该数据库中的合法用户, 则允许第二用户通过第二用户设备访问 所述数据库。 然后, 当第二用户需要调用外部例行程序时, 第二用 户可以通过第二用户设备向数据库发送调用外部例行程序的请求, 接收第二用户设备发送的外部例行程序调用请求。
步骤 402、 根据所述调用所述外部例行程序的请求判断第二用 户设备是否拥有调用所述外部例行程序的权限。
该数据库的管理员可以对第二用户在数据库中的权限进行设 置, 若所述第二用户设备没有调用所述外部例行程序的权限, 即对 于调用该源程序的第二用户为非法用户, 执行步骤 4021。
若所述第二用户设备拥有调用所述外部例行程序的权限, 从数 据库调用所述外部例行程序。 需要说明的是, 数据库中存储有该外 部例行程序的函数名, 可以根据所述外部例行程序的函数名调用该 外部例行程序, 然后, 在数据库内部根据存储外部例行程序的中间 码或机器码的目标名称和目标地址来调用外部例行程序的中间码或 机器码来运行该外部例行程序, 以便于给用户返回调用结果。
步骤 402 1、 禁止第二用户设备调用所述外部例行程序。
数据库系统可以向第二用户设备提示操作错误, 禁止第二用户 设备调用所述外部例行程序。
本发明实施例假设第二用户设备拥有调用所述外部例行程序的 权限, 执行步骤 403。
步骤 403、 获取所述调用请求的结果。
步骤 404、 直接执行所述外部例行程序的机器码。
当调用请求的结果是该外部例行程序的机器码, 利用该机器码 所述对应的运行平台运行该外部例行程序的机器码。
现有技术中, 在用户通过用户设备调用外部例行程序时, 不需 要判断调用外部例行程序的用户权限, 直接调用所述外部例行程序, 这样可能影响数据库对象的安全性或稳定性。
本发明实施例所述的数据处理方法, 在用户通过用户设备调用 外部例行程序时, 首先需要判断调用外部例行程序的用户权限, 只 有拥有调用外部例行程序权限的用户, 才能通过用户设备调用该外 部例行程序。 相对于现有技术, 在用户设备调用外部例行程序之前, 增加了判断用户调用权限环节, 有效地提高了数据库对象的安全性 或稳定性。
本发明实施例所述的数据处理方法, 首先, 接收第二用户设备 发送的外部例行程序调用请求, 然后, 根据所述外部例行程序调用 请求判断第二用户设备是否拥有调用所述外部例行程序的权限, 若 所述第二用户设备拥有调用所述外部例行程序的权限, 从数据库调 用所述外部例行程序, 获取所述调用请求的结果, 直接执行所述外 部例行程序的机器码。 相对于现有技术, 在用户设备调用外部例行 程序时, 增加了判断用户调用权限环节, 有效地提高了数据库对象 的安全性或稳定性。
示例的, 如图 5所示, 通过外部例行程序的逻辑框架图对外部 例行程序的源代码进行编译得到中间码或机器码, 并运行该中间码 或机器码的过程进行描述。 首先, 将外部例行程序的源代码输入给 语言前端模块 501 , 语言前端模块 501 对该源代码进行解析编译得 到解析树, 将解析树进行编译, 同时, 通过鉴权模块 502 判断该源 代码对数据库对象进行访问或操作等是否安全, 若该源代码对数据 库对象进行访问或操作等安全, 得到该源代码的中间码, 然后, 将 该中间码输入给中间码模块 503 , 该中间码模块 503 通过存储管理 模块 504 将该源代码的中间码存储到数据库中, 最后, 中间码模块 503将该源代码的中间码输入给运行平台 505 , 运行平台 505将该源 代码的中间码转换成机器码, 以便于在运行平台上执行该外部例行 程序得到预期的结果。 或者, 若没有将源代码的中间码转换成机器 码时, 当需要调用该外部例行程序时, 将该源代码的中间码输入给 虚拟机执行模块 506 , 虚拟机执行模块 506 将该源代码的中间码转 换成机器码的同时执行该机器码。
需要说明的是, 语言前端模块 501可以是 C语言、 Python语言 或 Fortran语言等语言前端模块。运行平台 405可以是 x86运行平台、 PwoerPC运行平台或 ARM运行平台等,每个运行平台所运行的机器 码不同。 本发明实施例提供一种数据处理装置 60 , 如图 6a所示, 包括: 第一接收单元 63 , 用于接收外部例行程序的源代码, 所述外部 例行程序的源代码由高级编程语言编写。
编译单元 66 , 用于编译所述源代码得到中间码, 所述中间码是 任意运行平台的虚拟机都能够识别的字节流。
转化单元 67 , 用于根据运行平台的指令集将所述中间码转化为 便于在所述运行平台上运行的机器码。
存储单元 68 , 用于将所述机器码存储到数据库。
这样一来, 首先, 接收外部例行程序的源代码, 然后, 编译所 述源代码得到中间码, 所述中间码是任意运行平台的虚拟机都能够 识别的字节流, 相对于现有技术, 所述中间码与运行平台无关, 对 于运行平台是一种统一的编码, 即任意的运行平台的虚拟机能够识 别该中间码, 使得数据库系统中不需要内嵌不同的编译器来编译外 部例行程序的源代码, 根据所述运行平台的指令集将所述中间码转 化为便于在该运行平台上运行的机器码, 有效地提高了数据库系统 的扩展能力。
如图 6b所示, 所述数据处理装置 600还包括:
第二接收单元 601 , 用于接收发送所述外部例行程序的源代码 的第一用户设备发送的数据库访问请求。
第一判断单元 602 , 用于根据所述数据库访问请求判断所述第 一用户设备是否拥有访问所述数据库的权限。
所述第一接收单元 603具体用于在所述第一判断单元 602判断 出所述第一用户设备拥有访问所述数据库的权限, 接收所述第一用 户设备发送的外部例行程序的源代码, 以实现转化单元 607 将所述 源代码转化为所述机器码并将所述机器码存储到所述数据库。
所述数据处理装置 600还包括:
第一检查单元 604 , 用于检查所述源代码访问所述数据库中对 象的范围是否在预先设置的访问所述数据库中对象的范围内。 所述编译单元 606具体用于:
在所述第一检查单元 604检查出所述源代码访问所述数据库中 对象的范围在所述预先设置的访问所述数据库中对象的范围内, 编 译所述源代码得到所述中间码
所述数据处理装置 600还包括:
第二检查单元 605 , 用于检查所述源代码对所述数据库中对象 的操作是否是预先设置的对所述数据库中对象的操作, 所述操作包 括对所述对象的修改、 增加或删除。
所述编译单元 606具体用于:
在所述第二检查单元 605检查出所述源代码对所述数据库中对 象的操作是预先设置的对所述数据库中对象的操作, 编译所述源代 码得到所述中间码。
所述存储单元 608还用于将所述中间码存储到所述数据库。 所述数据处理装置 600还包括:
第一生成单元 609 , 用于生成所述中间码的目标名称, 所述目 标名称用于唯一标识所述中间码。
第二生成单元 6010 , 用于生成所述中间码的目标地址, 所述目 标地址用于标识所述中间码在所述数据库中的地址。
需要说明的是, 在存储单元 608执行将所述中间码存储到所述 数据库后, 第一生成单元 609 生成所述中间码的目标名称, 所述目 标名称用于唯一标识所述中间码, 与第二生成单元 6010生成所述中 间码的目标地址, 所述目标地址用于标识所述中间码在所述数据库 中的地址可以同时进行, 无需区分生成目标名称与生成目标地址的 先后顺序。
所述数据处理装置 600还包括: 调用单元 601 1 ,
所述第二接收单元 601还用于接收第二用户设备发送的调用所 述外部例行程序的请求。 所述第一判断单元 602还用于根据所述调用所述外部例行程序 的请求判断所述第二用户设备是否拥有调用所述外部例行程序的权 限。
所述调用单元 601 1用于在所述第一判断单元 602判断出所述第 二用户设备拥有调用所述外部例行程序的权限时, 运行所述机器码, 以实现从所述数据库内调用所述外部例行程序。
本发明实施例所述的数据处理装置, 首先, 接收第一用户设备 发送的数据库访问请求, 根据该数据库访问请求判断第一用户设备 拥有访问数据库的权限, 接收外部例行程序的源代码, 然后, 在编 译所述源代码时, 检查所述源代码访问所述数据库中对象的范围在 所述预先设置的访问所述数据库中对象的范围内, 编译所述源代码 得到中间码, 同时还可以检查所述源代码对所述数据库中对象的操 作是预先设置的对所述数据库中对象的操作, 编译所述源代码得到 中间码, 获取所述中间码的机器码, 将所述机器码存储到数据库, 同时将所述中间码存储到数据库, 同时在存储外部例行程序的中间 码或机器码之后, 判断出第二用户设备拥有调用该外部例行程序的 权限时, 运行机器码或中间码, 以实现从所述数据库内调用所述外 部例行程序。 相对于现有技术, 所述中间码与运行平台无关, 对于 运行平台是一种统一的编码, 即任意的运行平台的虚拟机能够识别 该中间码, 使得数据库系统中不需要内嵌不同的编译器来编译外部 例行程序的源代码, 根据所述运行平台的指令集将所述中间码转化 为便于在该运行平台上运行的机器码, 有效地提高了数据库系统的 扩展能力, 同时在编译该源代码时检查该源代码访问数据库对象的 范围和检查该源代码访问数据库对象的操作有效地增强了数据库运 行安全和数据库中的数据的安全, 以及通过数据库控制的方法存储 和管理外部例行程序的中间码和机器码, 有效地避免了在管理外部 例行程序的中间码和机器码时存在外部例行程序被删除、 替换或篡 改等风险, 既提高了管理的严谨性又提高了数据库中数据的安全性。 本发明实施例提供一种数据处理装置 70 , 如图 7所示, 包括: 接收器 701 , 用于接收外部例行程序的源代码, 所述外部例行 程序的源代码由高级编程语言编写。
处理器 702 , 用于编译所述源代码得到中间码, 所述中间码是 任意运行平台的虚拟机都能够识别的字节流。
所述处理器 702还用于根据运行平台的指令集将所述中间码转 化为便于在所述运行平台上运行的机器码。
所述处理器 702还用于将所述机器码存储到数据库。
这样一来, 首先, 接收外部例行程序的源代码, 然后, 编译所 述源代码得到中间码, 所述中间码是任意运行平台的虚拟机都能够 识别的字节流, 相对于现有技术, 所述中间码与运行平台无关, 对 于运行平台是一种统一的编码, 即任意的运行平台的虚拟机能够识 别该中间码, 使得数据库系统中不需要内嵌不同的编译器来编译外 部例行程序的源代码, 根据所述运行平台的指令集将所述中间码转 化为便于在该运行平台上运行的机器码, 有效地提高了数据库系统 的扩展能力。
所述接收器 701还用于:
接收发送所述外部例行程序的源代码的第一用户设备发送的数 据库访问请求。
所述处理器 702还用于:
根据所述数据库访问请求判断所述第一用户设备是否拥有访问 所述数据库的权限。
所述处理器 702还用于:
在所述处理器 702判断出所述第一用户设备拥有访问所述数据 库的权限, 接收所述第一用户设备发送的外部例行程序的源代码, 以实现将所述源代码转化为所述机器码并将所述机器码存储到所述 数据库。
具体的, 所述处理器 702解析所述外部例行程序的源代码的数 据包, 获得所述数据包的第一标识, 所述第一标识用于标示所述数 据包的源地址。 然后判断所述数据包的第一标识是否是预先设置的 标识, 所述预先设置的标识用于标示所述第一用户设备的地址。
所述处理器 702还用于:
检查所述源代码访问所述数据库中对象的范围是否在预先设置 的访问所述数据库中对象的范围内。
所述处理器 702具体用于:
在所述处理器 702检查出所述源代码访问所述数据库中对象的 范围在所述预先设置的访问所述数据库中对象的范围内, 编译所述 源代码得到所述中间码。
所述处理器 702还用于:
检查所述源代码对所述数据库中对象的操作是否是预先设置的 对所述数据库中对象的操作, 所述操作包括对所述对象的修改、 增 加或删除。
所述处理器 702具体用于:
在所述处理器 702检查出所述源代码对所述数据库中对象的操 作是预先设置的对所述数据库中对象的操作, 编译所述源代码得到 所述中间码。
所述处理器 702还用于:
将所述中间码存储到所述数据库。
所述处理器 702还用于:
生成所述中间码的目标名称, 所述目标名称用于唯一标识所述 中间码。
所述处理器 702还用于:
生成所述中间码的目标地址, 所述目标地址用于标识所述中间 码在所述数据库中的地址。
所述接收器 701还用于:
接收第二用户设备发送的调用所述外部例行程序的请求。
所述处理器 702还用于:
根据所述调用所述外部例行程序的请求判断所述第二用户设备 是否拥有调用所述外部例行程序的权限。
所述处理器 702还用于:
在所述处理器 702判断出所述第二用户设备拥有调用所述外部 例行程序的权限时, 运行所述机器码, 以实现从所述数据库内调用 所述外部例行程序。
本发明实施例所述的数据处理装置, 首先, 接收第一用户设备 发送的数据库访问请求, 根据该数据库访问请求判断第一用户设备 拥有访问数据库的权限, 接收外部例行程序的源代码, 然后, 在编 译所述源代码时, 检查所述源代码访问所述数据库中对象的范围在 所述预先设置的访问所述数据库中对象的范围内, 编译所述源代码 得到中间码, 同时还可以检查所述源代码对所述数据库中对象的操 作是预先设置的对所述数据库中对象的操作, 编译所述源代码得到 中间码, 获取所述中间码的机器码, 将所述机器码存储到数据库, 同时将所述中间码存储到数据库, 同时在存储外部例行程序的中间 码或机器码之后, 判断出第二用户设备拥有调用该外部例行程序的 权限时, 运行机器码或中间码, 以实现从所述数据库内调用所述外 部例行程序。 相对于现有技术, 所述中间码与运行平台无关, 对于 运行平台是一种统一的编码, 即任意的运行平台的虚拟机能够识别 该中间码, 使得数据库系统中不需要内嵌不同的编译器来编译外部 例行程序的源代码, 根据所述运行平台的指令集将所述中间码转化 为便于在该运行平台上运行的机器码, 有效地提高了数据库系统的 扩展能力, 同时在编译该源代码时检查该源代码访问数据库对象的 范围和检查该源代码访问数据库对象的操作有效地增强了数据库运 行安全和数据库中的数据的安全, 以及通过数据库控制的方法存储 和管理外部例行程序的中间码和机器码, 有效地避免了在管理外部 例行程序的中间码和机器码时存在外部例行程序被删除、 替换或篡 改等风险, 既提高了管理的严谨性又提高了数据库中数据的安全性。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁, 上述描述的装置和单元的具体工作过程, 可以参考前述方法实施例 中的对应过程, 在此不再赘述。
在本申请所提供的几个实施例中, 应该理解到, 所揭露的装置 和方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施 例仅仅是示意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能 划分, 实际实现时可以有另外的划分方式, 例如多个单元或组件可 以结合或者可以集成到另一个系统, 或一些特征可以忽略, 或不执 行。 另一点, 所显示或讨论的相互之间的耦合或直接耦合或通信连 接可以是通过一些接口, 装置或单元的间接耦合或通信连接, 可以 是电性, 机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分 开的, 作为单元显示的部件可以是或者也可以不是物理单元, 即可 以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实 际的需要选择其中的部分或者全部单元来实现本实施例方案的 目 的。
另外, 在本发明各个实施例中的各功能单元可以集成在一个处 理单元中, 也可以是各个单元单独物理包括, 也可以两个或两个以 上单元集成在一个单元中。 上述集成的单元既可以采用硬件的形式 实现, 也可以采用硬件加软件功能单元的形式实现。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或 部分步骤可以通过程序指令相关的硬件来完成, 前述的程序可以存 储于一计算机可读取存储介质中, 该程序在执行时, 执行包括上述 方法实施例的步骤; 而前述的存储介质包括: ROM、 RAM , 磁碟或 者光盘等各种可以存储程序代码的介质。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围 并不局限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技 术范围内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围 之内。 因此, 本发明的保护范围应以所述权利要求的保护范围为准。

Claims

权 利 要 求 书
1、 一种数据处理方法, 其特征在于, 包括:
接收外部例行程序的源代码,所述外部例行程序的源代码由高级 编程语言编写;
编译所述源代码得到中间码,所述中间码是任意运行平台的虚拟 机都能够识别的字节流;
根据运行平台的指令集将所述中间码转化为便于在所述运行平 台上运行的机器码;
将所述机器码存储到数据库。
2、 根据权利要求 1 所述的数据处理方法, 其特征在于, 在所述 接收外部例行程序的源代码之前, 所述方法还包括:
接收发送所述外部例行程序的源代码的第一用户设备发送的数 据库访问请求;
根据所述数据库访问请求判断所述第一用户设备是否拥有访问 所述数据库的权限;
若所述第一用户设备拥有访问所述数据库的权限,接收所述第一 用户设备发送的外部例行程序的源代码, 以实现将所述源代码转化为 所述机器码并将所述机器码存储到所述数据库。
3、 根据权利要求 1或 2所述的数据处理方法, 其特征在于, 所 述编译所述源代码得到中间码之前, 进一步包括:
检查所述源代码访问所述数据库中对象的范围是否在预先设置 的访问所述数据库中对象的范围内;
若所述源代码访问所述数据库中对象的范围在所述预先设置的 访问所述数据库中对象的范围内, 编译所述源代码得到所述中间码。
4、 根据权利要求 1或 2所述的数据处理方法, 其特征在于, 所 述编译所述源代码得到所述中间码之前, 进一步包括:
检查所述源代码对所述数据库中对象的操作是否是预先设置的 对所述数据库中对象的操作, 所述操作包括对所述对象的修改、 增加 或删除; 若所述源代码对所述数据库中对象的操作是预先设置的对所述 数据库中对象的操作, 编译所述源代码得到所述中间码。
5、 根据权利要求 1 至 4任一项权利要求所述的数据处理方法, 其特征在于, 在所述编译所述源代码得到中间码之后, 所述方法还包 括:
将所述中间码存储到所述数据库。
6、 根据权利要求 5所述的数据处理方法, 其特征在于, 在所述 将所述中间码存储到所述数据库之后, 所述方法还包括:
生成所述中间码的目标名称,所述目标名称用于唯一标识所述中 间码;
生成所述中间码的目标地址,所述目标地址用于标识所述中间码 在所述数据库中的地址。
7、 根据权利要求 1 至 6任一项权利要求所述的数据处理方法, 其特征在于, 在所述将所述机器码存储到数据库之后, 所述方法还包 括:
接收第二用户设备发送的调用所述外部例行程序的请求; 根据所述调用所述外部例行程序的请求判断所述第二用户设备 是否拥有调用所述外部例行程序的权限;
若所述第二用户设备拥有调用所述外部例行程序的权限,则运行 所述机器码, 以实现从所述数据库内调用所述外部例行程序。
8、 一种数据处理装置, 其特征在于, 包括:
第一接收单元, 用于接收外部例行程序的源代码, 所述外部例行 程序的源代码由高级编程语言编写;
编译单元, 用于编译所述源代码得到中间码, 所述中间码是任意 运行平台的虚拟机都能够识别的字节流;
转化单元,用于根据运行平台的指令集将所述中间码转化为便于 在所述运行平台上运行的机器码;
存储单元, 用于将所述机器码存储到数据库。
9、 根据权利要求 8所述的数据处理装置, 其特征在于, 所述数 据处理装置还包括:
第二接收单元,用于接收发送所述外部例行程序的源代码的第一 用户设备发送的数据库访问请求;
第一判断单元,用于根据所述数据库访问请求判断所述第一用户 设备是否拥有访问所述数据库的权限;
所述第一接收单元具体用于在所述第一判断单元判断出所述第 一用户设备拥有访问所述数据库的权限, 接收所述第一用户设备发送 的外部例行程序的源代码, 以实现将所述源代码转化为所述机器码并 将所述机器码存储到所述数据库。
10、 根据权利要求 8或 9所述的数据处理装置, 其特征在于, 所 述数据处理装置还包括:
第一检查单元,用于检查所述源代码访问所述数据库中对象的范 围是否在预先设置的访问所述数据库中对象的范围内;
所述编译单元具体用于在所述第一检查单元检查出所述源代码 访问所述数据库中对象的范围在所述预先设置的访问所述数据库中 对象的范围内, 编译所述源代码得到所述中间码。
1 1、 根据权利要求 8或 9所述的数据处理装置, 其特征在于, 所 述数据处理装置还包括:
第二检查单元,用于检查所述源代码对所述数据库中对象的操作 是否是预先设置的对所述数据库中对象的操作, 所述操作包括对所述 对象的修改、 增加或删除;
所述编译单元具体用于在所述第二检查单元检查出所述源代码 对所述数据库中对象的操作是预先设置的对所述数据库中对象的操 作, 编译所述源代码得到所述中间码。
12、根据权利要求 8至 1 1任一项权利要求所述的数据处理装置, 其特征在于:
所述存储单元还用于将所述中间码存储到所述数据库。
13、 根据权利要求 12所述的数据处理装置, 其特征在于, 所述 数据处理装置还包括: 第一生成单元, 用于生成所述中间码的目标名称, 所述目标名称 用于唯一标识所述中间码;
第二生成单元, 用于生成所述中间码的目标地址, 所述目标地址 用于标识所述中间码在所述数据库中的地址。
14、根据权利要求 8至 13任一项权利要求所述的数据处理装置, 其特征在于, 还包括调用单元:
所述第二接收单元还用于接收第二用户设备发送的调用所述外 部例行程序的请求;
所述第一判断单元还用于根据所述调用所述外部例行程序的请 求判断所述第二用户设备是否拥有调用所述外部例行程序的权限; 所述调用单元用于在所述第一判断单元判断出所述第二用户设 备拥有调用所述外部例行程序的权限时, 运行所述机器码, 以实现从 所述数据库内调用所述外部例行程序。
PCT/CN2014/081141 2014-02-19 2014-06-30 一种数据处理方法及装置 WO2015123956A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP14856790.2A EP2937782B1 (en) 2014-02-19 2014-06-30 Data processing method and device
US14/753,232 US9430198B2 (en) 2014-02-19 2015-06-29 Data processing method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410055711.9 2014-02-19
CN201410055711.9A CN103838614B (zh) 2014-02-19 2014-02-19 一种数据处理方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/753,232 Continuation US9430198B2 (en) 2014-02-19 2015-06-29 Data processing method and apparatus

Publications (1)

Publication Number Publication Date
WO2015123956A1 true WO2015123956A1 (zh) 2015-08-27

Family

ID=50802147

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/081141 WO2015123956A1 (zh) 2014-02-19 2014-06-30 一种数据处理方法及装置

Country Status (4)

Country Link
US (1) US9430198B2 (zh)
EP (1) EP2937782B1 (zh)
CN (1) CN103838614B (zh)
WO (1) WO2015123956A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106648681A (zh) * 2016-12-29 2017-05-10 南京科远自动化集团股份有限公司 一种可编程语言编译装载系统及方法

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103838614B (zh) 2014-02-19 2017-12-22 华为技术有限公司 一种数据处理方法及装置
CN105700854B (zh) * 2014-11-25 2019-05-28 杭州海康威视数字技术股份有限公司 运行应用任务的方法及装置
US9830134B2 (en) * 2015-06-15 2017-11-28 Qualcomm Incorporated Generating object code from intermediate code that includes hierarchical sub-routine information
CN107508783A (zh) * 2016-06-14 2017-12-22 阿里巴巴集团控股有限公司 一种数据的处理方法和装置
CN108415719B (zh) * 2018-03-29 2019-03-19 网易(杭州)网络有限公司 代码热更新方法和装置、存储介质、处理器及终端
CN108763406B (zh) * 2018-05-23 2021-08-17 重庆第二师范学院 一种基于云服务器的计算机电子信息储存方法
CN110597891B (zh) * 2018-06-12 2022-06-21 武汉斗鱼网络科技有限公司 MySQL聚合为PostgreSQL数据库的设备、系统、方法、存储介质
US11385940B2 (en) 2018-10-26 2022-07-12 EMC IP Holding Company LLC Multi-cloud framework for microservice-based applications
CN110287378B (zh) * 2019-05-24 2021-10-19 中国科学院计算技术研究所 一种基于动态代码生成的图计算方法及系统
CN112333482B (zh) * 2019-08-05 2023-01-06 广州虎牙科技有限公司 一种列表的处理方法、装置、设备和存储介质
US11533317B2 (en) * 2019-09-30 2022-12-20 EMC IP Holding Company LLC Serverless application center for multi-cloud deployment of serverless applications
CN111625782B (zh) * 2020-05-25 2023-09-19 杭州安恒信息技术股份有限公司 源码的访问权限控制方法、装置、计算机设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101504613A (zh) * 2009-03-12 2009-08-12 上海交通大学 用于受限系统的分布式动态二进制翻译方法
CN101836188A (zh) * 2007-10-26 2010-09-15 高通股份有限公司 基于服务器的代码编译
CN102419714A (zh) * 2010-09-28 2012-04-18 程碧波 程序编译方法、编译器及计算机
US20120284696A1 (en) * 2009-12-21 2012-11-08 Nokia Corporation Method, Apparatuses and a System for Compilation
CN103838614A (zh) * 2014-02-19 2014-06-04 华为技术有限公司 一种数据处理方法及装置

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3527765B2 (ja) * 1993-11-29 2004-05-17 富士通株式会社 プログラムキャッシュ装置
US6574673B1 (en) * 1997-10-31 2003-06-03 Oracle Corporation Data type mapping for external callouts
US6243860B1 (en) * 1998-10-30 2001-06-05 Westinghouse Electric Company Llc Mechanism employing a memory area for exchanging information between a parent process and a child process compiled during execution of the parent process or between a run time compiler process and an application process
US6711579B2 (en) * 2001-04-20 2004-03-23 Sree Ayyanar Spinning And Weaving Mills Limited Data storage schema independent programming for data retrieval using semantic bridge
US20040225747A1 (en) * 2003-05-09 2004-11-11 Zafer Kadi Providing compiled bytecode applications to a wireless device
US7383255B2 (en) 2003-06-23 2008-06-03 Microsoft Corporation Common query runtime system and application programming interface
US20070038662A1 (en) * 2005-08-04 2007-02-15 Peter Bendel Method and system for managing external routines in a database management system
US8578339B2 (en) * 2007-09-26 2013-11-05 Symantec Corporation Automatically adding bytecode to a software application to determine database access information
US8856809B2 (en) * 2008-03-19 2014-10-07 International Business Machines Corporation Controlling navigation of application logic using annotated application code
DE112009001892T5 (de) 2008-07-31 2011-07-21 Dustin Kurt Calif. Adler Datensatz basierte Codestruktur
US8171045B2 (en) * 2008-07-31 2012-05-01 Xsevo Systems, Inc. Record based code structure
CN101499093A (zh) * 2009-03-05 2009-08-05 国电南瑞科技股份有限公司 一种监控系统内存数据库通用交互方法
US9104484B2 (en) * 2010-04-21 2015-08-11 Salesforce.Com, Inc. Methods and systems for evaluating bytecode in an on-demand service environment including translation of apex to bytecode
US20110296386A1 (en) * 2010-05-28 2011-12-01 Salesforce.Com, Inc. Methods and Systems for Validating Changes Submitted to a Source Control System
US20130124686A1 (en) * 2011-11-16 2013-05-16 Université d'Orléans System and a Method for Sharing Computing Resources Associated to Scientific Publications
CN103309779B (zh) * 2013-06-14 2016-07-06 广东电网公司电力科学研究院 智能变电站二次设备状态检测方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101836188A (zh) * 2007-10-26 2010-09-15 高通股份有限公司 基于服务器的代码编译
CN101504613A (zh) * 2009-03-12 2009-08-12 上海交通大学 用于受限系统的分布式动态二进制翻译方法
US20120284696A1 (en) * 2009-12-21 2012-11-08 Nokia Corporation Method, Apparatuses and a System for Compilation
CN102419714A (zh) * 2010-09-28 2012-04-18 程碧波 程序编译方法、编译器及计算机
CN103838614A (zh) * 2014-02-19 2014-06-04 华为技术有限公司 一种数据处理方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2937782A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106648681A (zh) * 2016-12-29 2017-05-10 南京科远自动化集团股份有限公司 一种可编程语言编译装载系统及方法

Also Published As

Publication number Publication date
CN103838614B (zh) 2017-12-22
CN103838614A (zh) 2014-06-04
US9430198B2 (en) 2016-08-30
EP2937782A1 (en) 2015-10-28
EP2937782A4 (en) 2016-04-20
US20150301810A1 (en) 2015-10-22
EP2937782B1 (en) 2022-10-19

Similar Documents

Publication Publication Date Title
WO2015123956A1 (zh) 一种数据处理方法及装置
Priebe et al. EnclaveDB: A secure database using SGX
US10361998B2 (en) Secure gateway communication systems and methods
Schultz et al. IFDB: decentralized information flow control for databases
Parker et al. LWeb: Information flow security for multi-tier web applications
US20080282354A1 (en) Access control based on program properties
CN111475782B (zh) 基于sgx软件扩展指令的api密钥保护方法及系统
CN104202296A (zh) 一种国产操作系统可信安全增强方法
JP2022506495A (ja) セキュリティ監視処理のためのシステム及び方法
Birrell et al. SGX enforcement of use-based privacy
WO2024021577A1 (zh) 防篡改的数据保护方法及系统
Araujo et al. Compiler-instrumented, Dynamic {Secret-Redaction} of Legacy Processes for Attacker Deception
US20220027458A1 (en) Compiiling and executing code in a secure sandbox
EP3841476B1 (en) Scalable pre-analysis of dynamic applications
JP2017531247A (ja) データ管理方法、そのためのコンピュータプログラム、その記録媒体、データ管理方法を実行するユーザークライアント、及びセキュリティーポリシーサーバー
CN111930752A (zh) 一种数据处理方法及相关设备
US11947677B2 (en) Dynamic taint tracking in abstract syntax tree interpreters
Bocić et al. Finding access control bugs in web applications with CanCheck
US11886899B2 (en) Privacy preserving introspection for trusted execution environments
US10255157B2 (en) Type safe secure logging
US20220129593A1 (en) Limited introspection for trusted execution environments
US11709930B2 (en) Inferring watchpoints for understandable taint reports
US20220027179A1 (en) Creating a guest-native executable in a host operating system
Pereira et al. Distributed and typed role-based access control mechanisms driven by CRUD expressions
KR102694517B1 (ko) 데이터베이스 저장 데이터의 암호화 처리 방법 및 데이터베이스 관리 시스템

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 2014856790

Country of ref document: EP

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14856790

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE