A multi-type database compatibility method, device, equipment and medium for an ORM framework
By obtaining and marking the SQL statement differences of multiple types of databases in the ORM framework, creating conversion tools and applying functions, the problem that the ORM framework is not compatible with multiple databases is solved, and a better user experience and wider database support is achieved.
Patent Information
- Application Number
- CN202210421544.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2042-04-21
AI Technical Summary
The existing ORM framework is not well compatible with multiple types of databases, which leads to the need to use external tools to convert incompatible SQL statements in actual applications, thus affecting the user experience.
Get SQL statements supported by multiple types of databases in the ORM framework, mark out the differences in personalized SQL statements, create SQL statement conversion tools, and achieve SQL statement compatibility for multi-type databases in the ORM framework by applying functions.
It realizes that the ORM framework is compatible with SQL statements of multiple types of databases, improves user experience, and supports more types of databases.
Smart Images

Figure CN114925142B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computers, and more particularly to a method, device, equipment and medium for ORM framework to be compatible with multiple types of databases. Background Art
[0002] In the era of big data, the types and sizes of databases are constantly expanding, which brings certain challenges to database management. In social production and life, the application scope of databases is gradually increasing. Improving the efficiency of database development and application is the key to ensuring the efficient operation of social production and life in my country. The ORM (Object Relational Mapping) framework uses metadata to describe the details of object-relational mapping. As long as the mapping relationship between the persistent class and the table is provided, the ORM framework can refer to the information of the mapping file at runtime and persist the object to the database.
[0003] In the prior art, the ORM framework cannot be well compatible with various types of databases. In actual applications, external tools are needed to convert SQL statements that are not compatible with the database, which affects the user experience. Summary of the invention
[0004] One or more embodiments of this specification provide a multi-type database compatibility method, device, equipment and medium of an ORM framework, which are used to solve the following technical problems:
[0005] In the prior art, the ORM framework cannot be well compatible with various types of databases. In actual applications, external tools are needed to convert SQL statements that are not compatible with the database, which affects the user experience.
[0006] One or more embodiments of this specification adopt the following technical solutions:
[0007] One or more embodiments of this specification provide a multi-type database compatibility method for an ORM framework, the method comprising:
[0008] In the ORM framework, the SQL statements supported by the multiple types of databases are obtained, and personalized SQL statements that are different from other databases are marked in each type of database;
[0009] Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement;
[0010] According to the database type built into the ORM framework, set the SQL statement type output by the SQL statement conversion tool;
[0011] Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
[0012] Furthermore, after applying the application function to the ORM framework, the method further includes:
[0013] Determine the clause types in SQL statements and set optimization rules for different clause types;
[0014] After the designated SQL statement is input into the ORM framework, the designated SQL statement is converted into a first SQL statement of the SQL statement type by the SQL statement conversion tool;
[0015] The execution order of the first SQL statement is adjusted according to the optimization rule.
[0016] Furthermore, after applying the application function to the ORM framework, the method further includes:
[0017] After the designated SQL statement is input into the ORM framework, the designated SQL statement is serialized and deserialized.
[0018] Furthermore, after applying the application function to the ORM framework, the method further includes:
[0019] Setting the paradigm of the database table in the ORM framework includes:
[0020] Setting all fields in the database table to a single attribute so that the database table is a two-dimensional table;
[0021] A business primary key is set for the database table so that no non-primary key columns exist in the database table.
[0022] Furthermore, after applying the application function to the ORM framework, the method further includes:
[0023] When a plurality of indexing instructions are executed in the database of the ORM framework, data IDs are determined through the plurality of indexing instructions, and corresponding data in the database of the ORM framework is queried according to the data IDs.
[0024] Furthermore, after applying the application function to the ORM framework, the method further includes:
[0025] When the free memory of the server of the ORM framework is greater than a preset threshold and the performance requirement is high, a read-write analysis is performed on the database of the ORM framework;
[0026] Distribute read requests to multiple slave servers to reduce the pressure on the database.
[0027] Furthermore, after applying the application function to the ORM framework, the method further includes:
[0028] The operator in the application function is converted into an SQL statement of the database in the ORM framework to operate the operation object at the database level.
[0029] One or more embodiments of this specification provide a multi-type database compatible device for an ORM framework, the device comprising:
[0030] An acquisition unit, in the ORM framework, acquires SQL statements supported by various types of databases, and marks personalized SQL statements that are different from other databases in each type of database;
[0031] A creation unit, which creates an SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement;
[0032] A setting unit, which sets the SQL statement type output by the SQL statement conversion tool according to the database type built into the ORM framework;
[0033] The application unit develops corresponding application functions according to the SQL statement type, and applies the application functions to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
[0034] One or more embodiments of this specification provide a multi-type database compatible device of an ORM framework, the device comprising:
[0035] at least one processor; and,
[0036] a memory communicatively connected to the at least one processor; wherein,
[0037] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0038] In the ORM framework, obtain the SQL statements supported by various types of databases, and mark the personalized SQL statements that are different from other databases in each type of database;
[0039] Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement;
[0040] According to the database type built into the ORM framework, set the SQL statement type output by the SQL statement conversion tool;
[0041] Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
[0042] One or more embodiments of this specification provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to:
[0043] In the ORM framework, obtain the SQL statements supported by various types of databases, and mark the personalized SQL statements that are different from other databases in each type of database;
[0044] Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement;
[0045] According to the database type built into the ORM framework, set the SQL statement type output by the SQL statement conversion tool;
[0046] Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
[0047] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects: In the embodiments of this specification, by obtaining SQL statements supported by various types of databases respectively in the ORM framework, the various types of databases at this time can be updated and added so that the ORM framework supports more types of databases. At the same time, the embodiments of this specification can mark the personalized SQL statements that are different from other databases in each type of database, so as to create a SQL statement conversion tool for converting SQL statements between various types of databases through the SQL statements supported by various types of databases and personalized SQL statements, so as to convert the SQL statements input subsequently, so that the ORM framework can be well compatible with different types of databases, and then process SQL statements of different types of databases. In addition, one or more database types built into the ORM framework can convert the input SQL statements into SQL statements supported by the built-in database of the ORM framework by setting the SQL statement type output by the SQL statement conversion tool. In addition, according to the SQL statement type output by the SQL statement conversion tool, an application function is developed, and the application function is applied to the ORM framework, so that the ORM framework can be compatible with SQL statements of various types of databases. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art description. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. In the drawings:
[0049] Figure 1 A flowchart of a multi-type database compatibility method of an ORM framework provided in one or more embodiments of this specification;
[0050] Figure 2 A schematic diagram of the structure of an ORM framework provided for one or more embodiments of this specification;
[0051] Figure 3 A schematic diagram of the structure of a multi-type database compatible device of an ORM framework provided in one or more embodiments of this specification;
[0052] Figure 4 A schematic diagram of the structure of a multi-type database compatible device of an ORM framework provided in one or more embodiments of this specification. DETAILED DESCRIPTION
[0053] The embodiments of the present specification provide a method, apparatus, device and medium for ORM framework compatibility with multiple types of databases.
[0054] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0055] Figure 1 A flowchart of a multi-type database compatibility method for an ORM framework provided in one or more embodiments of the present specification is provided. The process can be executed by a multi-type database compatibility system, which can be used for the compatibility of multi-type databases in the ORM framework. Certain input parameters or intermediate results in the process allow manual intervention and adjustment to help improve accuracy.
[0056] The method steps of the embodiment of this specification are as follows:
[0057] S102, in the ORM framework, obtaining SQL statements respectively supported by the multiple types of databases, and marking personalized SQL statements in each type of database that are different from those in other databases.
[0058] In the embodiments of this specification, multiple types of databases are the database types that the ORM framework is compatible with. In the subsequent use process, other types of databases can be added to make the ORM framework more effective in database compatibility.
[0059] In the embodiments of this specification, the personalized SQL statement is the part where each type of database differs from other databases. Based on the personalized SQL statement, when the SQL statement is subsequently converted, it can be better transferred to the SQL statement of the specified type of database.
[0060] S104: Creating an SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement.
[0061] In the embodiments of this specification, the SQL statement conversion tool may be a SQL statement conversion package. During execution, the personalized SQL statement may be loaded into the SQLAlchemy dialect program according to the beginning of the connection string, and the conversion of different SQL statements may be realized. At this time, the personalized SQL statement is a dialect (Dialect).
[0062] S106, setting the SQL statement type output by the SQL statement conversion tool according to the database type built into the ORM framework.
[0063] In the embodiments of the present specification, one or more types of databases may be built into the ORM framework. If the input SQL statement does not belong to the database type built into the ORM framework, the input SQL statement needs to be converted. At this time, the SQL statement type output by the SQL statement conversion tool can be set to convert the input SQL statement into an SQL statement supported by the ORM framework.
[0064] S108, developing corresponding application functions according to the SQL statement type, and applying the application functions to the ORM framework, so as to realize that the ORM framework is compatible with SQL statements of various types of databases.
[0065] In the embodiments of this specification, application functions can be developed according to different business scenarios.
[0066] After the application function is applied to the ORM framework in the embodiment of this specification, the ORM framework needs to be optimized. The clause type in the SQL statement can be determined first, and optimization rules for different clause types can be set. Then, after the specified SQL statement is input into the ORM framework, the specified SQL statement is converted into a first SQL statement of the SQL statement type through the SQL statement conversion tool. Finally, the execution order of the first SQL statement is adjusted according to the optimization rules.
[0067] After the application function is applied to the ORM framework in the embodiment of the present specification, the specified SQL statement can be serialized and deserialized after being input into the ORM framework to optimize the ORM framework.
[0068] After the application function is applied to the ORM framework in the embodiment of this specification, the paradigm of the database table in the ORM framework can be set, specifically including: setting all fields in the database table to a single attribute, and the column of the single attribute is composed of basic data types so that the database table is a two-dimensional table; setting a business primary key for the database table so that the database table does not have non-primary key columns.
[0069] After the application function is applied to the ORM framework in the embodiment of this specification, when multiple index instructions are executed in the database of the ORM framework, the data ID is determined by the multiple index instructions, and the corresponding data in the database of the ORM framework is queried according to the data ID.
[0070] After the application function is applied to the ORM framework in the embodiment of this specification, when the free memory of the server of the ORM framework is greater than a preset threshold and the performance requirement is high, the database of the ORM framework can be first read and written analyzed; then, the read request is distributed to multiple slave servers to reduce the pressure on the database. Among them, the high performance requirement can include high stability requirement, high availability requirement, high scalability requirement, and high manageability requirement.
[0071] After the application function is applied to the ORM framework in the embodiment of this specification, the operator in the application function can be converted into an SQL statement of the database in the ORM framework to operate the operation object at the database level.
[0072] The embodiments of this specification may be based on the python SQL Alchemy ORM framework, which is used to be compatible with multiple databases. It is a feasible solution for enterprises to use domestic databases and other mainstream databases at the same time. SQLAlchemy is an open source software under the Python programming language. It provides SQL toolkits and object-relational mapping (ORM) tools, which are released using the MIT license. ORM is often mentioned in Web application frameworks because it is a key component in the rapid development (Rapid Development) stack. Web frameworks such as Django and Ruby on Rails use the method of designing an independent stack to tightly integrate the self-developed ORM into the framework. The embodiments of this specification automatically identify different databases based on the database connection string, match the Dialect of the corresponding database, generate SQL statements through the object operations in the Dialect conversion code, and then call the DBAPI of different databases for database access, so as to achieve the purpose of database interaction.
[0073] In addition, as the domestic database ecosystem gradually improves, enterprises will have more choices and more reliable and secure database services. As the database ecosystem market becomes more complete and information security becomes stricter, the enterprise software services that quickly convert database results will reduce development costs. Based on this, compatibility and matching between databases is an even more important part at present.
[0074] In the specific implementation process of the embodiments of this specification, the following four aspects can be carried out:
[0075] A. According to the characteristics of different databases and SQL syntax, it can meet most database usage scenarios (add / delete / modify / query / function);
[0076] B. Optimize query strategies for different database performance and design styles to maximize performance;
[0077] C. Due to the different design ideas of different databases, targeted serialization and deserialization conversion and verification are performed;
[0078] D. Match the upper structure of SQL Alchemy ORM framework, adapt to the functions and methods related to ORM object operation layer, and have conversion capabilities;
[0079] For the content of A, you can do it in the following ways:
[0080] (1) Different databases support different SQL syntaxes, so the SQL statements used to achieve the same purpose are also different. During code execution, you can customize the SQL statements based on these differences.
[0081] (2) According to the description in (1), when it cannot meet the business needs, it is necessary to develop corresponding stored procedure functions and general functions to meet the database usage scenarios.
[0082] For the content of B, you can do it in the following ways:
[0083] (1) Have certain processing capabilities for database performance, database session duration, session type, and timeout response issues;
[0084] (2) Reasonably optimize the execution order of SQL statements for database queries.
[0085] For the content of C, you can do it in the following ways:
[0086] (1) For different databases, ensure that reasonable conversion is performed during database deserialization, which can not only improve database performance but also prevent exceptions at the database level;
[0087] (2) For different databases, ensure that when the database is serialized, the data is properly converted according to the definition of the ORM layer objects, which helps to stabilize the business logic.
[0088] For the content of D, you can do it in the following ways:
[0089] (1) For some functions and operations of the ORM layer, as well as custom operation functions that cannot meet the requirements of conventional operations, there is a certain ORM-to-database conversion capability;
[0090] (2) For ORM objects, the operation properties of the objects have certain function customization capabilities, and the functions are matched with database functions for execution.
[0091] In order to make the Python SQL AlchemyORM framework more efficient and compatible with multiple databases, the following structure can be used in the design:
[0092] 1. Multiple database connection issues
[0093] The connection strings and SQL statement adapter packages for different databases are different. You can install a conversion package to load the dialect into the SQLAlchemy dialect program according to the beginning of the connection string, so that different dialects can be used for processing.
[0094] 2. Match the upper structure of the pythonSQL Alchemy ORM framework and adapt to the functions and methods related to the ORM object operation layer
[0095] After connecting to the database, we will operate on the data. In order to facilitate our complex logical operations, we introduce the concept of ORM relational objects, that is, to achieve database-level operations through operating objects. Ordinary operators here are converted into the SQL language of the database. At the same time, for special models, special attribute definitions can be made, and this special attribute can be disguised as a general attribute or field. When called, the database function will be automatically called.
[0096] 3. Serialization and deserialization
[0097] The significance of serialization is to convert the data retrieved from the database into ORM object attributes. For model attributes, there may be virtual fields or special processing functions, and data processing and type conversion are performed. For deserialization, it means that the WEB service operation database will pass in parameters through ORM. If these parameters are not deserialized, they may cause database operation jams, errors, and even SQL statement injections to cause losses. Serialization and deserialization will allow you to write verification conversion logic in a custom Dialect.
[0098] 4. ORM operation database performance
[0099] Table structure optimization is the most important in database optimization. It is necessary to combine the actual situation to see how to design a more optimized and reasonable one. Regarding the index, the principle of the index is to pre-arrange and save it in the specified field order when adding, deleting and modifying. When searching, you can find the corresponding pointer to find the data from the index. For a large number of queries, you can first query all data IDs by conditions (if there is an index, the index will be covered). When the ID is found, querying the data by ID will be more efficient than directly querying. When there are redundant servers and high performance requirements, database read and write analysis can be performed. Generally, the writing server is called the master server, which is synchronized to the reading server (i.e., the slave server) after writing, and the read request is distributed to multiple slave servers to reduce the pressure on the master database.
[0100] 5. Cover more comprehensive database operation requirements
[0101] The basic operations of different databases are similar. For complex operations or differences between databases, there are no corresponding functions, which requires targeted database functions or stored procedures.
[0102] Furthermore, the present specification also provides a schematic diagram of the structure of an ORM framework, see Figure 2 In the figure, Object Relational Mapper (ORM) is the ORM layer, the next layer is the SQL Alchemy engine, and the next layer is the core layer, which is used to communicate with the data API. According to different database strings, different database APIs are called, and the last layer is used to store different databases.
[0103] Figure 3 The present invention provides a schematic diagram of the structure of a multi-type database compatible device of an ORM framework according to one or more embodiments of the present invention. The device includes: an acquisition unit 302 , a creation unit 304 , a setting unit 306 and an application unit 308 .
[0104] The acquisition unit 302 acquires SQL statements supported by multiple types of databases in the ORM framework, and marks personalized SQL statements that are different from other databases in each type of database;
[0105] The creation unit 304 creates an SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement;
[0106] The setting unit 306 sets the SQL statement type output by the SQL statement conversion tool according to the database type built into the ORM framework;
[0107] The application unit 308 develops corresponding application functions according to the SQL statement type, and applies the application functions to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
[0108] Figure 4 A schematic diagram of a multi-type database compatible device of an ORM framework provided in one or more embodiments of this specification, the device comprising:
[0109] at least one processor; and,
[0110] a memory communicatively connected to the at least one processor; wherein,
[0111] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0112] In the ORM framework, obtain the SQL statements supported by various types of databases, and mark the personalized SQL statements that are different from other databases in each type of database;
[0113] Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement;
[0114] According to the database type built into the ORM framework, set the SQL statement type output by the SQL statement conversion tool;
[0115] Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
[0116] One or more embodiments of this specification provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to:
[0117] In the ORM framework, obtain the SQL statements supported by various types of databases, and mark the personalized SQL statements that are different from other databases in each type of database;
[0118] Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement;
[0119] According to the database type built into the ORM framework, set the SQL statement type output by the SQL statement conversion tool;
[0120] Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
[0121] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0122] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0123] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.
Claims
1. A multi-type database compatibility method for an ORM framework, characterized in that: The method comprises: In the ORM framework, obtain the SQL statements supported by various types of databases, and mark the personalized SQL statements that are different from other databases in each type of database; Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement; According to the database type built into the ORM framework, the SQL statement type output by the SQL statement conversion tool is set so that the input SQL statement is converted into an SQL statement supported by the database built into the ORM framework; Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
2. The method according to claim 1, characterized in that After applying the application function to the ORM framework, the method further includes: Determine the clause types in SQL statements and set optimization rules for different clause types; After the designated SQL statement is input into the ORM framework, the designated SQL statement is converted into a first SQL statement of the SQL statement type by the SQL statement conversion tool; The execution order of the first SQL statement is adjusted according to the optimization rule.
3. The method according to claim 1, characterized in that After applying the application function to the ORM framework, the method further includes: After the designated SQL statement is input into the ORM framework, the designated SQL statement is serialized and deserialized.
4. The method according to claim 1, characterized in that: After applying the application function to the ORM framework, the method further includes: Setting the paradigm of the database table in the ORM framework includes: Setting all fields in the database table to a single attribute so that the database table is a two-dimensional table; A business primary key is set for the database table so that no non-primary key columns exist in the database table.
5. The method according to claim 1, characterized in that After applying the application function to the ORM framework, the method further includes: When a plurality of indexing instructions are executed in the database of the ORM framework, data IDs are determined through the plurality of indexing instructions, and corresponding data in the database of the ORM framework is queried according to the data IDs.
6. The method according to claim 1, characterized in that After applying the application function to the ORM framework, the method further includes: When the free memory of the server of the ORM framework is greater than a preset threshold and the performance requirement is high, a read-write analysis is performed on the database of the ORM framework; Distribute read requests to multiple slave servers to reduce the pressure on the database.
7. The method according to claim 1, characterized in that After applying the application function to the ORM framework, the method further includes: The operators in the application function are converted into SQL statements of the database in the ORM framework to operate the operation objects at the database level.
8. A multi-type database compatible device of an ORM framework, characterized in that: The device comprises: An acquisition unit, in the ORM framework, acquires SQL statements supported by various types of databases, and marks personalized SQL statements that are different from other databases in each type of database; A creation unit, which creates an SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement; A setting unit, which sets the SQL statement type output by the SQL statement conversion tool according to the database type built into the ORM framework, so that the input SQL statement is converted into an SQL statement supported by the database built into the ORM framework; The application unit develops corresponding application functions according to the SQL statement type, and applies the application functions to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
9. A multi-type database compatible device of an ORM framework, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: In the ORM framework, obtain the SQL statements supported by various types of databases, and mark the personalized SQL statements that are different from other databases in each type of database; Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement; According to the database type built into the ORM framework, the SQL statement type output by the SQL statement conversion tool is set so that the input SQL statement is converted into an SQL statement supported by the database built into the ORM framework; Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
10. A non-volatile computer storage medium, characterized in that: A computer executable instruction is stored, wherein the computer executable instruction is configured to: In the ORM framework, obtain the SQL statements supported by various types of databases, and mark the personalized SQL statements that are different from other databases in each type of database; Creating a SQL statement conversion tool for converting SQL statements between the multiple types of databases according to the SQL statements respectively supported by the multiple types of databases and the personalized SQL statement; According to the database type built into the ORM framework, the SQL statement type output by the SQL statement conversion tool is set so that the input SQL statement is converted into an SQL statement supported by the database built into the ORM framework; Corresponding application functions are developed according to the SQL statement type, and the application functions are applied to the ORM framework to enable the ORM framework to be compatible with SQL statements of various types of databases.
Citation Information
Patent Citations
SQL executing method and device based on multiple database types
CN104615713A
Universal database conversion device
CN113792027A