WO2017088702A1 - Editing method and device for database editor - Google Patents

Editing method and device for database editor Download PDF

Info

Publication number
WO2017088702A1
WO2017088702A1 PCT/CN2016/106327 CN2016106327W WO2017088702A1 WO 2017088702 A1 WO2017088702 A1 WO 2017088702A1 CN 2016106327 W CN2016106327 W CN 2016106327W WO 2017088702 A1 WO2017088702 A1 WO 2017088702A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
content
field
editing
location
Prior art date
Application number
PCT/CN2016/106327
Other languages
French (fr)
Chinese (zh)
Inventor
胡南杰
Original Assignee
阿里巴巴集团控股有限公司
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 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2017088702A1 publication Critical patent/WO2017088702A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • 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/23Updating

Definitions

  • the present invention relates to the field of databases, and in particular to a method and apparatus for editing a database editor.
  • the database is a warehouse that organizes, stores and manages data according to the data structure.
  • the user needs to use the database editor to edit the contents of the database.
  • Common database editors are SQL, Access, Oracle, and so on.
  • the completion of the database editor prompt is not accurate.
  • the database editor pre-defines all the keywords on the network side. When the user inputs a character, the character is matched with a predefined keyword to obtain the completion content of the character. Since various keywords may appear anywhere in the database, and the content input by the user is not parsed between the character matches, the database editor will prompt the user to fill in the content automatically input. The entire content is not accurate.
  • the embodiment of the invention provides a method and a device for editing a database editor, so as to at least solve the problem that when the database editor is used to edit the database content in the related art, the content input by the user is automatically analyzed because the content input by the user is not analyzed. The technical content of the incomplete content of the completion of the prompt is complete.
  • an editing method of a database editor including: when listening to editing a database content in a database editor, determining an editing location, wherein the editing location is currently being edited The location of the content in the database content; obtaining the attribute information associated with the editing location by parsing the database content currently edited in the database editor; determining whether there is content matching the editing location according to the attribute information; determining presence and editing In the case of a content that matches the position, a prompt message is output.
  • an editing apparatus for a database editor including: a first determining module, configured to determine an editing position when listening to editing the database content in the database editor, The editing location is the location of the content currently being edited in the database content; the parsing module is configured to obtain the attribute information associated with the editing location by parsing the database content currently edited in the database editor; the second determining module, And configured to determine, according to the attribute information, whether there is content that matches the edit position; and an output module, configured to output the prompt information if it is determined that the content that matches the edit position exists.
  • the edit position is determined, wherein the edit position is the position of the content currently being edited in the database content; by parsing the current database editor The edited database content, obtaining attribute information associated with the edit position; determining whether there is content matching the edit position according to the attribute information; and outputting the prompt information when determining that there is content matching the edit position,
  • the attribute information matching the editing position is obtained, and the content matching the editing position is completed in the editing position according to the attribute information, so that the user is prompted when using the database editor on the network side.
  • FIG. 1 is a hardware structural block of a computer terminal for editing a database editor according to an embodiment of the present invention
  • FIG. 2 is a flow chart of a method of editing a database editor in accordance with an embodiment of the present invention
  • FIG. 3 is a schematic diagram of an implementation architecture of an editing method of a database editor according to an embodiment of the present invention
  • FIG. 4 is a flow chart of an alternative method of editing a database editor in accordance with an embodiment of the present invention.
  • FIG. 5 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention.
  • FIG. 6 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention.
  • FIG. 7 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention.
  • FIG. 8 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention.
  • FIG. 9 is a flow chart of a preferred method of editing a database editor, in accordance with an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of an editing apparatus of a database editor according to an embodiment of the present invention.
  • FIG. 11 is a schematic diagram of an editing apparatus of an optional database editor, in accordance with an embodiment of the present invention.
  • FIG. 12 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention.
  • FIG. 13 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention.
  • FIG. 14 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention.
  • FIG. 15 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention.
  • 16 is a schematic diagram of another optional editing device of a database editor, in accordance with an embodiment of the present invention.
  • FIG. 17 is a structural block diagram of a computer terminal according to an embodiment of the present invention.
  • a database is a collection of data that is stored together in a certain way, can be shared by multiple users, has as little redundancy as possible, and is independent of the application.
  • Database editor a tool for editing database content in a database.
  • a method embodiment of a method for editing a database editor there is also provided a method embodiment of a method for editing a database editor, and it should be noted that the steps shown in the flowchart of the drawing may be in a computer system such as a set of computer executable instructions. The steps shown and described may be performed in a different order than the ones described herein, although the logical order is shown in the flowchart.
  • FIG. 1 is a hardware structural block diagram of a computer terminal for editing a database editor according to an embodiment of the present invention.
  • computer terminal 10 may include one or more (only one shown) processor 102 (processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA)
  • processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA)
  • a memory 104 for storing data
  • a transmission device 106 for communication functions.
  • computer terminal 10 may also include more or fewer components than those shown in FIG. 1, or have a different configuration than that shown in FIG.
  • the memory 104 can be used to store software programs and modules of application software, such as program instructions/modules corresponding to the editing method of the database editor in the embodiment of the present invention, and the processor 102 runs the software programs and modules stored in the memory 104, thereby Perform various function applications and data processing, that is, implement the editing method of the above database editor.
  • Memory 104 may include high speed random access memory, and may also include non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory.
  • memory 104 may further include memory remotely located relative to processor 102, which may be coupled to computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • Transmission device 106 is for receiving or transmitting data via a network.
  • the network specific examples described above may include a wireless network provided by a communication provider of the computer terminal 10.
  • the transmission device 106 includes a Network Interface Controller (NIC) that can be connected to other network devices through the base station. Communicate with the Internet.
  • the transmission device 106 can be a Radio Frequency (RF) module for communicating with the Internet wirelessly.
  • NIC Network Interface Controller
  • RF Radio Frequency
  • FIG. 2 is a flow chart of a method of editing a database editor in accordance with an embodiment of the present invention.
  • the editing method of the database editor of this embodiment may include the following steps:
  • step S12 when the database content is edited in the database editor, the editing position is determined, wherein the editing position is the position of the content currently being edited in the database content.
  • each data table may include at least one column, and each column may include at least one field, wherein each table or each column corresponds to a unique one.
  • Table 1 is the data table X1 in the database. As shown in Table 1, the X1 table includes two columns A and B, wherein the A column includes Aciton, Actor, and the B column includes Black, Baby.
  • the number of tables and columns in the database is large, and different tables and columns are distinguished by different identifiers, so that the effect of quickly and accurately finding the data in the desired table or column from the database can be achieved.
  • the database editor can be a tool for editing the contents of the database in the database, such as SQL, Access, Oracle, and so on. Users can edit the database contents in the database by using the database editor on the network side to manage the data in the database.
  • Database content that users can edit using the database editor can include keywords (such as selcet, from, where, etc.), tables, columns, and so on.
  • the user can edit the database content anywhere in the database content, and the user's edit position to the database content can be the location of the content currently being edited by the user in the database content. Similar to the Word editor, the editing location can be the location of the cursor in the editing interface, or the location of other icons used for marking.
  • the embodiment determines the position where the blinking cursor is located in the editing interface as the editing position of the current user, and is highlighted in the editing interface in the form of a blinking cursor, which can facilitate the user to quickly and accurately locate the editing position, thereby improving user editing efficiency.
  • the embodiment can also use a keyboard or a mouse to change the editing position, so that the user can conveniently edit the database content at any position, which greatly improves the user's editing efficiency of the database content.
  • the embodiment can design an event listener based on any database editor, that is, adding a layer of event listener on top of the database editor, and using the event listener to monitor whether the user is editing in the database.
  • the contents of the database are edited.
  • the event listener can also read the location of the cursor, thereby determining the editing position of the current user when editing the database content. And triggering subsequent actions to parse the database content edited by the user.
  • step S14 the attribute information associated with the editing position is obtained by parsing the database content currently edited in the database editor.
  • the embodiment intercepts the database content edited by the user at the current editing position, and parses the intercepted database content.
  • the user-edited database content may be a character or a character string input by the user, and the database content edited by the user may be located in front of the editing position or may be located behind the editing position.
  • the editing position in the editing interface is the position where the blinking cursor is located.
  • the character or character string in front of the blinking cursor is preferably intercepted.
  • This embodiment parses the database content currently edited in the database editor, and may include parsing the database content edited by the user and which type the database content belongs to, such as tables, columns, and keywords.
  • the embodiment may set a SQL parser for parsing the SQL content edited by the user at the edit position in the SQL editor, and determine which type of SQL content the user edits belongs to.
  • This embodiment can obtain the attribute information associated with the edit position by parsing the database content currently edited in the database editor, wherein the attribute information associated with the edit position can include the database content edited by the user at the edit position.
  • the type of database content that the user edits That is, the attribute information associated with the edit location in this embodiment may be the database content edited by the user at the edit location and the type of the database content.
  • the database content edited in the database editor is parsed, the attribute information associated with the edited position is obtained, and the database content edited by the user is complemented according to the attribute information associated with the edited position obtained after the parsing, It can improve the accuracy of complementing the database content edited by the user at the editing position, thereby achieving the effect of improving the user experience.
  • step S16 it is determined according to the attribute information whether there is content matching the editing position.
  • the embodiment pre-stores various tables and fields for compiling the user-edited database content in the source database, and only caches some of the more frequently used database contents in the local cache. For example, use more frequent keywords. This is beneficial to alleviate the burden on the network, and can avoid the problem that the network page will hang when the amount of data in the local cache is large, thereby achieving the effect of improving the user experience.
  • the embodiment may first search, from the local cache, whether there is content that matches the type of the database edited by the user, such as If there is no content in the local cache that matches the content of the database edited by the user, the source database is asynchronously requested, and the content of the source database is matched with the content of the database edited by the user. If there is content in the local cache or the source database that matches the content of the database edited by the user, step S18 is performed. If there is no type and content in the local cache and the source database, the content of the database is matched with the content edited by the user. The content ends the completion of the user-edited database content, and continues to listen to whether the user edits the database content in the database editor.
  • the embodiment may set a data cache component in a database editor, the data cache component may be used to cache some fixed keywords, and may also be used to request data from a source database in the background, and will be from the source.
  • the data requested in the database is double buffered.
  • the embodiment uses the combination of the local cache and the source database to store the database content for compiling the user edit, and first determines whether there is content matching the edit position according to the attribute information associated with the edit location, first from the local cache. Find, when you can't find the content that matches the edit location, look it up from the source database.
  • step S18 in the case where it is determined that there is content matching the editing position, the prompt information is output.
  • the embodiment when it is determined that there is content in the local cache or the source database that matches the edit position, the embodiment outputs prompt information, wherein the output prompt information is mainly used to prompt the user to complete the edit position.
  • Database content may be one or more, and when the content matching the editing position is plural, the embodiment may be displayed one by one in the form of a list. Users can use the mouse or keyboard to select the database content they need in the display list to automatically complete the database content in the editing position.
  • the database content of the editing location is complemented by displaying the prompt information for the user to select, which is beneficial to ensure the accuracy of the completed database content, and at the same time increase the user selection function, thereby increasing the interaction function with the user and improving the user's use.
  • the effect of the experience is complemented by displaying the prompt information for the user to select, which is beneficial to ensure the accuracy of the completed database content, and at the same time increase the user selection function, thereby increasing the interaction function with the user and improving the user's use.
  • the embodiment may further fill the content matching the editing position directly in the editing position, and the manner may be applicable to the obtained scene that has only one content matching the editing position.
  • the embodiment may further fill the content matching the editing position directly in the editing position, and the manner may be applicable to the obtained scene that has only one content matching the editing position.
  • the embodiment may set an automatic prompt component in the database editor, and the automatic prompt component may be used to display the matched data on the database editor, when the user selects a certain one from the displayed data.
  • the data content of the input is automatically completed in the database editor after the data.
  • FIG. 3 is a schematic diagram of an implementation architecture of an editing method of a database editor according to an embodiment of the present invention. As shown in FIG. 3, the implementation architecture 300 may include:
  • the event listener 32 which can be implemented based on any database editor, adds a layer of event listener on top of the database editor, can be used to listen to the database content edited by the user at the edit position, and is used to trigger subsequent user pairs.
  • the edited database content is parsed.
  • the parser 34 when the database editor is a SQL editor, the parser 34 is a SQL parser, which can be used to parse the database content edited by the user at the editing location, and determine which type of database content the editing location belongs to.
  • the data cache component 36 can be used to cache some fixed keywords in the local cache, and can also be used to asynchronously request data from the source database in the background through the network, and the requested data is secondarily cached in the local cache.
  • the automatic prompt component 38 can be used to display data matching the editing position on the database editor, and the user automatically selects the database content edited by the user in the database editor after selecting the required database content.
  • step S12 to step S18 the embodiment parses the database content edited by the user at the edit position, and searches from the local cache or the source database according to the attribute information of the edited edit position obtained by the parsing.
  • the database content matching the editing position can solve the related content in the related art when the database editor is used to edit the database content, because the content input by the user is not parsed, and the content of the prompt is completed when the content input by the user is automatically completed.
  • Inaccurate technical problems in order to edit the database content in the database editor, quickly and accurately complete the database content matching the editing location, and reduce the network burden when the amount of data is large, to ensure that the web page will not hang Technical effect.
  • FIG. 4 is a flowchart of an optional editing method of the database editor according to an embodiment of the present invention.
  • step S14 is currently edited in the database editor by parsing.
  • the database content, obtaining the attribute information associated with the editing location may include the following steps:
  • Step S142 intercepting the database statement to be analyzed in the database content according to the editing position.
  • the edit position is the position determined by step S12, and the database statement to be analyzed may be from the edit position to the first database statement end character, and the first database after the edit position
  • the statement contained in the statement end character is different according to the database editor.
  • the end character of the database statement in the SQL editor is a semicolon ";", that is, the statement between the two semicolons where the edit position is located is to be analyzed. Database statement.
  • Step S144 determining a field type of each field included in the database statement according to a predefined type attribute.
  • the field types include: tables, columns, and keywords.
  • the predefined type attributes may include tables, columns, and keywords.
  • the database statement can include at least one field, and the field types of each field can be the same or different.
  • the embodiment analyzes the field type of each field in the database statement according to the predefined type attribute, wherein the field type of each field may be a table, a column or a keyword. This embodiment analyzes the field type of each field in the database statement in order to accurately analyze the field type of the field at the editing position to achieve the purpose of accurately complementing the database content at the editing location.
  • Step S146 determining the field type of the field located in the edit position in the database statement according to the field type of each field.
  • the edit position may be located at a position where any one of the database statements is located, and the embodiment preferably determines the first field before the edit position as the field of the edit position, the determination manner and Word.
  • the characters at the cursor position in the editor are determined in the same way.
  • the field attribute of each field in the database statement can be determined by step S162, and when the field located at the edit position is determined, the field type can be determined.
  • Step S148 generating attribute information associated with the edit position according to the field type and the field content of the field located at the edit position.
  • the attribute information associated with the edit location may be the field content and field type of the field at the edit location.
  • the field content of the field of the edit position can be obtained by intercepting the database statement to be analyzed according to the edit position in step S142, and the field of the field of the edit position can be acquired through step S144 and step S146.
  • the embodiment may store the attribute information associated with the edit position, so that when the user edits the database content for the edit position again, The attribute information associated with the editing position that has been stored before can be quickly called, and the editing efficiency of the user's database content can be improved.
  • the attribute information associated with the edit position can be accurately acquired, so as to accurately complement and edit the edit information according to the attribute information.
  • the location matches the database content.
  • step S12 of the embodiment determines that the edit position can be the edit position by reading the cursor position displayed in the database content by the cursor, wherein the field content at the edit position is a character located before the cursor position or String.
  • This embodiment determines the position of the edit position and the edit position by reading the position of the cursor.
  • the content of the paragraph is convenient and simple, and is more in line with the user's editing habits.
  • FIG. 5 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 5, step S16 determines whether presence and editing are performed according to the attribute information. Before the location matches the content, the editing method of the database editor of this embodiment may further include the following steps:
  • step S15 it is determined whether the field type of the field located at the editing position is a keyword.
  • This embodiment predefines keywords used by the database editor, such as selcet, from, with, and the like.
  • the field type of the field at the edit position can be obtained by step S146 of this embodiment. If the field type of the field located at the editing position is a keyword, the process returns to step S12 to continue to listen to whether the database editor edits the database content; if the field type of the field located at the editing position is not a keyword, the process proceeds to step S16. A step of determining whether there is content matching the edit position based on the attribute information is performed.
  • the prior art has been able to automatically perform the completion of the keywords in the database editor, so this embodiment only for the case where the field type of the field located at the editing position is not a keyword, how to automatically complete the database at the editing position Content, such as tables and fields. Due to the large amount of data of tables and fields, this embodiment provides an accurate automatic completion scheme for tables and fields, which can achieve the effect of alleviating network pressure and optimizing network page performance.
  • FIG. 6 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 6, step S16 determines whether presence and editing are performed according to the attribute information. The content that matches the location can include the following steps:
  • Step S162 querying from the local cache according to the attribute information whether there is content matching the edit position. If the query is successful in the local cache, step S18 is executed to generate and output the prompt information; if the query fails in the local cache, step S164 is performed.
  • Step S164 asynchronously sending the query request to the source database, and querying from the source database whether there is content matching the edited location. If the query is successful, step S18 is executed to generate and output prompt information; if the query fails, the current event is ended, wherein the query request may include attribute information associated with the edit position, and the attribute information may include a field located at the edit position. Field type and field content.
  • some partially used database contents are stored in the local cache in advance, and tables and fields having a large amount of data are stored in the source database in the background.
  • the embodiment first queries from the local cache whether there is content matching the edit position, and if there is no content matching the edit position in the local cache, the source is redirected to the source.
  • the database asynchronously sends a query request, and queries the source database for content that matches the edit location.
  • FIG. 7 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention.
  • step S162 queries the local cache according to the attribute information. Whether there is content matching the editing location can include the following steps:
  • Step S1622 Query whether there is content in the local cache that is the same as the field type and the content of the field. If the query fails, step S1624 is performed; if the query is successful, step S18 is performed.
  • the content matching the editing position in this embodiment is the same database content as the field content and field type of the editing location.
  • Querying from the local cache whether there is content matching the edit location includes querying from the local cache whether there is database content that is the same as the field content and field type of the edit location.
  • the embodiment considers the field content and the field type of the editing position when querying the database content matching the editing position, which can improve the accuracy of the query result, and can automatically improve the accuracy of the database content at the editing position, thereby improving The effect of the user experience.
  • step S1624 it is determined whether the field type is a table field or a column field. If the field type is a table field or a column field, the process proceeds to step S164 to perform a step of asynchronously sending a query request to the source database; if the field type is not a table field or a column field, the event is ended.
  • a keyword is stored in the local cache.
  • the edit location needs to be further determined. Whether the field type is a table field or a column field. If it is determined that it is a table field or a column field, since the table and the field are stored in the source database in the background, the embodiment will asynchronously send the query request to the source database, and query from the source database whether there is content matching the edit position. If it is judged that it is not a table field or a column field, it indicates that the field type of the key position does not belong to the database content that can be automatically completed, and the completion operation is directly ended.
  • This embodiment can improve the accuracy of automatically completing the database content of the edit position by accurately parsing the field type and the field content of the edit position.
  • the accuracy of complementing the database content of the editing location can be further improved.
  • the real-time asynchronous request method can ensure that the webpage does not hang when the amount of data is large, and the performance of the webpage is optimized, and the user experience is improved.
  • outputting the prompt information in step S18 may include: displaying the prompt information in a database editor, and/or populating the prompt information to an edit position, wherein the prompt information may include: Matching content.
  • This embodiment provides two different completion modes for the user, and the user can adjust according to actual needs. The use of automatic filling saves user operations and improves user editing efficiency of database content. By displaying the user's own choice, the database content required by the user can be accurately determined, the complementation precision of the database content is improved, the interaction with the user is increased, and the user experience is improved.
  • FIG. 8 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 8, after determining the editing position in step S12, the implementation is performed.
  • the editing method of the database editor of the example may further include the following steps:
  • step S13 the content before or after the editing position is scanned in the database content.
  • step S14 parse the database content.
  • the comment character or the comment string is used to indicate that the database statement is a statement for interpretability and does not belong to a valid database statement.
  • the database editor does nothing with database statements that add comment characters or comment strings.
  • the comment character or comment string may be located between the labels "//*" and "*//”, and the comment character or comment string may be a Chinese character, an identifier for interpretation, or the like.
  • Valid database statements are statements that do not contain comment characters or comment strings and that contain the end of the database statement.
  • the SQL statement in the SQL editor is a statement between two semicolons ";", where the semicolon ";” is the end of the database statement in the SQL editor.
  • the embodiment can ensure the validity of the database statement to be analyzed at the intercepted editing position, thereby improving the parsed attribute associated with the editing position.
  • the accuracy of the information, the precise positioning needs to complete the database content, and improve the effect of the user's use of the feed.
  • FIG. 9 is a flow chart of a preferred method of editing a database editor, as shown in FIG. 9, including the following steps, in accordance with an embodiment of the present invention:
  • step S21 the user inputs the content in the database editor.
  • the database editor in this preferred embodiment can be SQL, Access, Oracle, and the like.
  • the user can use the database editor to edit the database content at any location to manage the data in the database.
  • the user can edit the location of the database content to the location of the content currently being edited by the user in the database content.
  • the contents of the database that the user can edit using the database editor may include keywords (such as select, from, where, etc.), tables, columns, and the like.
  • step S22 the input event is monitored.
  • the preferred embodiment can set event monitoring in the database editor Listener for listening to user input in the database editor. When the event listener listens to the user entering content in the database editor, the event listener triggers the action of parsing the user's input.
  • step S23 the input content is parsed.
  • the preferred embodiment intercepts the database content edited by the user at the current editing position and parses the intercepted database content.
  • the preferred embodiment parses the user's input content, ie, the database content currently edited in the database editor, and may include parsing the database content edited by the user and which type of database content, such as tables, columns, and keywords.
  • the preferred embodiment can set a parser for parsing the content edited by the user at the edit location in the database editor and determining which type of database content the user edits belongs to.
  • This embodiment can obtain the attribute information associated with the edit position by parsing the database content currently edited in the database editor, wherein the attribute information associated with the edit position can include the database content edited by the user at the edit position. And the type of database content that the user edits.
  • step S23 parsing the input content may include steps S231 to S234, where:
  • Step S231 intercepting the database statement to be analyzed according to the editing position.
  • the database statement to be analyzed in the preferred embodiment may be from the edit position to the first database statement end character, and the statement contained in the first database statement end character after the edit position.
  • the end of the database statement varies according to the database editor. For example, the end of the database statement in the SQL editor is a semicolon ";".
  • Step S232 determining a field type of each field in the database statement according to a predefined type attribute.
  • the predefined type attributes in the preferred embodiment may include tables, columns, and keywords.
  • the database statement can include at least one field, and the field types of each field can be the same or different. This embodiment analyzes the field type of each field in the database statement in order to accurately analyze the field type of the field at the editing position to achieve the purpose of accurately complementing the database content at the editing location.
  • Step S233 obtaining a field type of a field located at the editing position.
  • the preferred embodiment may determine the first field before the edit location as the field of the edit location. After determining the field properties of each field in the database statement and determining the field at the edit location, the field type of the field at the edit location can be determined.
  • Step S234 generating attribute information associated with the edit position according to the field type and the field content of the field located at the edit position.
  • the attribute information associated with the edit location in the preferred embodiment may be the field content and field type of the field at the edit location.
  • the attribute information associated with the edit position can be accurately acquired, so as to accurately complement and edit the edit information according to the attribute information.
  • the location matches the database content.
  • step S24 it is edited whether the field type of the location is a keyword.
  • the preferred embodiment is pre-defined with keywords used by the database editor, such as select, from, with, and the like. If the field type of the edit location is a keyword, return to step 22 to continue listening for the input event; if the field type of the edit location is not a keyword, step S25 is performed.
  • step S25 the database content matching the editing location is queried.
  • the preferred embodiment pre-stores various tables and fields for compiling the user-edited database content in the source database, and only caches some of the more frequently used database contents in the local cache, such as using more frequent keywords. .
  • it may first search for the content that matches the type of the database edited by the user, and if there is no type and content in the local cache. If the content edited by the user matches the contents of the database, the source database is asynchronously requested, and the content of the source database is matched with the content of the database edited by the user.
  • the preferred embodiment can also set a data cache component in the database editor, which can be used to cache some fixed keywords, and can also be used to request data from the source database in the background, and will request from the source database.
  • the data is buffered twice.
  • step S25 may include steps S251 to S256, where:
  • Step S251 receiving the field type and the field content of the field located at the editing position.
  • the content matching the editing position in the preferred embodiment is the same database content as the field content and field type of the editing location.
  • the field type and field content of the field at the edit position can be obtained by step S231 and step S234 in the preferred embodiment.
  • Step S252 determining whether there is content in the local cache that is the same as the field type and the field content. If not, step S253 is performed; if yes, step S254 is performed.
  • Querying from the local cache whether there is content matching the edit location includes querying from the local cache whether there is database content that is the same as the field content and field type of the edit location. The embodiment considers the field content and the field type of the editing position when querying the database content matching the editing position, so that the accuracy of the query result can be improved, and the accuracy of the database content at the editing position can be automatically completed.
  • Step S253 determining whether the field type is a table field or a column field. If yes, step S255 is performed; if not, step S256 is performed.
  • a keyword is stored in the local cache. When there is no database content in the local cache that has the same field type as the edit location, indicating that the field type of the edit location is not a keyword, it is necessary to further determine whether the field type of the edit location is a table field or Column field. If it is determined that it is a table field or a column field, since the table and the field are stored in the source database in the background, the preferred embodiment will asynchronously send the query request to the source. Database, from the source database to query whether there is content matching the editing location. If it is judged that it is not a table field or a column field, it indicates that the field type of the key position does not belong to the database content that can be automatically completed, and the completion operation is directly ended.
  • step S254 prompt information is generated.
  • step S255 the query request is sent asynchronously to the source database.
  • the source database is queried whether there is content matching the editing location. If the query is successful, the output prompt information is generated; if the query fails, the current event is ended, wherein the query request may include attribute information associated with the editing location.
  • step S256 the event is ended.
  • the preferred embodiment first queries the local cache whether there is content matching the edit position, and if there is no content matching the edit position in the local cache, then the source database is asynchronous. Send a query request to query the source database for content that matches the edit location.
  • the preferred embodiment can ensure the automatic completion of the table and the field in the case of a large amount of data, without causing the problem that the network page hangs, thereby achieving the effect of optimizing the performance of the web page and improving the user experience.
  • the prompt information is output.
  • the output prompt information is mainly used to prompt the user to complete the database content in the edit position.
  • the preferred embodiment can be displayed one by one in the form of a list. Users can use the mouse or keyboard to select the database content they need in the display list to automatically complete the database content in the editing position, which is beneficial to ensure the accuracy of the completed database content, and at the same time increase the user selection function. Increase the interaction with the user and improve the user experience.
  • the preferred embodiment may further fill the content matching the editing position directly in the editing position, and by directly filling the content matching the editing position to the editing position, the length of time for the user to edit the database content can be shortened, and the user is improved. The efficiency of editing database content.
  • the preferred embodiment parses the database content edited by the user at the edit position, and searches for the database matching the edited location from the local cache or the source database according to the attribute information of the edited edit position.
  • the content can solve the technical problem that when the database editor is used to edit the database content in the related art, the content input by the user is not parsed, and the content of the completion of the prompt is not accurate when the content input by the user is automatically completed, thereby realizing
  • the editing method of the database editor according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but In many cases the former is a better implementation.
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • FIG. 10 is a schematic diagram of an editing apparatus of a database editor according to an embodiment of the present invention. As shown in FIG. 10, the apparatus includes:
  • the first determining module 22 is configured to determine an editing location when the database content is edited in the database editor, wherein the editing location is a location of the content currently being edited in the database content;
  • the parsing module 24 is configured to: Obtaining the attribute information associated with the editing location by parsing the database content currently edited in the database editor;
  • the second determining module 26 is configured to determine, according to the attribute information, whether there is content that matches the editing location;
  • the output module 28 uses In the case where it is determined that there is content matching the editing position, the prompt information is output.
  • first determining module 22 in this embodiment may be used to perform step S12 in the first embodiment of the present application.
  • the parsing module 24 in this embodiment may be used to perform step S14 in the first embodiment of the present application.
  • the second determining module 26 in this embodiment may be used to perform step S16 in the first embodiment of the present application.
  • the output module 28 in the embodiment may be used to perform step S18 in the first embodiment of the present application.
  • the first determining module 22, the parsing module 24, the second determining module 26, and the output module 28 correspond to steps S12 to S18 in the first embodiment, and the modules and corresponding steps are implemented. It is the same as the application scenario, but is not limited to the content disclosed in the above embodiment. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
  • FIG. 11 is a schematic diagram of an optional editing device of a database editor according to an embodiment of the present invention.
  • the parsing module 24 may include: an intercepting module 242, configured to: The database statement to be analyzed in the database content is intercepted according to the editing position; the first sub-determination module 244 is configured to follow the predefined The type attribute determines a field type of each field included in the database statement, wherein the field type includes: a table, a column, and a keyword; and a second sub-determination module 246 is configured to determine that the database statement is located according to the field type of each field Editing the field type of the field of the location; the generating module 248 is configured to generate attribute information associated with the editing location according to the field type and the field content of the field located at the editing location.
  • the foregoing intercepting module 242, the first sub-determining module 244, the second sub-determining module 246, and the generating module 248 respectively correspond to step S142 to step S148 in the first embodiment, and the foregoing modules and corresponding steps are implemented.
  • the examples and application scenarios are the same, but are not limited to the contents disclosed in the above embodiments.
  • the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
  • the editing apparatus of the database editor of the embodiment may further include: a reading module, configured to read a cursor position displayed by the cursor in the database content as an editing position, where the editing position is located
  • the field content is a character or string that precedes the cursor position.
  • FIG. 12 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention.
  • the editing device of the database editor of the embodiment further The first determining module 25 is configured to determine whether the field type of the field located at the editing position is a keyword, and if the field type of the field located in the editing position is a keyword, return to the first determining module 22 to continue.
  • the database editor is listening to whether the database content is edited; if the field type of the field located at the edit position is not a keyword, the entry second determination module 26 performs a step of determining whether there is content matching the edit position based on the attribute information.
  • the first judging module 25 corresponds to the step S15 in the first embodiment, and the module is the same as the example and the application scenario implemented in step S15, but is not limited to the content disclosed in the foregoing embodiment. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
  • FIG. 13 is a schematic diagram of another optional editing device of the database editor according to an embodiment of the present invention.
  • the second determining module 26 may include: a query module 262. And for querying, from the local cache, whether there is content matching the edit location according to the attribute information, wherein when the query in the local cache succeeds, the input output module 28 generates prompt information; and the request module 264 is configured to cache locally.
  • the query fails, the query request is sent asynchronously to the source database, and the source database is queried whether there is content matching the edit position. If the query is successful, the output module 28 is generated to generate the prompt information. If the query fails, the current information is ended. An event in which the query request includes attribute information.
  • the query module 262 and the request module 264 correspond to the step S162 and the step S164 in the first embodiment.
  • the foregoing modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the foregoing embodiments. . It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
  • FIG. 14 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention.
  • the query module 262 may include: a first sub-query module. 2622, configured to query whether there is content in the local cache that is the same as the field type and the field content; the second determining module 2624 is configured to determine, in the case that the query fails, whether the field type is a table field or a column field, where the field is When the type is a table field or a column field, the entry request module 264 performs the step of asynchronously sending a query request to the source database; when the field type is not a table field or a column field, the event is ended.
  • the attribute information includes: the field type and the field content of the field at the editing position.
  • first sub-query module 2622 and the second judging module 2624 correspond to step S1622 and step S1624 in the first embodiment.
  • the foregoing modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the foregoing implementation. The content disclosed in the example. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
  • FIG. 15 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention.
  • the output module 28 includes: a display module 282 for The prompt information is displayed in the database editor; and/or the filling module 284 is configured to fill the prompt information to the editing location, wherein the prompt information includes: content that matches the editing location.
  • FIG. 16 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention.
  • the editing device of the database editor of the embodiment further The method may include: a scanning module 23, configured to scan content in the database content before or after the editing position, wherein the content is ended when the content before or after the editing position includes a comment character or a comment string;
  • the parsing module 24 proceeds to perform the step of parsing the database content.
  • the scanning module 23 corresponds to the step S13 in the first embodiment, and the module is the same as the example and the application scenario implemented in step S13, but is not limited to the content disclosed in the foregoing embodiment. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
  • the editing device of the database editor of the embodiment parses the database content edited by the user at the editing position through the modules 22 to 28, and searches and edits the location from the local cache or the source database according to the attribute information of the edited edit position.
  • the matching database content can solve the related art in the use of the database editor to edit the database content, because the user input content is not parsed, resulting in the completion of the user input content when the completion of the prompt is not accurate Technical problems, in turn, when editing the database content in the database editor, quickly and accurately complete the database content that matches the editing location, and slow down the network burden when the amount of data is large, so as to ensure that the network page does not hang the technical effect .
  • Embodiments of the present invention may provide a computer terminal, which may be any one of computer terminal groups.
  • the foregoing computer terminal may also be replaced with a terminal device such as a mobile terminal.
  • the computer terminal may be located in at least one network device of the plurality of network devices of the computer network.
  • the computer terminal may execute the program code of the following steps in the editing method of the database editor: when listening to the editing of the database content in the database editor, determining the editing position, wherein the editing position is currently being The location of the edited content in the database content; by parsing the database content currently edited in the database editor, obtaining the attribute information associated with the edit location; determining whether there is content matching the edit location based on the attribute information; In the case of content that matches the edit position, the prompt information is output.
  • FIG. 17 is a structural block diagram of a computer terminal according to an embodiment of the present invention.
  • the computer terminal A may include one or more (only one shown in the figure) processor 1702, memory 1704, and transmission device 1706.
  • the memory 1704 can be used to store software programs and modules, such as the editing method of the database editor and the program instructions/modules corresponding to the device in the embodiment of the present invention.
  • the processor 1702 runs the software programs and modules stored in the memory 1704. Thereby performing various functional applications and data processing, that is, implementing the above-described editing method of the database editor.
  • Memory 1704 can include high speed random access memory 1704, and can also include non-volatile memory 1704, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory 1704.
  • memory 1704 can further include a memory 1704 remotely disposed relative to processor 1702, which can be connected to terminal A via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the processor 1702 can invoke the information and application stored by the memory 1704 through the transmission device 1706 to perform the following steps: when listening to the editing of the database content in the database editor, determining the editing location, wherein the editing location is currently being The location of the edited content in the database content; by parsing the database content currently edited in the database editor, obtaining the attribute information associated with the edit location; determining whether there is content matching the edit location based on the attribute information; In the case of content that matches the edit position, the prompt information is output.
  • the processor 1702 may further execute the following steps: intercepting a database statement to be analyzed in the database content according to the edit location; determining a field type of each field included in the database statement according to the predefined type attribute, where The field types include: table, column, and keyword; according to the field type of each field, determine the field type of the field in the database statement at the editing position; generate and edit the position according to the field type and field content of the field at the editing position Associated attribute information.
  • the processor 1702 may further execute the following program code: reading a cursor position displayed by the cursor in the database content as an edit position, wherein the field content at the edit position is a character or a string located before the cursor position. .
  • the processor 1702 may further execute the following program code: determining whether a field type of a field located at an edit position is a keyword; and returning to continue monitoring if a field type of the field at the edit position is a keyword Whether the database editor edits the database content; if the field type of the field located at the editing position is not a keyword, the step of performing execution of determining whether there is content matching the editing position based on the attribute information is entered.
  • the processor 1702 may further execute the following steps: querying, according to the attribute information, whether the content in the local cache matches the edited location; if the query is successful in the local cache, generating the prompt information; If the query fails in the local cache, the query request is sent to the source database asynchronously.
  • the source database queries whether there is content matching the edit location. If the query succeeds, the prompt information is generated. If the query fails, the event ends.
  • the request includes attribute information.
  • the processor 1702 may further execute the following program code: query whether the local cache has the same content as the field type and the field content; if the query fails, determine whether the field type is a table field or a column field. If the field type is a table field or a column field, enter the step of performing an asynchronous send query request to the source database; if the field type is not a table field or a column field, the event ends.
  • the processor 1702 may further execute the following program code: display the prompt information in the database editor, and/or fill the prompt information to the edit location, where the prompt information includes: matching the edit position Matching content.
  • the processor 1702 may further execute the following program code: scan content in the database content before or after the editing position; if the content before or after the editing position includes a comment character or a comment string, end This event; if the content before or after the edit position includes the database statement end character, the step of parsing the database content is entered.
  • An embodiment of the present invention provides a method for editing a database editor and a device.
  • the attribute information matching the editing position is obtained, and the content matching the editing position is completed in the editing position according to the attribute information, so that the user is prompted when using the database editor on the network side.
  • the purpose of auto-filling the content matching the editing position is completed, thereby realizing the technical effect of quickly and accurately complementing the database content matching the editing position when editing the database content in the database editor, thereby solving the use in the related art.
  • the database editor edits the contents of the database, since the content input by the user is not parsed, the technical content of the completion content of the prompt when the content input by the user is automatically completed is inaccurate.
  • FIG. 17 is only an illustration, and the computer terminal can also be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, an applause computer, and a mobile Internet device (MID). Terminal equipment such as PAD.
  • Fig. 17 does not limit the structure of the above electronic device.
  • computer terminal A may also include more or fewer components (such as a network interface, display device, etc.) than shown in FIG. 17, or have a different configuration than that shown in FIG.
  • Embodiments of the present invention also provide a storage medium.
  • the foregoing storage medium may be used to save the program code executed by the editing method of the database editor provided in the first embodiment.
  • the foregoing storage medium may be located in any one of the computer terminal groups in the computer network, or in any one of the mobile terminal groups.
  • the storage medium is configured to store program code for performing the following steps: when listening to editing the database content in the database editor, determining an edit position, wherein the edit position is current The location of the content being edited in the database content; by parsing the database content currently edited in the database editor, obtaining the attribute information associated with the edit location; determining whether there is an edit location based on the attribute information Matching content; in the case where it is determined that there is content matching the editing position, the prompt information is output.
  • the storage medium may be further configured to store program code for performing the following steps: intercepting the database statement to be analyzed in the database content according to the edit location; determining the database statement according to the predefined type attribute The field type of each field included, where the field type includes: table, column, and keyword; according to the field type of each field, determine the field type of the field in the database statement at the edit position; according to the field located at the edit position Field type and field content, generating attribute information associated with the edit location.
  • the storage medium may be further configured to store program code for performing the following steps: reading a cursor position displayed by the cursor in the database content as an edit position, wherein the field content at the edit position Is the character or string that precedes the cursor position.
  • the storage medium may be further configured to store program code for performing the following steps: determining whether the field type of the field located at the editing position is a keyword; and the field type of the field at the editing position In the case of a keyword, the return continues to listen to whether the database editor edits the database content; if the field type of the field at the edit position is not a keyword, the entry execution determines whether there is a match with the edit position according to the attribute information. The steps of the content.
  • the storage medium may be further configured to store program code for performing the following steps: querying from the local cache according to the attribute information whether there is content matching the edit position; if in the local cache If the query succeeds, the prompt information is generated. If the query fails in the local cache, the query request is sent asynchronously to the source database, and the source database is used to query whether there is content matching the edit position. If the query succeeds, the prompt information is generated, and if the query fails, , the end of the event, where the query request includes attribute information.
  • the storage medium may be further configured to store program code for performing the following steps: querying whether there is content in the local cache that is the same as the field type and the field content; in the case that the query fails, Determine whether the field type is a table field or a column field; if the field type is a table field or a column field, enter a step of performing an asynchronous send query request to the source database; if the field type is not a table field or a column field, the event ends.
  • the storage medium may be further configured to store program code for performing the following steps: displaying the prompt information in a database editor, and/or populating the prompt information to an editing location, where The prompt information includes: content that matches the edit location.
  • the storage medium may be further configured to store program code for performing scanning of content before or after the editing location in the database content; if the content is before or after the editing location Ends this event, including comment characters or comment strings; if it is before or after the edit position
  • the content includes the end of the database statement, then enter the step of parsing the contents of the database.
  • any one of the above computer terminal groups can establish a communication relationship with the website server and the scanner, and the scanner can scan the value command of the web application executed by php on the computer terminal.
  • the disclosed technical contents may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, unit or module, and may be electrical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and the like. .

