CN111984666B - Database access method, apparatus, computer readable storage medium and computer device - Google Patents

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

Info

Publication number
CN111984666B
CN111984666B CN201910435436.6A CN201910435436A CN111984666B CN 111984666 B CN111984666 B CN 111984666B CN 201910435436 A CN201910435436 A CN 201910435436A CN 111984666 B CN111984666 B CN 111984666B
Authority
CN
China
Prior art keywords
operation command
database
mapping file
information
input
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.)
Active
Application number
CN201910435436.6A
Other languages
Chinese (zh)
Other versions
CN111984666A (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

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

Abstract

The invention provides a database access method, a database access device, a computer readable storage medium and computer equipment. The method relates to the 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 user-defined input parameters; and dynamically generating and executing an operation command according to the input parameters 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, apparatus, computer readable storage medium and computer device
Technical Field
The present invention relates to database technologies, and in particular, to a database access method, apparatus, computer readable storage medium, and computer device.
Background
Development programs often involve accessing databases, the most common way being to use embedded SQL in the business code to read data into the database. The method has the defects that even for the scene with high similarity of service, because the quantity of parameters transferred is different, one sentence with high similarity to the original SQL needs to be rewritten for different scenes for many times, the SQL sentence cannot 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 user-defined input parameters;
and dynamically generating and executing an operation command according to the input parameters 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 of the following contents:
sequence number of operation command, database information, definition of basic information of operation command, database field and field type of operation, definition of operation command parameter and definition of sentence.
Preferably, the step of obtaining the user-defined input parameter includes:
after detecting an input operation, verifying the format of input information to determine whether the input information accords with an operation command parameter definition;
and when the input information accords with the definition of the operation command parameters, taking the input information as the input parameters.
Preferably, after the step of verifying the format of the input information after detecting the input operation to determine whether the input information meets the operation command parameter definition, the method further includes:
when the input information does not accord with the definition of the operation command parameters, checking whether options of discarding database fields and field types are set in the operation command mapping file;
and under the condition that options of database fields and field types are abandoned, taking the input information after eliminating parameters related to the connection information of the database to be operated and the target data table as 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 discarding the database fields and field type options, a hint is returned to hint that the input information does not conform to 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 parameters 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 a database.
Preferably, the step of generating the basic operation command according to the input parameter and the operation command mapping file includes:
extracting database fields and field type and statement definitions of operations in the operation command mapping file;
and 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 revising the basic operation command according to the current context to obtain a formal operation command includes:
and carrying out any one or more of the following correction operations on the basic operation command according to the current context to obtain a formal operation command:
statement setting, page turning query setting, duplication removal setting and aggregation function processing.
Preferably, executing the operation command, and accessing the database includes:
when the operation command executes the query operation, the query result is converted into a format corresponding to the field type according to the field type corresponding to the operation command mapping file in the database field of the operation.
According to still 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 input parameters and database fields and the connection information of a database to be operated and a 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 parameter and the operation command mapping file.
Preferably, the apparatus further comprises:
the configuration file maintenance module is used for establishing the operation command mapping file, and the operation command mapping file further comprises any one or more of the following contents:
sequence number of operation command, database information, definition of basic information of operation command, database field of operation, field type and statement definition.
Preferably, the automatic access module includes:
the parameter matching unit is used for generating a basic operation command according to the input parameters 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 implements the steps of the above database access method.
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 said memory, said processor implementing the steps of the above database access method when executing said computer program.
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 obtained 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 realizes the automatic construction and execution of the operation command, adapts to various different application environments, and solves the problem of low database access efficiency caused by repeated writing of 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 with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this 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 identify like elements. The drawings, which are included in the description, illustrate some, but not all embodiments of the invention. Other figures can be derived from these figures by one of ordinary skill in the art without undue effort.
FIG. 1 illustrates a flow of a database access method according to an embodiment of the present invention;
FIG. 2 illustrates a specific flow of step 103 of FIG. 1;
FIG. 3 schematically illustrates a specific flow of step 104 of FIG. 1;
FIG. 4 schematically illustrates the logic of a database access method provided by an embodiment of the present invention;
FIG. 5 schematically illustrates a structure of a database access apparatus according to an embodiment of the present invention;
fig. 6 exemplarily illustrates a 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
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention. It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be arbitrarily combined with each other.
In order to solve the problem of low database access efficiency caused by repeated rewriting of SQL sentences, embodiments of the invention provide a database access method, a database access device, a computer readable storage medium and computer equipment. The operation command mapping file is defined for highly similar business scenes, and operation commands such as SQL sentences can be dynamically generated and executed, so that flexible and efficient database access is realized.
An embodiment of the present invention provides a database access method, and a flow for automatically generating an operation command such as an SQL statement to complete database access by using the method is shown in fig. 1, including:
step 101, an operation command mapping file is established.
The operation command mapping file contains 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 map file further contains any one or more of the following:
sequence number of operation command, database information, definition of basic information of operation command, database field and field type of operation, definition of operation command parameter and definition of sentence.
Taking an operation command as an example of an SQL sentence, in this step, according to an actual service, an SQL mapping file meeting the requirement is established, and the specific meaning of each item of content in the SQL mapping file is as follows:
1. and the sequence number of the SQL is used for positioning the configuration of the SQL. A configuration file contains a plurality of SQL mapping files, so that different SQLs are distinguished by sequence number allocation. After loading the configuration file, the specific SQL operation instruction needs to be generated to locate the SQL mapping file according to the corresponding SQL sequence number.
2. Database information specifying information of the database and the data table. Wherein the data table is one or more target data tables to which a particular SQL operation may be directed.
3. The definition of the SQL base information, specifying the format of the basic database operation types (create, delete, update, select) is exemplified as follows:
4. the database fields of the operation and the field types thereof are exemplified as follows:
5. the definition of SQL parameters defines the correspondence between input parameters and database fields, and examples are as follows:
6. the where/have statement definition is used to define the filtering conditions for executing the SQL command on the SQL statement definition of query, update, delete type, and examples are as follows:
step 102, loading a preset operation command mapping file.
The operation command mapping file contains the correspondence 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.
Step 103, obtaining user-defined input parameters.
The step is specifically shown in fig. 2, and includes:
step 1031, after detecting the input operation, verifies the format of the input information to determine whether the input information meets the operation command parameter definition.
Upon receipt of any external input, the parameter verification module is triggered immediately to perform format verification on the input parameters, ensuring that the user's input is in accordance with the SQL configuration definition.
The validation rules are as follows:
a) Reading the name and the request attribute of the input parameter;
b) Matching the name and the request attribute read in a) with the name and the request attribute in the SQL parameter definition, and if the name attribute is successfully matched, judging that the input information accords with the operation command parameter definition;
c) If the name in the input parameter is not matched with the name attribute of any parameter with the required attribute true in the SQL parameter definition, judging that the input information does not accord with the operation command parameter definition, terminating the current program, and returning a parameter verification error message.
In addition, if the user can ensure that the upstream input parameters are correct, the shutdown parameter verification module can be set under the condition of conforming to the context of the downstream SQL statement.
Step 1032, taking the input information as an input parameter when the input information accords with the operation command configuration definition.
Step 1033, when the input information does not conform to the operation command parameter definition, checking whether an option of discarding database fields and field types is set in the operation command mapping file.
Step 1034, in the case of discarding the database fields and field types, using the input information after rejecting the parameters associated with the connection information of the database to be operated and the target data table as input parameters.
Step 1035, returning a prompt to prompt that the input information does not conform to the predefined configuration without discarding the database fields and field type options.
If the input parameters of the user 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 accord with the definition of SQL configuration, the verification is passed, and the follow-up steps are continuously executed.
Step 104, dynamically generating and executing the operation command according to the input parameter and the operation command mapping file.
The step is specifically shown in fig. 3, and includes:
step 1041, generating a basic operation command according to the input parameters and the operation command mapping file.
In this step, firstly, the database field, field type and sentence definition of the operation in the operation command mapping file are extracted.
And then, matching the input parameters into corresponding database fields, organizing the database fields according to the statement definition, and generating the basic operation command.
Step 1042, revising the basic operation command according to the current context to obtain the formal operation command.
In this step, specifically, according to the current context, any one or more of the following correction operations are performed on the basic operation command, so as to obtain a formal operation command:
statement setting, page turning query setting, duplication removal setting and aggregation function processing.
Still taking SQL sentences as an example, after the input parameters pass verification, an SQL configuration file is matched according to the input parameters and the SQL mapping file, then specific parameter values are processed for the defined SQL sentences according to the context information of the current service scene, and finally a method for generating the SQL sentences is called to construct the final SQL. In the process of constructing the SQL sentence, 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 sentence is achieved. The specific treatment process is as follows:
a) The SQL basic information is read and is 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:
wherein:
the SQL type at least comprises query, addition, modification, deletion and the like;
whether the de-duplication is set only for the SQL of the query type, and other SQL operations are uniformly set to be not de-duplicated;
whether or not to page is set only for query type SQL, and other types of SQL operations are uniformly set to be non-paged.
b) And reading the field information of the database.
c) And generating a basic SQL sentence based on the information of the two steps.
d) Judging whether to further process the basic SQL statement generated in the step c) through the current context, wherein the further processing includes whether to set a where/find statement, whether to set page turning inquiry, de-duplication, aggregation function processing and the like.
Step 1043, executing the operation command, and accessing the database.
Specifically, when the operation command executes a query operation, according to a field type corresponding to the operation command mapping file in the database field of the operation, converting a query result into a format corresponding to the field type.
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 is connected to the database according to the database information, and then the SQL is executed to obtain a result. In particular, for the SQL statement of the query type, additional processing needs to be performed on the query result, and the processing rules are as follows:
a) The field type information is read.
b) Matching 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 value, character string and Boolean. The standard field type indicated by the field type information can be accurately identified through the field type classifier.
c) And converting the field type information into a standard field type according to the matching result.
The embodiment of the invention provides a database access method, the implementation principle is shown in figure 4, and SQL sentences are dynamically generated by judging whether the parameters transmitted by a program are consistent with the parameters defined in an SQL configuration file, so that the problem that the SQL sentences cannot be flexibly modified after being written in the software development process is solved while program service codes and the SQL sentences are separated.
An embodiment of the present invention further provides a database access apparatus, with a structure shown in fig. 5, including:
the configuration file loading module 501 is configured to load a preset operation command mapping file, where the operation command mapping file includes a corresponding relationship between an input parameter and a database field, and connection information of a database to be operated and a target data table;
the parameter obtaining module 502 is configured to obtain user-defined input parameters;
and the automatic access module 503 is 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:
sequence number of operation command, database information, definition of basic information of operation command, database field of operation, field type and statement definition.
Preferably, the structure of the automatic access module 503 is as 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, so as to obtain a formal operation command;
a command execution unit 5033 for executing the operation command and accessing the database.
Embodiments of the present invention also provide a computer readable storage medium having stored thereon a computer program which, when executed, implements 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, including a processor, a memory, and a computer program stored on the memory, where the processor implements the steps of the database access method provided by the embodiment of the present invention when the processor executes the computer program.
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 obtained 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 realizes the automatic construction and execution of the operation command, adapts to various different application environments, and solves the problem of low database access efficiency caused by repeated writing of the operation command.
For SQL sentences, SQL sentences with high multiplexing property can be defined in a scene with high similarity of business logic, and business codes and SQL codes are separated. In the scene that the SQL statement needs to be modified to realize the program function change, the SQL statement can be prevented from being modified to compile codes, so that the program can be thermally upgraded in the generation environment.
It will be apparent to those skilled in the art that 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 therein. 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 Disk (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 a computer. Furthermore, as is well known to those of ordinary skill in the art, 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.
The present invention is 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 identical elements in an article or apparatus that comprises 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. It is therefore intended that the following claims be interpreted as including the 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 modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (8)

1. A method of database access, 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 user-defined input parameters;
dynamically generating and executing an operation command according to the input parameters and the operation command mapping file;
before the step of loading the preset operation command mapping file, the method further comprises the following steps:
establishing the operation command mapping file, wherein the operation command mapping file further comprises the following contents:
the method comprises the steps of dynamically generating and executing an operation command according to the input parameters and the operation command mapping file, wherein the operation command comprises a sequence number, database information, definition of operation command basic information, database fields and field types of operation, operation command parameter definition and statement definition, and the sequence number of the operation command is used for positioning the mapping file, and the steps of dynamically generating and executing the operation command comprise:
generating a basic operation command according to the input parameters and the operation command mapping file;
correcting the basic operation command according to the current context to obtain a formal operation command;
executing the operation command and accessing a database;
the step of generating a basic operation command according to the input parameters and the operation command mapping file comprises the following steps:
extracting database fields and field type and statement definitions of operations 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;
and correcting the basic operation command according to the current context, wherein the step of obtaining the formal operation command comprises the following steps of:
and carrying out any one or more of the following correction operations on the basic operation command according to the current context to obtain a formal operation command:
statement setting, page turning query setting, duplication removal setting and aggregation function processing;
the database information is used for specifying information of a database and a data table; the definition of the basic information of the operation command is used for specifying the format of the basic database operation type; the operation command parameter definition is used for defining the corresponding relation between the input parameter and the database field; the statement defines filter conditions for executing the operation command on query, update, and delete types of statement definitions.
2. The database access method of claim 1, wherein the step of obtaining user-defined input parameters comprises:
after detecting an input operation, verifying the format of input information to determine whether the input information accords with an operation command parameter definition;
and when the input information accords with the definition of the operation command parameters, taking the input information as the input parameters.
3. The database access method according to claim 2, wherein after the step of verifying the format of the input information to determine whether the input information meets the operation command parameter definition after the input operation is detected, further comprising:
when the input information does not accord with the definition of the operation command parameters, checking whether options of discarding database fields and field types are set in the operation command mapping file;
and taking the input information after eliminating the parameters related to the connection information of the database to be operated and the target data table as input parameters when the option of discarding the database fields and the field types exists.
4. The database access method according to claim 3, wherein after the step of checking whether the option of discarding the database field and the field type is set in the operation command map file, further comprising:
without discarding the database fields and field type options, a hint is returned to hint that the input information does not conform to the predefined configuration.
5. The database access method according to claim 1, wherein the step of executing the operation command to access the database comprises:
when the operation command executes the query operation, the query result is converted into a format corresponding to the field type according to the field type corresponding to the operation command mapping file in the database field of the operation.
6. 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 input parameters and database fields and the connection information of a database to be operated and a target data table;
the parameter acquisition module is used for acquiring user-defined input parameters;
the automatic access module is used for dynamically generating and executing the operation command according to the input parameter and the operation command mapping file;
the apparatus further comprises:
the configuration file maintenance module is used for establishing the operation command mapping file, and the operation command mapping file further comprises the following contents:
the method comprises the steps of defining sequence numbers of operation commands, database information, basic information of the operation commands, database fields and field types of the operation, and operation command parameter definition and statement definition, wherein the sequence numbers of the operation commands are used for positioning mapping files;
the automatic access module comprises:
the parameter matching unit is used for generating a basic operation command according to the input parameters 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;
the command execution unit is used for executing the operation command and accessing a database;
the parameter matching unit is also used for extracting database fields and field type and statement definitions of the operations 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;
the command revising unit is further configured to perform, according to the current context, any one or more of the following revising operations on the basic operation command, to obtain a formal operation command: statement setting, page turning query setting, duplication removal setting and aggregation function processing;
the database information is used for specifying information of a database and a data table; the definition of the basic information of the operation command is used for specifying the format of the basic database operation type; the operation command parameter definition is used for defining the corresponding relation between the input parameter and the database field; the statement defines filter conditions for executing the operation command on query, update, and delete types of statement definitions.
7. 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 one of claims 1-5.
8. A computer device comprising a processor, a memory and a computer program stored on the memory, characterized in that the processor implements the steps of the method according to any of claims 1-5 when the computer program is executed.
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 CN111984666A (en) 2020-11-24
CN111984666B true 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)

