CN111984666A - Database access method and device, computer readable storage medium and computer equipment - Google Patents

Database access method and device, computer readable storage medium and computer equipment Download PDF

Info

Publication number
CN111984666A
CN111984666A CN201910435436.6A CN201910435436A CN111984666A CN 111984666 A CN111984666 A CN 111984666A CN 201910435436 A CN201910435436 A CN 201910435436A CN 111984666 A CN111984666 A CN 111984666A
Authority
CN
China
Prior art keywords
operation command
database
mapping file
input
parameter
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
CN201910435436.6A
Other languages
Chinese (zh)
Other versions
CN111984666B (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.)
Beijing Shuju Xinyun Information Technology Co ltd
Original Assignee
Beijing Shuju Xinyun Information 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 Beijing Shuju Xinyun Information Technology Co ltd filed Critical Beijing Shuju Xinyun Information Technology Co ltd
Priority to CN201910435436.6A priority Critical patent/CN111984666B/en
Publication of CN111984666A publication Critical patent/CN111984666A/en
Application granted granted Critical
Publication of CN111984666B publication Critical patent/CN111984666B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2438Embedded query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2445Data retrieval commands; View definitions
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a database access method, a database access device, a computer readable storage medium and computer equipment. The method relates to a database technology and solves the problem of low database access efficiency caused by repeated writing of operation commands. The method comprises the following steps: loading a preset operation command mapping file, wherein the operation command mapping file comprises the corresponding relation between input parameters and database fields and the connection information of a database to be operated and a target data table; acquiring input parameters defined by a user; and dynamically generating and executing the operation command according to the input parameter and the operation command mapping file. The technical scheme provided by the invention is suitable for database access, and realizes automatic construction and execution of the operation command.

Description