Abstract

Disclosed are an editing method and device for a database editor. The method comprises: upon monitoring editing of a database content by a database editor, determining an editing location, wherein the editing location is a location in the database content where a content item is currently being edited; acquiring property information associated with the editing location by analyzing the database content currently being edited by the database editor; determining, according to the property information, whether a content matching the editing location exists; and if so, outputting a prompt information. The invention solves a technical problem in which when related techniques employ database editors to edit database contents, a lack of analysis of content inputted by users results in imprecise completion content prompted when performing auto completion on the content inputted by the users.

Description

数据库编辑器的编辑方法和装置Database editor editing method and device
本申请要求2015年11月27日递交的申请号为201510846434.8发明名称为“数据库编辑器的编辑方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application Serial No. No. No. No. No. No. No. No. No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No
技术领域Technical field
本发明涉及数据库领域,具体而言,涉及一种数据库编辑器的编辑方法和装置。The present invention relates to the field of databases, and in particular to a method and apparatus for editing a database editor.
背景技术Background technique
随着信息技术和市场的发展,数据管理已不再是简单的数据存储和数据管理,而是转变成用户所需要的各种数据管理的方式。为了满足用户需求,数据库(Datebase)技术应运而生,数据库是按照数据结构来组织、存储和管理数据的仓库。用户在对数据库中的数据进行管理的过程中,需要使用数据库编辑器对数据库中的内容进行编辑。常见的数据库编辑器有SQL、Access、Oracle等。With the development of information technology and market, data management is no longer a simple data storage and data management, but a way of transforming into various data management that users need. In order to meet the needs of users, the database (Datebase) technology came into being. The database is a warehouse that organizes, stores and manages data according to the data structure. In the process of managing the data in the database, the user needs to use the database editor to edit the contents of the database. Common database editors are SQL, Access, Oracle, and so on.
为了提高用户编辑数据库内容的效率,很多数据库编辑器为用户提供了关键字(比如select、codemirror、ace等)的自动补全功能,在用户使用数据库编辑器编辑数据库内容时,根据用户输入的内容能够模糊查询数据库中的表和字段。但是,相关技术中的数据库编辑器自动补全关键字存在以下缺陷:In order to improve the efficiency of users editing database content, many database editors provide users with automatic completion of keywords (such as select, codemirror, ace, etc.), when the user uses the database editor to edit the database content, according to the user input content Ability to ambiguously query tables and fields in the database. However, the database editor in the related art automatically completes the keyword with the following defects:
1、数据库编辑器提示的补全内容不精确。数据库编辑器在网络端预先定义了所有的关键字,当用户输入某个字符时,将该字符与预先定义的关键字进行匹配以获得该字符的补全内容。由于数据库中任何位置都有可能出现各种关键字,且在字符匹配之间未对用户输入的内容进行解析,因此,将会造成数据库编辑器对用户输入的内容进行自动补全时提示的补全内容不精确。1. The completion of the database editor prompt is not accurate. The database editor pre-defines all the keywords on the network side. When the user inputs a character, the character is matched with a predefined keyword to obtain the completion content of the character. Since various keywords may appear anywhere in the database, and the content input by the user is not parsed between the character matches, the database editor will prompt the user to fill in the content automatically input. The entire content is not accurate.
2、数据库编辑器进行自动补全时将所有的表和字段在本地进行缓存,当数据库的数据量超过一定量时,将会导致网络页面挂死的问题。2. When the database editor performs automatic completion, all the tables and fields are cached locally. When the data volume of the database exceeds a certain amount, the network page will hang.
针对相关技术中使用数据库编辑器编辑数据库内容时,由于未对用户输入的内容进行解析,导致对用户输入的内容进行自动补全时提示的补全内容不精确的问题,目前尚未提出有效的解决方案。When the database content is edited by using the database editor in the related art, since the content input by the user is not parsed, the content of the completion of the prompting when the content input by the user is automatically completed is not accurate, and no effective solution has been proposed yet. Program.
发明内容Summary of the invention
本发明实施例提供了一种数据库编辑器的编辑方法和装置,以至少解决相关技术中使用数据库编辑器编辑数据库内容时,由于未对用户输入的内容进行解析,导致对用户输入的内容进行自动补全时提示的补全内容不精确的技术问题。The embodiment of the invention provides a method and a device for editing a database editor, so as to at least solve the problem that when the database editor is used to edit the database content in the related art, the content input by the user is automatically analyzed because the content input by the user is not analyzed. The technical content of the incomplete content of the completion of the prompt is complete.
根据本发明实施例的一个方面,提供了一种数据库编辑器的编辑方法,包括:当监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置;通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息;根据属性信息确定是否存在与编辑位置相匹配的内容;在确定存在与编辑位置相匹配的内容的情况下,输出提示信息。According to an aspect of an embodiment of the present invention, an editing method of a database editor is provided, including: when listening to editing a database content in a database editor, determining an editing location, wherein the editing location is currently being edited The location of the content in the database content; obtaining the attribute information associated with the editing location by parsing the database content currently edited in the database editor; determining whether there is content matching the editing location according to the attribute information; determining presence and editing In the case of a content that matches the position, a prompt message is output.
根据本发明实施例的另一方面,还提供了一种数据库编辑器的编辑装置,包括:第一确定模块,用于在监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置;解析模块,用于通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息;第二确定模块,用于根据属性信息确定是否存在与编辑位置相匹配的内容;输出模块,用于在确定存在与编辑位置相匹配的内容的情况下,输出提示信息。According to another aspect of the present invention, an editing apparatus for a database editor is further provided, including: a first determining module, configured to determine an editing position when listening to editing the database content in the database editor, The editing location is the location of the content currently being edited in the database content; the parsing module is configured to obtain the attribute information associated with the editing location by parsing the database content currently edited in the database editor; the second determining module, And configured to determine, according to the attribute information, whether there is content that matches the edit position; and an output module, configured to output the prompt information if it is determined that the content that matches the edit position exists.
在本发明实施例中,当监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置;通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息;根据属性信息确定是否存在与编辑位置相匹配的内容;在确定存在与编辑位置相匹配的内容的情况下,输出提示信息的方式,通过解析数据库编辑器中编辑的数据库内容,获取与编辑位置相匹配的属性信息,根据该属性信息在编辑位置补全与编辑位置相匹配的内容,达到了在网络端使用数据库编辑器时提示用户完成与编辑位置相匹配的内容的自动填充的目的,从而实现了在数据库编辑器中编辑数据库内容时,快速精确补全与编辑位置相匹配的数据库内容的技术效果,进而解决了相关技术中使用数据库编辑器编辑数据库内容时,由于未对用户输入的内容进行解析,导致对用户输入的内容进行自动补全时提示的补全内容不精确的技术问题。In the embodiment of the present invention, when the database content is edited in the database editor, the edit position is determined, wherein the edit position is the position of the content currently being edited in the database content; by parsing the current database editor The edited database content, obtaining attribute information associated with the edit position; determining whether there is content matching the edit position according to the attribute information; and outputting the prompt information when determining that there is content matching the edit position, By parsing the database content edited in the database editor, the attribute information matching the editing position is obtained, and the content matching the editing position is completed in the editing position according to the attribute information, so that the user is prompted when using the database editor on the network side. The purpose of auto-filling the content matching the editing position is completed, thereby realizing the technical effect of quickly and accurately complementing the database content matching the editing position when editing the database content in the database editor, thereby solving the use in the related art. Database editor When the contents of the database, not due to user input parsing, leading to user input of technical problems the whole content imprecise prompted automatically fill full-time complement.
附图说明DRAWINGS
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the invention, and are intended to be a part of the invention. In the drawing:
图1是本发明实施例的一种数据库编辑器的编辑方法的计算机终端的硬件结构框 图;1 is a hardware structural block of a computer terminal for editing a database editor according to an embodiment of the present invention; Figure
图2是根据本发明实施例的数据库编辑器的编辑方法的流程图;2 is a flow chart of a method of editing a database editor in accordance with an embodiment of the present invention;
图3是根据本发明实施例的数据库编辑器的编辑方法的实现架构的示意图;3 is a schematic diagram of an implementation architecture of an editing method of a database editor according to an embodiment of the present invention;
图4是根据本发明实施例的一种可选地数据库编辑器的编辑方法的流程图;4 is a flow chart of an alternative method of editing a database editor in accordance with an embodiment of the present invention;
图5是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图;5 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention;
图6是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图;6 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention;
图7是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图;7 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention;
图8是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图;8 is a flow chart of another alternative method of editing a database editor in accordance with an embodiment of the present invention;
图9是根据本发明实施例的一种优选地数据库编辑器的编辑方法的流程图;9 is a flow chart of a preferred method of editing a database editor, in accordance with an embodiment of the present invention;
图10是根据本发明实施例的数据库编辑器的编辑装置的示意图;FIG. 10 is a schematic diagram of an editing apparatus of a database editor according to an embodiment of the present invention; FIG.
图11是根据本发明实施例的一种可选地数据库编辑器的编辑装置的示意图;11 is a schematic diagram of an editing apparatus of an optional database editor, in accordance with an embodiment of the present invention;
图12是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图;12 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention;
图13是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图;13 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention;
图14是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图;14 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention;
图15是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图;15 is a schematic diagram of another optional editing device of a database editor in accordance with an embodiment of the present invention;
图16是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图;以及16 is a schematic diagram of another optional editing device of a database editor, in accordance with an embodiment of the present invention;
图17是根据本发明实施例的一种计算机终端的结构框图。FIG. 17 is a structural block diagram of a computer terminal according to an embodiment of the present invention.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is an embodiment of the invention, but not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of the present invention.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对 于这些过程、方法、产品或设备固有的其它步骤或单元。It is to be understood that the terms "first", "second" and the like in the specification and claims of the present invention are used to distinguish similar objects, and are not necessarily used to describe a particular order or order. It is to be understood that the data so used may be interchanged where appropriate, so that the embodiments of the invention described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "comprises" and "comprises" and "the" and "the" are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to Those steps or units, but may include those that are not clearly listed or Other steps or units inherent to these processes, methods, products or equipment.
首先,在对本发明实施例进行描述的过程中出现的部分名词或术语适用于如下解释:First, some of the nouns or terms that appear in the process of describing the embodiments of the present invention are applicable to the following explanations:
数据库,是指以一定方式存储在一起、能为多个用户共享、具有尽可能小的冗余度的特点、是与应用程序彼此独立的数据集合。A database is a collection of data that is stored together in a certain way, can be shared by multiple users, has as little redundancy as possible, and is independent of the application.
数据库编辑器,用于对数据库中的数据库内容进行编辑的工具。Database editor, a tool for editing database content in a database.
编辑位置,为当前正在编辑的内容在数据库内容中的位置。Edit the location as the location of the content currently being edited in the database content.
实施例1Example 1
根据本发明实施例,还提供了一种数据库编辑器的编辑方法的方法实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。According to an embodiment of the present invention, there is also provided a method embodiment of a method for editing a database editor, and it should be noted that the steps shown in the flowchart of the drawing may be in a computer system such as a set of computer executable instructions. The steps shown and described may be performed in a different order than the ones described herein, although the logical order is shown in the flowchart.
本申请实施例一所提供的方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。以运行在计算机终端上为例,图1是本发明实施例的一种数据库编辑器的编辑方法的计算机终端的硬件结构框图。如图1所示,计算机终端10可以包括一个或多个(图中仅示出一个)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)、用于存储数据的存储器104、以及用于通信功能的传输装置106。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述电子装置的结构造成限定。例如,计算机终端10还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The method embodiment provided in Embodiment 1 of the present application can be executed in a mobile terminal, a computer terminal or the like. Taking a computer terminal as an example, FIG. 1 is a hardware structural block diagram of a computer terminal for editing a database editor according to an embodiment of the present invention. As shown in FIG. 1, computer terminal 10 may include one or more (only one shown) processor 102 (processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) A memory 104 for storing data, and a transmission device 106 for communication functions. It will be understood by those skilled in the art that the structure shown in FIG. 1 is merely illustrative and does not limit the structure of the above electronic device. For example, computer terminal 10 may also include more or fewer components than those shown in FIG. 1, or have a different configuration than that shown in FIG.
存储器104可用于存储应用软件的软件程序以及模块,如本发明实施例中的数据库编辑器的编辑方法对应的程序指令/模块,处理器102通过运行存储在存储器104内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的数据库编辑器的编辑方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至计算机终端10。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 104 can be used to store software programs and modules of application software, such as program instructions/modules corresponding to the editing method of the database editor in the embodiment of the present invention, and the processor 102 runs the software programs and modules stored in the memory 104, thereby Perform various function applications and data processing, that is, implement the editing method of the above database editor. Memory 104 may include high speed random access memory, and may also include non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. In some examples, memory 104 may further include memory remotely located relative to processor 102, which may be coupled to computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
传输装置106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括计算机终端10的通信供应商提供的无线网络。在一个实例中,传输装置106包括一个网络适配器(Network Interface Controller,NIC),其可通过基站与其他网络设备相连从而可 与互联网进行通讯。在一个实例中,传输装置106可以为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。 Transmission device 106 is for receiving or transmitting data via a network. The network specific examples described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC) that can be connected to other network devices through the base station. Communicate with the Internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module for communicating with the Internet wirelessly.
在上述运行环境下,本申请提供了如图2所示的数据库编辑器的编辑方法。图2是根据本发明实施例的数据库编辑器的编辑方法的流程图。In the above operating environment, the present application provides an editing method of the database editor as shown in FIG. 2. 2 is a flow chart of a method of editing a database editor in accordance with an embodiment of the present invention.
如图2所示,该实施例的数据库编辑器的编辑方法可以包括以下步骤:As shown in FIG. 2, the editing method of the database editor of this embodiment may include the following steps:
步骤S12,当监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置。In step S12, when the database content is edited in the database editor, the editing position is determined, wherein the editing position is the position of the content currently being edited in the database content.
在步骤S12提供的技术方案中,数据库中可以包括至少一个表,每个数据表中可以包括至少一个列,每列中可以包括至少一个字段,其中,每个表或者每个列均对应有唯一的标识符。例如,表1是数据库中的数据表X1,如表1所示,X1表中包括A和B两列,其中,A列中包括Aciton,Actor,B列中包括Black,Baby。在实际场景中,数据库中的表和列的数量较大,用不同的标识符区别不同的表和列,能够达到便于从数据库中快速准确地查找所需的表或者列中的数据的效果。In the technical solution provided in step S12, at least one table may be included in the database, and each data table may include at least one column, and each column may include at least one field, wherein each table or each column corresponds to a unique one. Identifier. For example, Table 1 is the data table X1 in the database. As shown in Table 1, the X1 table includes two columns A and B, wherein the A column includes Aciton, Actor, and the B column includes Black, Baby. In the actual scenario, the number of tables and columns in the database is large, and different tables and columns are distinguished by different identifiers, so that the effect of quickly and accurately finding the data in the desired table or column from the database can be achieved.
表1数据库中的数据表X1Table 1 data table X1 in the database
  AA BB
