[go: up one dir, main page]

CN120632012A - Method, device, equipment and storage medium for extracting error text from database - Google Patents

Method, device, equipment and storage medium for extracting error text from database

Info

Publication number
CN120632012A
CN120632012A CN202511120393.4A CN202511120393A CN120632012A CN 120632012 A CN120632012 A CN 120632012A CN 202511120393 A CN202511120393 A CN 202511120393A CN 120632012 A CN120632012 A CN 120632012A
Authority
CN
China
Prior art keywords
error
text
area
target
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202511120393.4A
Other languages
Chinese (zh)
Other versions
CN120632012B (en
Inventor
王敬强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Nankai University General Data Technologies Co ltd
Original Assignee
Tianjin Nankai University General Data Technologies Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Nankai University General Data Technologies Co ltd filed Critical Tianjin Nankai University General Data Technologies Co ltd
Priority to CN202511120393.4A priority Critical patent/CN120632012B/en
Publication of CN120632012A publication Critical patent/CN120632012A/en
Application granted granted Critical
Publication of CN120632012B publication Critical patent/CN120632012B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device, equipment and a storage medium for extracting database error text, and relates to the technical field of database text extraction. The invention can firstly read the total number of the error information stored in the first part when the error text is extracted, thereby determining the storage range of the second part. Thereby reading out index information with less space occupation of each error information stored in the second section. And in the index information, determining a storage range of the error text corresponding to the target error number, and further reading out the target error text. According to the extraction method, no matter how many error texts are contained in the error file, the error text corresponding to the target error number can be obtained only by three times of small data reading operation, so that the time consumption for extracting the error text is greatly shortened, and the response speed of the client is improved.

Description

Method, device, equipment and storage medium for extracting database error text
Technical Field
The present invention relates to the field of database text extraction technologies, and in particular, to a method, an apparatus, a device, and a storage medium for extracting a database error text.
Background
The client-server architecture is a network architecture model that classifies computers in a network into two categories, client and server. Application scenarios where clients access server databases are very wide-ranging, e.g., enterprise Resource Planning (ERP) systems, customer Relationship Management (CRM) systems, etc. For example, the client accesses the database through a CSDK provided by the database vendor.
When a database client accesses a database, errors may occasionally occur. The error message typically includes an error number and error text, among other parts. The error number is generated by the server side or the client side. The error text is descriptive of the error and is typically stored in a file on the client. When the error text needs to be extracted, file operation needs to be carried out on the client file, and system call is involved. The traditional method for extracting the error text can be to read each error message one by one to a memory, compare error numbers and extract the target error text. In this way, the file needs to be read for many times, which takes a long time and affects the response speed of the client. The traditional method for extracting the error text can also be that all error information in the file is read to a memory at one time, and then is compared and extracted one by one. Although the number of times of reading is small, the method occupies more memory resources and consumes longer time for batch reading of a large amount of data. Therefore, the existing database error text extraction mode consumes too long time, and the response speed of the client is low.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for extracting database error texts, which are used for solving the problem that the response speed of a client is low due to the fact that the traditional database error text extraction mode is excessively long in time.
In a first aspect, an embodiment of the present invention provides a method for extracting an error text of a database, where an error file stores a plurality of error messages when accessing the database, where the error file includes three areas that are continuously stored, a first area stores a total number of error messages, a second area stores an error number of each error message and a storage range corresponding to the error text, and a third area stores a plurality of error texts with non-fixed lengths, where the method includes:
Reading the first area to obtain the total number of the error information;
Obtaining a storage range of the second area based on the total number of the error information;
Reading the second area based on the storage range of the second area to obtain error numbers of each piece of error information and the storage range of the corresponding error text;
Inquiring to obtain the storage range of the error text corresponding to the target error number in the error number of each error message and the storage range of the corresponding error text based on the target error number;
And reading the target error text according to the storage range of the error text corresponding to the target error number.
In one possible implementation manner, the storage space of the first area is a first fixed length, the storage space of each error message in the second area is a second fixed length, and the obtaining the storage range of the second area based on the total number of the error messages includes:
and obtaining the storage range of the second area based on the first fixed length, the total number of error messages and the second fixed length of each error message.
In one possible implementation, the storage range of the error text includes an offset and an error text length, and the offset represents a starting storage position of the error text in the error file.
In one possible implementation, the offset of any erroneous text is equal to the sum of the lengths of the first and second regions, plus the sum of the lengths of all erroneous text preceding said erroneous text.
In one possible implementation manner, the error files are multiple, each error file stores the same type of error information, and the reading the first area to obtain the total number of the error information includes:
determining the type of error information corresponding to the target error number according to the target error number;
determining a target error file corresponding to the type according to the type of the error information;
and reading the first area of the target error file to obtain the total number of error information in the target error file.
In one possible implementation, the type of error information includes a database connection error, a database operation syntax error, or a database data error.
In one possible implementation manner, the error number of each error message and the storage range of the corresponding error text are stored in the second area according to the sequence of the error numbers, and based on the target error number, the searching to obtain the storage range of the error text corresponding to the target error number from the error number of each error message and the storage range of the corresponding error text comprises the following steps:
Based on the target error number, determining the position of the target error number by adopting a dichotomy in the error number of each error message and the storage range of the corresponding error text;
and obtaining the storage range of the error text corresponding to the target error number based on the position of the target error number.
In a second aspect, an embodiment of the present invention provides a device for extracting an error text of a database, where an error file stores a plurality of pieces of error information when accessing the database, where the error file includes three areas that are stored continuously, a first area stores a total number of pieces of error information, a second area stores an error number of each piece of error information and a storage range corresponding to the error text, and a third area stores a plurality of error texts with non-fixed lengths, where the device includes:
the acquisition module is used for acquiring a target error number of the target error information;
The first zone reading module is used for reading the first zone to obtain the total number of error information;
The second area range determining module is used for obtaining the storage range of the second area based on the total number of the error information;
The second area reading module is used for reading the second area based on the storage range of the second area to obtain error numbers of each piece of error information and the storage range of the corresponding error text;
the target text range determining module is used for inquiring and obtaining the storage range of the error text corresponding to the target error number in the error number of each error message and the storage range of the error text corresponding to the error message based on the target error number;
and the target text reading module is used for reading the target error text according to the storage range of the error text corresponding to the target error number.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory and a processor, the memory storing a computer program, the processor implementing the method according to the first aspect or any one of the possible implementations of the first aspect, when the processor executes the computer program.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium storing a computer program which, when executed by a processor, implements a method as in the first aspect or any one of the possible implementations of the first aspect.
In a fifth aspect, embodiments of the present invention provide a computer program product comprising a computer program which, when executed by a processor, implements a method as in the first aspect or any one of the possible implementations of the first aspect.
In the embodiment of the invention, the error file adopts a storage mode of separating an index from text data, and stores a plurality of pieces of error information. The first area of the error file stores the total number of error information, the second area stores the index information of each error information, the index information comprises error numbers and storage ranges corresponding to error texts, and the third area stores error text data with non-fixed length. The index and text data are stored in separate areas in the same file. Based on the above storage mode, when extracting the error text, firstly reading the total number of error information stored in the first area, thereby determining the storage range of the second area. The index information with less occupied space of each error information stored in the second area, namely the error number and the storage range of the corresponding error text are read. And in the index information, determining a storage range of the error text corresponding to the target error number, and further reading out the target error text. According to the extraction method, no matter how many error texts are contained in the error file, the error text corresponding to the target error number can be obtained only by three times of small data reading operation, so that the time consumption for extracting the error text is greatly shortened, and the response speed of the client is improved.
Drawings
FIG. 1 is an application scenario diagram of a method for extracting database error text provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram of a storage structure of an error file according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for extracting database error text according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an apparatus for extracting database error text according to an embodiment of the present invention;
Fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
Fig. 1 is an application scenario diagram of a method for extracting database error text according to an embodiment of the present invention. As shown in fig. 1, errors that occur when a client accesses a database may be stored in the client. For example, the error information is stored in an error file. The database error text is a text prompt containing error information returned to a user when the database system encounters an abnormality or error in the running process. These texts are often used to indicate the type of problem, the possible reasons and the direction of resolution, and are important bases for locating and repairing database faults. When the client performs error analysis and error processing, the client needs to read error information in the error file, and particularly the error text in the error information. However, the existing database error text extraction method consumes too long, which results in lower response speed of the client. How to reduce the number of times of reading the file, and further reduce the system call, is a key for improving the response speed of the client.
According to the embodiment of the invention, a storage mode of separating the index from the text data is adopted to store a plurality of pieces of error information. And by further adopting three times of small data reading operation, the error text corresponding to the target error number can be obtained, and the response speed of the client is improved. The storage structure of the error file is first described below.
FIG. 2 is a schematic diagram of a storage structure of an error file provided by an embodiment of the present invention, referring to FIG. 2, the error file stores a plurality of pieces of error information when accessing the database, the error file includes three areas that are continuously stored, a first area stores a total number of pieces of error information, a second area stores an error number of each piece of error information and a storage range corresponding to an error text, and a third area stores a plurality of pieces of error text with non-fixed length;
The error file stores a plurality of pieces of error information in advance when the database is accessed. Illustratively, each error message includes at least an error number and an error text. For example, the error number is generated by the server side or the client side. The error number is a unique identification of each piece of error information. Further, the error number may also include error type information, user information, time information, or the like. The specific coding rules for the error number are not limited herein. It should be further noted that, the error information is not stored one by one in the error file, but each error information is split into different parts and stored in different areas of the error file respectively.
Fig. 3 is a flowchart of a method for extracting database error text according to an embodiment of the present invention. Referring to fig. 3, the method for extracting the database error text includes:
Step 301, obtaining a target error number of the target error information;
The specific application scenario of the embodiment of the invention is to extract the target error text based on the target error number. The error number may be not only a unique identification of the error text, but may also represent more information. For example, a bit in the error number indicates a certain type of error. When the client needs to analyze a certain type of errors, the target error number can be screened out. Further, a target error text is extracted based on the target error number. The specific scenario in which the extraction of the erroneous text is required is not limited herein.
Step 302, obtaining a storage range of the second area based on the total number of the error information;
In one possible implementation manner, the storage space of the first area is a first fixed length, the storage space of each piece of error information in the second area is a second fixed length, and obtaining the storage range of the second area based on the total number of pieces of error information comprises obtaining the storage range of the second area based on the first fixed length, the total number of pieces of error information and the second fixed length of each piece of error information.
In one possible implementation, the error file is used for storing a plurality of pieces of error information when accessing the database, and comprises three continuously stored areas, wherein the first area with a first fixed length stores the total number of pieces of error information, the third area stores a plurality of pieces of error texts with a non-fixed length, and the second area stores the error numbers of the pieces of error information and the storage range of the corresponding error texts;
Illustratively, the stored range of error text includes an offset and an error text length. The offset represents the initial storage position of the error text in the error file, and the length of each error message in the second area is a second fixed length.
In some embodiments, the error file includes three regions stored in succession. Continuous storage means that in physical storage, three zones are contiguous, non-compartmentalized storage space. For example, a first zone, a second zone, and a third zone, which are stored consecutively. The functions of the three regions are described below, respectively.
In some embodiments, the first fixed length first region stores a total number of error messages. Illustratively, the first fixed length of the first region is 2 bytes. Referring to fig. 2, the total number of error messages stored in the first area is 3, as an example.
In some embodiments, the third region stores a plurality of errant text of non-fixed length. The error text is used to describe the error content. Referring to fig. 2, text 1, text 2, and text 3 represent erroneous text. By way of example, text 1 in the third zone may be "database service not present," text 2 may be "user name not present," and text 3 may be "password error. The length of the erroneous text is non-fixed. A plurality of non-fixed length texts stored consecutively can save storage space relative to a manner of allocating the same storage space for each text in terms of maximum length. But a plurality of non-fixed length texts stored consecutively also results in a plurality of texts having no fixed storage rule in the storage space. The second area may be used to record the storage location of each erroneous text. The following is a detailed description. It should be noted that in the storage space, the second area is located between the first area and the third area.
In some embodiments, the second area stores an error number, an offset, and an error text length for each error message, each offset representing a starting storage location of each error text in the error file, and each error message in the second area has a second fixed length.
For example, referring to fig. 2, the error number, the offset, and the error text length of 3 pieces of error information are contained in the second area. The first error message, error number 101, offset 20, error text length 24. The second error message, error number 102, offset 40, error text length 17. The third error message, error number 103, offset 61, error text length 15.
With respect to the second fixed length, the total length of the storage space occupied by the error number, the offset, and the error text length of each error message is exemplified as the second fixed length. For example, the error number, offset, and error text length each occupy 2 bytes of memory, i.e., each piece of error information occupies 6 bytes of memory in the second region. Thus, since the length of the storage space occupied by each error message in the second area is fixed, the total length of the storage space in the second area can be determined based on the total number of error messages in the first area.
It should be noted that, each offset represents a starting storage location of each error text in the error file. For example, the offset of text 1 is 20, which means that the initial storage location of text 1 in the error file is 20, which corresponds to the initial storage location of text 1 being the sum of the lengths of the first and second regions. Further, the target error text may be read based on the offset and the error text length. It should be further noted that the offset is determined when the error information is stored. The offset may specifically represent the initial storage location in an absolute coordinate manner, or may represent the initial storage location in a relative coordinate manner.
It should be further noted that, the error numbers stored in the second area and the error texts stored in the third area are in a one-to-one correspondence, and are all stored in the same order. For example, error number 101 corresponds to text 1, error number 102 corresponds to text 2, and error number 103 corresponds to text 3.
It should be noted that the error file is stored in a storage medium, for example, in a hard disk of the client. The reading may be reading some data of the error file in the hard disk into the memory of the client, and executing the method according to the embodiment of the present invention with the processor of the client as the execution body.
In one possible implementation, after the target error number of the target error information is obtained, the method further comprises obtaining a starting storage position of the error file, and correspondingly, based on the first fixed length, reading the first area to obtain the total number of the error information, wherein the method comprises the step of reading the first area to obtain the total number of the error information based on the starting storage position of the error file and the first fixed length.
In order to further improve the extraction efficiency of the error text, the error information can be classified according to the error type, the error information of the same class is stored in the same file, the error information of different classes is stored in different error files, and the following embodiments are described.
In one possible implementation manner, the error files are multiple, each error file stores error information of the same type, correspondingly, the first area is read to obtain the total number of the error information, the type of the error information corresponding to the target error number is determined according to the target error number, the target error file corresponding to the type is determined according to the type of the error information, and the first area of the target error file is read to obtain the total number of the error information in the target error file.
It should be noted that, after the target error file is determined, when the reading operation is involved in the subsequent steps, the target error file is read.
In some embodiments, the type of error information includes a database connection error, a database operation syntax error, or a database data error.
Illustratively, database connection errors include database service absence, user name absence, or password errors. The database operation grammar error comprises grammar format error or illegal character contained in sentence. Database data errors include data right-hand truncations.
The above steps result in the total number of error messages in the first area of the error file. In the following, it is explained how the storage area of the second area is obtained.
Step 303, obtaining a storage range of the second area based on the total number of the error information;
In some embodiments, the starting position and length of the second area are obtained based on the first fixed length, the total number of error messages, and the second fixed length of each error message;
it should be noted that, since the first area and the second area are continuously stored, the starting position of the second area may be obtained based on the first fixed length of the first area. For example, the start position of the error file content is denoted as 0, the first fixed length is 2 bytes, and the start position of the second area may be denoted as 2, i.e. starting from the 2 nd byte and containing the 2 nd byte.
It should be further noted that, since the length of each error message in the second area is fixed and is the second fixed length, and since the relevant fields of each error message in the second area are also stored continuously, the length of the second area can be obtained based on the total number of error messages and the second fixed length. Thus, based on the starting position and length of the second area, the second area can be read directly in the storage space.
In the embodiment of the invention, the error file adopts a fixed length index and independent area storage mode to store a plurality of error messages. The first area of the error file stores the total number of error information, the second area stores the index information of each error information, the index information comprises error numbers, offset and error text length, the index information of the first area and the index information of the second area are fixed lengths, and the third area stores error text data with non-fixed lengths. The index and text data are stored in separate areas in the same file. The fixed length index region is physically stored contiguous but logically independent of the non-fixed length text region. Based on the storage mode, when the error text is extracted, the storage range of the second area can be rapidly determined, the time consumption for extracting the error text is reduced, and the response speed of the client is improved.
Step 304, reading the second area based on the storage range of the second area to obtain error numbers of each piece of error information and the storage range of the corresponding error text;
In some embodiments, based on the starting position and the length of the second area, reading the second area to obtain an error number, an offset and an error text length of each piece of error information;
In some embodiments, the second area of the error file is read based on the starting position and the length of the second area, and an error number, an offset, and an error text length of each piece of error information stored in the second area are obtained.
Illustratively, in the error document, the offset of any error text is equal to the sum of the lengths of the first and second regions, plus the sum of the lengths of all error text preceding the error text. For example, referring to fig. 2, the offset of text 2 is 44, which is the sum of the length of the first area 2 bytes, the length of the second area 18 bytes, and the length of text 1 24 bytes.
In some embodiments, the error text storage range includes an offset and an error text length, the offset representing a starting storage location of the error text in the error file.
Illustratively, the offset of any erroneous text is equal to the sum of the lengths of the first and second regions, plus the sum of the lengths of all erroneous text preceding said erroneous text.
Step 305, based on the target error number, inquiring to obtain a storage range of the error text corresponding to the target error number in the error number of each error message and the storage range of the error text corresponding to the error message;
In some embodiments, based on the target error number, the offset and the error text length corresponding to the target error number are obtained by querying in the error number, the offset and the error text length of each error message.
For example, the target error number may be compared with each error number one by one in the order of storage. The computational efficiency of this approach is uncertain. Another possible implementation is provided below.
In one possible implementation manner, the error number of each error message and the storage range of the corresponding error text are stored in the second area according to the sequence of the error numbers, and based on the target error number, the searching to obtain the storage range of the error text corresponding to the target error number from the error number of each error message and the storage range of the corresponding error text comprises the following steps:
Based on the target error number, determining the position of the target error number by adopting a dichotomy in the error number of each error message and the storage range of the corresponding error text;
and obtaining the storage range of the error text corresponding to the target error number based on the position of the target error number.
According to the embodiment of the invention, the index information of each error message is stored based on the error number sequence, and the position of the target error number can be quickly matched and determined by adopting a dichotomy, so that the storage range of the error text corresponding to the target error number can be quickly obtained.
And 306, reading the target error text according to the storage range of the error text corresponding to the target error number.
In some embodiments, the target error text is read according to the offset and the error text length corresponding to the target error number.
Illustratively, the target error text is read out in the third area of the error text according to the offset corresponding to the target error number and the error text length.
Illustratively, in the third region, the start position of the first erroneous text=the start position of the third region=the first region length+the second region length. Start position of the nth erroneous text = start position of the nth-1 erroneous text + length of the nth-1 erroneous text.
It should be noted that, after the offset and the error text length corresponding to the target error number are obtained, the target error text may be directly read from the error file.
In one possible implementation, after the target error text is read, the method further comprises the steps of obtaining a plurality of target error texts based on a plurality of target error numbers, and carrying out statistical analysis on error reasons when accessing the database according to the plurality of target error texts.
Illustratively, according to each target error number, a target error text corresponding to the target error number is obtained based on steps 301-306. After a plurality of target error texts are obtained, the error reasons when the database is accessed can be statistically analyzed according to the plurality of target error texts.
In the embodiment of the invention, the error file adopts a storage mode of separating an index from text data, and stores a plurality of pieces of error information. The first area of the error file stores the total number of error information, the second area stores the index information of each error information, the index information comprises error numbers and storage ranges corresponding to error texts, and the third area stores error text data with non-fixed length. The index and text data are stored in separate areas in the same file. Based on the above storage mode, when extracting the error text, firstly reading the total number of error information stored in the first area, thereby determining the storage range of the second area. The index information with less occupied space of each error information stored in the second area, namely the error number and the storage range of the corresponding error text are read. And in the index information, determining a storage range of the error text corresponding to the target error number, and further reading out the target error text. According to the extraction method, no matter how many error texts are contained in the error file, the error text corresponding to the target error number can be obtained only by three times of small data reading operation, so that the time consumption for extracting the error text is greatly shortened, and the response speed of the client is improved.
It should be noted that, in step 302, for the first time data is read, only the total number of error messages is read. In step 304, for the second read of data, only the second area is read. In step 306, the third time of reading data, the target error text is directly read.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
The following are device embodiments of the invention, for details not described in detail therein, reference may be made to the corresponding method embodiments described above.
Fig. 4 is a schematic structural diagram of an apparatus for extracting database error text according to an embodiment of the present invention, and for convenience of explanation, only the portions relevant to the embodiment of the present invention are shown, which is described in detail below:
As shown in fig. 4, the error file stores a plurality of error messages when accessing the database, the error file includes three areas that are continuously stored, the first area stores the total number of error messages, the second area stores the error number of each error message and the storage range of the corresponding error text, the third area stores a plurality of error texts with non-fixed length, and the device 4 for extracting the error text of the database includes:
an obtaining module 41, configured to obtain a target error number of the target error information;
A first area reading module 42, configured to read the first area to obtain the total number of error information;
A second area range determining module 43, configured to obtain a storage range of the second area based on the total number of error information;
a second area reading module 44, configured to read the second area based on the storage range of the second area, to obtain an error number of each error message and a storage range of a corresponding error text;
The target text range determining module 45 is configured to query, based on the target error number, a storage range of an error text corresponding to the target error number from error numbers of each error message and storage ranges of corresponding error texts;
the target text reading module 46 is configured to read the target error text according to the storage range of the error text corresponding to the target error number.
In the embodiment of the invention, the error file adopts a storage mode of separating an index from text data, and stores a plurality of pieces of error information. The first area of the error file stores the total number of error information, the second area stores the index information of each error information, the index information comprises error numbers and storage ranges corresponding to error texts, and the third area stores error text data with non-fixed length. The index and text data are stored in separate areas in the same file. Based on the above storage mode, when extracting the error text, firstly reading the total number of error information stored in the first area, thereby determining the storage range of the second area. The index information with less occupied space of each error information stored in the second area, namely the error number and the storage range of the corresponding error text are read. And in the index information, determining a storage range of the error text corresponding to the target error number, and further reading out the target error text. According to the extraction method, no matter how many error texts are contained in the error file, the error text corresponding to the target error number can be obtained only by three times of small data reading operation, so that the time consumption for extracting the error text is greatly shortened, and the response speed of the client is improved.
Fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 5, the electronic device 5 of this embodiment includes a processor 50 and a memory 51. The memory 51 stores a computer program 52. The steps of the various method embodiments described above are implemented by processor 50 when executing computer program 52. Or the processor 50, when executing the computer program 52, performs the functions of the modules/units of the various device embodiments described above.
By way of example, the computer program 52 may be partitioned into one or more modules/units that are stored in the memory 51 and executed by the processor 50 to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments are used to describe the execution of the computer program 52 in the electronic device 5.
The electronic device 5 may include, but is not limited to, a processor 50, a memory 51. It will be appreciated by those skilled in the art that fig. 5 is merely an example of the electronic device 5 and is not meant to be limiting of the electronic device 5, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the electronic device 5 may also include input-output devices, network access devices, buses, etc.
The Processor 50 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the electronic device 5, such as a hard disk or a memory of the electronic device 5. The memory 51 may also be an external storage device of the electronic device 5, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), or the like, which are provided on the electronic device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the electronic device 5. The memory 51 is used to store a computer program 52 and other programs and data required by the electronic device 5. The memory 51 may also be used to temporarily store data that has been output or is to be output.
For convenience and brevity of description, only the above-described division of each functional module/unit is illustrated, and in practical application, the above-described function allocation may be performed by different functional modules/units according to needs. The modules/units described above may be implemented in hardware, software, or a combination of hardware and software.
Embodiments of the present invention also provide a computer-readable storage medium storing a computer program. The computer program, when executed by a processor, implements the methods of the method embodiments described above.
The embodiment of the invention also provides a computer program product comprising a computer program. The computer program, when executed by a processor, implements the methods of the method embodiments described above.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium can include any entity or device capable of carrying computer program code, recording medium, USB flash disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media, among others.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments. In the event of no special description or logic conflict, terms and/or descriptions between the different embodiments are consistent and mutually exclusive and technical features in the different embodiments may be combined to form new embodiments according to their inherent logic relationships.
The foregoing embodiments are merely illustrative of the technical solutions of the present invention, and not restrictive, and although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that modifications may still be made to the technical solutions described in the foregoing embodiments or equivalent substitutions of some technical features thereof, and that such modifications or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for extracting error text of a database is characterized in that error files are stored with a plurality of pieces of error information when the database is accessed, the error files comprise three areas which are continuously stored, a first area stores the total number of the error information, a second area stores error numbers of the error information and storage ranges corresponding to the error text, and a third area stores a plurality of pieces of error text with non-fixed length, and the method comprises the following steps:
Reading the first area to obtain the total number of the error information;
Obtaining a storage range of the second area based on the total number of the error information;
Reading the second area based on the storage range of the second area to obtain error numbers of each piece of error information and the storage range of the corresponding error text;
Inquiring to obtain the storage range of the error text corresponding to the target error number in the error number of each error message and the storage range of the corresponding error text based on the target error number;
And reading the target error text according to the storage range of the error text corresponding to the target error number.
2. The method for extracting error text from a database according to claim 1, wherein the storage space of the first area is a first fixed length, the storage space of each piece of error information in the second area is a second fixed length, and obtaining the storage range of the second area based on the total number of pieces of error information comprises:
and obtaining the storage range of the second area based on the first fixed length, the total number of error messages and the second fixed length of each error message.
3. The method of extracting erroneous text from a database of claim 1 wherein the range of storage of erroneous text includes an offset and an erroneous text length, the offset indicating a starting storage location of the erroneous text in the erroneous file.
4. A method of extracting a database erroneous text as claimed in claim 3 wherein the offset of any erroneous text is equal to the sum of the lengths of the first and second regions plus the sum of the lengths of all erroneous text preceding said erroneous text.
5. The method for extracting error text from a database according to claim 1, wherein the plurality of error files each storing the same type of error information, wherein the reading the first area to obtain the total number of error information comprises:
determining the type of error information corresponding to the target error number according to the target error number;
determining a target error file corresponding to the type according to the type of the error information;
and reading the first area of the target error file to obtain the total number of error information in the target error file.
6. The method of extracting database error text as claimed in claim 5, wherein the type of the error information includes a database connection error, a database operation grammar error or a database data error.
7. The method for extracting error text from database according to claim 1, wherein the error number of each error message and the storage range of the corresponding error text are stored in the second area according to the order of the error numbers, and wherein the searching for the storage range of the error text corresponding to the target error number from the error number of each error message and the storage range of the corresponding error text based on the target error number comprises:
Based on the target error number, determining the position of the target error number by adopting a dichotomy in the error number of each error message and the storage range of the corresponding error text;
and obtaining the storage range of the error text corresponding to the target error number based on the position of the target error number.
8. The device for extracting the error text of the database is characterized in that the error file stores a plurality of pieces of error information when accessing the database, the error file comprises three areas which are continuously stored, a first area stores the total number of pieces of error information, a second area stores error numbers of the pieces of error information and storage ranges of corresponding error text, and a third area stores a plurality of pieces of error text with non-fixed length, and the device comprises:
the acquisition module is used for acquiring a target error number of the target error information;
The first zone reading module is used for reading the first zone to obtain the total number of error information;
The second area range determining module is used for obtaining the storage range of the second area based on the total number of the error information;
The second area reading module is used for reading the second area based on the storage range of the second area to obtain error numbers of each piece of error information and the storage range of the corresponding error text;
the target text range determining module is used for inquiring and obtaining the storage range of the error text corresponding to the target error number in the error number of each error message and the storage range of the error text corresponding to the error message based on the target error number;
and the target text reading module is used for reading the target error text according to the storage range of the error text corresponding to the target error number.
9. An electronic device comprising a memory storing a computer program and a processor implementing a method of extracting database-erroneous text as claimed in any of claims 1 to 7 when the computer program is executed.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements a method of extracting database-erroneous text as claimed in any of claims 1 to 7.
CN202511120393.4A 2025-08-12 2025-08-12 A method, apparatus, device, and storage medium for extracting error text from a database. Active CN120632012B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202511120393.4A CN120632012B (en) 2025-08-12 2025-08-12 A method, apparatus, device, and storage medium for extracting error text from a database.

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202511120393.4A CN120632012B (en) 2025-08-12 2025-08-12 A method, apparatus, device, and storage medium for extracting error text from a database.