Database access method and device, computer readable storage medium and computer equipment
Technical Field
The present invention relates to database technologies, and in particular, to a database access method, an apparatus, a computer-readable storage medium, and a computer device.
Background
Developing programs often involves accessing a database, and the most common way is to read data from the database using embedded SQL in the business code. The method needs to write different SQL sentences aiming at different business scenes, and has the defect that even for scenes with highly similar business, one sentence which is highly similar to the original SQL sentence needs to be rewritten for many times aiming at different scenes due to different transmitted parameter quantities, so that the SQL sentences can not be reused, and the database access efficiency is low.
Disclosure of Invention
The present invention is directed to solving the problems described above.
According to an aspect of the present invention, there is provided a database access method including:
loading a preset operation command mapping file, wherein the operation command mapping file comprises the corresponding relation between input parameters and database fields and the connection information of a database to be operated and a target data table;
acquiring input parameters defined by a user;
and dynamically generating and executing the operation command according to the input parameter and the operation command mapping file.
Preferably, before the step of loading the preset operation command mapping file, the method further includes:
establishing the operation command mapping file, wherein the operation command mapping file further comprises any one or more items of the following contents:
the serial number of the operation command, the database information, the definition of the basic information of the operation command, the field and the field type of the database of the operation, the parameter definition of the operation command and the statement definition.
Preferably, the step of obtaining the user-defined input parameters includes:
after the input operation is detected, the format of the input information is verified to judge whether the input information conforms to the parameter definition of the operation command;
And when the input information conforms to the operation command parameter definition, taking the input information as an input parameter.
Preferably, after the step of verifying the format of the input information to determine whether the input information conforms to the parameter definition of the operation command after the input operation is detected, the method further includes:
when the input information does not accord with the parameter definition of the operation command, checking whether an option of abandoning database fields and field types is set in the operation command mapping file;
and under the condition that the options of the database field and the field type are abandoned, the input information after parameters related to the connection information of the database to be operated and the target data table are removed is used as the input parameters.
Preferably, after the step of checking whether the option of discarding the database field and the field type is set in the operation command mapping file, the method further includes:
without the option of discarding the database fields and field types, a prompt is returned to prompt the input information to be inconsistent with the predefined configuration.
Preferably, the step of dynamically generating and executing the operation command according to the input parameter and the operation command mapping file includes:
Generating a basic operation command according to the input parameter and the operation command mapping file;
correcting the basic operation command according to the current context to obtain a formal operation command;
and executing the operation command and accessing the database.
Preferably, the step of generating a basic operation command according to the input parameter and the operation command mapping file includes:
extracting the database field, the field type and the statement definition of the operation in the operation command mapping file;
matching the input parameters into corresponding database fields, organizing the database fields according to the statement definition, and generating the basic operation command.
Preferably, the step of modifying the basic operation command according to the current context to obtain a formal operation command includes:
and according to the current context, carrying out any one or more of the following correction operations on the basic operation command to obtain a formal operation command:
statement setting, page turning query setting, duplication removing setting and aggregation function processing.
Preferably, the step of executing the operation command and accessing the database includes:
And when the operation command executes the query operation, converting the query result into a format corresponding to the field type according to the field type of the database field of the operation corresponding to the operation command mapping file.
According to another aspect of the present invention, there is also provided a database access apparatus, including:
the configuration file loading module is used for loading a preset operation command mapping file, wherein the operation command mapping file comprises the corresponding relation between the input parameters and the database fields and the connection information of the database to be operated and the target data table;
the parameter acquisition module is used for acquiring user-defined input parameters;
and the automatic access module is used for dynamically generating and executing the operation command according to the input parameters and the operation command mapping file.
Preferably, the apparatus further comprises:
a configuration file maintenance module, configured to establish the operation command mapping file, where the operation command mapping file further includes any one or more of the following:
the serial number of the operation command, the database information, the definition of the basic information of the operation command, the database field and field type of the operation, and the statement definition.
Preferably, the automatic access module includes:
the parameter matching unit is used for generating a basic operation command according to the input parameter and the operation command mapping file;
the command correction unit is used for correcting the basic operation command according to the current context to obtain a formal operation command;
and the command execution unit is used for executing the operation command and accessing the database.
According to a further aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed, performs the steps of the database access method described above.
According to a further aspect of the present invention, there is provided a computer device comprising a processor, a memory and a computer program stored on the memory, the processor implementing the steps of the database access method described above when executing the computer program.
The invention provides a database access method, a database access device, a computer readable storage medium and computer equipment, which are used for loading a preset operation command mapping file, acquiring user-defined input parameters in real time, and dynamically generating and executing an operation command according to the input parameters and the operation command mapping file. The method and the device realize automatic construction and execution of the operation command, are suitable for various different application environments, and solve the problem of low database access efficiency caused by repeatedly writing the operation command.
Other characteristic features and advantages of the invention will become apparent from the following description of exemplary embodiments, which is to be read in connection with the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention. In the drawings, like reference numerals are used to indicate like elements. The drawings in the following description are directed to some, but not all embodiments of the invention. For a person skilled in the art, other figures can be derived from these figures without inventive effort.
FIG. 1 is a flow chart illustrating a database access method according to an embodiment of the present invention;
FIG. 2 schematically shows a detailed flow of step 103 in FIG. 1;
FIG. 3 schematically shows a detailed flow of step 104 in FIG. 1;
FIG. 4 illustrates schematically the logical principles of a database access method provided by an embodiment of the present invention;
fig. 5 exemplarily shows a structure of a database access apparatus provided by an embodiment of the present invention;
FIG. 6 schematically illustrates the structure of the automatic access module 503 in FIG. 5;
Fig. 7 exemplarily shows a structure of a computer apparatus provided by an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
In order to solve the problem of low database access efficiency caused by repeatedly rewriting SQL statements, embodiments of the present invention provide a database access method, an apparatus, a computer-readable storage medium, and a computer device. The operation command mapping file is defined for the highly similar service scene, the operation commands such as SQL sentences and the like can be dynamically generated and executed, and flexible and efficient database access is realized.
An embodiment of the present invention provides a database access method, where a flow for automatically generating operation commands such as SQL statements and the like to complete database access is shown in fig. 1, and includes:
step 101, establishing an operation command mapping file.
The operation command mapping file comprises the corresponding relation between the input parameters and the database fields and the connection information of the database to be operated and the target data table. Preferably, the operation command mapping file further contains any one or more of the following items:
the serial number of the operation command, the database information, the definition of the basic information of the operation command, the field and the field type of the database of the operation, the parameter definition of the operation command and the statement definition.
Taking an operation command as an example of an SQL statement, in this step, according to an actual service, an SQL mapping file satisfying the requirement is established, and specific meanings of each item of content in the SQL mapping file are as follows:
1. and the sequence number of the SQL is used for positioning the configuration of the SQL. One configuration file comprises a plurality of SQL mapping files, so that different SQL is divided by allocating sequence numbers. After the configuration file is loaded, generating a specific SQL operation instruction requires positioning the SQL mapping file according to the corresponding SQL sequence number.
2. Database information for specifying information of the database and the data table. The data table is one or more target data tables that a specific SQL operation can involve.
3. The definition of SQL basic information for specifying the format of basic database operation types (create, delete, update, select) is exemplified as follows:
Figure BDA0002070372400000061
Figure BDA0002070372400000071
4. the database fields of the operation and their field types are exemplified as follows:
Figure BDA0002070372400000072
5. the definition of SQL parameters defines the correspondence between input parameters and database fields, as follows:
Figure BDA0002070372400000073
Figure BDA0002070372400000081
6. the where/browsing statement definition is used to define the filtering condition for executing the SQL command for the query, update, and delete types of SQL statements, which is exemplified as follows:
Figure BDA0002070372400000082
Figure BDA0002070372400000091
and 102, loading a preset operation command mapping file.
The operation command mapping file comprises the corresponding relation between the input parameters and the database fields.
In this step, the built SQL mapping file is loaded and is in a state of waiting for external information input.
And 103, acquiring input parameters defined by a user.
As shown in fig. 2, the steps include:
and step 1031, after the input operation is detected, verifying the format of the input information so as to judge whether the input information conforms to the parameter definition of the operation command.
Once any external input is received, the parameter verification module is triggered to perform format verification on the input parameters immediately, and the input of the user is ensured to be in accordance with the SQL configuration definition.
The validation rules are as follows:
a) reading the name and require attributes of the input parameters;
b) matching the name and require attributes read in the a) with the name and require attributes in the SQL parameter definition, and if the name attributes are successfully matched, judging that the input information conforms to the parameter definition of the operation command;
c) if the name in the input parameter is not matched with the name attribute of any parameter with the require attribute being true in the SQL parameter definition, judging that the input information is not in accordance with the parameter definition of the operation command, terminating the current program, and returning a message of parameter verification error.
In addition, if the user can ensure that the upstream input parameters are correct and the context of the downstream SQL statement is met, the parameter verification module can be closed through setting.
And 1032, when the input information conforms to the configuration definition of the operation command, taking the input information as an input parameter.
And 1033, when the input information does not conform to the parameter definition of the operation command, checking whether an option of abandoning the database field and the field type is set in the operation command mapping file.
And 1034, under the condition that the options of the database fields and the field types are abandoned, taking the input information after the parameters related to the connection information of the database to be operated and the target data table are removed as the input parameters.
Step 1035, without the option of discarding the database fields and field types, returns a prompt to prompt that the input information does not conform to the predefined configuration.
If the user's input parameters are not associated with the SQL configuration definition, the current step is terminated, and an error prompt is returned to the user. If the input parameters of the user conform to the definition of the SQL configuration, the verification is passed, and the subsequent steps are continuously executed.
And step 104, dynamically generating and executing the operation command according to the input parameters and the operation command mapping file.
As shown in fig. 3, the present step includes:
step 1041, generating a basic operation command according to the input parameter and the operation command mapping file.
In this step, first, the database fields, field types, and statement definitions of the operations in the operation command mapping file are extracted.
Then, matching the input parameters into corresponding database fields, organizing the database fields according to the statement definition, and generating the basic operation command.
1042, modifying the basic operation command according to the current context to obtain a formal operation command.
In this step, specifically, the basic operation command is modified according to the current context by any one or more of the following operations to obtain a formal operation command:
statement setting, page turning query setting, duplication removing setting and aggregation function processing.
Still taking the SQL statement as an example, after the input parameter verification is passed, the SQL configuration file is matched according to the input parameter and the SQL mapping file, then the specific parameter value is processed for the defined SQL statement according to the context information of the current business scenario, and finally the method for generating the SQL statement is called to construct the final SQL. In the process of constructing the SQL statement, if the actual parameters do not correspond to the parameters of the SQL configuration file, the parameters defined in the SQL configuration file are ignored in the process of generating the SQL, so that the effect of dynamically generating the SQL statement is achieved. The specific treatment process is as follows:
a) the SQL basic information is read and mainly used for determining the type (query, update, deletion and insertion) of the SQL statement and the target data table. The following is an example of SQL base information:
Figure BDA0002070372400000111
Figure BDA0002070372400000121
Wherein:
the type of SQL at least comprises query, addition, modification, deletion and the like;
whether the duplicate removal is set only aiming at the SQL of the query type or not, and the SQL operations of other types are uniformly set not to be subjected to duplicate removal;
whether paging is set only for query type SQL, and other types of SQL operation are uniformly set to not page.
b) And reading the database field information.
c) And generating a basic SQL statement based on the information of the two steps.
d) And judging whether the basic SQL sentences generated in the step c) are further processed or not according to the current context, wherein the further processing comprises whether a where/having sentence needs to be set or not, whether page turning inquiry needs to be set or not, removing duplication, processing an aggregation function and the like.
And 1043, executing the operation command and accessing the database.
Specifically, when the operation command executes a query operation, the query result is converted into a format corresponding to the field type according to the field type of the database field of the operation in the operation command mapping file.
Preferably, in the embodiment of the present invention, a module for executing the SQL statement is defined, the generated SQL statement is transmitted to the module as a parameter, the module connects to the database according to the database information, and then the SQL is executed to obtain a result. Particularly, for the SQL statement of the query type, the query result needs to be additionally processed, and the processing rule is as follows:
a) The field type information is read.
b) Matching with the field type provided by the field type classifier. The field type classifier counts various field types in different databases, classifies the field types of the databases, and obtains three standard field types of numerical values, character strings and Boolean. Through the field type classifier, the standard field type indicated by the field type information can be accurately identified.
c) And converting the field type information into a standard field type according to a matching result.
The embodiment of the invention provides a database access method, which is implemented according to the principle shown in fig. 4, and dynamically generates an SQL statement by judging whether parameters transmitted by a program are consistent with parameters defined in an SQL configuration file, so that the problem that the SQL statement can not be flexibly modified after being written in the software development process is solved while program service codes are separated from the SQL statement.
An embodiment of the present invention further provides a database access apparatus, whose structure is shown in fig. 5, including:
a configuration file loading module 501, configured to load a preset operation command mapping file, where the operation command mapping file includes a correspondence between an input parameter and a database field, and connection information of a database to be operated and a target data table;
A parameter obtaining module 502, configured to obtain user-defined input parameters;
and an automatic access module 503, configured to dynamically generate and execute an operation command according to the input parameter and the operation command mapping file.
Preferably, the apparatus further comprises:
a configuration file maintenance module 504, configured to establish the operation command mapping file, where the operation command mapping file further includes any one or more of the following:
the serial number of the operation command, the database information, the definition of the basic information of the operation command, the database field and field type of the operation, and the statement definition.
Preferably, the structure of the automatic access module 503 is shown in fig. 6, and includes:
a parameter matching unit 5031, configured to generate a basic operation command according to the input parameter and the operation command mapping file;
a command modification unit 5032, configured to modify the basic operation command according to the current context to obtain a formal operation command;
a command executing unit 5033, configured to execute the operation command and access the database.
Embodiments of the present invention also provide a computer-readable storage medium having stored thereon a computer program which, when executed, performs the steps of the database access method provided by embodiments of the present invention.
An embodiment of the present invention further provides a computer device, whose structure is shown in fig. 7, and includes a processor, a memory, and a computer program stored in the memory, where the processor executes the computer program to implement the steps of the database access method provided by the embodiment of the present invention.
The embodiment of the invention provides a database access method, a database access device, a computer readable storage medium and computer equipment, wherein a preset operation command mapping file is loaded, user-defined input parameters are acquired in real time, and an operation command is dynamically generated and executed according to the input parameters and the operation command mapping file. The method and the device realize automatic construction and execution of the operation command, are suitable for various different application environments, and solve the problem of low database access efficiency caused by repeatedly writing the operation command.
For the SQL statement, the SQL statement with high reusability can be defined in a scene with highly similar business logic, and business codes and SQL codes are separated. In a scene that the SQL statement needs to be modified to realize the change of the program function, the SQL statement can be prevented from being modified to compile codes, so that the program can be thermally upgraded in a generating environment.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus (device), or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media having computer-usable program code embodied in the medium. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, including, but not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by the computer, and the like. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that an article or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such article or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of additional like elements in the article or device comprising the element.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, it is intended that the present invention cover the modifications and variations of this invention provided they come within the scope of the appended claims and their equivalents.