11 ActionAction BlackBlack
22 ActorActor BabyBaby
数据库编辑器可以为用于编辑数据库中的数据库内容的工具,比如SQL、Access、Oracle等。用户可以在网络端通过使用数据库编辑器对数据库中的数据库内容进行编辑,以实现对数据库中数据的管理。用户使用数据库编辑器可以编辑的数据库内容可以包括关键字(比如selcet、from、where等)、表、列等。在网络端,用户可以在数据库内容中的任意位置编辑数据库内容,用户对数据库内容的编辑位置可以为当前用户正在编辑的内容在数据库内容中的位置。类似于Word编辑器,编辑位置可以是编辑界面中光标所在的位置,或者其他用于标记的图标所在的位置等。优选地,该实施例将编辑界面中闪烁光标所在的位置确定为当前用户的编辑位置,以闪烁光标的形式在编辑界面中突出显示,能够方便用户快速准确定位编辑位置,进而提高用户编辑效率。可选地,该实施例还可以使用键盘或者鼠标等工具更改编辑位置,使得用户可以方便地对任意位置处的数据库内容进行编辑,极大地提高了用户对数据库内容的编辑效率。The database editor can be a tool for editing the contents of the database in the database, such as SQL, Access, Oracle, and so on. Users can edit the database contents in the database by using the database editor on the network side to manage the data in the database. Database content that users can edit using the database editor can include keywords (such as selcet, from, where, etc.), tables, columns, and so on. On the network side, the user can edit the database content anywhere in the database content, and the user's edit position to the database content can be the location of the content currently being edited by the user in the database content. Similar to the Word editor, the editing location can be the location of the cursor in the editing interface, or the location of other icons used for marking. Preferably, the embodiment determines the position where the blinking cursor is located in the editing interface as the editing position of the current user, and is highlighted in the editing interface in the form of a blinking cursor, which can facilitate the user to quickly and accurately locate the editing position, thereby improving user editing efficiency. Optionally, the embodiment can also use a keyboard or a mouse to change the editing position, so that the user can conveniently edit the database content at any position, which greatly improves the user's editing efficiency of the database content.
在实际应用场景中,该实施例可以基于任意一种数据库编辑器设计事件监听器,即在数据库编辑器之上增加一层事件监听,利用该事件监听器监听用户是否在数据库编辑 器中对数据库内容进行编辑,当监听到用户正在数据库编辑器中对数据库内容进行编辑时,利用该事件监听器还可以读取光标所在位置,进而确定当前用户对数据库内容进行编辑时的编辑位置,进而触发后续对用户编辑的数据库内容进行解析的动作。In an actual application scenario, the embodiment can design an event listener based on any database editor, that is, adding a layer of event listener on top of the database editor, and using the event listener to monitor whether the user is editing in the database. The contents of the database are edited. When the user is being edited in the database editor, the event listener can also read the location of the cursor, thereby determining the editing position of the current user when editing the database content. And triggering subsequent actions to parse the database content edited by the user.
步骤S14,通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息。In step S14, the attribute information associated with the editing position is obtained by parsing the database content currently edited in the database editor.
在步骤S14提供的技术方案中,该实施例在监听到用户编辑数据库内容时,会截取当前编辑位置处的用户编辑的数据库内容,并对截取到的数据库内容进行解析。可选地,用户编辑的数据库内容可以是用户输入的字符或者字符串,用户编辑的数据库内容可以位于编辑位置的前面,也可以位于编辑位置的后面。例如,编辑界面中的编辑位置为闪烁光标所在的位置,该实施例在截取用户编辑的数据库内容时,优选地截取该闪烁光标前面的字符或者字符串。In the technical solution provided in step S14, when listening to the user editing the database content, the embodiment intercepts the database content edited by the user at the current editing position, and parses the intercepted database content. Optionally, the user-edited database content may be a character or a character string input by the user, and the database content edited by the user may be located in front of the editing position or may be located behind the editing position. For example, the editing position in the editing interface is the position where the blinking cursor is located. In this embodiment, when the user-edited database content is intercepted, the character or character string in front of the blinking cursor is preferably intercepted.
该实施例对当前在数据库编辑器中编辑的数据库内容进行解析,可以包括解析用户编辑的数据库内容以及该数据库内容属于哪个类型,比如表、列和关键字。以SQL编辑器为例,在实际应用场景中,该实施例可以设置SQL解析器用于解析该SQL编辑器中用户在编辑位置处编辑的SQL内容,并判断用户编辑的SQL内容属于哪种类型。该实施例通过解析当前在数据库编辑器中编辑的数据库内容,能够获取到与该编辑位置相关联的属性信息,其中,与编辑位置相关联的属性信息可以包括用户在该编辑位置编辑的数据库内容,以及用户编辑的数据库内容的类型。也就是说,该实施例中与编辑位置相关联的属性信息可以为用户在编辑位置编辑的数据库内容以及该数据库内容的类型。This embodiment parses the database content currently edited in the database editor, and may include parsing the database content edited by the user and which type the database content belongs to, such as tables, columns, and keywords. Taking the SQL editor as an example, in an actual application scenario, the embodiment may set a SQL parser for parsing the SQL content edited by the user at the edit position in the SQL editor, and determine which type of SQL content the user edits belongs to. This embodiment can obtain the attribute information associated with the edit position by parsing the database content currently edited in the database editor, wherein the attribute information associated with the edit position can include the database content edited by the user at the edit position. And the type of database content that the user edits. That is, the attribute information associated with the edit location in this embodiment may be the database content edited by the user at the edit location and the type of the database content.
该实施例通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息,根据解析后获取到的与编辑位置相关联的属性信息对用户编辑的数据库内容进行补全,能够提高对编辑位置处用户编辑的数据库内容进行补全的准确度,进而达到提高用户使用体验的效果。In this embodiment, the database content edited in the database editor is parsed, the attribute information associated with the edited position is obtained, and the database content edited by the user is complemented according to the attribute information associated with the edited position obtained after the parsing, It can improve the accuracy of complementing the database content edited by the user at the editing position, thereby achieving the effect of improving the user experience.
步骤S16,根据属性信息确定是否存在与编辑位置相匹配的内容。In step S16, it is determined according to the attribute information whether there is content matching the editing position.
在步骤S16提供的方案中,该实施例预先将用于补全用户编辑的数据库内容的各种表和字段均存储于源数据库中,而在本地缓存中只缓存部分使用较为频繁的数据库内容,比如使用较为频繁的关键字。这样有利于减轻网络负担,能够避免本地缓存中数据量较大时网络页面会挂死的问题,进而达到提高用户使用体验的效果。In the solution provided in step S16, the embodiment pre-stores various tables and fields for compiling the user-edited database content in the source database, and only caches some of the more frequently used database contents in the local cache. For example, use more frequent keywords. This is beneficial to alleviate the burden on the network, and can avoid the problem that the network page will hang when the amount of data in the local cache is large, thereby achieving the effect of improving the user experience.
可选地,该实施例在根据属性信息确定是否存在与编辑位置相匹配的内容时,可以先从本地缓存中查找是否存在类型、内容均与用户编辑的数据库内容相匹配的内容,如 果本地缓存中不存在类型、内容均与用户编辑的数据库内容相匹配的内容,则异步请求源数据库,从源数据库中查找类型、内容均与用户编辑的数据库内容相匹配的内容。如果本地缓存或者源数据库中存在类型、内容均与用户编辑的数据库内容相匹配的内容,则执行步骤S18,如果本地缓存和源数据库中均不存在类型、内容均与用户编辑的数据库内容相匹配的内容,则结束对用户编辑的数据库内容的补全,继续监听用户是否在数据库编辑器中对数据库内容进行编辑。Optionally, when determining, according to the attribute information, whether there is content that matches the edit location, the embodiment may first search, from the local cache, whether there is content that matches the type of the database edited by the user, such as If there is no content in the local cache that matches the content of the database edited by the user, the source database is asynchronously requested, and the content of the source database is matched with the content of the database edited by the user. If there is content in the local cache or the source database that matches the content of the database edited by the user, step S18 is performed. If there is no type and content in the local cache and the source database, the content of the database is matched with the content edited by the user. The content ends the completion of the user-edited database content, and continues to listen to whether the user edits the database content in the database editor.
在实际应用场景中,该实施例可以在数据库编辑器中设置数据缓存组件,该数据缓存组件可以用于缓存一些固定的关键字,还可以用于向后台的源数据库请求数据,并将从源数据库中请求到的数据进行二次缓存。In an actual application scenario, the embodiment may set a data cache component in a database editor, the data cache component may be used to cache some fixed keywords, and may also be used to request data from a source database in the background, and will be from the source. The data requested in the database is double buffered.
该实施例利用本地缓存和源数据库结合的方式存储用于补全用户编辑的数据库内容,在根据与编辑位置相关联的属性信息确定是否存在与编辑位置相匹配的内容时,首先从本地缓存中查找,当查找不到与编辑位置相匹配的内容时,再从源数据库中查找。通过上述前后端异步请求的方式获取与编辑位置相匹配的内容,能够保证在数据量较大的情况下实现表和字段的自动补全,进而达到了优化网络性能,提高用户编辑效率的效果。The embodiment uses the combination of the local cache and the source database to store the database content for compiling the user edit, and first determines whether there is content matching the edit position according to the attribute information associated with the edit location, first from the local cache. Find, when you can't find the content that matches the edit location, look it up from the source database. By obtaining the content matching the editing position through the above-mentioned asynchronous request, it is possible to ensure automatic completion of the table and the field in the case of a large amount of data, thereby achieving the effect of optimizing network performance and improving user editing efficiency.
步骤S18,在确定存在与编辑位置相匹配的内容的情况下,输出提示信息。In step S18, in the case where it is determined that there is content matching the editing position, the prompt information is output.
在步骤S18提供的方案中,当确定本地缓存或者源数据库中存在与编辑位置相匹配的内容时,该实施例会输出提示信息,其中,输出的提示信息主要用于提示用户在编辑位置补全的数据库内容。可选地,与编辑位置相匹配的内容可以是一个,也可以是多个,当与编辑位置相匹配的内容是多个时,该实施例可以采用列表的形式逐条显示。用户可以在该显示列表中利用鼠标或者键盘选择自己所需的数据库内容,以实现在编辑位置自动补全数据库内容。该实施例采用显示提示信息供用户选择的方式补全编辑位置的数据库内容,有利于保证补全的数据库内容的准确性,同时增加用户选择功能,能够达到增加与用户的交互功能,提高用户使用体验的效果。In the solution provided in step S18, when it is determined that there is content in the local cache or the source database that matches the edit position, the embodiment outputs prompt information, wherein the output prompt information is mainly used to prompt the user to complete the edit position. Database content. Optionally, the content matching the editing position may be one or more, and when the content matching the editing position is plural, the embodiment may be displayed one by one in the form of a list. Users can use the mouse or keyboard to select the database content they need in the display list to automatically complete the database content in the editing position. In this embodiment, the database content of the editing location is complemented by displaying the prompt information for the user to select, which is beneficial to ensure the accuracy of the completed database content, and at the same time increase the user selection function, thereby increasing the interaction function with the user and improving the user's use. The effect of the experience.
可选地,该实施例还可以将与编辑位置相匹配的内容直接填充在编辑位置,该方式可以适用于获取到的与编辑位置相匹配的内容只有一个的情景。通过将与编辑位置相匹配的内容直接填充至编辑位置,能够缩短用户编辑数据库内容的时长,提高用户编辑数据库内容的效率。Optionally, the embodiment may further fill the content matching the editing position directly in the editing position, and the manner may be applicable to the obtained scene that has only one content matching the editing position. By directly filling the content matching the editing position to the editing position, the length of time for the user to edit the database content can be shortened, and the efficiency of the user to edit the database content can be improved.
在实际应用场景中,该实施例可以在数据库编辑器中设置自动提示组件,该自动提示组件可以用于在数据库编辑器上展现匹配到的数据,当用户从展现的数据中选择某一 数据后自动在数据库编辑器中补全输入的数据库内容。In an actual application scenario, the embodiment may set an automatic prompt component in the database editor, and the automatic prompt component may be used to display the matched data on the database editor, when the user selects a certain one from the displayed data. The data content of the input is automatically completed in the database editor after the data.
图3是根据本发明实施例的数据库编辑器的编辑方法的实现架构的示意图,如图3所示,该实现架构300可以包括:FIG. 3 is a schematic diagram of an implementation architecture of an editing method of a database editor according to an embodiment of the present invention. As shown in FIG. 3, the implementation architecture 300 may include:
事件监听器32,该实施例可以基于任意一种数据库编辑器实现,在数据库编辑器之上增加一层事件监听,可以用于监听用户在编辑位置编辑的数据库内容,用于触发后续的对用户编辑的数据库内容进行解析的动作。The event listener 32, which can be implemented based on any database editor, adds a layer of event listener on top of the database editor, can be used to listen to the database content edited by the user at the edit position, and is used to trigger subsequent user pairs. The edited database content is parsed.
解析器34,当数据库编辑器为SQL编辑器时,解析器34为SQL解析器,可以用于对用户在编辑位置编辑的数据库内容进行解析,判断编辑位置处的数据库内容属于哪种类型。The parser 34, when the database editor is a SQL editor, the parser 34 is a SQL parser, which can be used to parse the database content edited by the user at the editing location, and determine which type of database content the editing location belongs to.
数据缓存组件36,可以用于在本地缓存中缓存一些固定的关键字,还可以用于通过网络端向后台的源数据库异步请求数据,并将请求到的数据在本地缓存中进行二次缓存。The data cache component 36 can be used to cache some fixed keywords in the local cache, and can also be used to asynchronously request data from the source database in the background through the network, and the requested data is secondarily cached in the local cache.
自动提示组件38,可以用于在数据库编辑器上展现与编辑位置相匹配的数据,用户选择所需的数据库内容后自动在数据库编辑器中补全用户编辑的数据库内容。The automatic prompt component 38 can be used to display data matching the editing position on the database editor, and the user automatically selects the database content edited by the user in the database editor after selecting the required database content.
在图3所示的实现架构中,通过步骤S12至步骤S18,该实施例通过对用户在编辑位置编辑的数据库内容进行解析,根据解析得到的编辑位置的属性信息从本地缓存或者源数据库中查找与编辑位置的相匹配的数据库内容,能够解决相关技术中使用数据库编辑器编辑数据库内容时,由于未对用户输入的内容进行解析,导致对用户输入的内容进行自动补全时提示的补全内容不精确的技术问题,进而实现在数据库编辑器中编辑数据库内容时,快速精确补全与编辑位置相匹配的数据库内容,以及在数据量较大时减缓网络负担,保障网络页面不会出现挂死的技术效果。In the implementation architecture shown in FIG. 3, by step S12 to step S18, the embodiment parses the database content edited by the user at the edit position, and searches from the local cache or the source database according to the attribute information of the edited edit position obtained by the parsing. The database content matching the editing position can solve the related content in the related art when the database editor is used to edit the database content, because the content input by the user is not parsed, and the content of the prompt is completed when the content input by the user is automatically completed. Inaccurate technical problems, in order to edit the database content in the database editor, quickly and accurately complete the database content matching the editing location, and reduce the network burden when the amount of data is large, to ensure that the web page will not hang Technical effect.
作为一种可选地实施例,图4是根据本发明实施例的一种可选地数据库编辑器的编辑方法的流程图,如图4所示,步骤S14通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息可以包括以下步骤:As an alternative embodiment, FIG. 4 is a flowchart of an optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 4, step S14 is currently edited in the database editor by parsing. The database content, obtaining the attribute information associated with the editing location may include the following steps:
步骤S142,按照编辑位置截取数据库内容中待分析的数据库语句。Step S142, intercepting the database statement to be analyzed in the database content according to the editing position.
在步骤S142提供的方案中,编辑位置是通过步骤S12确定得到的位置,待分析的数据库语句可以是从该编辑位置之前至第一个数据库语句结束字符,以及从该编辑位置之后第一个数据库语句结束字符包含的语句。其中,数据库语句结束字符根据数据库编辑器的不同而不同,比如SQL编辑器中数据库语句结束字符为分号“;”,也就是说,编辑位置所在的两个分号之间的语句为待分析的数据库语句。In the solution provided in step S142, the edit position is the position determined by step S12, and the database statement to be analyzed may be from the edit position to the first database statement end character, and the first database after the edit position The statement contained in the statement end character. The end character of the database statement is different according to the database editor. For example, the end character of the database statement in the SQL editor is a semicolon ";", that is, the statement between the two semicolons where the edit position is located is to be analyzed. Database statement.
步骤S144,按照预定义的类型属性确定数据库语句中包含的每个字段的字段类型, 其中,字段类型包括:表、列和关键字。Step S144, determining a field type of each field included in the database statement according to a predefined type attribute. Among them, the field types include: tables, columns, and keywords.
在步骤S144提供的方案中,预定义的类型属性可以包括表、列和关键字。数据库语句中可以包括至少一个字段,每个字段的字段类型可以相同,也可以不同。该实施例在获取待分析的数据库语句后,根据预定义的类型属性会分析该数据库语句中每个字段的字段类型,其中,每个字段的字段类型可以为表、列或者关键字。该实施例分析数据库语句中每个字段的字段类型是为了准确地分析编辑位置处的字段的字段类型,以达到精确地补全编辑位置处的数据库内容的目的。In the scenario provided in step S144, the predefined type attributes may include tables, columns, and keywords. The database statement can include at least one field, and the field types of each field can be the same or different. After obtaining the database statement to be analyzed, the embodiment analyzes the field type of each field in the database statement according to the predefined type attribute, wherein the field type of each field may be a table, a column or a keyword. This embodiment analyzes the field type of each field in the database statement in order to accurately analyze the field type of the field at the editing position to achieve the purpose of accurately complementing the database content at the editing location.
步骤S146,根据每个字段的字段类型,确定数据库语句中位于编辑位置的字段的字段类型。Step S146, determining the field type of the field located in the edit position in the database statement according to the field type of each field.
在步骤S146提供的方案中,编辑位置可以位于一个数据库语句中的任意一个字段所在的位置,该实施例优选地将编辑位置之前的第一个字段确定为编辑位置的字段,该确定方式与Word编辑器中光标位置处的字符的确定方法相同。通过步骤S162可以确定数据库语句中每个字段的字段属性,当确定位于编辑位置的字段后,其字段类型便可以确定。In the solution provided in step S146, the edit position may be located at a position where any one of the database statements is located, and the embodiment preferably determines the first field before the edit position as the field of the edit position, the determination manner and Word. The characters at the cursor position in the editor are determined in the same way. The field attribute of each field in the database statement can be determined by step S162, and when the field located at the edit position is determined, the field type can be determined.
步骤S148,根据位于编辑位置的字段的字段类型和字段内容,生成与编辑位置相关联的属性信息。Step S148, generating attribute information associated with the edit position according to the field type and the field content of the field located at the edit position.
在步骤S148提供的方案中,与编辑位置相关联的属性信息可以为编辑位置处的字段的字段内容和字段类型。具体地,编辑位置的字段的字段内容可以通过步骤S142按照编辑位置截取待分析的数据库语句时能够获取到,编辑位置的字段的字段可以通过步骤S144和步骤S146获取到。In the scenario provided in step S148, the attribute information associated with the edit location may be the field content and field type of the field at the edit location. Specifically, the field content of the field of the edit position can be obtained by intercepting the database statement to be analyzed according to the edit position in step S142, and the field of the field of the edit position can be acquired through step S144 and step S146.
可选地,在步骤S148生成与编辑位置相关联的属性信息后,该实施例可以将与该编辑位置相关联的属性信息进行存储,以便于用户再次对该编辑位置进行数据库内容的编辑时,可以快速地调用之前已经存储的与该编辑位置相关联的属性信息,能够达到提高用户对数据库内容的编辑效率。Optionally, after the attribute information associated with the edit position is generated in step S148, the embodiment may store the attribute information associated with the edit position, so that when the user edits the database content for the edit position again, The attribute information associated with the editing position that has been stored before can be quickly called, and the editing efficiency of the user's database content can be improved.
通过上述步骤S142和步骤S148,通过解析当前在数据库编辑器中编辑的数据库内容,可以精确地获取到与该编辑位置相关联的属性信息,以便于后续根据该属性信息精确地补全与该编辑位置相匹配的数据库内容。Through the above steps S142 and S148, by parsing the database content currently edited in the database editor, the attribute information associated with the edit position can be accurately acquired, so as to accurately complement and edit the edit information according to the attribute information. The location matches the database content.
作为一种可选地实施例,该实施例步骤S12确定编辑位置可以通过读取光标在数据库内容中显示的光标位置作为编辑位置,其中,位于编辑位置的字段内容为位于光标位置之前的字符或字符串。该实施例通过读取光标位置来确定编辑位置以及编辑位置的字 段内容,方便简单,且比较符合用户的编辑习惯。As an optional embodiment, step S12 of the embodiment determines that the edit position can be the edit position by reading the cursor position displayed in the database content by the cursor, wherein the field content at the edit position is a character located before the cursor position or String. This embodiment determines the position of the edit position and the edit position by reading the position of the cursor. The content of the paragraph is convenient and simple, and is more in line with the user's editing habits.
作为一种可选地实施例,图5是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图,如图5所示,步骤S16根据属性信息确定是否存在与编辑位置相匹配的内容之前,该实施例的数据库编辑器的编辑方法还可以包括以下步骤:As an alternative embodiment, FIG. 5 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 5, step S16 determines whether presence and editing are performed according to the attribute information. Before the location matches the content, the editing method of the database editor of this embodiment may further include the following steps:
步骤S15,判断位于编辑位置的字段的字段类型是否为关键字。In step S15, it is determined whether the field type of the field located at the editing position is a keyword.
该实施例预先定义有数据库编辑器使用的关键字,比如selcet、from、with等。位于编辑位置的字段的字段类型可以通过该实施例步骤S146获取。在位于编辑位置的字段的字段类型为关键字的情况下,返回步骤S12继续监听数据库编辑器是否对数据库内容进行编辑;在位于编辑位置的字段的字段类型不是关键字的情况下,进入步骤S16执行根据属性信息确定是否存在与编辑位置相匹配的内容的步骤。This embodiment predefines keywords used by the database editor, such as selcet, from, with, and the like. The field type of the field at the edit position can be obtained by step S146 of this embodiment. If the field type of the field located at the editing position is a keyword, the process returns to step S12 to continue to listen to whether the database editor edits the database content; if the field type of the field located at the editing position is not a keyword, the process proceeds to step S16. A step of determining whether there is content matching the edit position based on the attribute information is performed.
现有技术已经能够实现对数据库编辑器中的关键字进行自动补全,故该实施例只针对在位于编辑位置的字段的字段类型不是关键字的情况下,如何自动补全编辑位置处的数据库内容,比如表和字段。由于表和字段的数据量较大,该实施例针对表和字段提供了精确地自动补全方案,能够达到缓解网络压力,优化网络页面性能的效果。The prior art has been able to automatically perform the completion of the keywords in the database editor, so this embodiment only for the case where the field type of the field located at the editing position is not a keyword, how to automatically complete the database at the editing position Content, such as tables and fields. Due to the large amount of data of tables and fields, this embodiment provides an accurate automatic completion scheme for tables and fields, which can achieve the effect of alleviating network pressure and optimizing network page performance.
作为一种可选地实施例,图6是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图,如图6所示,步骤S16根据属性信息确定是否存在与编辑位置相匹配的内容可以包括以下步骤:As an alternative embodiment, FIG. 6 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 6, step S16 determines whether presence and editing are performed according to the attribute information. The content that matches the location can include the following steps:
步骤S162,根据属性信息从本地缓存中查询是否存在与编辑位置相匹配的内容。如果在本地缓存中查询成功,则执行步骤S18生成并输出提示信息;如果在本地缓存中查询失败,则执行步骤S164。Step S162, querying from the local cache according to the attribute information whether there is content matching the edit position. If the query is successful in the local cache, step S18 is executed to generate and output the prompt information; if the query fails in the local cache, step S164 is performed.
步骤S164,异步发送查询请求至源数据库,从源数据库查询是否存在与编辑位置相匹配的内容。如果查询成功,则执行步骤S18生成并输出提示信息;如果查询失败,则结束本次事件,其中,查询请求可以包括与编辑位置相关联的属性信息,该属性信息可以包括位于编辑位置的字段的字段类型和字段内容。Step S164, asynchronously sending the query request to the source database, and querying from the source database whether there is content matching the edited location. If the query is successful, step S18 is executed to generate and output prompt information; if the query fails, the current event is ended, wherein the query request may include attribute information associated with the edit position, and the attribute information may include a field located at the edit position. Field type and field content.
该实施例预先在本地缓存中存储有部分使用较为频繁的数据库内容,在后台的源数据库中存储有数据量较大的表和字段。在步骤S162和步骤S164提供的方案中,该实施例首先从本地缓存中查询是否存在与编辑位置相匹配的内容,在本地缓存中不存在与编辑位置相匹配的内容的情况下,再向源数据库异步发送查询请求,从源数据库中查询是否存在与编辑位置相匹配的内容。上述方式能够保证在数据量较大的情况下实现表和字段的自动补全,而不会造成网络页面挂死的问题,进而达到了优化网络页面性能,提高 用户使用体验的效果。In this embodiment, some partially used database contents are stored in the local cache in advance, and tables and fields having a large amount of data are stored in the source database in the background. In the solution provided in step S162 and step S164, the embodiment first queries from the local cache whether there is content matching the edit position, and if there is no content matching the edit position in the local cache, the source is redirected to the source. The database asynchronously sends a query request, and queries the source database for content that matches the edit location. The above method can ensure the automatic completion of the table and the field in the case of a large amount of data, without causing the problem that the network page hangs, thereby achieving the performance of optimizing the network page and improving The effect of the user experience.
作为一种可选地实施例,图7是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图,如图7所示,步骤S162根据属性信息从本地缓存中查询是否存在与编辑位置相匹配的内容可以包括以下步骤:As an alternative embodiment, FIG. 7 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 7, step S162 queries the local cache according to the attribute information. Whether there is content matching the editing location can include the following steps:
步骤S1622,查询本地缓存中是否存在与字段类型和字段内容相同的内容。在查询失败的情况下,执行步骤S1624;在查询成功的情况下,执行步骤S18。Step S1622: Query whether there is content in the local cache that is the same as the field type and the content of the field. If the query fails, step S1624 is performed; if the query is successful, step S18 is performed.
该实施例中与编辑位置相匹配的内容为与编辑位置的字段内容和字段类型均相同的数据库内容。从本地缓存中查询是否存在与编辑位置相匹配的内容包括从本地缓存中查询是否存在与编辑位置的字段内容与字段类型均相同的数据库内容。该实施例在查询与编辑位置相匹配的数据库内容时考虑了编辑位置的字段内容和字段类型,这样能够提高查询结果的准确性,能够达到自动补全编辑位置处的数据库内容的精度,进而提高用户使用体验的效果。The content matching the editing position in this embodiment is the same database content as the field content and field type of the editing location. Querying from the local cache whether there is content matching the edit location includes querying from the local cache whether there is database content that is the same as the field content and field type of the edit location. The embodiment considers the field content and the field type of the editing position when querying the database content matching the editing position, which can improve the accuracy of the query result, and can automatically improve the accuracy of the database content at the editing position, thereby improving The effect of the user experience.
步骤S1624,判断字段类型是否为表字段或列字段。如果字段类型为表字段或列字段,则进入步骤S164执行异步发送查询请求至源数据库的步骤;如果字段类型不是表字段或列字段,则结束本次事件。In step S1624, it is determined whether the field type is a table field or a column field. If the field type is a table field or a column field, the process proceeds to step S164 to perform a step of asynchronously sending a query request to the source database; if the field type is not a table field or a column field, the event is ended.
在步骤S1624提供的方案中,本地缓存中存储有关键字,当本地缓存中不存在与编辑位置的字段类型相同的数据库内容时,说明编辑位置的字段类型不是关键字,则需要进一步判断编辑位置的字段类型是否是表字段或者列字段。如果判断出是表字段或者列字段,由于表和字段均存储在后台的源数据库中,故此时该实施例会异步发送查询请求至源数据库,从源数据库查询是否存在与编辑位置相匹配的内容。如果判断出不是表字段,也不是列字段,则说明关键位置的字段类型不属于能够自动补全的数据库内容,则直接结束补全操作。In the solution provided in step S1624, a keyword is stored in the local cache. When there is no database content in the local cache that has the same field type as the edit location, indicating that the field type of the edit location is not a keyword, the edit location needs to be further determined. Whether the field type is a table field or a column field. If it is determined that it is a table field or a column field, since the table and the field are stored in the source database in the background, the embodiment will asynchronously send the query request to the source database, and query from the source database whether there is content matching the edit position. If it is judged that it is not a table field or a column field, it indicates that the field type of the key position does not belong to the database content that can be automatically completed, and the completion operation is directly ended.
该实施例通过精确解析编辑位置的字段类型和字段内容,能够提高对编辑位置的数据库内容进行自动补全的精确度。同时,从本地缓存或者源数据库中查询与编辑位置相匹配的数据库内容时,通过查询字段类型和字段内容均相同的数据库内容,可以进一步地提高对编辑位置的数据库内容进行补全的精确度。而且采用实时的前后端异步请求方式能够保证在数据量较大的情况下网页页面也不出现挂死的问题,优化了网络页面性能,提高了用户的使用体验。This embodiment can improve the accuracy of automatically completing the database content of the edit position by accurately parsing the field type and the field content of the edit position. At the same time, when querying the database content matching the editing location from the local cache or the source database, by querying the database content with the same field type and field content, the accuracy of complementing the database content of the editing location can be further improved. Moreover, the real-time asynchronous request method can ensure that the webpage does not hang when the amount of data is large, and the performance of the webpage is optimized, and the user experience is improved.
作为一种可选地实施例,步骤S18输出提示信息可以包括:将提示信息在数据库编辑器中展示,和/或将提示信息填充至编辑位置,其中,提示信息可以包括:与编辑位置 相匹配的内容。该实施例为用户提供了两种不同的补全方式,用户可以根据实际需求进行调整。采用自动填充的方式节省了用户操作,能够提高用户对数据库内容的编辑效率。采用展示供用户自己选择的方式,能够精确确定用户所需的数据库内容,提高了数据库内容的补全精度,同时增加了与用户的交互性,提高了用户的使用体验。As an optional embodiment, outputting the prompt information in step S18 may include: displaying the prompt information in a database editor, and/or populating the prompt information to an edit position, wherein the prompt information may include: Matching content. This embodiment provides two different completion modes for the user, and the user can adjust according to actual needs. The use of automatic filling saves user operations and improves user editing efficiency of database content. By displaying the user's own choice, the database content required by the user can be accurately determined, the complementation precision of the database content is improved, the interaction with the user is increased, and the user experience is improved.
作为一种可选地实施例,图8是根据本发明实施例的另一种可选地数据库编辑器的编辑方法的流程图,如图8所示,在步骤S12确定编辑位置之后,该实施例的数据库编辑器的编辑方法还可以包括以下步骤:As an alternative embodiment, FIG. 8 is a flowchart of another optional editing method of the database editor according to an embodiment of the present invention. As shown in FIG. 8, after determining the editing position in step S12, the implementation is performed. The editing method of the database editor of the example may further include the following steps:
步骤S13,在数据库内容中扫描位于编辑位置之前或之后的内容。In step S13, the content before or after the editing position is scanned in the database content.
如果位于编辑位置之前或之后的内容包括注释字符或注释字符串,则结束本次事件;如果位于编辑位置之前或之后的内容包括数据库语句结束字符,则进入步骤S14解析数据库内容。If the content before or after the edit position includes a comment character or a comment string, the current event is ended; if the content before or after the edit position includes the database statement end character, the process proceeds to step S14 to parse the database content.
在步骤S13提供的方案中,注释字符或注释字符串用于表示该数据库语句为用于解释性的语句,不属于有效的数据库语句。数据库编辑器对添加注释字符或注释字符串的数据库语句不做任何执行操作。注释字符或注释字符串可以位于标号“//*”以及“*//”之间,注释字符或注释字符串可以是汉字,也可以是用于解释的标识符等。有效地数据库语句为不包含注释字符或注释字符串,且包含数据库语句结束字符的语句。比如,SQL编辑器中有效地SQL语句为两个分号“;”之间的语句,其中,分号“;”为SQL编辑器中的数据库语句结束字符。In the scheme provided in step S13, the comment character or the comment string is used to indicate that the database statement is a statement for interpretability and does not belong to a valid database statement. The database editor does nothing with database statements that add comment characters or comment strings. The comment character or comment string may be located between the labels "//*" and "*//", and the comment character or comment string may be a Chinese character, an identifier for interpretation, or the like. Valid database statements are statements that do not contain comment characters or comment strings and that contain the end of the database statement. For example, the SQL statement in the SQL editor is a statement between two semicolons ";", where the semicolon ";" is the end of the database statement in the SQL editor.
该实施例通过判断编辑位置之前或之后的数据库语句是否为有效的数据库语句,能够保证截取到的编辑位置处的待分析的数据库语句的有效性,进而提高解析得到的与编辑位置相关联的属性信息的准确性,实现精确定位需要补全的数据库内容,提高用户使用提要的效果。By determining whether the database statement before or after the editing position is a valid database statement, the embodiment can ensure the validity of the database statement to be analyzed at the intercepted editing position, thereby improving the parsed attribute associated with the editing position. The accuracy of the information, the precise positioning needs to complete the database content, and improve the effect of the user's use of the feed.
下面结合图9详细介绍本申请的一种优选实施例。图9是根据本发明实施例的一种优选地数据库编辑器的编辑方法的流程图,如图9所示,该方法包括以下步骤:A preferred embodiment of the present application is described in detail below in conjunction with FIG. 9 is a flow chart of a preferred method of editing a database editor, as shown in FIG. 9, including the following steps, in accordance with an embodiment of the present invention:
步骤S21,用户在数据库编辑器中输入内容。该优选实施例中的数据库编辑器可以是SQL、Access、Oracle等。用户使用数据库编辑器可以对任意位置的数据库内容进行编辑,以达到管理数据库中的数据,其中,用户对数据库内容的编辑位置可以为当前用户正在编辑的内容在数据库内容中的位置。用户使用数据库编辑器可以编辑的数据库内容可以包括关键字(比如select、from、where等)、表、列等。In step S21, the user inputs the content in the database editor. The database editor in this preferred embodiment can be SQL, Access, Oracle, and the like. The user can use the database editor to edit the database content at any location to manage the data in the database. The user can edit the location of the database content to the location of the content currently being edited by the user in the database content. The contents of the database that the user can edit using the database editor may include keywords (such as select, from, where, etc.), tables, columns, and the like.
步骤S22,对输入事件进行监听。该优选实施例在数据库编辑器中可以设置事件监 听器,用于监听用户在数据库编辑器中的输入内容。当事件监听器监听到用户在数据库编辑器中输入内容时,事件监听器触发对用户的输入内容进行解析的动作。In step S22, the input event is monitored. The preferred embodiment can set event monitoring in the database editor Listener for listening to user input in the database editor. When the event listener listens to the user entering content in the database editor, the event listener triggers the action of parsing the user's input.
步骤S23,对输入内容进行解析。该优选实施例在监听到用户编辑数据库内容时,会截取当前编辑位置处的用户编辑的数据库内容,并对截取到的数据库内容进行解析。该优选实施例对用户的输入内容,即当前在数据库编辑器中编辑的数据库内容进行解析,可以包括解析用户编辑的数据库内容以及该数据库内容属于哪个类型,比如表、列和关键字。该优选实施例可以设置解析器用于解析该数据库编辑器中用户在编辑位置处编辑的内容,并判断用户编辑的数据库内容属于哪种类型。该实施例通过解析当前在数据库编辑器中编辑的数据库内容,能够获取到与该编辑位置相关联的属性信息,其中,与编辑位置相关联的属性信息可以包括用户在该编辑位置编辑的数据库内容,以及用户编辑的数据库内容的类型。In step S23, the input content is parsed. When the user listens to the user to edit the database content, the preferred embodiment intercepts the database content edited by the user at the current editing position and parses the intercepted database content. The preferred embodiment parses the user's input content, ie, the database content currently edited in the database editor, and may include parsing the database content edited by the user and which type of database content, such as tables, columns, and keywords. The preferred embodiment can set a parser for parsing the content edited by the user at the edit location in the database editor and determining which type of database content the user edits belongs to. This embodiment can obtain the attribute information associated with the edit position by parsing the database content currently edited in the database editor, wherein the attribute information associated with the edit position can include the database content edited by the user at the edit position. And the type of database content that the user edits.
具体地,步骤S23对输入内容进行解析可以包括步骤S231至步骤S234,其中:Specifically, the step S23 parsing the input content may include steps S231 to S234, where:
步骤S231,按照编辑位置截取待分析的数据库语句。该优选实施例中待分析的数据库语句可以是从该编辑位置之前至第一个数据库语句结束字符,以及从该编辑位置之后第一个数据库语句结束字符包含的语句。数据库语句结束字符根据数据库编辑器的不同而不同,比如SQL编辑器中数据库语句结束字符为分号“;”。Step S231, intercepting the database statement to be analyzed according to the editing position. The database statement to be analyzed in the preferred embodiment may be from the edit position to the first database statement end character, and the statement contained in the first database statement end character after the edit position. The end of the database statement varies according to the database editor. For example, the end of the database statement in the SQL editor is a semicolon ";".
步骤S232,按照预定义的类型属性确定数据库语句中每个字段的字段类型。该优选实施例中预定义的类型属性可以包括表、列和关键字。数据库语句中可以包括至少一个字段,每个字段的字段类型可以相同,也可以不同。该实施例分析数据库语句中每个字段的字段类型是为了准确地分析编辑位置处的字段的字段类型,以达到精确地补全编辑位置处的数据库内容的目的。Step S232, determining a field type of each field in the database statement according to a predefined type attribute. The predefined type attributes in the preferred embodiment may include tables, columns, and keywords. The database statement can include at least one field, and the field types of each field can be the same or different. This embodiment analyzes the field type of each field in the database statement in order to accurately analyze the field type of the field at the editing position to achieve the purpose of accurately complementing the database content at the editing location.
步骤S233,获取位于编辑位置的字段的字段类型。该优选实施例可以将编辑位置之前的第一个字段确定为编辑位置的字段。在确定数据库语句中每个字段的字段属性,以及确定位于编辑位置的字段后,位于编辑位置的字段的字段类型便可以确定。Step S233, obtaining a field type of a field located at the editing position. The preferred embodiment may determine the first field before the edit location as the field of the edit location. After determining the field properties of each field in the database statement and determining the field at the edit location, the field type of the field at the edit location can be determined.
步骤S234,根据位于编辑位置的字段的字段类型和字段内容,生成与编辑位置相关联的属性信息。该优选实施例中与编辑位置相关联的属性信息可以为编辑位置处的字段的字段内容和字段类型。Step S234, generating attribute information associated with the edit position according to the field type and the field content of the field located at the edit position. The attribute information associated with the edit location in the preferred embodiment may be the field content and field type of the field at the edit location.
通过上述步骤S231和步骤S234,通过解析当前在数据库编辑器中编辑的数据库内容,可以精确地获取到与该编辑位置相关联的属性信息,以便于后续根据该属性信息精确地补全与该编辑位置相匹配的数据库内容。 Through the above steps S231 and S234, by parsing the database content currently edited in the database editor, the attribute information associated with the edit position can be accurately acquired, so as to accurately complement and edit the edit information according to the attribute information. The location matches the database content.
步骤S24,编辑位置的字段类型是否为关键字。该优选实施例预先定义有数据库编辑器使用的关键字,比如select、from、with等。如果编辑位置的字段类型为关键字,则返回步骤22继续监听输入事件;如果编辑位置的字段类型不是关键字,则执行步骤S25。In step S24, it is edited whether the field type of the location is a keyword. The preferred embodiment is pre-defined with keywords used by the database editor, such as select, from, with, and the like. If the field type of the edit location is a keyword, return to step 22 to continue listening for the input event; if the field type of the edit location is not a keyword, step S25 is performed.
步骤S25,查询与编辑位置匹配的数据库内容。该优选实施例预先将用于补全用户编辑的数据库内容的各种表和字段均存储于源数据库中,而在本地缓存中只缓存部分使用较为频繁的数据库内容,比如使用较为频繁的关键字。根据属性信息确定是否存在与编辑位置相匹配的内容时,可以先从本地缓存中查找是否存在类型、内容均与用户编辑的数据库内容相匹配的内容,如果本地缓存中不存在类型、内容均与用户编辑的数据库内容相匹配的内容,则异步请求源数据库,从源数据库中查找类型、内容均与用户编辑的数据库内容相匹配的内容。该优选实施例还可以在数据库编辑器中设置数据缓存组件,该数据缓存组件可以用于缓存一些固定的关键字,还可以用于向后台的源数据库请求数据,并将从源数据库中请求到的数据进行二次缓存。通过上述前后端异步请求的方式获取与编辑位置相匹配的内容,能够保证在数据量较大的情况下实现表和字段的自动补全,进而达到了优化网络性能,提高用户编辑效率的效果。In step S25, the database content matching the editing location is queried. The preferred embodiment pre-stores various tables and fields for compiling the user-edited database content in the source database, and only caches some of the more frequently used database contents in the local cache, such as using more frequent keywords. . When determining whether there is content matching the editing location according to the attribute information, it may first search for the content that matches the type of the database edited by the user, and if there is no type and content in the local cache. If the content edited by the user matches the contents of the database, the source database is asynchronously requested, and the content of the source database is matched with the content of the database edited by the user. The preferred embodiment can also set a data cache component in the database editor, which can be used to cache some fixed keywords, and can also be used to request data from the source database in the background, and will request from the source database. The data is buffered twice. By obtaining the content matching the editing position through the above-mentioned asynchronous request, it is possible to ensure automatic completion of the table and the field in the case of a large amount of data, thereby achieving the effect of optimizing network performance and improving user editing efficiency.
具体地,步骤S25可以包括步骤S251至步骤S256,其中:Specifically, step S25 may include steps S251 to S256, where:
步骤S251,接收位于编辑位置的字段的字段类型和字段内容。该优选实施例中与编辑位置相匹配的内容为与编辑位置的字段内容和字段类型均相同的数据库内容。位于编辑位置的字段的字段类型和字段内容可以通过该优选实施例中步骤S231和步骤S234得到。Step S251, receiving the field type and the field content of the field located at the editing position. The content matching the editing position in the preferred embodiment is the same database content as the field content and field type of the editing location. The field type and field content of the field at the edit position can be obtained by step S231 and step S234 in the preferred embodiment.
步骤S252,判断本地缓存中是否存在与字段类型和字段内容均相同的内容。如果不存在,则执行步骤S253;如果存在,则执行步骤S254。从本地缓存中查询是否存在与编辑位置相匹配的内容包括从本地缓存中查询是否存在与编辑位置的字段内容与字段类型均相同的数据库内容。该实施例在查询与编辑位置相匹配的数据库内容时考虑了编辑位置的字段内容和字段类型,这样能够提高查询结果的准确性,能够达到自动补全编辑位置处的数据库内容的精度。Step S252, determining whether there is content in the local cache that is the same as the field type and the field content. If not, step S253 is performed; if yes, step S254 is performed. Querying from the local cache whether there is content matching the edit location includes querying from the local cache whether there is database content that is the same as the field content and field type of the edit location. The embodiment considers the field content and the field type of the editing position when querying the database content matching the editing position, so that the accuracy of the query result can be improved, and the accuracy of the database content at the editing position can be automatically completed.
步骤S253,判断字段类型是否为表字段或列字段。如果是,则执行步骤S255;如果不是,则执行步骤S256。本地缓存中存储有关键字,当本地缓存中不存在与编辑位置的字段类型相同的数据库内容时,说明编辑位置的字段类型不是关键字,则需要进一步判断编辑位置的字段类型是否是表字段或者列字段。如果判断出是表字段或者列字段,由于表和字段均存储在后台的源数据库中,故此时该优选实施例会异步发送查询请求至源 数据库,从源数据库查询是否存在与编辑位置相匹配的内容。如果判断出不是表字段,也不是列字段,则说明关键位置的字段类型不属于能够自动补全的数据库内容,则直接结束补全操作。Step S253, determining whether the field type is a table field or a column field. If yes, step S255 is performed; if not, step S256 is performed. A keyword is stored in the local cache. When there is no database content in the local cache that has the same field type as the edit location, indicating that the field type of the edit location is not a keyword, it is necessary to further determine whether the field type of the edit location is a table field or Column field. If it is determined that it is a table field or a column field, since the table and the field are stored in the source database in the background, the preferred embodiment will asynchronously send the query request to the source. Database, from the source database to query whether there is content matching the editing location. If it is judged that it is not a table field or a column field, it indicates that the field type of the key position does not belong to the database content that can be automatically completed, and the completion operation is directly ended.
步骤S254,生成提示信息。In step S254, prompt information is generated.
步骤S255,异步发送查询请求至源数据库。从源数据库查询是否存在与编辑位置相匹配的内容,如果查询成功,则生成输出提示信息;如果查询失败,则结束本次事件,其中,查询请求可以包括与编辑位置相关联的属性信息。In step S255, the query request is sent asynchronously to the source database. The source database is queried whether there is content matching the editing location. If the query is successful, the output prompt information is generated; if the query fails, the current event is ended, wherein the query request may include attribute information associated with the editing location.
步骤S256,结束本次事件。In step S256, the event is ended.
通过上述步骤S251和步骤S256,该优选实施例首先从本地缓存中查询是否存在与编辑位置相匹配的内容,在本地缓存中不存在与编辑位置相匹配的内容的情况下,再向源数据库异步发送查询请求,从源数据库中查询是否存在与编辑位置相匹配的内容。该优选实施例能够保证在数据量较大的情况下实现表和字段的自动补全,而不会造成网络页面挂死的问题,进而达到了优化网络页面性能,提高用户使用体验的效果。Through the above steps S251 and S256, the preferred embodiment first queries the local cache whether there is content matching the edit position, and if there is no content matching the edit position in the local cache, then the source database is asynchronous. Send a query request to query the source database for content that matches the edit location. The preferred embodiment can ensure the automatic completion of the table and the field in the case of a large amount of data, without causing the problem that the network page hangs, thereby achieving the effect of optimizing the performance of the web page and improving the user experience.
步骤S26,输出提示信息。输出的提示信息主要用于提示用户在编辑位置补全的数据库内容。该优选实施例可以采用列表的形式逐条显示。用户可以在该显示列表中利用鼠标或者键盘选择自己所需的数据库内容,以实现在编辑位置自动补全数据库内容,这样有利于保证补全的数据库内容的准确性,同时增加用户选择功能,能够达到增加与用户的交互功能,提高用户使用体验的效果。可选地,该优选实施例还可以将与编辑位置相匹配的内容直接填充在编辑位置,通过将与编辑位置相匹配的内容直接填充至编辑位置,能够缩短用户编辑数据库内容的时长,提高用户编辑数据库内容的效率。In step S26, the prompt information is output. The output prompt information is mainly used to prompt the user to complete the database content in the edit position. The preferred embodiment can be displayed one by one in the form of a list. Users can use the mouse or keyboard to select the database content they need in the display list to automatically complete the database content in the editing position, which is beneficial to ensure the accuracy of the completed database content, and at the same time increase the user selection function. Increase the interaction with the user and improve the user experience. Optionally, the preferred embodiment may further fill the content matching the editing position directly in the editing position, and by directly filling the content matching the editing position to the editing position, the length of time for the user to edit the database content can be shortened, and the user is improved. The efficiency of editing database content.
通过上述步骤S21至步骤S26,该优选实施例通过对用户在编辑位置编辑的数据库内容进行解析,根据解析得到的编辑位置的属性信息从本地缓存或者源数据库中查找与编辑位置的相匹配的数据库内容,能够解决相关技术中使用数据库编辑器编辑数据库内容时,由于未对用户输入的内容进行解析,导致对用户输入的内容进行自动补全时提示的补全内容不精确的技术问题,进而实现在数据库编辑器中编辑数据库内容时,快速精确补全与编辑位置相匹配的数据库内容,以及在数据量较大时减缓网络负担,保障网络页面不会出现挂死的技术效果。Through the above steps S21 to S26, the preferred embodiment parses the database content edited by the user at the edit position, and searches for the database matching the edited location from the local cache or the source database according to the attribute information of the edited edit position. The content can solve the technical problem that when the database editor is used to edit the database content in the related art, the content input by the user is not parsed, and the content of the completion of the prompt is not accurate when the content input by the user is automatically completed, thereby realizing When editing the database content in the database editor, it quickly and accurately completes the database content that matches the editing location, and slows down the network burden when the amount of data is large, so as to ensure that the web page does not have the technical effect of hanging.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也 应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should understand that the present invention is not limited by the described action sequence. Because certain steps may be performed in other sequences or concurrently in accordance with the present invention. Second, the person skilled in the art also It should be understood that the embodiments described in the specification are a preferred embodiment and that the acts and modules involved are not necessarily essential to the invention.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的数据库编辑器的编辑方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the editing method of the database editor according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but In many cases the former is a better implementation. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
实施例2Example 2
根据本发明实施例,还提供了一种用于实施上述数据库编辑器的编辑方法的数据库编辑器的编辑装置。图10是根据本发明实施例的数据库编辑器的编辑装置的示意图,如图10所示,该装置包括:According to an embodiment of the present invention, there is also provided an editing apparatus for a database editor for implementing the editing method of the database editor described above. FIG. 10 is a schematic diagram of an editing apparatus of a database editor according to an embodiment of the present invention. As shown in FIG. 10, the apparatus includes:
第一确定模块22,用于在监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置;解析模块24,用于通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息;第二确定模块26,用于根据属性信息确定是否存在与编辑位置相匹配的内容;输出模块28,用于在确定存在与编辑位置相匹配的内容的情况下,输出提示信息。The first determining module 22 is configured to determine an editing location when the database content is edited in the database editor, wherein the editing location is a location of the content currently being edited in the database content; the parsing module 24 is configured to: Obtaining the attribute information associated with the editing location by parsing the database content currently edited in the database editor; the second determining module 26 is configured to determine, according to the attribute information, whether there is content that matches the editing location; the output module 28 uses In the case where it is determined that there is content matching the editing position, the prompt information is output.
需要说明的是,该实施例中的第一确定模块22可以用于执行本申请实施例一中的步骤S12,该实施例中的解析模块24可以用于执行本申请实施例一中的步骤S14,该实施例中的第二确定模块26可以用于执行本申请实施例一中的步骤S16,该实施例中的输出模块28可以用于执行本申请实施例一中的步骤S18。It should be noted that the first determining module 22 in this embodiment may be used to perform step S12 in the first embodiment of the present application. The parsing module 24 in this embodiment may be used to perform step S14 in the first embodiment of the present application. The second determining module 26 in this embodiment may be used to perform step S16 in the first embodiment of the present application. The output module 28 in the embodiment may be used to perform step S18 in the first embodiment of the present application.
此处需要说明的是,上述第一确定模块22、解析模块24、第二确定模块26和输出模块28对应于实施例一中的步骤S12至步骤S18,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在实施例提供的计算机终端10中,可以通过软件实现,也可以通过硬件实现。It should be noted that the first determining module 22, the parsing module 24, the second determining module 26, and the output module 28 correspond to steps S12 to S18 in the first embodiment, and the modules and corresponding steps are implemented. It is the same as the application scenario, but is not limited to the content disclosed in the above embodiment. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
作为一种可选地实施例,图11是根据本发明实施例的一种可选地数据库编辑器的编辑装置的示意图,如图11所示,解析模块24可以包括:截取模块242,用于按照编辑位置截取数据库内容中待分析的数据库语句;第一子确定模块244,用于按照预定义的 类型属性确定数据库语句中包含的每个字段的字段类型,其中,字段类型包括:表、列和关键字;第二子确定模块246,用于根据每个字段的字段类型,确定数据库语句中位于编辑位置的字段的字段类型;生成模块248,用于根据位于编辑位置的字段的字段类型和字段内容,生成与编辑位置相关联的属性信息。As an alternative embodiment, FIG. 11 is a schematic diagram of an optional editing device of a database editor according to an embodiment of the present invention. As shown in FIG. 11, the parsing module 24 may include: an intercepting module 242, configured to: The database statement to be analyzed in the database content is intercepted according to the editing position; the first sub-determination module 244 is configured to follow the predefined The type attribute determines a field type of each field included in the database statement, wherein the field type includes: a table, a column, and a keyword; and a second sub-determination module 246 is configured to determine that the database statement is located according to the field type of each field Editing the field type of the field of the location; the generating module 248 is configured to generate attribute information associated with the editing location according to the field type and the field content of the field located at the editing location.
需要说明的是,上述截取模块242、第一子确定模块244、第二子确定模块246和生成模块248分别对应于实施例一中的步骤S142至步骤S148,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在实施例提供的计算机终端10中,可以通过软件实现,也可以通过硬件实现。It should be noted that the foregoing intercepting module 242, the first sub-determining module 244, the second sub-determining module 246, and the generating module 248 respectively correspond to step S142 to step S148 in the first embodiment, and the foregoing modules and corresponding steps are implemented. The examples and application scenarios are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
作为一种可选地实施例,该实施例的数据库编辑器的编辑装置还可以包括:读取模块,用于读取光标在数据库内容中显示的光标位置作为编辑位置,其中,位于编辑位置的字段内容为位于光标位置之前的字符或字符串。As an optional embodiment, the editing apparatus of the database editor of the embodiment may further include: a reading module, configured to read a cursor position displayed by the cursor in the database content as an editing position, where the editing position is located The field content is a character or string that precedes the cursor position.
作为一种可选地实施例,图12是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图,如图12所示,该实施例的数据库编辑器的编辑装置还可以包括:第一判断模块25,用于判断位于编辑位置的字段的字段类型是否为关键字,其中,在位于编辑位置的字段的字段类型为关键字的情况下,返回第一确定模块22继续监听数据库编辑器是否对数据库内容进行编辑;在位于编辑位置的字段的字段类型不是关键字的情况下,进入第二确定模块26执行根据属性信息确定是否存在与编辑位置相匹配的内容的步骤。As an alternative embodiment, FIG. 12 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention. As shown in FIG. 12, the editing device of the database editor of the embodiment further The first determining module 25 is configured to determine whether the field type of the field located at the editing position is a keyword, and if the field type of the field located in the editing position is a keyword, return to the first determining module 22 to continue. Whether the database editor is listening to whether the database content is edited; if the field type of the field located at the edit position is not a keyword, the entry second determination module 26 performs a step of determining whether there is content matching the edit position based on the attribute information.
需要说明的是,第一判断模块25对应于实施例一中的步骤S15,该模块与步骤S15所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在实施例提供的计算机终端10中,可以通过软件实现,也可以通过硬件实现。It should be noted that the first judging module 25 corresponds to the step S15 in the first embodiment, and the module is the same as the example and the application scenario implemented in step S15, but is not limited to the content disclosed in the foregoing embodiment. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
作为一种可选地实施例,图13是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图,如图13所示,第二确定模块26可以包括:查询模块262,用于根据属性信息从本地缓存中查询是否存在与编辑位置相匹配的内容,其中,当在本地缓存中查询成功时,进入输出模块28生成提示信息;请求模块264,用于当在本地缓存中查询失败时,异步发送查询请求至源数据库,从源数据库查询是否存在与编辑位置相匹配的内容,如果查询成功,则进入输出模块28生成提示信息,如果查询失败,则结束本次 事件,其中,查询请求包括属性信息。As an alternative embodiment, FIG. 13 is a schematic diagram of another optional editing device of the database editor according to an embodiment of the present invention. As shown in FIG. 13, the second determining module 26 may include: a query module 262. And for querying, from the local cache, whether there is content matching the edit location according to the attribute information, wherein when the query in the local cache succeeds, the input output module 28 generates prompt information; and the request module 264 is configured to cache locally. When the query fails, the query request is sent asynchronously to the source database, and the source database is queried whether there is content matching the edit position. If the query is successful, the output module 28 is generated to generate the prompt information. If the query fails, the current information is ended. An event in which the query request includes attribute information.
需要说明的是,查询模块262和请求模块264对应于实施例一中的步骤S162和步骤S164,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在实施例提供的计算机终端10中,可以通过软件实现,也可以通过硬件实现。It should be noted that the query module 262 and the request module 264 correspond to the step S162 and the step S164 in the first embodiment. The foregoing modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the foregoing embodiments. . It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
作为一种可选地实施例,图14是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图,如图14所示,查询模块262可以包括:第一子查询模块2622,用于查询本地缓存中是否存在与字段类型和字段内容相同的内容;第二判断模块2624,用于在查询失败的情况下,判断字段类型是否为表字段或列字段,其中,在字段类型为表字段或列字段时,进入请求模块264执行异步发送查询请求至源数据库的步骤;在字段类型不是表字段或列字段时,结束本次事件。其中,属性信息包括:位于编辑位置的字段的字段类型和字段内容As an alternative embodiment, FIG. 14 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention. As shown in FIG. 14, the query module 262 may include: a first sub-query module. 2622, configured to query whether there is content in the local cache that is the same as the field type and the field content; the second determining module 2624 is configured to determine, in the case that the query fails, whether the field type is a table field or a column field, where the field is When the type is a table field or a column field, the entry request module 264 performs the step of asynchronously sending a query request to the source database; when the field type is not a table field or a column field, the event is ended. The attribute information includes: the field type and the field content of the field at the editing position.
需要说明的是,第一子查询模块2622和第二判断模块2624对应于实施例一中的步骤S1622和步骤S1624,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在实施例提供的计算机终端10中,可以通过软件实现,也可以通过硬件实现。It should be noted that the first sub-query module 2622 and the second judging module 2624 correspond to step S1622 and step S1624 in the first embodiment. The foregoing modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the foregoing implementation. The content disclosed in the example. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
作为一种可选地实施例,图15是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图,如图15所示,输出模块28包括:展示模块282,用于将提示信息在数据库编辑器中展示;和/或填充模块284,用于将提示信息填充至编辑位置,其中,提示信息包括:与编辑位置相匹配的内容。As an alternative embodiment, FIG. 15 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention. As shown in FIG. 15, the output module 28 includes: a display module 282 for The prompt information is displayed in the database editor; and/or the filling module 284 is configured to fill the prompt information to the editing location, wherein the prompt information includes: content that matches the editing location.
作为一种可选地实施例,图16是根据本发明实施例的另一种可选地数据库编辑器的编辑装置的示意图,如图16所示,该实施例的数据库编辑器的编辑装置还可以包括:扫描模块23,用于在数据库内容中扫描位于编辑位置之前或之后的内容,其中,在位于编辑位置之前或之后的内容包括注释字符或注释字符串时,结束本次事件;在位于编辑位置之前或之后的内容包括数据库语句结束字符时,进入解析模块24执行解析数据库内容的步骤。As an alternative embodiment, FIG. 16 is a schematic diagram of another optional editing device of a database editor according to an embodiment of the present invention. As shown in FIG. 16, the editing device of the database editor of the embodiment further The method may include: a scanning module 23, configured to scan content in the database content before or after the editing position, wherein the content is ended when the content before or after the editing position includes a comment character or a comment string; When the content before or after the editing position includes the database statement end character, the parsing module 24 proceeds to perform the step of parsing the database content.
需要说明的是,扫描模块23对应于实施例一中的步骤S13,该模块与步骤S13所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在实施例提供的计算机终端10中,可以通过软件实现,也可以通过硬件实现。 It should be noted that the scanning module 23 corresponds to the step S13 in the first embodiment, and the module is the same as the example and the application scenario implemented in step S13, but is not limited to the content disclosed in the foregoing embodiment. It should be noted that the foregoing module may be implemented in the computer terminal 10 provided in the embodiment as a part of the device, and may be implemented by software or by hardware.
该实施例的数据库编辑器的编辑装置,通过上述模块22至模块28对用户在编辑位置编辑的数据库内容进行解析,根据解析得到的编辑位置的属性信息从本地缓存或者源数据库中查找与编辑位置的相匹配的数据库内容,能够解决相关技术中使用数据库编辑器编辑数据库内容时,由于未对用户输入的内容进行解析,导致对用户输入的内容进行自动补全时提示的补全内容不精确的技术问题,进而实现在数据库编辑器中编辑数据库内容时,快速精确补全与编辑位置相匹配的数据库内容,以及在数据量较大时减缓网络负担,保障网络页面不会出现挂死的技术效果。The editing device of the database editor of the embodiment parses the database content edited by the user at the editing position through the modules 22 to 28, and searches and edits the location from the local cache or the source database according to the attribute information of the edited edit position. The matching database content can solve the related art in the use of the database editor to edit the database content, because the user input content is not parsed, resulting in the completion of the user input content when the completion of the prompt is not accurate Technical problems, in turn, when editing the database content in the database editor, quickly and accurately complete the database content that matches the editing location, and slow down the network burden when the amount of data is large, so as to ensure that the network page does not hang the technical effect .
实施例3Example 3
本发明的实施例可以提供一种计算机终端,该计算机终端可以是计算机终端群中的任意一个计算机终端设备。可选地,在本实施例中,上述计算机终端也可以替换为移动终端等终端设备。Embodiments of the present invention may provide a computer terminal, which may be any one of computer terminal groups. Optionally, in this embodiment, the foregoing computer terminal may also be replaced with a terminal device such as a mobile terminal.
可选地,在本实施例中,上述计算机终端可以位于计算机网络的多个网络设备中的至少一个网络设备。Optionally, in this embodiment, the computer terminal may be located in at least one network device of the plurality of network devices of the computer network.
在本实施例中,上述计算机终端可以执行数据库编辑器的编辑方法中以下步骤的程序代码:当监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置;通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息;根据属性信息确定是否存在与编辑位置相匹配的内容;在确定存在与编辑位置相匹配的内容的情况下,输出提示信息。In this embodiment, the computer terminal may execute the program code of the following steps in the editing method of the database editor: when listening to the editing of the database content in the database editor, determining the editing position, wherein the editing position is currently being The location of the edited content in the database content; by parsing the database content currently edited in the database editor, obtaining the attribute information associated with the edit location; determining whether there is content matching the edit location based on the attribute information; In the case of content that matches the edit position, the prompt information is output.
可选地,图17是根据本发明实施例的一种计算机终端的结构框图。如图17所示,该计算机终端A可以包括:一个或多个(图中仅示出一个)处理器1702、存储器1704、以及传输装置1706。Optionally, FIG. 17 is a structural block diagram of a computer terminal according to an embodiment of the present invention. As shown in FIG. 17, the computer terminal A may include one or more (only one shown in the figure) processor 1702, memory 1704, and transmission device 1706.
其中,存储器1704可用于存储软件程序以及模块,如本发明实施例中的数据库编辑器的编辑方法和装置对应的程序指令/模块,处理器1702通过运行存储在存储器1704内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的数据库编辑器的编辑方法。存储器1704可包括高速随机存储器1704,还可以包括非易失性存储器1704,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器1704。在一些实例中,存储器1704可进一步包括相对于处理器1702远程设置的存储器1704,这些远程存储器1704可以通过网络连接至终端A。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。 The memory 1704 can be used to store software programs and modules, such as the editing method of the database editor and the program instructions/modules corresponding to the device in the embodiment of the present invention. The processor 1702 runs the software programs and modules stored in the memory 1704. Thereby performing various functional applications and data processing, that is, implementing the above-described editing method of the database editor. Memory 1704 can include high speed random access memory 1704, and can also include non-volatile memory 1704, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory 1704. In some examples, memory 1704 can further include a memory 1704 remotely disposed relative to processor 1702, which can be connected to terminal A via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
处理器1702可以通过传输装置1706调用存储器1704存储的信息及应用程序,以执行下述步骤:当监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置;通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息;根据属性信息确定是否存在与编辑位置相匹配的内容;在确定存在与编辑位置相匹配的内容的情况下,输出提示信息。The processor 1702 can invoke the information and application stored by the memory 1704 through the transmission device 1706 to perform the following steps: when listening to the editing of the database content in the database editor, determining the editing location, wherein the editing location is currently being The location of the edited content in the database content; by parsing the database content currently edited in the database editor, obtaining the attribute information associated with the edit location; determining whether there is content matching the edit location based on the attribute information; In the case of content that matches the edit position, the prompt information is output.
可选的,上述处理器1702还可以执行如下步骤的程序代码:按照编辑位置截取数据库内容中待分析的数据库语句;按照预定义的类型属性确定数据库语句中包含的每个字段的字段类型,其中,字段类型包括:表、列和关键字;根据每个字段的字段类型,确定数据库语句中位于编辑位置的字段的字段类型;根据位于编辑位置的字段的字段类型和字段内容,生成与编辑位置相关联的属性信息。Optionally, the processor 1702 may further execute the following steps: intercepting a database statement to be analyzed in the database content according to the edit location; determining a field type of each field included in the database statement according to the predefined type attribute, where The field types include: table, column, and keyword; according to the field type of each field, determine the field type of the field in the database statement at the editing position; generate and edit the position according to the field type and field content of the field at the editing position Associated attribute information.
可选的,上述处理器1702还可以执行如下步骤的程序代码:读取光标在数据库内容中显示的光标位置作为编辑位置,其中,位于编辑位置的字段内容为位于光标位置之前的字符或字符串。Optionally, the processor 1702 may further execute the following program code: reading a cursor position displayed by the cursor in the database content as an edit position, wherein the field content at the edit position is a character or a string located before the cursor position. .
可选的,上述处理器1702还可以执行如下步骤的程序代码:判断位于编辑位置的字段的字段类型是否为关键字;在位于编辑位置的字段的字段类型为关键字的情况下,返回继续监听数据库编辑器是否对数据库内容进行编辑;在位于编辑位置的字段的字段类型不是关键字的情况下,进入执行根据属性信息确定是否存在与编辑位置相匹配的内容的步骤。Optionally, the processor 1702 may further execute the following program code: determining whether a field type of a field located at an edit position is a keyword; and returning to continue monitoring if a field type of the field at the edit position is a keyword Whether the database editor edits the database content; if the field type of the field located at the editing position is not a keyword, the step of performing execution of determining whether there is content matching the editing position based on the attribute information is entered.
可选的,上述处理器1702还可以执行如下步骤的程序代码:根据属性信息从本地缓存中查询是否存在与编辑位置相匹配的内容;如果在本地缓存中查询成功,则生成提示信息;如果在本地缓存中查询失败,则异步发送查询请求至源数据库,从源数据库查询是否存在与编辑位置相匹配的内容,如果查询成功,则生成提示信息,如果失败,则结束本次事件,其中,查询请求包括属性信息。Optionally, the processor 1702 may further execute the following steps: querying, according to the attribute information, whether the content in the local cache matches the edited location; if the query is successful in the local cache, generating the prompt information; If the query fails in the local cache, the query request is sent to the source database asynchronously. The source database queries whether there is content matching the edit location. If the query succeeds, the prompt information is generated. If the query fails, the event ends. The request includes attribute information.
可选的,上述处理器1702还可以执行如下步骤的程序代码:查询本地缓存中是否存在与字段类型和字段内容相同的内容;在查询失败的情况下,判断字段类型是否为表字段或列字段;如果字段类型为表字段或列字段,则进入执行异步发送查询请求至源数据库的步骤;如果字段类型不是表字段或列字段,则结束本次事件。Optionally, the processor 1702 may further execute the following program code: query whether the local cache has the same content as the field type and the field content; if the query fails, determine whether the field type is a table field or a column field. If the field type is a table field or a column field, enter the step of performing an asynchronous send query request to the source database; if the field type is not a table field or a column field, the event ends.
可选的,上述处理器1702还可以执行如下步骤的程序代码:将提示信息在数据库编辑器中展示,和/或将提示信息填充至编辑位置,其中,提示信息包括:与编辑位置相匹 配的内容。Optionally, the processor 1702 may further execute the following program code: display the prompt information in the database editor, and/or fill the prompt information to the edit location, where the prompt information includes: matching the edit position Matching content.
可选的,上述处理器1702还可以执行如下步骤的程序代码:在数据库内容中扫描位于编辑位置之前或之后的内容;如果位于编辑位置之前或之后的内容包括注释字符或注释字符串,则结束本次事件;如果位于编辑位置之前或之后的内容包括数据库语句结束字符,则进入解析数据库内容的步骤。Optionally, the processor 1702 may further execute the following program code: scan content in the database content before or after the editing position; if the content before or after the editing position includes a comment character or a comment string, end This event; if the content before or after the edit position includes the database statement end character, the step of parsing the database content is entered.
采用本发明实施例,提供了一种数据库编辑器的编辑方法和装置的方案。通过解析数据库编辑器中编辑的数据库内容,获取与编辑位置相匹配的属性信息,根据该属性信息在编辑位置补全与编辑位置相匹配的内容,达到了在网络端使用数据库编辑器时提示用户完成与编辑位置相匹配的内容的自动填充的目的,从而实现了在数据库编辑器中编辑数据库内容时,快速精确补全与编辑位置相匹配的数据库内容的技术效果,进而解决了相关技术中使用数据库编辑器编辑数据库内容时,由于未对用户输入的内容进行解析,导致对用户输入的内容进行自动补全时提示的补全内容不精确的技术问题。An embodiment of the present invention provides a method for editing a database editor and a device. By parsing the database content edited in the database editor, the attribute information matching the editing position is obtained, and the content matching the editing position is completed in the editing position according to the attribute information, so that the user is prompted when using the database editor on the network side. The purpose of auto-filling the content matching the editing position is completed, thereby realizing the technical effect of quickly and accurately complementing the database content matching the editing position when editing the database content in the database editor, thereby solving the use in the related art. When the database editor edits the contents of the database, since the content input by the user is not parsed, the technical content of the completion content of the prompt when the content input by the user is automatically completed is inaccurate.
本领域普通技术人员可以理解,图17所示的结构仅为示意,计算机终端也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌声电脑以及移动互联网设备(MobileInternetDevices,MID)、PAD等终端设备。图17其并不对上述电子装置的结构造成限定。例如,计算机终端A还可包括比图17中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图17所示不同的配置。A person skilled in the art can understand that the structure shown in FIG. 17 is only an illustration, and the computer terminal can also be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, an applause computer, and a mobile Internet device (MID). Terminal equipment such as PAD. Fig. 17 does not limit the structure of the above electronic device. For example, computer terminal A may also include more or fewer components (such as a network interface, display device, etc.) than shown in FIG. 17, or have a different configuration than that shown in FIG.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。A person of ordinary skill in the art may understand that all or part of the steps of the foregoing embodiments may be completed by a program to instruct terminal device related hardware, and the program may be stored in a computer readable storage medium, and the storage medium may be Including: flash disk, read-only memory (ROM), random access memory (RAM), disk or optical disk.
实施例4Example 4
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于保存上述实施例一所提供的数据库编辑器的编辑方法所执行的程序代码。Embodiments of the present invention also provide a storage medium. Optionally, in the embodiment, the foregoing storage medium may be used to save the program code executed by the editing method of the database editor provided in the first embodiment.
可选地,在本实施例中,上述存储介质可以位于计算机网络中计算机终端群中的任意一个计算机终端中,或者位于移动终端群中的任意一个移动终端中。Optionally, in this embodiment, the foregoing storage medium may be located in any one of the computer terminal groups in the computer network, or in any one of the mobile terminal groups.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:当监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,编辑位置为当前正在编辑的内容在数据库内容中的位置;通过解析当前在数据库编辑器中编辑的数据库内容,获取与编辑位置相关联的属性信息;根据属性信息确定是否存在与编辑位置 相匹配的内容;在确定存在与编辑位置相匹配的内容的情况下,输出提示信息。Optionally, in the embodiment, the storage medium is configured to store program code for performing the following steps: when listening to editing the database content in the database editor, determining an edit position, wherein the edit position is current The location of the content being edited in the database content; by parsing the database content currently edited in the database editor, obtaining the attribute information associated with the edit location; determining whether there is an edit location based on the attribute information Matching content; in the case where it is determined that there is content matching the editing position, the prompt information is output.
可选地,在本实施例中,存储介质还可以被设置为存储用于执行以下步骤的程序代码:按照编辑位置截取数据库内容中待分析的数据库语句;按照预定义的类型属性确定数据库语句中包含的每个字段的字段类型,其中,字段类型包括:表、列和关键字;根据每个字段的字段类型,确定数据库语句中位于编辑位置的字段的字段类型;根据位于编辑位置的字段的字段类型和字段内容,生成与编辑位置相关联的属性信息。Optionally, in this embodiment, the storage medium may be further configured to store program code for performing the following steps: intercepting the database statement to be analyzed in the database content according to the edit location; determining the database statement according to the predefined type attribute The field type of each field included, where the field type includes: table, column, and keyword; according to the field type of each field, determine the field type of the field in the database statement at the edit position; according to the field located at the edit position Field type and field content, generating attribute information associated with the edit location.
可选地,在本实施例中,存储介质还可以被设置为存储用于执行以下步骤的程序代码:读取光标在数据库内容中显示的光标位置作为编辑位置,其中,位于编辑位置的字段内容为位于光标位置之前的字符或字符串。Optionally, in this embodiment, the storage medium may be further configured to store program code for performing the following steps: reading a cursor position displayed by the cursor in the database content as an edit position, wherein the field content at the edit position Is the character or string that precedes the cursor position.
可选地,在本实施例中,存储介质还可以被设置为存储用于执行以下步骤的程序代码:判断位于编辑位置的字段的字段类型是否为关键字;在位于编辑位置的字段的字段类型为关键字的情况下,返回继续监听数据库编辑器是否对数据库内容进行编辑;在位于编辑位置的字段的字段类型不是关键字的情况下,进入执行根据属性信息确定是否存在与编辑位置相匹配的内容的步骤。Optionally, in this embodiment, the storage medium may be further configured to store program code for performing the following steps: determining whether the field type of the field located at the editing position is a keyword; and the field type of the field at the editing position In the case of a keyword, the return continues to listen to whether the database editor edits the database content; if the field type of the field at the edit position is not a keyword, the entry execution determines whether there is a match with the edit position according to the attribute information. The steps of the content.
可选地,在本实施例中,存储介质还可以被设置为存储用于执行以下步骤的程序代码:根据属性信息从本地缓存中查询是否存在与编辑位置相匹配的内容;如果在本地缓存中查询成功,则生成提示信息;如果在本地缓存中查询失败,则异步发送查询请求至源数据库,从源数据库查询是否存在与编辑位置相匹配的内容,如果查询成功,则生成提示信息,如果失败,则结束本次事件,其中,查询请求包括属性信息。Optionally, in this embodiment, the storage medium may be further configured to store program code for performing the following steps: querying from the local cache according to the attribute information whether there is content matching the edit position; if in the local cache If the query succeeds, the prompt information is generated. If the query fails in the local cache, the query request is sent asynchronously to the source database, and the source database is used to query whether there is content matching the edit position. If the query succeeds, the prompt information is generated, and if the query fails, , the end of the event, where the query request includes attribute information.
可选地,在本实施例中,存储介质还可以被设置为存储用于执行以下步骤的程序代码:查询本地缓存中是否存在与字段类型和字段内容相同的内容;在查询失败的情况下,判断字段类型是否为表字段或列字段;如果字段类型为表字段或列字段,则进入执行异步发送查询请求至源数据库的步骤;如果字段类型不是表字段或列字段,则结束本次事件。Optionally, in this embodiment, the storage medium may be further configured to store program code for performing the following steps: querying whether there is content in the local cache that is the same as the field type and the field content; in the case that the query fails, Determine whether the field type is a table field or a column field; if the field type is a table field or a column field, enter a step of performing an asynchronous send query request to the source database; if the field type is not a table field or a column field, the event ends.
可选地,在本实施例中,存储介质还可以被设置为存储用于执行以下步骤的程序代码:将提示信息在数据库编辑器中展示,和/或将提示信息填充至编辑位置,其中,提示信息包括:与编辑位置相匹配的内容。Optionally, in this embodiment, the storage medium may be further configured to store program code for performing the following steps: displaying the prompt information in a database editor, and/or populating the prompt information to an editing location, where The prompt information includes: content that matches the edit location.
可选地,在本实施例中,存储介质还可以被设置为存储用于执行以下步骤的程序代码:在数据库内容中扫描位于编辑位置之前或之后的内容;如果位于编辑位置之前或之后的内容包括注释字符或注释字符串,则结束本次事件;如果位于编辑位置之前或之后 的内容包括数据库语句结束字符,则进入解析数据库内容的步骤。Optionally, in this embodiment, the storage medium may be further configured to store program code for performing scanning of content before or after the editing location in the database content; if the content is before or after the editing location Ends this event, including comment characters or comment strings; if it is before or after the edit position The content includes the end of the database statement, then enter the step of parsing the contents of the database.
此处需要说明的是,上述计算机终端群中的任意一个可以与网站服务器和扫描器建立通信关系,扫描器可以扫描计算机终端上php执行的web应用程序的值命令。It should be noted here that any one of the above computer terminal groups can establish a communication relationship with the website server and the scanner, and the scanner can scan the value command of the web application executed by php on the computer terminal.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present invention, the descriptions of the various embodiments are different, and the parts that are not detailed in a certain embodiment can be referred to the related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed technical contents may be implemented in other manners. The device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, unit or module, and may be electrical or otherwise.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and the like. .
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。 The above description is only a preferred embodiment of the present invention, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. It should be considered as the scope of protection of the present invention.