Publications (2)

Publication Number Publication Date
CN120632012A true CN120632012A (en) 2025-09-12
CN120632012B CN120632012B (en) 2025-11-25

Family

ID=96966193

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202511120393.4A Active CN120632012B (en) 2025-08-12 2025-08-12 A method, apparatus, device, and storage medium for extracting error text from a database.

Country Status (1)

Country Link
CN (1) CN120632012B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08314966A (en) * 1995-05-19 1996-11-29 Toshiba Corp Document creating apparatus index creation method and document searching apparatus
US20030135495A1 (en) * 2001-06-21 2003-07-17 Isc, Inc. Database indexing method and apparatus
CN104272274A (en) * 2013-12-31 2015-01-07 华为技术有限公司 Data processing method and device in distributed file storage system
CN106326397A (en) * 2016-08-19 2017-01-11 东软集团股份有限公司 Method and device for generating index file
CN112686045A (en) * 2021-03-17 2021-04-20 北京世纪好未来教育科技有限公司 Method and device for evaluating text error detection model
CN116467109A (en) * 2023-04-11 2023-07-21 平安壹钱包电子商务有限公司 Error processing method, device, equipment and medium for database

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08314966A (en) * 1995-05-19 1996-11-29 Toshiba Corp Document creating apparatus index creation method and document searching apparatus
US20030135495A1 (en) * 2001-06-21 2003-07-17 Isc, Inc. Database indexing method and apparatus
CN104272274A (en) * 2013-12-31 2015-01-07 华为技术有限公司 Data processing method and device in distributed file storage system
CN106326397A (en) * 2016-08-19 2017-01-11 东软集团股份有限公司 Method and device for generating index file
CN112686045A (en) * 2021-03-17 2021-04-20 北京世纪好未来教育科技有限公司 Method and device for evaluating text error detection model
CN116467109A (en) * 2023-04-11 2023-07-21 平安壹钱包电子商务有限公司 Error processing method, device, equipment and medium for database

