CN110442636A - A kind of reading/writing method of data, device and reading and writing data equipment - Google Patents

A kind of reading/writing method of data, device and reading and writing data equipment Download PDF

Info

Publication number
CN110442636A
CN110442636A CN201910782275.8A CN201910782275A CN110442636A CN 110442636 A CN110442636 A CN 110442636A CN 201910782275 A CN201910782275 A CN 201910782275A CN 110442636 A CN110442636 A CN 110442636A
Authority
CN
China
Prior art keywords
data
database
operation interface
reading
specified
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910782275.8A
Other languages
Chinese (zh)
Other versions
CN110442636B (en
Inventor
杨斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201910782275.8A priority Critical patent/CN110442636B/en
Publication of CN110442636A publication Critical patent/CN110442636A/en
Application granted granted Critical
Publication of CN110442636B publication Critical patent/CN110442636B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Abstract

The embodiment of the present application provides the reading/writing method, device and reading and writing data equipment of a kind of data.Method includes: to obtain reading and writing data request;By calling instantiation data library operation interface, determine the specified database in the operation interface of instantiation data library, wherein, instantiation data library operation interface is that the operation interface based on specified database generates, and the information of specified database is carried in the note of the operation interface of specified database;Reading and writing data is carried out to specified database according to reading and writing data request.By the way which database used in the note of routine interface file, and pass through the routine interface file generated instantiation data library operation interface, reading and writing data can be carried out to specified database with the coupled relation of database without establishing in service logic by realizing, it avoids and original service logic is invaded, guarantee the stability of service logic, while also reducing service logic maintenance and testing cost.

Description

A kind of reading/writing method of data, device and reading and writing data equipment
Technical field
This application involves reading and writing data technical fields, in particular to the reading/writing method, device and data of a kind of data Read-write equipment.
Background technique
Currently, can be by establishing the coupled relation with database in the service logic of reading and writing data equipment, with specified number Which database reading and writing data is carried out using according to read-write equipment.But very due to the coupling of various businesses code in service logic By force, establishing in service logic can cause significantly to invade with the coupled relation of database to original service logic, cause The decline of its stability, while also increasing maintenance and testing cost.
Summary of the invention
The application is to provide a kind of reading/writing method of data, device and reading and writing data equipment, to avoid original industry is invaded Business logic, guarantees the stability of service logic, reduces service logic maintenance and testing cost.
In a first aspect, the embodiment of the present application provides a kind of reading/writing method of data, which comprises
Obtain reading and writing data request;
By calling instantiation data library operation interface, the specified number in the operation interface of the instantiation data library is determined According to library, wherein instantiation data library operation interface is that the operation interface based on the specified database generates, the data The information of the specified database is carried in the note of the operation interface in library;
Reading and writing data is carried out to the specified database according to reading and writing data request.
In the embodiment of the present application, by the note of routine interface file use which database, and by should Routine interface file generated instantiation data library operation interface is realized without establishing the coupling pass with database in service logic System can carry out reading and writing data to specified database, avoid and invade original service logic, guarantee the stability of service logic, Service logic maintenance and testing cost are also reduced simultaneously.
With reference to first aspect, in the first possible implementation, passing through calling instantiation data library operation interface, Before determining the specified database in the operation interface of the instantiation data library, the method also includes:
Scan the note in the operation interface of the specified database, obtain carried in the note it is described specified The mark of database, and according to the instruction of the note, obtain the mark of the database in data base configuration file, wherein The mark of database in the data base configuration file is currently assigned using which database progress reading and writing data for configuring;
Determine that the mark of the database in data base configuration file is identical as the mark of the specified database, by the finger The operation interface instantiation for determining database, generates instantiation data library operation interface.
In the embodiment of the present application, it since program self-test scanning has the characteristics that simple and to realize, therefore is infused by scanning The mode of solution can realize the quick and convenient instantiation by interface, and then realize quick and convenient determine specified database.
The possible implementation of with reference to first aspect the first, in the second possible implementation, in scanning institute Before stating the note in the operation interface of specified database, the method also includes:
The operation interface of the pre-generated specified database corresponding with the specified database that system is supported, in institute State the mark that the specified database is defined in explaining.
In the embodiment of the present application, by being defined in the note of the operation interface of database corresponding with specified database The mark of the corresponding specified database effectively avoids missing so that subsequent can accurately determine the specified database by mark Judgement.
The possible implementation of second with reference to first aspect pre-generates in the third possible implementation The operation interface of the specified database corresponding with the specified database that system is supported, comprising:
Pre-generate java applet interface document corresponding with the specified database, the java applet interface document packet Include the operation interface of the specified database.
In the embodiment of the present application, due to java routine interface file convenience, therefore by generating java routine interface text Part to generate the operation interface of database indirectly, and the operation interface for easily generating database may be implemented.
With reference to first aspect the first any possible implementation into the third, in the 4th kind of possible realization In mode, the operation interface of the specified database is instantiated, instantiation data library operation interface is generated, comprising:
By the dynamic proxy of the Java of Mybatis, the operation interface of the specified database is instantiated, is generated Instantiation data library operation interface.
In the embodiment of the present application, it since the dynamic proxy of the Java of Mybatis is general service, therefore utilizes The dynamic proxy of the Java of Mybatis can easily generate instantiation data library operation interface.
Second aspect, the embodiment of the present application provide a kind of reading/writing method of data, are applied to reading and writing data equipment, described Device includes:
Data transmit-receive module, for obtaining reading and writing data request;
Data processing module, for determining the instantiation data library by calling instantiation data library operation interface Specified database in operation interface, wherein instantiation data library operation interface is the behaviour based on the specified database Make interface generation, the information of the specified database is carried in the note of the operation interface of the database;And it is also used to Reading and writing data is carried out to the specified database according to reading and writing data request.
In conjunction with second aspect, in the first possible implementation, in the data processing module by calling example Change database manipulation interface, before determining the specified database in the operation interface of the instantiation data library,
The data processing module is also used to scan the note in the operation interface of the specified database, obtains The mark of the specified database carried in the note, and according to the instruction of the note, obtain database configuration text The mark for the database specified in part, wherein the mark of the database in the data base configuration file is for configuring current finger Surely which database reading and writing data is carried out using;Determine that the mark of the database in the data base configuration file is specified with described The mark of database is identical, and the operation interface of the specified database is instantiated, and generates the instantiation data library operation and connects Mouthful.
In conjunction with the first possible implementation of second aspect, in the second possible implementation, the data Processing module before the note in the operation interface for scanning the specified database, the method also includes:
The data processing module is also used to pre-generate the finger corresponding with the specified database that system is supported The operation interface for determining database defines the mark of the specified database in the note.
In conjunction with second of possible implementation of second aspect, in the third possible implementation,
The data processing module, for pre-generating java applet interface document corresponding with the specified database, The java applet interface document includes the operation interface of the specified database.
In conjunction with second aspect the first into the third any possible implementation, in the 4th kind of possible realization In mode,
The data processing module, for the dynamic proxy of the Java by Mybatis, by the behaviour of the specified database It is instantiated as interface, generates instantiation data library operation interface.
The third aspect, the embodiment of the present application provide a kind of reading and writing data equipment, and the reading and writing data equipment includes: processing Device and memory;
The memory, for storing the operation interface for carrying the database of note;
The processor, the operation interface of the database for carrying note according to, execute such as first aspect or The reading/writing method of data described in any possible implementation of first aspect.
Fourth aspect, the embodiment of the present application provide a kind of readable storage medium of non-volatile computer, are stored with program generation Code executes any possible implementation such as first aspect or first aspect when said program code is run by computer The reading/writing method of the data.
To enable the above objects, features, and advantages of the application to be clearer and more comprehensible, preferred embodiment is cited below particularly, and cooperate Appended attached drawing, is described in detail below.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application, below will be to needed in the embodiment attached Figure is briefly described, it should be understood that the following drawings illustrates only some embodiments of the application, therefore is not construed as pair The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this A little attached drawings obtain other relevant attached drawings.
Fig. 1 shows the annexation figure of reading and writing data equipment and database in the embodiment of the present application;
Fig. 2 shows a kind of flow charts of the reading/writing method of data provided by the embodiments of the present application;
Fig. 3 shows a kind of structural block diagram of reading and writing data equipment provided by the embodiments of the present application;
Fig. 4 shows a kind of structural block diagram of the read-write equipment of data provided by the embodiments of the present application.
Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application is described.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile the application's In description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
Fig. 1 and Fig. 2 are please referred to, the embodiment of the present application provides a kind of reading/writing method of data, and the reading/writing method of data can To be executed by reading and writing data equipment 10, which can be terminal or server, wherein terminal can be a People's computer (personal computer, PC), tablet computer, smart phone, personal digital assistant (personal digital Assistant, PDA) etc.;Server can be network server, database server, Cloud Server or by multiple child servers The server set of composition at etc..
Specifically, the reading/writing method of the data may include: step S100, step S200 and step S300.
Step S100: reading and writing data request is obtained.
Step S200: by calling instantiation data library operation interface, instantiation data library operation interface is determined In specified database, wherein instantiation data library operation interface is that operation interface based on the specified database is raw At carrying the information of the specified database in the note of the operation interface of the database.
Step S300: reading and writing data is carried out to the specified database according to reading and writing data request.
Scheme is described in detail below in conjunction with step S100 to step S300.
Reading and writing data equipment 10 can dock multitype database 20, so that a variety of data can be used in reading and writing data equipment 10 Library 20 carries out reading and writing data.Wherein, database 20 can be MySQL database, oracle database, DB2 database or SQLServer database etc..Database 20 can be deployed in reading and writing data equipment 10;Alternatively, database 20 can also be disposed On the other physical equipments being connect with reading and writing data equipment 10.
Reading and writing data is carried out since multitype database 20 can be used in reading and writing data equipment 10, therefore reading and writing data equipment 10 is every The type of database 20 used in read-write in secondary read-write or every time can be different according to specifying for user.Example Such as, in this reading and writing data, specified reading and writing data equipment 10 uses MySQL database, and in reading and writing data next time When, specified reading and writing data equipment 10 uses oracle database;In another example specifying number when request is for reading data MySQL database is used according to read-write equipment 10, and when request is for data write-in, specify reading and writing data equipment 10 to use Be oracle database, wherein MySQL database and oracle database are different types of database.Therefore, in data Particular moment before read-write, reading and writing data equipment 10 is it needs to be determined which kind of database currently assigned use, for example, reading in data Write device 10 booting power on, the control program of the system reboot of reading and writing data equipment 10, reading and writing data equipment 10 is reloaded or When the control program self-test of person's reading and writing data equipment 10, reading and writing data equipment 10 can determine currently assigned which kind of data of use Library.
As the specified exemplary approach currently needed using which kind of database, reading and writing data equipment 10 can be by passing through Data base configuration file determines currently assigned using which kind of database progress reading and writing data.
Specifically, reading and writing data equipment 10 is pre-generated the every kind of number supported with the system in the reading and writing data equipment 10 According to the operation interface of the one-to-one every kind of database in library.Wherein, since the mode for generating the operation interface of every kind of database is big Cause identical, for ease of understanding, the present embodiment for generating the operation interface of the corresponding database of a certain database to be said It is bright.Wherein, for ease of description, the subsequent a certain database that will be enumerated is referred to as " specified database 21 ".
As the exemplary approach for the operation interface for generating the database, reading and writing data equipment 10 can be pre-generated and is somebody's turn to do The corresponding java applet interface document of specified database 21, and in the java applet interface document then include the specified database 21 Corresponding operation interface.In this way, reading and writing data equipment 10 is by calling the specified database 21 in java applet interface document Operation interface, the specified database 21 can be accessed.
It is illustrated below by an example:
The operation interface of database is IUserDao interface, and IUserDao interface corresponds to MySQL database, the behaviour of database Making interface is IUserDaoForOracle interface, and IUserDaoForOracle interface corresponds to oracle database, wherein IUserDao interface and IUserDaoForOracle interface are different types of interface, MySQL database and oracle database Type it is also different.If reading and writing data equipment 10 calls IUserDao interface, access MySQL database is realized, if data are read Write device 10 calls IUserDaoForOracle interface, then realizes Accessing Oracle Database.
It is determining currently assigned using which kind of database by the operation interface for scanning the specified database to realize, pre- When first generating the operation interface of the specified database, corresponding note is also set in the operation interface of the specified database in advance Solution.Wherein, the information of specified database 21, such as the unique identification of the specified database 21 are carried in note, and are also taken With the decision logic for currently whether using the specified database 21.In this way, reading and writing data equipment 10 is by scanning the specified number It can be determined according to the note of the operation interface in library current whether using the specified database 21 progress reading and writing data.
Specifically, such as decision logic may is that the mark of the specified database 21 in note and database configuration text The mark of database 22 in part is compared that (mark of the database 22 in data base configuration file is used to indicate current needs The database 22 carries out reading and writing data), if the same using the specified database 21 in explaining, number is used if not identical According to the database 22 in base configuration file.In addition, explaining entrained content also includes the mark for explaining specified data library 22, And also the operation interface comprising which database supports the database 22 specified in the note.
After reading and writing data equipment 10 obtains decision logic by the content carried in scanning note, reading and writing data equipment 10 The mark of specified database 21 in explaining can be obtained according to decision logic, and according to the instruction of decision logic in note, Obtain the mark of the database 22 in data base configuration file.In this way, reading and writing data equipment 10 will be explained further according to decision logic The mark of middle specified database 21 is matched with the mark of the database 22 in data base configuration file, explains middle finger fixed number to determine According to the database 22 in the mark and data base configuration file in library 21 identify whether it is identical.
If it is determined that mark is identical, indicates current and need to carry out reading and writing data using specified database 21 in explaining, otherwise table Show and currently needs to carry out reading and writing data using the database 22 in data base configuration file.
It should be noted that under some cases, the mark of specified database 21 can be directly carried in note, and other In the case of, note can carry file index, and this document index can be directed toward in reading and writing data equipment 10 to be stored with to explain and specify The data file of the mark of database 21.It is explained by scanning, reading and writing data equipment 10 can obtain this document index, and from text The mark of the specified database 21 is obtained in the data file that part index is directed toward.
Continue aforementioned exemplary, be arranged in IUserDaoForOracle interface and explain, the content carried in the note can be with Are as follows:
public@interface DataSource{
// default supports MySQL database, naturally it is also possible to which default supports other databases
String value()default"MySQL";
}
public class DataSourceConfig implements Condition{
@Override
public boolean matches(…){
When //IUserDaoForOracle interface is called, according to the@on IUserDaoForOracle interface DataSource explains the mark in specified data library, is compared with the mark for the database specified in data base configuration file It is right, specified data library if the same is explained using@DataSource, using in data base configuration file if not identical Specified data library.
}
@DataSource(“Oracle”)
@Conditional(DataSourceConfig.class)
public interface IUserDaoForOracle extends IUserDao{}
And the mark for the database specified in data base configuration file are as follows:
Db.used=Oracle.
Reading and writing data equipment 10 passes through the note for scanning the operation interface of the specified database 21, can determine in note It is identical as the mark Oracle in data base configuration file to identify Oracle, so that it is determined that reading and writing data equipment 10 currently needs to make Reading and writing data is carried out with oracle database.
It should be noted that decision logic is also not necessarily limited to logic above-mentioned in the present embodiment, can according to the actual situation into Row setting;For example, decision logic may also is that the current data storage for obtaining each database stored in reading and writing data equipment Amount, the database for selecting current data amount of storage minimum is as the currently assigned database used;In another example decision logic may be used also To be: obtain reading and writing data equipment in store each database currently used number (reading and writing data equipment in the database into Reading and writing data of row then thinks that the database is only used once), select the least database of currently used number as current Need database to be used.Certainly, there are also other decision logics, the present embodiment is just no longer enumerated.
It is worth noting that if judging, explaining entrained content for one can determine which kind of data current correspond to uses Library can choose the operation interface setting of some database in the operation interface of various databases to avoid repeating judging It explains.For example, the IUserDaoForOracle arbitrarily in selection IUserDaoForOracle interface and IUserDao interface connects Mouth setting is explained, and the content of the carrying of the note is used to indicate reading and writing data equipment and currently needs using MySQL database still MySQL database is written and read.If desired combination judge content entrained by multiple notes can determine it is current need using The operation interface of multitype database can be respectively provided with note, for example, IUserDaoForOracle interface is set by which kind of database Note 1 is set, the setting of IUserDao interface explains 2, and reading and writing data equipment 10 is successively read note 1 and the content of note 2 can Determination currently needs to be written and read using MySQL database or MySQL database.
Based on the same inventive concept, in the present embodiment, if reading and writing data equipment needs to increase newly a kind of database, a side Face can increase the operation interface for accessing the newly-increased database in routine interface file, and on the other hand, adjustment is explained Decision logic so that the mark of the newly-increased database is also in the determination range of decision logic.In this way, making in current needs When with the newly-increased database, reading and writing data equipment can determine by scanning to explain and currently need to use the newly-increased data Library is written and read.It is understood that the realization of newly-increased database is connect by the operation to routine interface file and database The note of mouth is adjusted, and is adjusted without the service logic to reading and writing data in data read-write equipment, realizes using newly-increased Database while be written and read, it is ensured that the stability of business, and avoid maintenance and the increase of testing cost.
In the present embodiment, after specified database 21 is written and read in determining currently used note, if the specified data The operation interface in library 21 has not been yet instantiated, and in order to normally access the specified database 21, reading and writing data equipment 10 can also be incited somebody to action The operation interface of the database instantiates, to generate instantiation data library operation interface.
As by the exemplary approach of the operation interface instantiation of database, the database of reading and writing data equipment 10 configures text It include the configuration information of the specified database 21 in part.Reading and writing data equipment 10 for example, by the Java of Mybatis dynamic generation The configuration information of specified database 21, is configured to the operation interface of the specified database, can generate instantiation data by reason Library operation interface.Follow-up data read-write equipment 10, which calls directly the instantiation data library operation interface, can access the specified number According to library 21.
Continue aforementioned exemplary, the configuration information of specified database 21 may include: in data base configuration file
Spring.datasource.driver-class-name=oracle.jdbc.OracleDr iver
Spring.datasource.url=xxx
Spring.datasource.username=xxx
By the dynamic proxy of the Java of Mybatis, the configuration information is configured for IUserDaoForOracle interface, just The instantiation of IUserDaoForOracle interface may be implemented.
Certainly, after specified database 21 is written and read in determining currently used note, if the database of the support Operation interface is instantiated, and reading and writing data equipment 10 is not necessarily to be instantiated again, and directly by the database of the support Operation interface is determined as instantiation data library operation interface in routine interface file.
Further, after generating instantiation data library operation interface, reading and writing data equipment 10 can execute step S100.
Step S100: reading and writing data request is obtained.
If client needs read and write data in specified database 21, client can send number to reading and writing data equipment 10 According to read-write requests, wherein client may operate on the other physical equipments connecting with reading and writing data equipment 10.Correspondingly, Reading and writing data equipment 10 can correspond to the reading and writing data request for receiving client transmission.
If reading and writing data equipment 10 itself needs read and write data in specified database 21, reading and writing data equipment 10 itself can To generate reading and writing data request, that is, obtain the reading and writing data request of itself generation.
Step S200: it by calling instantiation data library operation interface, obtains in the operation interface of the instantiation data library Specified database.
Due to having instantiation data library operation interface in the routine interface file of reading and writing data equipment 10, reading and writing data is set Standby 10 can call the instantiation data library operation interface, thus according to the mapping relations of the instantiation data library operation interface, It can determine the specified database 21 in the instantiation data library operation interface.
Step S300: reading and writing data is carried out to the specified database according to reading and writing data request.
Determining specified database, reading and writing data equipment 10 can specify data to this using reading and writing data request Library 21 carries out read operation or the write operation of data.
Referring to Fig. 3, based on the same inventive concept, the embodiment of the present application provides a kind of reading and writing data equipment 10, the number It may include the communication interface 11 for being connected to each database 20, the one or more for executing program instructions according to read-write equipment 10 Processor 12, bus 13 and various forms of memories 14, for example, disk, ROM or RAM, or any combination thereof.It is exemplary Ground, computer platform can also include being stored in ROM, RAM or other kinds of non-transitory storage medium or its any group Program instruction in conjunction.
Memory 14 is used to carry the operation interface of the database of note, and processor 12 is used to carry note according to this Database operation interface, execute the reading/writing method of data above-mentioned.
Referring to Fig. 4, based on the same inventive concept, the embodiment of the present application provides a kind of read-write equipment 100 of data, number According to read-write equipment 100 can be applied to reading and writing data equipment 10, the read-write equipment 100 of the data may include:
Data transmit-receive module 110, for obtaining reading and writing data request.
Data processing module 120, for determining the instantiation data by calling instantiation data library operation interface Specified database in the operation interface of library, wherein instantiation data library operation interface is based on the specified database Operation interface generates, and the information of the specified database is carried in the note of the operation interface of the database;And it also uses It requests according to the reading and writing data to specified database progress reading and writing data.
Optionally, the reality is determined by calling instantiation data library operation interface in the data processing module 120 Before specified database in exampleization database manipulation interface,
The data processing module 120 is also used to scan the note in the operation interface of the specified database, obtains The mark of the specified database carried in the note is taken, and according to the instruction of the note, obtains database configuration The mark of the fixed database of document, wherein the mark of the database in the data base configuration file is current for configuring It is specified which database to carry out reading and writing data using;Determine the database in data base configuration file mark and the specified number It is identical according to the mark in library, the operation interface of the specified database is instantiated, instantiation data library operation interface is generated.
Optionally, the note of the data processing module 120 in the operation interface for scanning the specified database Before, the method also includes:
The data processing module 120 is also used to pre-generate institute corresponding with the specified database that system is supported The operation interface for stating specified database defines the mark of the specified database in the note.
Optionally, the data processing module 120, for pre-generating java applet corresponding with the specified database Interface document, the java applet interface document include the operation interface of the specified database.
Optionally, the data processing module 120 will be described specified for the dynamic proxy of the Java by Mybatis The operation interface of database is instantiated, and instantiation data library operation interface is generated.
It should be noted that due to it is apparent to those skilled in the art that, for the convenience and letter of description Clean, system, the specific work process of device and unit of foregoing description can be with reference to corresponding in preceding method embodiment Journey, details are not described herein.
The computer that some embodiments of the application additionally provide a kind of non-volatile program code that computer is executable can Storage medium is read, which can be general storage medium, such as mobile disk, hard disk, the computer-readable storage Program code is stored on medium, which executes the read-write of the data of any of the above-described embodiment when being run by computer The step of method.
The program code product of the reading/writing method of data provided by the embodiment of the present application, including storing program code Computer readable storage medium, the instruction that program code includes can be used for executing the method in previous methods embodiment, specific real Now reference can be made to embodiment of the method, details are not described herein.
In conclusion the embodiment of the present application provides the reading/writing method, device and reading and writing data equipment of a kind of data.Pass through Which database is used in the note of routine interface file, and is grasped by the routine interface file generated instantiation data library Make interface, data reading can be carried out to specified database with the coupled relation of database without establishing in service logic by realizing It writes, avoids and original service logic is invaded, guarantee the stability of service logic, while also reducing service logic maintenance and test Cost.
More than, the only specific embodiment of the application, but the protection scope of the application is not limited thereto, and it is any to be familiar with Those skilled in the art within the technical scope of the present application, can easily think of the change or the replacement, and should all cover Within the protection scope of the application.Therefore, the protection scope of the application should be subject to the protection scope in claims.

Claims (11)

1. a kind of reading/writing method of data, which is characterized in that the described method includes:
Obtain reading and writing data request;
By calling instantiation data library operation interface, the specified data in the operation interface of the instantiation data library are determined Library, wherein instantiation data library operation interface is that the operation interface based on the specified database generates, the specified number The information of the specified database is carried in note according to the operation interface in library;
Reading and writing data is carried out to the specified database according to reading and writing data request.
2. the reading/writing method of data according to claim 1, which is characterized in that by calling instantiation data library to operate Interface, before determining the specified database in the operation interface of the instantiation data library, the method also includes:
The note in the operation interface of the specified database is scanned, the specified data carried in the note are obtained The mark in library, and according to the instruction of the note, obtain the mark of the database in data base configuration file, wherein described The mark of database in data base configuration file is currently assigned using which database progress reading and writing data for configuring;
Determine that the mark of the database in data base configuration file is identical as the mark of the specified database, by the specified number It is instantiated according to the operation interface in library, generates instantiation data library operation interface.
3. the reading/writing method of data according to claim 2, which is characterized in that in the operation for scanning the specified database Before the note in interface, the method also includes:
The operation interface of the pre-generated specified database corresponding with the specified database that system is supported, in the note The mark of the specified database is defined in solution.
4. the reading/writing method of data according to claim 3, which is characterized in that the pre-generated finger supported with system Determine the operation interface of the corresponding specified database of database, comprising:
Java applet interface document corresponding with the specified database is pre-generated, the java applet interface document includes institute State the operation interface of specified database.
5. according to the reading/writing method of data described in claim any in claim 2-4, which is characterized in that by the specified data The operation interface in library instantiates, and generates instantiation data library operation interface, comprising:
By the dynamic proxy of the Java of Mybatis, the operation interface of the specified database is instantiated, described in generation Instantiation data library operation interface.
6. a kind of read-write equipment of data, which is characterized in that described device includes:
Data transmit-receive module, for obtaining reading and writing data request;
Data processing module, for determining the instantiation data library operation by calling instantiation data library operation interface Specified database in interface, wherein instantiation data library operation interface is that the operation based on the specified database connects Mouth generates, and the information of the specified database is carried in the note of the operation interface of the database;And it is also used to basis The reading and writing data request carries out reading and writing data to the specified database.
7. the read-write equipment of data according to claim 6, which is characterized in that pass through calling in the data processing module Instantiation data library operation interface, before determining the specified database in the operation interface of the instantiation data library,
The data processing module, is also used to scan the note in the operation interface of the specified database, described in acquisition The mark of the specified database carried in note, and according to the instruction of the note, obtain in data base configuration file The mark in specified data library, wherein the mark of the database in the data base configuration file is for configuring currently assigned make Which database reading and writing data is carried out with;Determine the mark and the specified data of the database in the data base configuration file The mark in library is identical, and the operation interface of the specified database is instantiated, instantiation data library operation interface is generated.
8. the read-write equipment of data according to claim 7, which is characterized in that the data processing module is described in the scanning Before the note in the operation interface of specified database,
The data processing module is also used to pre-generate the specified number corresponding with the specified database that system is supported According to the operation interface in library, the mark of the specified database is defined in the note.
9. the read-write equipment of data according to claim 8, which is characterized in that
The data processing module, it is described for pre-generating java applet interface document corresponding with the specified database Java applet interface document includes the operation interface of the specified database.
10. according to the read-write equipment of data described in claim any in claim 7-9, which is characterized in that
The data processing module connects the operation of the specified database for the dynamic proxy of the Java by Mybatis Mouth is instantiated, and instantiation data library operation interface is generated.
11. a kind of reading and writing data equipment, which is characterized in that the reading and writing data equipment includes: processor and memory;
The memory, for storing the operation interface for carrying the database of note;
The processor, the operation interface of the database for carrying note according to are executed as claim 1-5 is any The reading/writing method of data described in claim.
CN201910782275.8A 2019-08-22 2019-08-22 Data reading and writing method and device and data reading and writing equipment Active CN110442636B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910782275.8A CN110442636B (en) 2019-08-22 2019-08-22 Data reading and writing method and device and data reading and writing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910782275.8A CN110442636B (en) 2019-08-22 2019-08-22 Data reading and writing method and device and data reading and writing equipment

Publications (2)

Publication Number Publication Date
CN110442636A true CN110442636A (en) 2019-11-12
CN110442636B CN110442636B (en) 2022-04-05

Family

ID=68437258

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910782275.8A Active CN110442636B (en) 2019-08-22 2019-08-22 Data reading and writing method and device and data reading and writing equipment

Country Status (1)

Country Link
CN (1) CN110442636B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708518A (en) * 2020-06-12 2020-09-25 北京思特奇信息技术股份有限公司 Data source switching method and device, storage medium and equipment
CN113176876A (en) * 2021-04-23 2021-07-27 网易(杭州)网络有限公司 Data reading and writing method and device and electronic equipment

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008146586A (en) * 2006-12-13 2008-06-26 Fujitsu Ltd Annotation management program, annotation management device, and annotation management method
CN103793432A (en) * 2012-11-01 2014-05-14 深圳中兴网信科技有限公司 Method and device for splitting database reading and writing
CN103942281A (en) * 2014-04-02 2014-07-23 北京中交兴路车联网科技有限公司 Method and device for operating object persistently stored
US20150170015A1 (en) * 2006-06-02 2015-06-18 Felica Networks, Inc. Data communications system, information processing terminal, ic card, reader/writer, and program
CN106940695A (en) * 2016-01-05 2017-07-11 阿里巴巴集团控股有限公司 The method of calibration and device of data source information
CN107220375A (en) * 2017-06-20 2017-09-29 北京小度信息科技有限公司 Data read-write method and server
CN107301179A (en) * 2016-04-14 2017-10-27 北京京东尚科信息技术有限公司 The method and apparatus of data base read-write separation
CN107463378A (en) * 2017-07-28 2017-12-12 深圳市丰巢科技有限公司 A kind of local cache implementation method, storage device and electronic equipment based on note
US20180004543A1 (en) * 2016-06-30 2018-01-04 Sap Portals Israel Ltd. Centralized overview display generated from annotated data sources
CN107633016A (en) * 2017-08-23 2018-01-26 阿里巴巴集团控股有限公司 Data processing method and device and electronic equipment
CN108804644A (en) * 2018-06-05 2018-11-13 中国平安人寿保险股份有限公司 Interface log storing method, device, computer equipment and storage medium
CN109271331A (en) * 2018-08-20 2019-01-25 平安普惠企业管理有限公司 Generation method, device, computer equipment and the storage medium of log

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150170015A1 (en) * 2006-06-02 2015-06-18 Felica Networks, Inc. Data communications system, information processing terminal, ic card, reader/writer, and program
JP2008146586A (en) * 2006-12-13 2008-06-26 Fujitsu Ltd Annotation management program, annotation management device, and annotation management method
CN103793432A (en) * 2012-11-01 2014-05-14 深圳中兴网信科技有限公司 Method and device for splitting database reading and writing
CN103942281A (en) * 2014-04-02 2014-07-23 北京中交兴路车联网科技有限公司 Method and device for operating object persistently stored
CN106940695A (en) * 2016-01-05 2017-07-11 阿里巴巴集团控股有限公司 The method of calibration and device of data source information
CN107301179A (en) * 2016-04-14 2017-10-27 北京京东尚科信息技术有限公司 The method and apparatus of data base read-write separation
US20180004543A1 (en) * 2016-06-30 2018-01-04 Sap Portals Israel Ltd. Centralized overview display generated from annotated data sources
CN107220375A (en) * 2017-06-20 2017-09-29 北京小度信息科技有限公司 Data read-write method and server
CN107463378A (en) * 2017-07-28 2017-12-12 深圳市丰巢科技有限公司 A kind of local cache implementation method, storage device and electronic equipment based on note
CN107633016A (en) * 2017-08-23 2018-01-26 阿里巴巴集团控股有限公司 Data processing method and device and electronic equipment
CN108804644A (en) * 2018-06-05 2018-11-13 中国平安人寿保险股份有限公司 Interface log storing method, device, computer equipment and storage medium
CN109271331A (en) * 2018-08-20 2019-01-25 平安普惠企业管理有限公司 Generation method, device, computer equipment and the storage medium of log

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
BKY-LXM: "Mybatis-就是使用接口+XML映射文件直接操作数据库", 《开发者知识库》 *
PHYLLIPE LIMA 等: "An annotation-based API for supporting runtime code annotation reading", 《ACM》 *
舒伟 等: "基于可视化配置的异构数据库通用访问实现", 《大科技》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708518A (en) * 2020-06-12 2020-09-25 北京思特奇信息技术股份有限公司 Data source switching method and device, storage medium and equipment
CN113176876A (en) * 2021-04-23 2021-07-27 网易(杭州)网络有限公司 Data reading and writing method and device and electronic equipment
CN113176876B (en) * 2021-04-23 2023-08-11 网易(杭州)网络有限公司 Data reading and writing method and device and electronic equipment

Also Published As

Publication number Publication date
CN110442636B (en) 2022-04-05

Similar Documents

Publication Publication Date Title
US10983902B2 (en) Collaborative computer aided test plan generation
US9870268B2 (en) Virtual computing instance migration
US20190108486A1 (en) System and method for intelligent and automatic electronic communication support and routing
US20190108470A1 (en) Automated orchestration of incident triage workflows
US11580179B2 (en) Method and system for service agent assistance of article recommendations to a customer in an app session
US11663240B2 (en) Categorization using organizational hierarchy
US20190324883A1 (en) Method for optimized canary deployments for improved customer experience
CN108959059B (en) Test method and test platform
CN109787830A (en) Gray scale distribution control method, device, system, electronic equipment and storage medium
US10902039B2 (en) Automatic identification of retraining data in a classifier-based dialogue system
US11093774B2 (en) Optical character recognition error correction model
CN108287708B (en) Data processing method and device, server and computer readable storage medium
CN113268336B (en) Service acquisition method, device, equipment and readable medium
CN110442636A (en) A kind of reading/writing method of data, device and reading and writing data equipment
CN110941547B (en) Automatic test case library management method, device, medium and electronic equipment
CN109614312A (en) Method for generating test case, device, electronic equipment and storage medium
CN109614271A (en) Control method, device, equipment and the storage medium of multiple company-data consistency
US20090112704A1 (en) Management tool for efficient allocation of skills and resources
CN112650689A (en) Test method, test device, electronic equipment and storage medium
US20200210164A1 (en) Preventing database package updates to fail customer requests and cause data corruptions
US11108714B1 (en) Integration of an email client with hosted applications
US20170293599A1 (en) Checklist Contexts and Completion
CN113342781A (en) Data migration method, device, equipment and storage medium
CN109803017A (en) File interoperability methods, calculate equipment and computer readable storage medium at device
CN115484560B (en) Intelligent short message processing method and device, electronic equipment and storage medium

Legal Events

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