Claims (16)

  1. 一种数据库编辑器的编辑方法,其特征在于,包括:A method for editing a database editor, comprising:
    当监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,所述编辑位置为当前正在编辑的内容在所述数据库内容中的位置;Determining an editing location when listening to editing the database content in the database editor, wherein the editing location is a location of the content currently being edited in the database content;
    通过解析当前在所述数据库编辑器中编辑的所述数据库内容,获取与所述编辑位置相关联的属性信息;Obtaining attribute information associated with the edit location by parsing the database content currently edited in the database editor;
    根据所述属性信息确定是否存在与所述编辑位置相匹配的内容;Determining, according to the attribute information, whether there is content that matches the edit location;
    在确定存在与所述编辑位置相匹配的内容的情况下,输出提示信息。In the case where it is determined that there is content matching the edit position, the prompt information is output.
  2. 根据权利要求1所述的方法,其特征在于,通过解析当前在所述数据库编辑器中编辑的所述数据库内容,获取与所述编辑位置相关联的属性信息包括:The method according to claim 1, wherein the obtaining the attribute information associated with the editing location by parsing the database content currently edited in the database editor comprises:
    按照所述编辑位置截取所述数据库内容中待分析的数据库语句;Obtaining, in the edit position, a database statement to be analyzed in the database content;
    按照预定义的类型属性确定所述数据库语句中包含的每个字段的字段类型,其中,所述字段类型包括:表、列和关键字;Determining, according to a predefined type attribute, a field type of each field included in the database statement, wherein the field type includes: a table, a column, and a keyword;
    根据所述每个字段的字段类型,确定所述数据库语句中位于所述编辑位置的字段的字段类型;Determining, according to the field type of each field, a field type of a field in the database statement located at the edit position;
    根据所述位于所述编辑位置的字段的所述字段类型和字段内容,生成与所述编辑位置相关联的属性信息。Attribute information associated with the edit location is generated based on the field type and field content of the field located at the edit location.
  3. 根据权利要求2所述的方法,其特征在于,读取光标在所述数据库内容中显示的光标位置作为所述编辑位置,其中,位于所述编辑位置的所述字段内容为位于所述光标位置之前的字符或字符串。The method according to claim 2, wherein a cursor position displayed in the database content is read as the editing position, wherein the field content located at the editing position is located at the cursor position. The previous character or string.
  4. 根据权利要求2所述的方法,其特征在于,在根据所述属性信息确定是否存在与所述编辑位置相匹配的内容之前,所述方法还包括:The method according to claim 2, wherein before determining whether there is content matching the edit position according to the attribute information, the method further comprises:
    判断位于所述编辑位置的字段的字段类型是否为所述关键字;Determining whether a field type of a field located at the edit location is the keyword;
    在位于所述编辑位置的字段的字段类型为所述关键字的情况下,返回继续监听所述数据库编辑器是否对所述数据库内容进行编辑;In case the field type of the field located in the editing position is the keyword, returning to continue listening to whether the database editor edits the database content;
    在位于所述编辑位置的字段的字段类型不是所述关键字的情况下,进入执行根据所述属性信息确定是否存在与所述编辑位置相匹配的内容的步骤。In the case where the field type of the field located at the editing position is not the keyword, a step of performing determination based on the attribute information as to whether or not there is content matching the editing position is entered.
  5. 根据权利要求1至4中任意一项所述的方法,其特征在于,根据所述属性信息确定是否存在与所述编辑位置相匹配的内容包括:The method according to any one of claims 1 to 4, wherein determining whether there is content matching the editing position according to the attribute information comprises:
    根据所述属性信息从本地缓存中查询是否存在与所述编辑位置相匹配的内容; Querying, according to the attribute information, whether there is content matching the editing location from the local cache;
    如果在所述本地缓存中查询成功,则生成所述提示信息;Generating the prompt information if the query is successful in the local cache;
    如果在所述本地缓存中查询失败,则异步发送查询请求至源数据库,从所述源数据库查询是否存在与所述编辑位置相匹配的内容,如果查询成功,则生成所述提示信息,如果失败,则结束本次事件,其中,所述查询请求包括所述属性信息。If the query fails in the local cache, the query request is sent to the source database asynchronously, and the source database is used to query whether there is content matching the edit position. If the query is successful, the prompt information is generated, if the failure occurs. And ending the event, wherein the query request includes the attribute information.
  6. 根据权利要求5所述的方法,其特征在于,所述属性信息包括:位于所述编辑位置的字段的所述字段类型和字段内容,其中,根据所述属性信息从本地缓存中查询是否存在与所述编辑位置相匹配的内容包括:The method according to claim 5, wherein the attribute information comprises: the field type and the field content of the field located in the edit position, wherein the presence or absence of the query is performed from the local cache according to the attribute information. The content matching the editing position includes:
    查询所述本地缓存中是否存在与所述字段类型和所述字段内容相同的内容;Querying whether there is content in the local cache that is the same as the field type and the content of the field;
    在查询失败的情况下,判断所述字段类型是否为表字段或列字段;In the case that the query fails, it is determined whether the field type is a table field or a column field;
    如果所述字段类型为所述表字段或所述列字段,则进入执行所述异步发送查询请求至源数据库的步骤;If the field type is the table field or the column field, enter a step of executing the asynchronous sending query request to a source database;
    如果所述字段类型不是所述表字段或所述列字段,则结束本次事件。If the field type is not the table field or the column field, the event is ended.
  7. 根据权利要求6所述的方法,其特征在于,输出提示信息包括:将所述提示信息在所述数据库编辑器中展示,和/或将所述提示信息填充至所述编辑位置,其中,所述提示信息包括:与所述编辑位置相匹配的内容。The method according to claim 6, wherein outputting the prompt information comprises: displaying the prompt information in the database editor, and/or filling the prompt information to the edit position, wherein The prompt information includes: content that matches the edit position.
  8. 根据权利要求1所述的方法,其特征在于,在确定编辑位置之后,所述方法还包括:The method of claim 1, wherein after determining the edit position, the method further comprises:
    在所述数据库内容中扫描位于所述编辑位置之前或之后的内容;Scanning content in the database content before or after the editing location;
    如果位于所述编辑位置之前或之后的内容包括注释字符或注释字符串,则结束本次事件;Ending the event if the content before or after the edit position includes a comment character or a comment string;
    如果位于所述编辑位置之前或之后的内容包括数据库语句结束字符,则进入解析所述数据库内容的步骤。If the content before or after the edit position includes a database statement end character, the step of parsing the database content is entered.
  9. 一种数据库编辑器的编辑装置,其特征在于,包括:An editing device for a database editor, comprising:
    第一确定模块,用于在监听到在数据库编辑器中对数据库内容进行编辑时,确定编辑位置,其中,所述编辑位置为当前正在编辑的内容在所述数据库内容中的位置;a first determining module, configured to determine an editing location when the database content is edited in the database editor, wherein the editing location is a location of the content currently being edited in the database content;
    解析模块,用于通过解析当前在所述数据库编辑器中编辑的所述数据库内容,获取与所述编辑位置相关联的属性信息;a parsing module, configured to obtain attribute information associated with the edit location by parsing the database content currently edited in the database editor;
    第二确定模块,用于根据所述属性信息确定是否存在与所述编辑位置相匹配的内容;a second determining module, configured to determine, according to the attribute information, whether there is content that matches the edited location;
    输出模块,用于在确定存在与所述编辑位置相匹配的内容的情况下,输出提示信息。 And an output module, configured to output the prompt information if it is determined that there is content matching the edit position.
  10. 根据权利要求9所述的装置,其特征在于,所述解析模块包括:The apparatus according to claim 9, wherein the parsing module comprises:
    截取模块,用于按照所述编辑位置截取所述数据库内容中待分析的数据库语句;An intercepting module, configured to intercept, according to the edit location, a database statement to be analyzed in the database content;
    第一子确定模块,用于按照预定义的类型属性确定所述数据库语句中包含的每个字段的字段类型,其中,所述字段类型包括:表、列和关键字;a first sub-determination module, configured to determine, according to a predefined type attribute, a field type of each field included in the database statement, where the field type includes: a table, a column, and a keyword;
    第二子确定模块,用于根据所述每个字段的字段类型,确定所述数据库语句中位于所述编辑位置的字段的字段类型;a second sub-determination module, configured to determine, according to a field type of each field, a field type of a field in the edited position in the database statement;
    生成模块,用于根据所述位于所述编辑位置的字段的所述字段类型和字段内容,生成与所述编辑位置相关联的属性信息。And a generating module, configured to generate attribute information associated with the edit location according to the field type and field content of the field located in the edit location.
  11. 根据权利要求10所述的装置,其特征在于,所述装置还包括:读取模块,用于读取光标在所述数据库内容中显示的光标位置作为所述编辑位置,其中,位于所述编辑位置的所述字段内容为位于所述光标位置之前的字符或字符串。The device according to claim 10, further comprising: a reading module, configured to read a cursor position displayed by the cursor in the database content as the editing position, wherein the editing is located in the editing The field content of the location is a character or string that precedes the cursor position.
  12. 根据权利要求10所述的装置,其特征在于,所述装置还包括:The device according to claim 10, wherein the device further comprises:
    第一判断模块,用于判断位于所述编辑位置的字段的字段类型是否为所述关键字;a first determining module, configured to determine whether a field type of a field located at the editing location is the keyword;
    其中,在位于所述编辑位置的字段的字段类型为所述关键字的情况下,返回所述第一确定模块继续监听所述数据库编辑器是否对所述数据库内容进行编辑,在位于所述编辑位置的字段的字段类型不是所述关键字的情况下,进入所述第二确定模块执行根据所述属性信息确定是否存在与所述编辑位置相匹配的内容的步骤。Wherein, in a case that the field type of the field located at the editing position is the keyword, the first determining module is returned to continue to listen to whether the database editor edits the database content, and is located in the editing. In a case where the field type of the field of the location is not the keyword, the step of entering the second determining module performs determining whether there is content matching the editing location according to the attribute information.
  13. 根据权利要求9至12中任意一项所述的装置,其特征在于,所述第二确定模块包括:The apparatus according to any one of claims 9 to 12, wherein the second determining module comprises:
    查询模块,用于根据所述属性信息从本地缓存中查询是否存在与所述编辑位置相匹配的内容,其中,当在所述本地缓存中查询成功时,返回所述输出模块执行生成所述提示信息;a query module, configured to query, according to the attribute information, whether there is content that matches the edit location, where the query is returned to the output module to generate the prompt information;
    请求模块,用于当在所述本地缓存中查询失败时,异步发送查询请求至源数据库,从所述源数据库查询是否存在与所述编辑位置相匹配的内容,如果查询成功,则返回所述输出模块执行生成所述提示信息,如果查询失败,则结束本次事件,其中,所述查询请求包括所述属性信息。a requesting module, configured to asynchronously send a query request to a source database when the query fails in the local cache, and query, from the source database, whether there is content that matches the edit location, and if the query is successful, return the The output module executes to generate the prompt information, and if the query fails, ends the current event, wherein the query request includes the attribute information.
  14. 根据权利要求13所述的装置,其特征在于,所述属性信息包括:位于所述编辑位置的字段的所述字段类型和字段内容,其中,所述查询模块包括:The device according to claim 13, wherein the attribute information comprises: the field type and the field content of the field located in the editing position, wherein the query module comprises:
    第一子查询模块,用于查询所述本地缓存中是否存在与所述字段类型和所述字段内容相同的内容; a first sub-query module, configured to query, in the local cache, whether the content of the field type and the content of the field is the same;
    第二判断模块,用于在查询失败的情况下,判断所述字段类型是否为表字段或列字段,其中,在所述字段类型为所述表字段或所述列字段时,进入所述请求模块执行所述异步发送查询请求至源数据库的步骤,在所述字段类型不是所述表字段或所述列字段时,结束本次事件。a second determining module, configured to determine, when the query fails, whether the field type is a table field or a column field, where the request is entered when the field type is the table field or the column field The module performs the step of asynchronously sending a query request to the source database, and ends the event when the field type is not the table field or the column field.
  15. 根据权利要求14所述的装置,其特征在于,所述输出模块包括:The apparatus according to claim 14, wherein said output module comprises:
    展示模块,用于将所述提示信息在所述数据库编辑器中展示;和/或a presentation module for displaying the prompt information in the database editor; and/or
    填充模块,用于将所述提示信息填充至所述编辑位置,其中,所述提示信息包括:与所述编辑位置相匹配的内容。And a filling module, configured to fill the prompt information to the editing location, where the prompt information includes: content that matches the editing location.
  16. 根据权利要求9所述的装置,其特征在于,所述装置还包括:The device according to claim 9, wherein the device further comprises:
    扫描模块,用于在所述数据库内容中扫描位于所述编辑位置之前或之后的内容,a scanning module, configured to scan content in the database content before or after the editing position,
    其中,在位于所述编辑位置之前或之后的内容包括注释字符或注释字符串时,结束本次事件,在位于所述编辑位置之前或之后的内容包括数据库语句结束字符时,进入所述解析模块解析所述数据库内容的步骤。 Wherein, when the content before or after the editing position includes a comment character or a comment character string, the current event is ended, and when the content before or after the editing position includes the database statement end character, the parsing module is entered. The step of parsing the contents of the database.