Also Published As

Publication number Publication date
CN120632012B (en) 2025-11-25

Similar Documents

Publication Publication Date Title
CN111258966A (en) Data deduplication method, device, equipment and storage medium
CN111241389B (en) Sensitive word filtering method and device based on matrix, electronic equipment and storage medium
CN110737689B (en) Data standard compliance detection method, device, system and storage medium
US20230205755A1 (en) Methods and systems for improved search for data loss prevention
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN114741368A (en) Log data statistical method based on artificial intelligence and related equipment
CN118733717A (en) File duplication checking method, device, equipment, storage medium and program product
CN112181430B (en) Code change statistical method, device, electronic equipment and storage medium
CN110765100B (en) Label generation method and device, computer readable storage medium and server
CN116580138A (en) Engineering drawing analysis method and electronic equipment
CN120632012B (en) A method, apparatus, device, and storage medium for extracting error text from a database.
CN116483735B (en) Method, device, storage medium and equipment for analyzing influence of code change
CN118363603A (en) Code file analysis method, device, electronic equipment and readable storage medium
CN110781182A (en) Automatic coding method and device for check logic and computer equipment
CN113408250B (en) Project file processing method and device
CN112732681B (en) Data platform migration method and system
CN116775488A (en) Abnormal data determination method, device, equipment, medium and product
CN114924977A (en) AI-based unit testing method and related equipment
CN114373173A (en) Data processing method and device, terminal equipment and storage medium
CN112434195A (en) Data analysis method and device, electronic equipment and computer readable storage medium
CN112559331A (en) Test method and device
CN112181539B (en) File processing method, device, equipment and medium
CN117389980B (en) Log file analysis method and device, computer equipment and readable storage medium
CN113988176B (en) Sample labeling method and device
CN118568264B (en) Text classification method, text search method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant