CN116069802A - Method, device, electronic equipment and storage medium for accessing database - Google Patents
Method, device, electronic equipment and storage medium for accessing database Download PDFInfo
- Publication number
- CN116069802A CN116069802A CN202111273470.1A CN202111273470A CN116069802A CN 116069802 A CN116069802 A CN 116069802A CN 202111273470 A CN202111273470 A CN 202111273470A CN 116069802 A CN116069802 A CN 116069802A
- Authority
- CN
- China
- Prior art keywords
- information
- database
- queried
- authority
- application system
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 230000000977 initiatory effect Effects 0.000 claims abstract description 13
- 238000012423 maintenance Methods 0.000 abstract description 11
- 238000010586 diagram Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000004590 computer program Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/25—Integrating or interfacing systems involving database management systems
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Storage Device Security (AREA)
Abstract
The application relates to the technical field of databases and discloses a method for accessing a database, which comprises the following steps: acquiring database information to be queried in a data query request; under the condition that the preset database table comprises the database information to be queried, acquiring the application system information and the user information for initiating the data query request; acquiring an initial query statement corresponding to the information of the database to be queried; acquiring target authority information according to the application system information, the user information and the database information to be queried; adding the target authority information to a preset position of an initial query sentence to obtain the query sentence; and accessing a database corresponding to the database information to be queried by using the query statement. Under the condition of changing the authority rule, the control code of the access authority of the database is not required to be modified, and the service code is not required to be modified, so that the cost of later maintenance of the service system can be reduced. The application also discloses a device for accessing the database, electronic equipment and a storage medium.
Description
Technical Field
The present application relates to the field of database technologies, for example, to a method, an apparatus, an electronic device, and a storage medium for accessing a database.
Background
As business systems develop, the more complex the rights control rules for data access in the system become, such as from the initial access to business data according to department dimension configuration rights to access business data according to department + post + region configuration rights. Existing methods of configuring rights are by adding a flag in the service code or adding rights control hard coding.
In the process of implementing the embodiments of the present disclosure, it is found that at least the following problems exist in the related art:
the existing method for configuring the authority has invasiveness to the service codes, so that the service codes cannot be reused, and the control codes of the database access authority are required to be modified after the authority rules of the service system are changed; and the cost of the post maintenance of the business system is increased.
Disclosure of Invention
The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview, and is intended to neither identify key/critical elements nor delineate the scope of such embodiments, but is intended as a prelude to the more detailed description that follows.
The embodiment of the disclosure provides a method, a device, electronic equipment and a storage medium for accessing a database, so that the cost of post maintenance of a business system can be reduced.
In some embodiments, the method comprises: acquiring database information to be queried in a data query request; acquiring application system information and user information for initiating the data query request under the condition that the preset database table comprises the database information to be queried; acquiring an initial query statement corresponding to the database information to be queried; acquiring target authority information according to the application system information, the user information and the database information to be queried; the target authority information is used for representing the authority of an application system and a user in a database corresponding to the database information to be queried; adding the target authority information to a preset position of the initial query statement to obtain a query statement; and accessing a database corresponding to the database information to be queried by using the query statement.
In some embodiments, the apparatus comprises: the first acquisition module is configured to acquire database information to be queried in the data query request; the second acquisition module is configured to acquire the application system information and the user information for initiating the data query request under the condition that the database information to be queried is included in a preset database table; acquiring an initial query statement corresponding to the database information to be queried; the third acquisition module is configured to acquire target authority information according to the application system information, the user information and the database information to be queried; the target authority information is used for representing the authority of an application system and a user in a database corresponding to the database information to be queried; the adding module is configured to add the target authority information to a preset position of the initial query statement to obtain a query statement; and the access module is configured to access the database corresponding to the database information to be queried by utilizing the query statement.
In some embodiments, the apparatus comprises a processor and a memory storing program instructions, the processor being configured to perform the above-described method for accessing a database when the program instructions are executed.
In some embodiments, the electronic device comprises the above-described means for accessing a database.
In some embodiments, the storage medium stores program instructions that, when executed, perform the method for accessing a database described above.
The method, the device, the electronic equipment and the storage medium for accessing the database provided by the embodiment of the disclosure can realize the following technical effects: the authority of the application system and the user in the database corresponding to the database information to be queried is added to the preset position of the initial query statement, so that the query statement is obtained, and therefore, when the database corresponding to the database information to be queried is accessed by utilizing the query statement, the data corresponding to the target authority information can be obtained, and under the condition that the authority rule is changed, the control code of the access authority of the database is not required to be modified, and the service code is not required to be modified, so that the cost of later maintenance of the service system can be reduced.
The foregoing general description and the following description are exemplary and explanatory only and are not restrictive of the application.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which like reference numerals refer to similar elements, and in which:
FIG. 1 is a schematic diagram of a method for accessing a database provided by an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of another method for accessing a database provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of another method for accessing a database provided by an embodiment of the present disclosure;
FIG. 4 is a timing diagram of one method for accessing a database provided by an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an apparatus for accessing a database provided by an embodiment of the present disclosure;
fig. 6 is a schematic diagram of another apparatus for accessing a database provided by an embodiment of the present disclosure.
Detailed Description
So that the manner in which the features and techniques of the disclosed embodiments can be understood in more detail, a more particular description of the embodiments of the disclosure, briefly summarized below, may be had by reference to the appended drawings, which are not intended to be limiting of the embodiments of the disclosure. In the following description of the technology, for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the disclosed embodiments. However, one or more embodiments may still be practiced without these details. In other instances, well-known structures and devices may be shown simplified in order to simplify the drawing.
The terms first, second and the like in the description and in the claims of the embodiments of the disclosure and in the above-described figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe embodiments of the present disclosure. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion.
The term "plurality" means two or more, unless otherwise indicated.
In the embodiment of the present disclosure, the character "/" indicates that the front and rear objects are an or relationship. For example, A/B represents: a or B.
The term "and/or" is an associative relationship that describes an object, meaning that there may be three relationships. For example, a and/or B, represent: a or B, or, A and B.
The term "corresponding" may refer to an association or binding relationship, and the correspondence between a and B refers to an association or binding relationship between a and B.
As shown in conjunction with fig. 1, an embodiment of the present disclosure provides a method for accessing a database, comprising:
s101, a server acquires database information to be queried in a data query request;
s102, the server acquires application system information and user information for initiating a data query request under the condition that a preset database table comprises database information to be queried; acquiring an initial query statement corresponding to the information of the database to be queried;
s103, the server side obtains target authority information according to the application system information, the user information and the database information to be queried; the target authority information is used for representing the authority of the application system and the user in the database corresponding to the database information to be queried;
s104, the server adds the target authority information to a preset position of an initial query sentence to obtain the query sentence;
s105, the server accesses a database corresponding to the database information to be queried by using the query statement.
By adopting the method for accessing the database, which is provided by the embodiment of the disclosure, the query statement is obtained by directly adding the authority of the application system and the user in the database corresponding to the information of the database to be queried to the preset position of the initial query statement, so that when the database corresponding to the information of the database to be queried is accessed by using the query statement, the data corresponding to the target authority information can be obtained, and therefore, under the condition that the authority rule is changed, the control code of the access authority of the database is not required to be modified, and the service code is not required to be modified, thereby reducing the cost of the later maintenance of the service system.
Optionally, acquiring the application system information and the user information that initiate the data query request includes: and acquiring the application system information for initiating the data query request from the data query request, and acquiring the user information for initiating the data query request from the data query request.
Optionally, the application system information includes an application system name; optionally, the application system is deployed at the client.
Optionally, the user information includes a user ID (Identity document).
In some embodiments, the client pushes a login page of the application system to a user, and obtains a user ID input by the user on the login page; the user logs in the application system through the client; and then the client acquires a data query request sent by the user in the application system and sends the data query request to the server.
Optionally, the database information to be queried includes a database name of the database to be queried. In some embodiments, where the database table includes a database name of the database to be queried, it is determined that the database table includes database information to be queried.
Optionally, obtaining the target authority information according to the application system information, the user information and the database information to be queried includes: acquiring a plurality of first authority information according to the application system information and the database information to be queried; the first authority information is used for representing the authority of the application system in a database corresponding to the database information to be queried; acquiring a plurality of pieces of second authority information according to the user information and the database information to be queried; the second authority information is used for representing the authority of the user in the database corresponding to the database information to be queried; and acquiring target authority information according to the first authority information and the second authority information.
As shown in conjunction with fig. 2, an embodiment of the present disclosure provides a method for accessing a database, comprising:
s201, a server acquires database information to be queried in a data query request;
s202, the server acquires application system information and user information for initiating a data query request under the condition that a preset database table comprises database information to be queried; acquiring an initial query statement corresponding to the information of the database to be queried;
s203, acquiring a plurality of pieces of first authority information according to the application system information and the database information to be queried; acquiring a plurality of pieces of second authority information according to the user information and the database information to be queried; acquiring target authority information according to the first authority information and the second authority information;
s204, the server adds the target authority information to a preset position of an initial query sentence to obtain the query sentence;
s205, the server accesses the database corresponding to the database information to be queried by using the query statement.
By adopting the method for accessing the database, which is provided by the embodiment of the disclosure, the query statement is obtained by directly adding the authority of the application system and the user in the database corresponding to the information of the database to be queried to the preset position of the initial query statement, so that when the database corresponding to the information of the database to be queried is accessed by using the query statement, the data corresponding to the target authority information can be obtained, and therefore, under the condition that the authority rule is changed, the control code of the access authority of the database is not required to be modified, and the service code is not required to be modified, thereby reducing the cost of the later maintenance of the service system.
Optionally, acquiring the target authority information according to each first authority information and each second authority information includes: the first authority information identical to the second authority information is determined as target authority information, and/or the second authority information identical to the first authority information is determined as target authority information. In the actual application process, different application systems comprise different authorities in databases corresponding to the database information to be queried, different users also comprise different authorities in databases corresponding to the database information to be queried, and the authorities of different users in the databases corresponding to the database information to be queried when logging in different application systems can be determined through the method provided by the embodiment.
Optionally, acquiring the plurality of first authority information according to the application system information and the database information to be queried, including: acquiring a plurality of pieces of first authority information which correspond to the application system information and the database information to be queried together from a database table; the database table stores the corresponding relation among the application system information, the database information to be queried and the first authority information.
Optionally, obtaining a plurality of second authority information according to the user information and the database information to be queried, including: acquiring a plurality of pieces of second authority information which correspond to the user information and the database information to be queried in the database table; the database table stores the corresponding relation among the user information, the database information to be queried and the second authority information.
As shown in conjunction with fig. 3, an embodiment of the present disclosure provides a method for accessing a database, comprising:
s301, a server acquires database information to be queried in a data query request;
s302, the server acquires application system information and user information for initiating a data query request under the condition that a preset database table comprises database information to be queried; acquiring an initial query statement corresponding to the information of the database to be queried;
s303, the server acquires a plurality of pieces of first authority information which correspond to the application system information and the database information to be queried together in a database table; the database table stores the corresponding relation among the application system information, the database information to be queried and the first authority information; acquiring a plurality of pieces of second authority information which correspond to the user information and the database information to be queried in the database table; the database table stores the corresponding relation among the user information, the database information to be queried and the second authority information; acquiring target authority information according to the first authority information and the second authority information;
s304, the server adds the target authority information to a preset position of an initial query sentence to obtain the query sentence;
s305, the server accesses a database corresponding to the database information to be queried by using the query statement.
By adopting the method for accessing the database, which is provided by the embodiment of the disclosure, the query statement is obtained by directly adding the authority of the application system and the user in the database corresponding to the information of the database to be queried to the preset position of the initial query statement, so that when the database corresponding to the information of the database to be queried is accessed by using the query statement, the data corresponding to the target authority information can be obtained, and therefore, under the condition that the authority rule is changed, the control code of the access authority of the database is not required to be modified, and the service code is not required to be modified, thereby reducing the cost of the later maintenance of the service system.
As shown in connection with fig. 4, an embodiment of the present disclosure provides a method for accessing a database, comprising:
s401, the client sends a data query request to the server;
s402, the server receives a data query request sent by the client;
s403, the server acquires the information of the database to be queried in the data query request;
s404, the server acquires application system information for initiating a data query request from the data query request and user information for initiating the data query request from the data query request under the condition that the database information to be queried is included in a preset database table; acquiring an initial query statement corresponding to the information of the database to be queried;
s405, the server acquires a plurality of pieces of first authority information which are corresponding to the application system information and the database information to be queried together in a database table; the database table stores the corresponding relation among the application system information, the database information to be queried and the first authority information; acquiring a plurality of pieces of second authority information which correspond to the user information and the database information to be queried in the database table; the database table stores the corresponding relation among the user information, the database information to be queried and the second authority information; acquiring target authority information according to the first authority information and the second authority information;
s406, the server adds the target authority information to a preset position of an initial query sentence to obtain the query sentence;
s407, the server accesses a database corresponding to the database information to be queried by utilizing the query statement to obtain data corresponding to the target authority information;
s408, the server side sends the data corresponding to the target authority information to the client side.
By adopting the method for accessing the database, which is provided by the embodiment of the disclosure, the query statement is obtained by directly adding the authority of the application system and the user in the database corresponding to the information of the database to be queried to the preset position of the initial query statement, so that when the database corresponding to the information of the database to be queried is accessed by utilizing the query statement, the data corresponding to the target authority information can be obtained, and the server side can replace the client side to access the database, thereby avoiding modifying the control code of the access authority of the database and the service code under the condition of changing the authority rule, and further reducing the later maintenance cost of the service system.
In some embodiments, the client pushes a login page of the application system to a user, and obtains a user ID input by the user on the login page; the user logs in the application system through the client. Then the client acquires a data query request sent by a user in an application system and sends the data query request to the server; the server receives a data query request sent by the client, acquires database information to be queried in the data query request, and acquires application system information and user information for initiating the data query request under the condition that a preset database table comprises the database information to be queried; acquiring an initial query statement corresponding to the information of the database to be queried; acquiring a plurality of pieces of first authority information which correspond to the application system information and the database information to be queried together from a database table; acquiring a plurality of pieces of second authority information which correspond to the user information and the database information to be queried in the database table; determining first authority information identical to the second authority information as target authority information and/or determining second authority information identical to the first authority information as target authority information; adding the target authority information to a preset position of an initial query sentence to obtain the query sentence; accessing a database corresponding to the database information to be queried by utilizing the query statement to obtain data corresponding to the target authority information; and then transmitting the data corresponding to the target authority information to the client.
As shown in conjunction with fig. 5, an embodiment of the present disclosure provides an apparatus for accessing a database, including a first obtaining module 501, a second obtaining module 502, a third obtaining module 503, an adding module 504, and an accessing module 505; the first obtaining module 501 is configured to obtain database information to be queried in a data query request; the second obtaining module 502 is configured to obtain, when the preset database table includes the database information to be queried, the application system information and the user information that initiate the data query request; acquiring an initial query statement corresponding to the information of the database to be queried; the third obtaining module 503 is configured to obtain target authority information according to the application system information, the user information and the database information to be queried; the target authority information is used for representing the authority of the application system and the user in the database corresponding to the database information to be queried; the adding module 504 is configured to add the target authority information to a preset position of the initial query statement, and obtain the query statement; the access module 505 is configured to access a database corresponding to the database information to be queried using the query statement.
By adopting the device for accessing the database, which is provided by the embodiment of the disclosure, the application system and the authority of the user in the database corresponding to the information of the database to be queried are added to the preset position of the initial query statement through the adding module, so that the query statement is obtained, and therefore, when the access module accesses the database corresponding to the information of the database to be queried by utilizing the query statement, the access module can obtain the data corresponding to the target authority information, and therefore, under the condition that the authority rule is changed, the control code of the access authority of the database is not required to be modified, and the service code is not required to be modified, so that the later maintenance cost of the service system can be reduced.
Optionally, the third obtaining module is configured to obtain the target authority information according to the application system information, the user information and the database information to be queried by the following ways: acquiring a plurality of first authority information according to the application system information and the database information to be queried; the first authority information is used for representing the authority of the application system in a database corresponding to the database information to be queried; acquiring a plurality of pieces of second authority information according to the user information and the database information to be queried; the second authority information is used for representing the authority of the user in the database corresponding to the database information to be queried; and acquiring target authority information according to the first authority information and the second authority information.
Optionally, acquiring the plurality of first authority information according to the application system information and the database information to be queried, including: acquiring a plurality of pieces of first authority information which correspond to the application system information and the database information to be queried together from a database table; the database table stores the corresponding relation among the application system information, the database information to be queried and the first authority information.
Optionally, obtaining a plurality of second authority information according to the user information and the database information to be queried, including: acquiring a plurality of pieces of second authority information which correspond to the user information and the database information to be queried in the database table; the database table stores the corresponding relation among the user information, the database information to be queried and the second authority information.
As shown in connection with fig. 6, an embodiment of the present disclosure provides an apparatus for accessing a database, including a processor (processor) 600 and a memory (memory) 601. Optionally, the apparatus may further comprise a communication interface (Communication Interface) 602 and a bus 603. The processor 600, the communication interface 602, and the memory 601 may communicate with each other via the bus 603. The communication interface 602 may be used for information transfer. The processor 600 may call logic instructions in the memory 601 to perform the method for accessing a database of the above-described embodiments.
By adopting the device for accessing the database, which is provided by the embodiment of the disclosure, the query statement is obtained by adding the authority of the application system and the user in the database corresponding to the information of the database to be queried to the preset position of the initial query statement, so that when the database corresponding to the information of the database to be queried is accessed by using the query statement, the data corresponding to the target authority information can be obtained, and therefore, under the condition that the authority rule is changed, the control code of the access authority of the database is not required to be modified, and the service code is not required to be modified, thereby reducing the cost of the later maintenance of the service system.
Further, the logic instructions in the memory 601 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product.
The memory 601 serves as a computer readable storage medium, and may be used to store a software program, a computer executable program, and program instructions/modules corresponding to the methods in the embodiments of the present disclosure. The processor 600 performs functional applications as well as data processing by running program instructions/modules stored in the memory 601, i.e. implements the method for accessing databases in the above-described embodiments.
The memory 601 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for functions; the storage data area may store data created according to the use of the terminal device, etc. In addition, the memory 601 may include a high-speed random access memory, and may also include a nonvolatile memory.
The embodiment of the disclosure provides an electronic device, which comprises the device for accessing a database.
By adopting the electronic equipment provided by the embodiment of the disclosure, the query statement is obtained by adding the authority of the application system and the user in the database corresponding to the database information to be queried to the preset position of the initial query statement, so that when the database corresponding to the database information to be queried is accessed by utilizing the query statement, the data corresponding to the target authority information can be obtained, and under the condition that the authority rule is changed, the control code of the database access authority is not required to be modified, and the service code is not required to be modified, so that the cost of the later maintenance of the service system can be reduced.
Optionally, the electronic device includes a computer, a mobile phone, a computer, a tablet, and the like.
The storage medium of the embodiment of the disclosure stores program instructions that, when executed, perform the method for accessing a database described above.
The disclosed embodiments provide a computer program product comprising a computer program stored on a computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, cause the computer to perform the above-described method for accessing a database.
The computer readable storage medium may be a transitory computer readable storage medium or a non-transitory computer readable storage medium.
Embodiments of the present disclosure may be embodied in a software product stored on a storage medium, including one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of a method according to embodiments of the present disclosure. And the aforementioned storage medium may be a non-transitory storage medium including: a plurality of media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or a transitory storage medium.
The above description and the drawings illustrate embodiments of the disclosure sufficiently to enable those skilled in the art to practice them. Other embodiments may involve structural, logical, electrical, process, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the sequence of operations may vary. Portions and features of some embodiments may be included in, or substituted for, those of others. Moreover, the terminology used in the present application is for the purpose of describing embodiments only and is not intended to limit the claims. As used in the description of the embodiments and the claims, the singular forms "a," "an," and "the" (the) are intended to include the plural forms as well, unless the context clearly indicates otherwise. Similarly, the term "and/or" as used in this application is meant to encompass any and all possible combinations of one or more of the associated listed. Furthermore, when used in this application, the terms "comprises," "comprising," and/or "includes," and variations thereof, mean that the stated features, integers, steps, operations, elements, and/or components are present, but that the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof is not precluded. Without further limitation, an element defined by the phrase "comprising one …" does not exclude the presence of other like elements in a process, method or apparatus comprising such elements. In this context, each embodiment may be described with emphasis on the differences from the other embodiments, and the same similar parts between the various embodiments may be referred to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method sections disclosed in the embodiments, the description of the method sections may be referred to for relevance.
Those of skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. The skilled artisan may use different methods for each particular application to achieve the described functionality, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the embodiments disclosed herein, the disclosed methods, articles of manufacture (including but not limited to devices, apparatuses, etc.) may be practiced in other ways. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the units may be merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form. The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to implement the present embodiment. In addition, each functional unit in the embodiments of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. In the description corresponding to the flowcharts and block diagrams in the figures, operations or steps corresponding to different blocks may also occur in different orders than that disclosed in the description, and sometimes no specific order exists between different operations or steps. For example, two consecutive operations or steps may actually be performed substantially in parallel, they may sometimes be performed in reverse order, which may be dependent on the functions involved. Each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Claims (11)
1. A method for accessing a database, comprising:
acquiring database information to be queried in a data query request;
acquiring application system information and user information for initiating the data query request under the condition that the preset database table comprises the database information to be queried; acquiring an initial query statement corresponding to the database information to be queried;
acquiring target authority information according to the application system information, the user information and the database information to be queried; the target authority information is used for representing the authority of an application system and a user in a database corresponding to the database information to be queried;
adding the target authority information to a preset position of the initial query statement to obtain a query statement;
and accessing a database corresponding to the database information to be queried by using the query statement.
2. The method of claim 1, wherein obtaining target rights information based on the application system information, the user information, and the database information to be queried comprises:
acquiring a plurality of first authority information according to the application system information and the database information to be queried; the first authority information is used for representing the authority of the application system in a database corresponding to the database information to be queried; acquiring a plurality of pieces of second authority information according to the user information and the database information to be queried; the second authority information is used for representing the authority of the user in the database corresponding to the database information to be queried;
and acquiring the target authority information according to the first authority information and the second authority information.
3. The method according to claim 2, wherein obtaining a number of first rights information from the application system information and the database information to be queried, comprises:
acquiring a plurality of pieces of first authority information which correspond to the application system information and the database information to be queried together from the database table; and the database table stores the corresponding relation among the application system information, the database information to be queried and the first authority information.
4. The method according to claim 2, wherein obtaining a number of second rights information from the user information and the database information to be queried, comprises:
acquiring a plurality of pieces of second authority information which correspond to the user information and the database information to be queried together from the database table; and the database table stores the corresponding relation among the user information, the database information to be queried and the second authority information.
5. An apparatus for accessing a database, comprising:
the first acquisition module is configured to acquire database information to be queried in the data query request;
the second acquisition module is configured to acquire the application system information and the user information for initiating the data query request under the condition that the database information to be queried is included in a preset database table; acquiring an initial query statement corresponding to the database information to be queried;
the third acquisition module is configured to acquire target authority information according to the application system information, the user information and the database information to be queried; the target authority information is used for representing the authority of an application system and a user in a database corresponding to the database information to be queried;
the adding module is configured to add the target authority information to a preset position of the initial query statement to obtain a query statement;
and the access module is configured to access the database corresponding to the database information to be queried by utilizing the query statement.
6. The apparatus of claim 5, wherein the third obtaining module configured to obtain the target rights information from the application system information, the user information, and the database information to be queried comprises:
acquiring a plurality of first authority information according to the application system information and the database information to be queried; the first authority information is used for representing the authority of the application system in a database corresponding to the database information to be queried; acquiring a plurality of pieces of second authority information according to the user information and the database information to be queried; the second authority information is used for representing the authority of the user in the database corresponding to the database information to be queried;
and acquiring the target authority information according to the first authority information and the second authority information.
7. The apparatus of claim 6, wherein obtaining a number of first rights information from the application system information and the database information to be queried comprises:
acquiring a plurality of pieces of first authority information which correspond to the application system information and the database information to be queried together from the database table; and the database table stores the corresponding relation among the application system information, the database information to be queried and the first authority information.
8. The apparatus of claim 6, wherein obtaining a number of second rights information from the user information and the database information to be queried comprises:
acquiring a plurality of pieces of second authority information which correspond to the user information and the database information to be queried together from the database table; and the database table stores the corresponding relation among the user information, the database information to be queried and the second authority information.
9. An apparatus for accessing a database comprising a processor and a memory storing program instructions, wherein the processor is configured to perform the method for accessing a database as claimed in any one of claims 1 to 4 when the program instructions are executed.
10. An electronic device comprising the apparatus for accessing a database of claim 9.
11. A storage medium storing program instructions which, when executed, perform the method for accessing a database as claimed in any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111273470.1A CN116069802A (en) | 2021-10-29 | 2021-10-29 | Method, device, electronic equipment and storage medium for accessing database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111273470.1A CN116069802A (en) | 2021-10-29 | 2021-10-29 | Method, device, electronic equipment and storage medium for accessing database |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116069802A true CN116069802A (en) | 2023-05-05 |
Family
ID=86171925
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111273470.1A Pending CN116069802A (en) | 2021-10-29 | 2021-10-29 | Method, device, electronic equipment and storage medium for accessing database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116069802A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116578548A (en) * | 2023-05-18 | 2023-08-11 | 广东星云开物科技股份有限公司 | Database management method, system, electronic equipment and storage medium |
-
2021
- 2021-10-29 CN CN202111273470.1A patent/CN116069802A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116578548A (en) * | 2023-05-18 | 2023-08-11 | 广东星云开物科技股份有限公司 | Database management method, system, electronic equipment and storage medium |
CN116578548B (en) * | 2023-05-18 | 2024-06-07 | 广东星云开物科技股份有限公司 | Database management method, system, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108255958B (en) | Data query method, device and storage medium | |
CN107798038B (en) | Data response method and data response equipment | |
CN107491519B (en) | Method and device for inquiring block chain account book | |
CN110851748A (en) | Short link generation method, server, storage medium and computer equipment | |
CN104572727A (en) | Data querying method and device | |
CN106909595B (en) | Data migration method and device | |
CN113282580A (en) | Method, storage medium and server for executing timed task | |
CN112328641A (en) | Multi-dimensional data aggregation method and device and computer equipment | |
CN109981569A (en) | Network system access method, device, computer equipment and readable storage medium storing program for executing | |
CN116069802A (en) | Method, device, electronic equipment and storage medium for accessing database | |
CN112861005A (en) | Method, device and equipment for information push | |
CN111767481A (en) | Access processing method, device, equipment and storage medium | |
CN113285933A (en) | User access control method and device, electronic equipment and storage medium | |
CN115879120A (en) | Method and device for acquiring user right, electronic equipment and storage medium | |
CN104239307A (en) | User information storage method and system | |
CN117014860B (en) | Method and device for downloading configuration file, ESIM card and storage medium | |
CN110119337B (en) | Data analysis method and device and server | |
JP2014524210A (en) | Generate variable length nonce | |
CN115840836A (en) | Method and device for storing data, electronic equipment and storage medium | |
CN116781687A (en) | Method and device for downloading file, electronic equipment and storage medium | |
CN112714438B (en) | Method and device for distributing Host equipment ID and electronic equipment | |
CN108255533B (en) | System configuration changing method and device | |
CN113032820A (en) | File storage method, access method, device, equipment and storage medium | |
CN116069978A (en) | Method, device, electronic equipment and storage medium for storing data | |
CN110795604A (en) | Method, apparatus, computing device and medium for generating transaction serial number |
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 |