PCT/CN2016/106327 2015-11-27 2016-11-18 Editing method and device for database editor WO2017088702A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510846434.8 2015-11-27
CN201510846434.8A CN106815219A (en) 2015-11-27 2015-11-27 The edit methods and device of database engine

Publications (1)

Publication Number Publication Date
WO2017088702A1 true WO2017088702A1 (en) 2017-06-01

Family

ID=58763026

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/106327 WO2017088702A1 (en) 2015-11-27 2016-11-18 Editing method and device for database editor

Country Status (2)

Country Link
CN (1) CN106815219A (en)
WO (1) WO2017088702A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108415922B (en) * 2017-09-30 2021-10-22 平安科技(深圳)有限公司 Database modification method and application server
CN109933318A (en) * 2019-04-01 2019-06-25 山东浪潮云信息技术有限公司 The implementation method of SQL online editor in a kind of Angular

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5845300A (en) * 1996-06-05 1998-12-01 Microsoft Corporation Method and apparatus for suggesting completions for a partially entered data item based on previously-entered, associated data items
CN101258496A (en) * 2005-09-08 2008-09-03 微软公司 Autocompleting with queries to a database

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105912669B (en) * 2012-09-20 2020-04-07 北京奇付通科技有限公司 Method and device for complementing search terms and establishing individual interest model

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5845300A (en) * 1996-06-05 1998-12-01 Microsoft Corporation Method and apparatus for suggesting completions for a partially entered data item based on previously-entered, associated data items
CN101258496A (en) * 2005-09-08 2008-09-03 微软公司 Autocompleting with queries to a database