Claims (14)

1. A database access method, comprising:
loading a preset operation command mapping file, wherein the operation command mapping file comprises the corresponding relation between input parameters and database fields and the connection information of a database to be operated and a target data table;
acquiring input parameters defined by a user;
and dynamically generating and executing the operation command according to the input parameter and the operation command mapping file.
2. The database access method according to claim 1, wherein the step of loading the preset operation command mapping file is preceded by the step of:
establishing the operation command mapping file, wherein the operation command mapping file further comprises any one or more items of the following contents:
the serial number of the operation command, the database information, the definition of the basic information of the operation command, the field and the field type of the database of the operation, the parameter definition of the operation command and the statement definition.
3. The database access method of claim 1, wherein the step of obtaining user-defined input parameters comprises:
after the input operation is detected, the format of the input information is verified to judge whether the input information conforms to the parameter definition of the operation command;
and when the input information conforms to the operation command parameter definition, taking the input information as an input parameter.
4. The database access method according to claim 3, wherein after the step of verifying the format of the input information to determine whether the input information conforms to the parameter definition of the operation command after the input operation is detected, the method further comprises:
when the input information does not accord with the parameter definition of the operation command, checking whether an option of abandoning database fields and field types is set in the operation command mapping file;
and under the condition that the options of the database field and the field type are abandoned, the input information after parameters related to the connection information of the database to be operated and the target data table are removed is used as the input parameters.
5. The database access method according to claim 4, wherein the step of checking whether the option of discarding the database field and the field type is set in the operation command mapping file further comprises:
Without the option of discarding the database fields and field types, a prompt is returned to prompt the input information to be inconsistent with the predefined configuration.
6. The database access method according to claim 1 or 2, wherein the step of dynamically generating and executing the operation command according to the input parameter and the operation command mapping file comprises:
generating a basic operation command according to the input parameter and the operation command mapping file;
correcting the basic operation command according to the current context to obtain a formal operation command;
and executing the operation command and accessing the database.
7. The database access method of claim 6, wherein the step of generating a base operation command according to the input parameters and the operation command mapping file comprises:
extracting the database field, the field type and the statement definition of the operation in the operation command mapping file;
matching the input parameters into corresponding database fields, organizing the database fields according to the statement definition, and generating the basic operation command.
8. The method according to claim 6, wherein modifying the basic operation command according to the current context to obtain a formal operation command comprises:
And according to the current context, carrying out any one or more of the following correction operations on the basic operation command to obtain a formal operation command:
statement setting, page turning query setting, duplication removing setting and aggregation function processing.
9. The database access method of claim 6, wherein executing the operation command, the step of accessing the database comprises:
and when the operation command executes the query operation, converting the query result into a format corresponding to the field type according to the field type of the database field of the operation corresponding to the operation command mapping file.
10. A database access apparatus, comprising:
the configuration file loading module is used for loading a preset operation command mapping file, wherein the operation command mapping file comprises the corresponding relation between the input parameters and the database fields and the connection information of the database to be operated and the target data table;
the parameter acquisition module is used for acquiring user-defined input parameters;
and the automatic access module is used for dynamically generating and executing the operation command according to the input parameters and the operation command mapping file.
11. The database access device of claim 10, further comprising:
a configuration file maintenance module, configured to establish the operation command mapping file, where the operation command mapping file further includes any one or more of the following:
the serial number of the operation command, the database information, the definition of the basic information of the operation command, the database field and field type of the operation, and the statement definition.
12. The database access device of claim 10 or 11, wherein the automatic access module comprises:
the parameter matching unit is used for generating a basic operation command according to the input parameter and the operation command mapping file;
the command correction unit is used for correcting the basic operation command according to the current context to obtain a formal operation command;
and the command execution unit is used for executing the operation command and accessing the database.
13. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed, implements the steps of the method according to any of claims 1-9.
14. A computer arrangement comprising a processor, a memory and a computer program stored on the memory, characterized in that the steps of the method according to any of claims 1-9 are implemented when the computer program is executed by the processor.
CN201910435436.6A 2019-05-23 2019-05-23 Database access method, apparatus, computer readable storage medium and computer device Active CN111984666B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910435436.6A CN111984666B (en) 2019-05-23 2019-05-23 Database access method, apparatus, computer readable storage medium and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910435436.6A CN111984666B (en) 2019-05-23 2019-05-23 Database access method, apparatus, computer readable storage medium and computer device

