Unlock instant, AI-driven research and patent intelligence for your innovation.

Method for obtaining tree structure data from database through single query

A tree structure and database technology, applied in database indexing, electronic digital data processing, structured data retrieval, etc., can solve the problems of iterative dead loop, low query efficiency, etc., to solve iterative dead loop, low query efficiency, Effect of improving efficiency and safety

Pending Publication Date: 2021-02-12
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The purpose of the present invention is to provide a method for obtaining tree-structured data from the database through a single query in order to solve the above problems. The present invention does not use iterative query, but only performs a single database table query operation, and then processes the data through background logic. The method solves the problem of iterative infinite loop and low query efficiency that may occur in obtaining tree-structured data from the database; avoids the infinite loop problem that may occur due to data errors, and only performs one query at the same time, avoiding too many connections The problem of query performance degradation caused by this problem effectively improves query efficiency

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for obtaining tree structure data from database through single query
  • Method for obtaining tree structure data from database through single query

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0021] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other implementations obtained by persons of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.

[0022] In either embodiment, if Figure 1-2 As shown, the method for obtaining tree-structured data from a database by a single query of the present invention includes:

[0023] Step 1. Query all the data sets contained in the tree structure in the data table. The queried data must have at least two fields: id and parent id;

[0024] Step 2. Create a new class to save the queried data. The difference between the new object class and the original data object is...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a method for obtaining tree structure data from a database through single query, which solves the problems of possible iterative endless loop and low query efficiency when thetree structure data is obtained from the database through a background logic processing method instead of iterative query and only through single database table query operation. Through single database table query operation and a background logic processing method, the problems of iterative endless loop and low query efficiency possibly occurring when the tree structure data is acquired from the database are solved, and the efficiency and safety of tree structure data acquisition operation are improved.

Description

technical field [0001] The invention relates to the technical field of back-end development, in particular to a method for acquiring tree-structured data from a database through a single query. Background technique [0002] In the current methods for obtaining tree-structured data, most of them use the parent node id of the child node data to perform iterative query. First obtain a given data id, obtain the child node data by querying the data whose parent node id is the given id, and then loop and iterate the query according to the above method, so as to obtain all the child node data under the given id. However, there are two problems with this method: first, if the data in the database is wrong, such as the ID of the parent node is the same as the ID of the node itself, the iteration will fall into an infinite loop; second, the query of a database will be reopened each time through loop iteration Connections, when there are too many connections, the query performance wil...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F16/22G06F16/2453
CPCG06F16/2246G06F16/2453
Inventor 钟声
Owner SICHUAN CHANGHONG ELECTRIC CO LTD