Also Published As

Publication number Publication date
CN106815219A (en) 2017-06-09

Similar Documents

Publication Publication Date Title
CN107463632B (en) Distributed NewSQL database system and data query method
US11157473B2 (en) Multisource semantic partitioning
US11783114B2 (en) Techniques for view capture and storage for mobile applications
US20150347420A1 (en) Performing Application Searches
US9953639B2 (en) Voice recognition system and construction method thereof
WO2018095351A1 (en) Method and device for search processing
US8417690B2 (en) Automatically avoiding unconstrained cartesian product joins
TWI686707B (en) Method and device for obtaining data inventory
EP3267330A1 (en) Query rewriting in a relational data harmonization framework
JP2013531289A (en) Use of model information group in search
US11494395B2 (en) Creating dashboards for viewing data in a data storage system based on natural language requests
US10901811B2 (en) Creating alerts associated with a data storage system based on natural language requests
US9122755B2 (en) Instantaneous incremental search user interface
US20150213077A1 (en) Method and system for causing a web application to obtain a database change
US20130006979A1 (en) Enhancing cluster analysis using document metadata
WO2017088702A1 (en) Editing method and device for database editor
US11693859B2 (en) Systems and methods for data retrieval from a database indexed by an external search engine
US20170293683A1 (en) Method and system for providing contextual information
US9037752B1 (en) Remote materialization of low velocity data
US20220100742A1 (en) Lossless Switching Between Search Grammars
US20130024761A1 (en) Semantic tagging of user-generated content
CN112732751B (en) Medical data processing method, device, storage medium and equipment
CN108780452B (en) Storage process processing method and device
CN110263055B (en) Parameter prompting method, device, equipment and storage medium
CN115952203B (en) Data query method, device, system and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16867925

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16867925

Country of ref document: EP

Kind code of ref document: A1