Database adaptation method, device, storage medium and program product
By loading and executing the method files and rewritten SQL files within the JAR package of the database to be adapted when Flowable starts, the problems of high difficulty in modifying source code and poor security in adapting Flowable to third-party databases are solved. Adaptation without rewriting Flowable source code is achieved, reducing maintenance difficulty and maintaining the encapsulation of open source code.
Patent Information
- Application Number
- CN202111670205.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2041-12-30
AI Technical Summary
Existing technologies require modifications to the source code to adapt Flowable to third-party databases, resulting in high maintenance difficulty, poor security, and compromise of the encapsulation of open-source code.
By loading and executing the method files and rewritten SQL files within the JAR package of the database to be adapted when Flowable starts, a file conforming to the syntax of the database to be adapted is generated and used to complete the initialization of Flowable and achieve adaptation with the database to be adapted.
It reduces the difficulty of rewriting the source code within the Flowable package, improves security, and maintains the encapsulation of open-source code.
Smart Images

Figure CN116414852B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of database, and particularly relate to a database adaptation method, device, storage medium and program product. BACKGROUND
[0002] Flowable is a popular lightweight business process engine developed with Java. When a system integrated with Flowable creates a workflow, data involved needs to be stored in a database, which can use some databases supported by default by Flowable, but there are often cases where databases not supported by Flowable need to be used, facing the problem of adaptation of Flowable and third-party databases.
[0003] In the prior art, the adaptation between Flowable and third-party databases can be realized by modifying the source code of Flowable.
[0004] However, during the implementation of the present application, the inventors found that at least the following problems exist in the prior art: in the existing third-party database adaptation scheme, the introduction of source code modification has high maintenance difficulty, poor security, and destroys the encapsulation of open source code. SUMMARY
[0005] Embodiments of the present application provide a database adaptation method, device, storage medium and program product to avoid rewriting the source code in the Flowable package, thereby reducing the maintenance difficulty, improving the security, and ensuring the encapsulation of open source code.
[0006] In a first aspect, embodiments of the present application provide a database adaptation method, comprising:
[0007] When starting Flowable, loading and executing the method file and the rewritten SQL file in the JAR package of the database to be adapted to complete the initialization of the Flowable; the method file is obtained by inheriting a class in the Liquibase package and rewriting the method corresponding to the class according to the syntax of the database to be adapted; the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted;
[0008] Based on the initialized Flowable, the database to be adapted is operated.
[0009] In a possible design, before the loading and execution of the method file and the rewritten SQL file in the JAR package of the database to be adapted, the method further comprises:
[0010] rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted, to obtain the rewritten SQL file;
[0011] inheriting a class in the Liquibase package, and rewriting a method corresponding to the class according to the syntax of the database to be adapted, to obtain a method file corresponding to the class;
[0012] packing the rewritten SQL file and the method file into a JAR package, to obtain the JAR package of the database to be adapted.
[0013] In a possible design, after the rewritten SQL file is obtained, the method further includes:
[0014] saving the rewritten SQL file to a first path locally; a sub-path of the first path is the same as an internal path of the SQL file in the Flowable package;
[0015] the loading and execution of the rewritten SQL file in the JAR package of the database to be adapted includes:
[0016] loading and executing the rewritten SQL file according to the first path.
[0017] In a possible design, after the method file corresponding to the class is obtained, the method further includes:
[0018] saving the method file corresponding to the class to a second path locally; the second path is a sub-path of Liquibase;
[0019] the loading and execution of the method file in the JAR package of the database to be adapted includes:
[0020] loading and executing the method file according to the second path.
[0021] In a possible design, the inheriting a class in the Liquibase package, and rewriting a method corresponding to the class according to the syntax of the database to be adapted, to obtain a method file corresponding to the class includes:
[0022] inheriting an AbstractJdbcDatabase class in the Liquibase package, generating a first class corresponding to the database to be adapted, and generating a table operation method file corresponding to the first class according to the syntax of the database to be adapted.
[0023] In a possible design, the inheriting a class in the Liquibase package, and rewriting a method corresponding to the class according to the syntax of the database to be adapted, to obtain a method file corresponding to the class includes:
[0024] Inherit the AbstractSQLGenerator class in the Liquibase package, generate a second class corresponding to the to-be-adapted database, and generate a SQL generation method file corresponding to the second class according to the syntax of the to-be-adapted database.
[0025] In a possible design, the method of obtaining the method file corresponding to the class by inheriting the class in the Liquibase package and rewriting the method corresponding to the class according to the syntax of the to-be-adapted database includes:
[0026] Inherit the LiquibaseDataType class in the Liquibase package, generate a third class corresponding to the to-be-adapted database, and generate a data type conversion method file corresponding to the third class according to the syntax of the to-be-adapted database.
[0027] In a second aspect, an embodiment of the present application provides a database adaptation device, including:
[0028] The initialization module is configured to load and execute the method file in the JAR package of the to-be-adapted database and the rewritten SQL file to complete the initialization of the Flowable when the Flowable is started; the method file is obtained by inheriting the class in the Liquibase package and rewriting the method corresponding to the class according to the syntax of the to-be-adapted database; and the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the to-be-adapted database.
[0029] The operation module is configured to operate the to-be-adapted database based on the Flowable whose initialization is completed.
[0030] In a third aspect, an embodiment of the present application provides a database adaptation device, including at least one processor and a memory.
[0031] The memory stores computer execution instructions.
[0032] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method in the first aspect and various possible designs of the first aspect.
[0033] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer execution instructions. When the processor executes the computer execution instructions, the method in the first aspect and various possible designs of the first aspect is implemented.
[0034] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, wherein the computer program, when executed by a processor, implements the method in the first aspect and various possible designs of the first aspect.
[0035] The database adaptation method, device, storage medium and program product provided by the embodiment of the present application, the method loads and executes the method file and the rewritten SQL file in the JAR package of the database to be adapted when starting Flowable, to complete the initialization of the Flowable, the method file is obtained by inheriting the class in the Liquibase package and rewriting the method corresponding to the class according to the syntax of the database to be adapted, and the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted, and the database to be adapted is operated based on the initialized Flowable. The database adaptation method provided by the embodiment generates the SQL file and the method file suitable for the database to be adapted according to the syntax of the database to be adapted, and completes the initialization of the Flowable based on the above files, realizes the adaptation of the Flowable and the database to be adapted, so that the source code in the Flowable package does not need to be rewritten, thereby reducing the maintenance difficulty, improving the security, and ensuring the encapsulation of the open source code. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0037] Figure 1 The principle diagram of the database adaptation method provided by the embodiment of the present application is shown in the figure.
[0038] Figure 2 The flowchart of the database adaptation method provided by the embodiment of the present application is shown in the figure. Figure 1
[0039] Figure 3 The flowchart of the database adaptation method provided by the embodiment of the present application is shown in the figure. Figure 2
[0040] Figure 4 The structure diagram of the database adaptation device provided by the embodiment of the present application is shown in the figure.
[0041] Figure 5 The hardware structure block diagram of the database adaptation device provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0042] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0043] Flowable is a popular lightweight business process engine developed with Java. Through the Flowable process engine, BPMN2.0 process definitions can be deployed, process instances can be created through process definitions, and process-related instances and data can be queried and accessed. When a system integrated with Flowable creates a workflow (including but not limited to an electronic flow of leave and an electronic flow of shift), data related to the workflow (electronic flow data to be filled in, electronic flow templates, etc.) needs to be stored in a database. The database can use some databases supported by default by Flowable (for example, H2 database, MySQL database, Oracle database, DB2 database, etc.). However, there are often cases where databases not supported by Flowable (for example, KeyDB database, DuckDB database, and other non-mainstream databases) need to be used, and the adaptation of Flowable and third-party databases is faced. In the prior art, the adaptation between Flowable and third-party databases can usually be achieved by modifying the source code of Flowable. However, introducing source code modification has high maintenance difficulty, poor security, and destroys the encapsulation of open source code.
[0044] To solve the above technical problems, the present inventors have found that without modifying the source code of Flowable, the structured query language (SQL) file and the method file can be generated according to the syntax of the database to be adapted, so that Flowable loads these files preferentially after starting, completes the initialization of Flowable, and realizes the adaptation between Flowable and the database to be adapted. Based on this, the database adaptation method provided in the embodiments of the present application generates the SQL file and the method file suitable for the database to be adapted according to the syntax of the database to be adapted, and completes the initialization of Flowable based on the above files, realizes the adaptation between Flowable and the database to be adapted, so that the source code in the Flowable package does not need to be rewritten, thereby reducing the maintenance difficulty, improving the security, and ensuring the encapsulation of the open source code.
[0045] Figure 1This is a schematic diagram illustrating the principle of the database adaptation method provided in the embodiments of this application. Figure 1 As shown, the Flowable and Liquibase packages have a dependency relationship. The local JAR package includes rewritten SQL files and method files. The rewritten SQL files are obtained by rewriting the SQL files in the Flowable package according to the syntax of the database to be adapted. The method files are obtained by inheriting classes from the Liquibase package and rewriting the corresponding methods of those classes according to the syntax of the database to be adapted. The inherited classes can include AbstractJdbcDatabase, AbstractSQLGenerator, or LiquibaseDataType.
[0046] In its implementation, upon startup, Flowable first loads and executes pre-generated method files and rewritten SQL files that conform to the syntax of the database to be adapted, thus completing Flowable initialization. After initialization, adaptation with the database is achieved. This allows access to the database from the initialized Flowable, enabling operations such as adding, deleting, and modifying data.
[0047] The database adaptation method provided in this embodiment generates SQL files and method files suitable for the database to be adapted based on the syntax of the database to be adapted, and completes the initialization of Flowable based on the above files, thereby realizing the adaptation of Flowable and the database to be adapted. This eliminates the need to rewrite the source code in the Flowable package, thereby reducing the maintenance difficulty, improving security, and ensuring the encapsulation of open source code.
[0048] The technical solutions of this application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0049] Figure 2 Flowchart of the database adaptation method provided in the embodiments of this application Figure 1 .like Figure 2 As shown, the method includes:
[0050] 201. When Flowable is started, the method file and the rewritten SQL file in the JAR package of the database to be adapted are loaded and executed to complete the initialization of Flowable; the method file is obtained by inheriting the class in the Liquibase package and rewriting the corresponding method of the class according to the syntax of the database to be adapted; the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted.
[0051] 202. Based on the initialized Flowable, operate on the database to be adapted.
[0052] The execution subject of this embodiment can be a data processing device such as a computer, tablet computer, handheld terminal, or server.
[0053] In this embodiment, the method files and rewritten SQL files within the Java Archive (JAR) package of the database to be adapted are prepared in advance. The rewritten SQL files are related to the SQL files within the Flowable package, and the method files inherit from classes within the Liquibase package. Both the method files and the rewritten SQL files conform to the syntax of the database to be adapted and can be loaded and executed by Flowable. The Liquibase package is a dependency of the Flowable package.
[0054] Specifically, when Flowable starts, it first loads and executes pre-generated method files and rewritten SQL files that conform to the syntax of the database to be adapted, thus completing the Flowable initialization. After Flowable initialization is complete, adaptation with the database to be adapted is achieved. This allows access to the database to be adapted based on the initialized Flowable, enabling a series of operations such as adding, deleting, and modifying data.
[0055] For the security of data, it is required that Flowable uses a non-mainstream self-developed database in an enterprise. In order to adapt Flowable to the self-developed database, a method file and a rewritten SQL file can be generated and saved according to the syntax rules of the self-developed database based on the SQL file in the Flowable package and the related classes in the Liquibase package. When starting Flowable, Flowable will preferentially load and execute the method file and the rewritten SQL file generated according to the syntax rules of the self-developed database, complete the initialization of Flowable, and adapt Flowable to the self-developed database. In the process of creating a new workflow such as a leave electronic flow and a shift electronic flow based on Flowable, the self-developed database can be operated to add, delete or modify, so as to realize the creation of the workflow and the application of the subsequent workflow.
[0056] It should be noted that there are various ways to obtain the rewritten SQL file. The rewritten SQL file can be obtained by copying the SQL file in the Flowable package and then adding, deleting or modifying the copied file. The rewritten SQL file can also be obtained by rewriting the SQL file in the Flowable package. Regardless of the form, as long as the rewritten SQL file obtained is consistent with the syntax of the database to be adapted and can be loaded and executed by Flowable, it is within the protection scope of the present embodiment, and the present embodiment does not limit this.
[0057] The database adaptation method provided in the present embodiment generates a SQL file and a method file suitable for the database to be adapted according to the syntax of the database to be adapted, and completes the initialization of Flowable based on the above-mentioned files, so as to adapt Flowable to the database to be adapted. The source code in the Flowable package does not need to be rewritten, thereby reducing the maintenance difficulty, improving the security, and ensuring the encapsulation of the open source code.
[0058] Figure 3 Flow of the database adaptation method provided in the present embodiment Figure 2 As shown in Figure 3 , the method comprises the following steps.
[0059] 301. The SQL file in the Flowable package is rewritten according to the syntax of the database to be adapted, and the rewritten SQL file is obtained.
[0060] Specifically, in an implementation, each SQL file in the Flowable package can be copied to the local, and then each SQL file copied to the local is rewritten, and for each SQL file, the code that does not conform to the syntax rule of the database to be adapted is modified to conform to the syntax rule of the database to be adapted, thereby obtaining the rewritten SQL file corresponding to each SQL file copied to the local.
[0061] In the embodiment, after the rewritten SQL file is obtained, the rewritten SQL file can be saved to a first path of the local; a sub-path of the first path is the same as an internal path of the SQL file in the Flowable package, and then the rewritten SQL file is loaded and executed according to the first path.
[0062] For example, the rewritten SQL file can be placed under / src / main / resorce / of the local, and the sub-path is the same as the internal path of the SQL file in the Flowable package.
[0063] 302, inherit the class in the Liquibase package, and rewrite the method corresponding to the class according to the syntax of the database to be adapted to obtain the method file corresponding to the class.
[0064] In the embodiment, the method file can include at least one of the following: a table operation method file, a SQL generation method file, and a data type conversion method file.
[0065] In some embodiments, the method of inheriting the class in the Liquibase package and rewriting the method corresponding to the class according to the syntax of the database to be adapted to obtain the method file corresponding to the class can include: inheriting the AbstractJdbcDatabase class in the Liquibase package, generating a first class corresponding to the database to be adapted, and generating a table operation method file corresponding to the first class according to the syntax of the database to be adapted. Specifically, through the table operation method file, after the Liquibase is initialized, the data table in the database to be adapted can be based on the initialized Liquibase to perform basic operations such as adding data, deleting data, modifying data, and querying data.
[0066] In some embodiments, inheriting a class from the Liquibase package and rewriting the corresponding methods of the class according to the syntax of the database to be adapted, to obtain the method file corresponding to the class, may include: inheriting the AbstractSQLGenerator class from the Liquibase package to generate a second type of database to be adapted, and generating an SQL generation method file corresponding to the second type according to the syntax of the database to be adapted. Specifically, after initializing Liquibase with the SQL generation method file, the initialized Liquibase can generate SQL statements that conform to the syntax rules of the database to be adapted, so that the database to be adapted can execute the SQL statements.
[0067] In some embodiments, inheriting a class from the Liquibase package and rewriting the corresponding methods of the class according to the syntax of the database to be adapted to obtain the method file corresponding to the class includes: inheriting the LiquibaseDataType class from the Liquibase package, generating a third type corresponding to the database to be adapted, and generating a data type conversion method file corresponding to the third type according to the syntax of the database to be adapted. Specifically, after initializing Liquibase using the data type conversion method file, the initialized Liquibase can be used to perform data type conversion on the data in the database to be adapted.
[0068] In some embodiments, after obtaining the method file corresponding to the class, the method file corresponding to the class can be saved to a second local path; the second path is a subpath of Liquibase, and then the method file can be loaded and executed according to the second path.
[0069] Specifically, the method file can be placed locally under Liquibase, or in a path one level below Liquibase (e.g., liquibase / base), or in a path N levels below Liquibase. This embodiment does not limit this; any subpath under Liquibase is acceptable.
[0070] 303. Package the rewritten SQL file and the method file into a JAR file to obtain the JAR file of the database to be adapted.
[0071] Specifically, after obtaining the rewritten SQL file and method file, these files can be packaged into a JAR file. When Flowable starts up and identifies the database to be adapted, it will prioritize loading and executing the files in the JAR file to complete the Flowable initialization.
[0072] 304. When Flowable is started, the method file and the rewritten SQL file in the JAR package of the database to be adapted are loaded and executed to complete the initialization of Flowable; the method file is obtained by inheriting the class in the Liquibase package and rewriting the corresponding method of the class according to the syntax of the database to be adapted; the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted.
[0073] 305. Based on the initialized Flowable, operate on the database to be adapted.
[0074] In this embodiment, steps 304 to 305 are similar to steps 201 to 202 in the above embodiment, and will not be described again here.
[0075] The database adaptation method provided in this embodiment generates SQL files and method files suitable for the database to be adapted based on the syntax of the database to be adapted, and completes the initialization of Flowable based on the above files, thereby realizing the adaptation of Flowable to the database to be adapted. This eliminates the need to rewrite the source code in the Flowable package, thereby reducing the maintenance difficulty, improving security, and ensuring the encapsulation of open source code.
[0076] Figure 4 A schematic diagram of the structure of the database adaptation device provided in this application embodiment. (See attached diagram.) Figure 4 As shown, the database adaptation device 40 includes: a framing module 401, a detection module 402, and a determination module 403.
[0077] The initialization module 401 is used to load and execute the method file and the rewritten SQL file in the JAR package of the database to be adapted when Flowable is started, so as to complete the initialization of Flowable; the method file is obtained by inheriting the class in the Liquibase package and rewriting the corresponding method of the class according to the syntax of the database to be adapted; the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted.
[0078] Operation module 402 is used to operate on the database to be adapted based on the initialized Flowable.
[0079] The database adaptation device provided by the embodiment of the present application, the initialization module 401 loads and executes the method file and the rewritten SQL file in the JAR package of the database to be adapted when starting the Flowable, so as to complete the initialization of the Flowable; the method file is obtained by inheriting the class in the Liquibase package and rewriting the method corresponding to the class according to the syntax of the database to be adapted; the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted, and the operation module 402 operates the database to be adapted based on the completed Flowable. The SQL file and the method file suitable for the database to be adapted are generated according to the syntax of the database to be adapted, the initialization of the Flowable is completed based on the above files, the adaptation of the Flowable and the database to be adapted is realized, so that the source code in the Flowable package does not need to be rewritten, thereby reducing the maintenance difficulty, improving the security, and ensuring the encapsulation of the open source code.
[0080] The database adaptation device provided by the embodiment of the present application can be used to execute the method embodiments described above, and has similar implementation principles and technical effects, which will not be described here.
[0081] Figure 5 The hardware structure block diagram of the database adaptation device provided by the embodiment of the present application, the device can be a computer, a message transmission device, a tablet device, a medical device, etc.
[0082] The apparatus 50 can include one or more of the following components: a processing component 501, a memory 502, a power supply component 503, a multimedia component 504, an audio component 505, an input / output (I / O) interface 506, a sensor component 507, and a communication component 508.
[0083] The processing component 501 usually controls the overall operation of the apparatus 50, such as operations associated with displaying, making phone calls, data communications, camera operations, and recording operations. The processing component 501 can include one or more processors 509 to execute instructions to complete all or part of the steps of the methods described above. In addition, the processing component 501 can include one or more modules to facilitate interaction between the processing component 501 and other components. For example, the processing component 501 can include a multimedia module to facilitate the interaction between the multimedia component 504 and the processing component 501.
[0084] The memory 502 is configured to store various types of data to support the operation of the device 50. Examples of these data include instructions for any application or method operating on the device 50, contact data, phonebook data, messages, pictures, videos, and the like. The memory 502 can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0085] The power supply component 503 supplies electrical power for the various components of the device 50. The power supply component 503 can include a power supply management system, one or more power supplies, and other components associated with generating, managing and distributing electrical power for the device 50.
[0086] The multimedia component 504 includes a screen providing an output interface between the device 50 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swiping and gestures on the touch panel. The touch sensors can not only sense a boundary of a touching or swiping action, but also detect duration and pressure related to the touching or swiping action. In some embodiments, the multimedia component 504 includes a front camera and / or a rear camera. The front and / or rear camera can receive external multimedia data when the device 50 is in an operation mode, such as a shooting mode or a video mode. Each of the front and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0087] The audio component 505 is configured to output and / or input audio signals. For example, the audio component 505 includes a microphone (MIC) that is configured to receive external audio signals when the device 50 is in an operation mode, such as a calling mode, a recording mode and a voice recognition mode. The received audio signals can be further stored in the memory 502 or transmitted via the communication component 508. In some embodiments, the audio component 505 also includes a speaker for outputting audio signals.
[0088] The I / O interface 506 provides an interface between the processing component 501 and peripheral interface modules, which can be a keyboard, a click wheel, a button, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button and a lock button.
[0089] The sensor component 507 includes one or more sensors to provide status assessments for various aspects of the device 50. For example, the sensor component 507 can detect an open / closed status of the device 50, relative positioning of components, such as a display and keypad of the device 50, a change in position of the device 50 or a component of the device 50, presence or absence of user contact with the device 50, orientation or acceleration / deceleration of the device 50, and temperature changes of the device 50. The sensor component 507 can include a proximity sensor configured to detect presence of a nearby object without any physical contact. The sensor component 507 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 507 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0090] The communication component 508 is configured to facilitate wired or wireless communication between the device 50 and another device. The device 50 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 508 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 508 also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra-WideBand (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0091] In an exemplary embodiment, the device 50 can be implemented using one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic elements to perform the above-described methods.
[0092] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 502 including instructions, is also provided, which can be executed by the processor 509 of the device 50 to perform the above-described methods. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.
[0093] The computer readable storage medium described above can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0094] An exemplary readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium, and can write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the device.
[0095] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program executes to perform the steps of the above-mentioned method embodiments; and the foregoing storage medium includes ROM, RAM, magnetic disk or optical disk and various storage media that can store program codes.
[0096] The embodiments of the present application also provide a computer program product, comprising a computer program, which is executed by a processor to implement the database adaptation method executed by the database adaptation device.
[0097] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A database adaptation method, characterized by, The application comprises the following steps: When starting Flowable, load and execute the method file and the rewritten SQL file in the JAR package of the database to be adapted to complete the initialization of the Flowable; the method file is obtained by inheriting the class in the Liquibase package and rewriting the corresponding method of the class according to the syntax of the database to be adapted; the rewritten SQL file is obtained by rewriting the SQL file in the Flowable package according to the syntax of the database to be adapted; Based on the initialized Flowable, operate the database to be adapted; Before the step of loading and executing the method file and the rewritten SQL file in the JAR package of the database to be adapted, the application further comprises the following steps: Rewrite the SQL file in the Flowable package according to the syntax of the database to be adapted to obtain the rewritten SQL file; the rewritten SQL file is saved to a first path on the local, and the sub-path of the first path is the same as the internal path of the SQL file in the Flowable package; Inherit the class in the Liquibase package and rewrite the corresponding method of the class according to the syntax of the database to be adapted to obtain the method file corresponding to the class; the method file is saved to a second path on the local, and the second path is the sub-path of Liquibase; Pack the rewritten SQL file and the method file into a JAR package to obtain the JAR package of the database to be adapted.
2. The method of claim 1, wherein, The step of loading and executing the rewritten SQL file in the JAR package of the database to be adapted comprises the following steps: Load and execute the rewritten SQL file according to the first path.
3. The method of claim 1, wherein, The step of loading and executing the method file in the JAR package of the database to be adapted comprises the following steps: Load and execute the method file according to the second path.
4. The method of claim 1, wherein, The step of inheriting the class in the Liquibase package and rewriting the corresponding method of the class according to the syntax of the database to be adapted to obtain the method file corresponding to the class comprises the following steps: Inherit the AbstractJdbcDatabase class in the Liquibase package to generate a first class corresponding to the database to be adapted, and generate the table operation method file corresponding to the first class according to the syntax of the database to be adapted.
5. The method of claim 1, wherein, The step of inheriting the class in the Liquibase package and rewriting the corresponding method of the class according to the syntax of the database to be adapted to obtain the method file corresponding to the class comprises the following steps: Inherit the AbstractSQLGenerator class in the Liquibase package to generate a second class corresponding to the database to be adapted, and generate the SQL generation method file corresponding to the second class according to the syntax of the database to be adapted.
6. The method of claim 1, wherein, The step of inheriting the class in the Liquibase package and rewriting the corresponding method of the class according to the syntax of the database to be adapted to obtain the method file corresponding to the class comprises the following steps: Inherit a LiquibaseDataType class in the Liquibase package, generate a third class corresponding to the database to be adapted, and generate a data type conversion method file corresponding to the third class according to the syntax of the database to be adapted.
7. A database adaptation device, characterized by Comprise: An initialization module, configured to load and execute a method file and a rewritten SQL file in a JAR package of the database to be adapted when starting Flowable, so as to complete initialization of the Flowable; the method file is obtained by inheriting a class in a Liquibase package and rewriting a method corresponding to the class according to the syntax of the database to be adapted; and the rewritten SQL file is obtained by rewriting a SQL file in a Flowable package according to the syntax of the database to be adapted; An operation module, configured to operate the database to be adapted based on the Flowable whose initialization is completed; The initialization module is further configured to rewrite the SQL file in the Flowable package according to the syntax of the database to be adapted, to obtain the rewritten SQL file; the rewritten SQL file is saved to a first path in a local device, and a sub-path of the first path is the same as an internal path of the SQL file in the Flowable package; a class in the Liquibase package is inherited, and a method corresponding to the class is rewritten according to the syntax of the database to be adapted, to obtain a method file corresponding to the class; the method file is saved to a second path in the local device, and the second path is a sub-path of the Liquibase; The rewritten SQL file and the method file are packed into a JAR package, to obtain the JAR package of the database to be adapted.
8. A database adaptation device, characterized by Comprise: At least one processor and a memory; The memory stores computer execution instructions; The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the database adaptation method in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, the database adaptation method in any one of claims 1 to 6 is realized.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the database adaptation method in any one of claims 1 to 6.