Publications (2)

Publication Number Publication Date
CN111984666A true CN111984666A (en) 2020-11-24
CN111984666B CN111984666B (en) 2024-03-29

Family

ID=73437420

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910435436.6A Active CN111984666B (en) 2019-05-23 2019-05-23 Database access method, apparatus, computer readable storage medium and computer device

Country Status (1)

Country Link
CN (1) CN111984666B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112464034A (en) * 2020-12-08 2021-03-09 深圳市欢太科技有限公司 User data extraction method and device, electronic equipment and computer readable medium
CN112765259A (en) * 2021-01-20 2021-05-07 青岛海信网络科技股份有限公司 Data processing method and device for subway line network center
CN114003229A (en) * 2021-09-28 2022-02-01 厦门国际银行股份有限公司 SQL code similarity analysis method and system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101046812A (en) * 2006-06-12 2007-10-03 华为技术有限公司 Method of data base table recording structure and detection and its device
CN101339559A (en) * 2008-07-18 2009-01-07 北京航空航天大学 Long lasting implementing method for data
CN102110110A (en) * 2009-12-28 2011-06-29 中国移动通信集团公司 Method and device for data access based on SOA (Service-Oriented Architecture)
CN102346785A (en) * 2011-11-15 2012-02-08 北京创腾科技有限公司 Method and device for directly self-defining field of database
CN105159920A (en) * 2015-07-28 2015-12-16 卡斯柯信号有限公司 Attribute tag based database access method
CN106294565A (en) * 2016-07-27 2017-01-04 中国农业银行股份有限公司 A kind of data bank access method and system
CN107665216A (en) * 2016-07-29 2018-02-06 银联数据服务有限公司 A kind of data bank access method and middleware
CN108228597A (en) * 2016-12-14 2018-06-29 深圳市优朋普乐传媒发展有限公司 Data bank access method and device
CN108647300A (en) * 2018-05-09 2018-10-12 携程旅游信息技术(上海)有限公司 Database access intermediate system, method, equipment and storage medium
CN109542925A (en) * 2018-10-26 2019-03-29 广州朗尊软件科技有限公司 Data base access system, method, equipment and multi-user mall system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101046812A (en) * 2006-06-12 2007-10-03 华为技术有限公司 Method of data base table recording structure and detection and its device
CN101339559A (en) * 2008-07-18 2009-01-07 北京航空航天大学 Long lasting implementing method for data
CN102110110A (en) * 2009-12-28 2011-06-29 中国移动通信集团公司 Method and device for data access based on SOA (Service-Oriented Architecture)
CN102346785A (en) * 2011-11-15 2012-02-08 北京创腾科技有限公司 Method and device for directly self-defining field of database
CN105159920A (en) * 2015-07-28 2015-12-16 卡斯柯信号有限公司 Attribute tag based database access method
CN106294565A (en) * 2016-07-27 2017-01-04 中国农业银行股份有限公司 A kind of data bank access method and system
CN107665216A (en) * 2016-07-29 2018-02-06 银联数据服务有限公司 A kind of data bank access method and middleware
CN108228597A (en) * 2016-12-14 2018-06-29 深圳市优朋普乐传媒发展有限公司 Data bank access method and device
CN108647300A (en) * 2018-05-09 2018-10-12 携程旅游信息技术(上海)有限公司 Database access intermediate system, method, equipment and storage medium
CN109542925A (en) * 2018-10-26 2019-03-29 广州朗尊软件科技有限公司 Data base access system, method, equipment and multi-user mall system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112464034A (en) * 2020-12-08 2021-03-09 深圳市欢太科技有限公司 User data extraction method and device, electronic equipment and computer readable medium
CN112765259A (en) * 2021-01-20 2021-05-07 青岛海信网络科技股份有限公司 Data processing method and device for subway line network center
CN114003229A (en) * 2021-09-28 2022-02-01 厦门国际银行股份有限公司 SQL code similarity analysis method and system
CN114003229B (en) * 2021-09-28 2022-10-18 厦门国际银行股份有限公司 SQL code similarity analysis method and system

