Supercharge Your Innovation With Domain-Expert AI Agents!

Method for processing binary data file through SQL statements

A technology of binary data and sentences, applied in the field of IT digitization, can solve the problems of increasing learning costs and achieve the effect of low learning costs

Inactive Publication Date: 2020-04-17
SICHUAN WINSHARE EDUCATION SCI & TECH
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0019] It can be seen that under the prior art, binary data files are usually read directly through direct codes. Typically, c / c++ reads through data pointer jumps, so that upper-level business coding personnel need to understand the details of the data files, and Increased learning costs for API syntax familiar with files, file memory mapping, data byte access, etc.

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 processing binary data file through SQL statements
  • Method for processing binary data file through SQL statements
  • Method for processing binary data file through SQL statements

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0043] This embodiment illustrates the method of writing SQL statements to query and update resource data by operating a specific resource data file.

[0044] The format and main values ​​of the digital resource binary data file are shown in the following table:

[0045]

[0046]

[0047] The data file contains two tables: a resource table and a configuration table. The resource table is mainly composed of a resource index table and a resource data table; the configuration table is mainly composed of a configuration data table. The resource ID composition rule is to start numbering sequentially from 100, for example, the resource with ID 199 is the 199th-100+1=100th resource. The data of each resource is variable-length data (because the title and description fields in each resource are variable-length fields).

[0048] If only the query operation is performed on the data file, the OpenFileMapping / MapViewOfFile function can be used under the windows system to map the da...

Embodiment 2

[0059] Take querying the size of a resource whose title starts with "Five Generations" and whose resource type is "image" as an example, the query method is:

[0060] Step 1. According to the business scenario, compile the query SQL statement:

[0061] Write SQL statement: string SQL=select size from resource where title like'five generations%s'and mediatypeName='image';

[0062] Step 2, parse out the keywords in the SQL statement:

[0063] Same as above, use the SQLParser component to analyze, you can get the query keyword select, the table name resource, the query field title / like / 'five generations%s'; and; mediatypeName / = / 'image';

[0064] Step 3. Translate the above keywords into high-level language codes, and execute according to the situation:

[0065] You can know that it is a query statement through the query keyword select, and know that the current query is a query for a resource table through the table name resource. In the file header, you can find that the index...

Embodiment 3

[0069] Take updating resource data with resource ID 199 and changing its resource description field (description) to "Boundary: Classification: Tropical, North Temperate, North Cold, South Temperate, South Cold" as an example, the update method is:

[0070] Step 1. According to the business scenario, compile the update SQL statement:

[0071] Write SQL statement: string SQL=update resource set description==Boundary division: classification: tropical, north temperate zone, north frigid zone, south temperate zone, south frigid zone 'where resourceId='199';

[0072] Step 2, parse out the keywords in the SQL statement:

[0073] Use the SQLParser component in durid to parse the SQL, and you can get the keyword update, table name resource, field description / 'demarcation boundary: classification: tropical, north temperate, north frigid, south temperate, south frigid', and condition resourceId / = / 199;

[0074] Step 3. Translate the above keywords into high-level language codes, and ...

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 processing a binary data file through an SQL (Structured Query Language) statement, which comprises the following steps of: compiling the SQL statement for query or update according to a service scene; analyzing keywords in the SQL statement, wherein the keywords comprise SQL request keywords, table names, field names in conditional clauses and corresponding field values; translating the keyword into a high-level language code, and executing the steps according to conditions: if the keyword is a query statement, reading the mapped file according to a typical data reading mode to obtain a result; and if the keyword is an updated statement, finding a target data entry according to the first query method, and processing the situation that the length of theupdated data field is less than, equal to and greater than the length of the original field according to the situation. According to the method, by using the SQL statements, encoding personnel not concerning a bottom data structure can easily read the data files, the learning cost of developers is low, and the method is suitable for applications with small data volume and selection of binary datafiles instead of databases.

Description

technical field [0001] The invention relates to a method for processing binary data files, in particular to a method for processing binary data files through SQL statements, and belongs to the technical field of IT digitization. Background technique [0002] There is often a need to access data in software. For systems with a large amount of data, databases are generally used for data access. For a small amount of data, especially a read-only system, the use of a database is heavy. The alternative solution includes using text files for data access, such as common xml, json, ini and other files. In addition, it is also a common way to use a custom binary data file as a data carrier. The binary data file format is generally defined privately, and the program for reading and writing the data file performs specific code writing according to the structure of the data file. The advantage of this method is that data files can be directly manipulated, and the reading and writing e...

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
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/41G06F8/73G06F16/14
CPCG06F8/427G06F8/73G06F16/144
Inventor 连接力
Owner SICHUAN WINSHARE EDUCATION SCI & TECH
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More