Families Citing this family (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
CN114003229B (en) * 2021-09-28 2022-10-18 厦门国际银行股份有限公司 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

Also Published As

Publication number Publication date
CN111984666A (en) 2020-11-24

Similar Documents

Publication Publication Date Title
CN111984666B (en) Database access method, apparatus, computer readable storage medium and computer device
US10489591B2 (en) Detection system and method thereof
CN107665216B (en) Database access method and middleware
US9348568B2 (en) Software application porting system
CN110442371B (en) Method, device and medium for releasing codes and computer equipment
CN111443912B (en) Component-based page rendering method, device, computer equipment and storage medium
CN109739828B (en) Data processing method and device and computer readable storage medium
CN112905624B (en) Database extension method and device of low-code development platform
US10699243B2 (en) Business model data management
CN108536745B (en) Shell-based data table extraction method, terminal, equipment and storage medium
CN110019111B (en) Data processing method, data processing device, storage medium and processor
CN111160045A (en) Game resource file translation method, device and equipment
CN115391439B (en) Document data export method, device, electronic equipment and storage medium
CN109657803B (en) Construction of machine learning models
CN116560642A (en) Code generation method and device, electronic equipment and storage medium
CN111367890A (en) Data migration method and device, computer equipment and readable storage medium
CN108334335B (en) Method and device for determining software source code version
WO2022012327A1 (en) Code analysis method and system, and computing device
CN110069455B (en) File merging method and device
JP4477531B2 (en) Data import method and data import apparatus
CN113326063B (en) Data processing method, electronic device and storage medium
US9626371B2 (en) Attribute selectable file operation
CN113391812A (en) Analysis method and device of application program module and analysis tool
CN103761247A (en) Processing method and device for error files
CN115774565B (en) Single code warehouse construction method, system, device and 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