Also Published As

Publication number Publication date
CN111984666B (en) 2024-03-29

Similar Documents

Publication Publication Date Title
US10489591B2 (en) Detection system and method thereof
CN111443912B (en) Component-based page rendering method, device, computer equipment and storage medium
CN111984666B (en) Database access method, apparatus, computer readable storage medium and computer device
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
CN109634682B (en) Configuration file updating method and device for application program
CN107330014B (en) Data table creating method and device
CN110795140A (en) Configuration file generation method and device
CN112732571A (en) Test data generation method and device
CN111813803B (en) Method, device, equipment and storage medium for generating statement block execution plan
CN111367890A (en) Data migration method and device, computer equipment and readable storage medium
CN109657803B (en) Construction of machine learning models
CN115391439A (en) Document data export method, device, electronic equipment and storage medium
WO2019041891A1 (en) Method and device for generating upgrade package
CN117289905B (en) Application software development method and device, storage medium and electronic equipment
US20170116208A1 (en) Non-uniform multi-row text file loading
CN113761863A (en) List page configuration method, device and storage medium
US20070067254A1 (en) Business model data management
CN105740260A (en) Method and device for extracting template file data structure
CN112612833A (en) Rule package updating method, device, equipment and storage medium
CN110019295B (en) Database retrieval method, device, system and storage medium
US10936563B2 (en) System and method for merging a source data from a source application into a target data of a target application
CN113326063B (en) Data processing method, electronic device and storage medium
CN115617594A (en) Method, apparatus, storage medium, and program product for generating incentive information
CN110704742B (en) Feature extraction method and device
CN110991164B (en) Legal document processing method and device

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