CN107818157A - A kind of SQL statement method for packing based on FMDB - Google Patents

A kind of SQL statement method for packing based on FMDB Download PDF

Info

Publication number
CN107818157A
CN107818157A CN201711042735.0A CN201711042735A CN107818157A CN 107818157 A CN107818157 A CN 107818157A CN 201711042735 A CN201711042735 A CN 201711042735A CN 107818157 A CN107818157 A CN 107818157A
Authority
CN
China
Prior art keywords
sql
fmdb
sql statement
userdbmanager
classes
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
CN201711042735.0A
Other languages
Chinese (zh)
Other versions
CN107818157B (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.)
Beijing Kuwo Technology Co Ltd
Original Assignee
Beijing Kuwo Technology 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 Beijing Kuwo Technology Co Ltd filed Critical Beijing Kuwo Technology Co Ltd
Priority to CN201711042735.0A priority Critical patent/CN107818157B/en
Publication of CN107818157A publication Critical patent/CN107818157A/en
Application granted granted Critical
Publication of CN107818157B publication Critical patent/CN107818157B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to a kind of SQL statement method for packing based on FMDB, comprise the following steps:In FM interface layers, a UserDBManager classes are created, for being managed to customer data base, the UserDBManager classes generate an object and call method:AllModel(), this method intrinsic call FMDB encapsulation functions:Table functions, for specifying the table in customer data base, selectArray functions, for specifying on-unit, additional function, for specifying optional extra-instruction, after above parameter receives and parses through, UserDBManager classes are transferred to SQL execution levels after analysis result is encapsulated by commit instructions and handled.The present invention, it is clear in structure based on FMDB, it is easy to accomplish, simplify SQL statement writes size of code, is advantageous to improve development efficiency, reduces mistake caused by the duplication of labour in programming.

Description

A kind of SQL statement method for packing based on FMDB
Technical field
The present invention relates to SQLite API encapsulation technologies field, specifically a kind of SQL statement encapsulation side based on FMDB Method.
Background technology
IOS SDK support SQLite very early, when in use, it is only necessary to add libsqlite3.dylib rely on and Introduce sqlite3.h header files.But primary SQLite API are upper quite unfriendly in use, when in use, very Inconvenience.
The content of the invention
For defect present in prior art, it is an object of the invention to provide a kind of SQL statement envelope based on FMDB Dress method, it is clear in structure based on FMDB, it is easy to accomplish, simplify SQL statement writes size of code, is advantageous to improve exploitation effect Rate, reduce mistake caused by the duplication of labour in programming.
To achieve the above objectives, the present invention adopts the technical scheme that:
A kind of SQL statement method for packing based on FMDB, it is characterised in that comprise the following steps:
In FM interface layers, a UserDBManager classes are created, for being managed to customer data base,
The UserDBManager classes generate an object and call method:AllModel(), this method intrinsic call FMDB envelopes Fill function:
Table functions, for specifying the table in customer data base,
SelectArray functions, for specifying on-unit,
Additional function, for specifying optional extra-instruction,
After above parameter receives and parses through, after UserDBManager classes are encapsulated analysis result by commit instructions It is transferred to the processing of SQL execution levels.
On the basis of above-mentioned technical proposal, the optional extra-instruction and operational order parameter association, including it is but unlimited In:Ordering instruction, quantity limitation instruction, conditional order.
On the basis of above-mentioned technical proposal, the Parameter analysis of electrochemical refers to:
The parameter received is forwarded to SQL parameter layer by UserDBManager classes,
In SQL parameter layer,
Table name assignment statement by table name Parameter analysis of electrochemical for SQL statement Plays,
Operational order Parameter analysis of electrochemical for the operation of SQL statement Plays and is formulated into column name sentence,
Additional function is resolved to the additional function switch statement of SQL statement Plays,
After SQL parameter layer is disposed, result is forwarded to SQL assembled layers by UserDBManager classes, by result group The SQL statement of standard is dressed up,
Finally, the SQL statement for the standard that SQL assembled layers finish assembling returns to UserDBManager classes as character string.
On the basis of above-mentioned technical proposal, the character string after commit instruction encapsulation by being transferred to SQL execution levels Processing.
On the basis of above-mentioned technical proposal, the character string after commit instruction encapsulation by being used as params parameters Value is transferred to the processing of SQL execution levels.
On the basis of above-mentioned technical proposal, the SQL languages of params parameters carrying in the parsing commit instructions of SQL execution levels After sentence, the DBQueue queues of FM execution levels are stored to,
In FM execution levels, pass through executeQuery()Method is instructed to inquire about database to assign select, is inquired about As a result resultSet,
Finally, Query Result resultSet is returned into FM interface layers by KWSqlResult parameters.
On the basis of above-mentioned technical proposal, data below is comprised at least in the KWSqlResult parameters:
Success Flag position success, the result performed for indicating SQL,
More data bit rows, the Query Result of multiple data is included for storing,
Forms data position id, the Query Result of a data is included for storing,
Meter digital num, the Query Result of statistics is included for storing.
SQL statement method for packing of the present invention based on FMDB, it is clear in structure based on FMDB, it is easy to accomplish, simplify SQL statement writes size of code, is advantageous to improve development efficiency, reduces mistake caused by the duplication of labour in programming.
Brief description of the drawings
The present invention has drawings described below:
The flow chart of Fig. 1 present invention.
Embodiment
The present invention is described in further detail below in conjunction with accompanying drawing.
As shown in figure 1, the SQL statement method for packing of the present invention based on FMDB, comprises the following steps:
In FM interface layers, a UserDBManager classes are created, for being managed to customer data base,
The UserDBManager classes generate an object and call method:AllModel(), this method intrinsic call FMDB envelopes Fill function:
Table functions, for specifying the table in customer data base, user tables, i.e. user's table are specified in embodiment illustrated in fig. 1,
SelectArray functions, for specifying on-unit, selectarray instructions are specified in embodiment illustrated in fig. 1, Array is selected, and specifies selection nil objects,
Additional function, for specifying optional extra-instruction, sortStr instructions, i.e. ordering instruction are specified in embodiment illustrated in fig. 1, And ORDER BY rowid DESC are particularly limited as, quantity limitation instruction, conditional order etc. are can also be,
After above parameter receives and parses through, after UserDBManager classes are encapsulated analysis result by commit instructions It is transferred to the processing of SQL execution levels.
On the basis of above-mentioned technical proposal, the Parameter analysis of electrochemical refers to:
The parameter received is forwarded to SQL parameter layer by UserDBManager classes,
In SQL parameter layer,
Table name assignment statement by table name Parameter analysis of electrochemical for SQL statement Plays, i.e.,:Implement shown in table=sentence, Fig. 1 Table=user should be resolved in example,
By operational order Parameter analysis of electrochemical for SQL statement Plays operation and specified column name sentence, i.e.,:The row that acquisition is specified Row name simultaneously carries out corresponding operating to it, and the row obtained in the user tables such as uid, uname should be resolved in embodiment illustrated in fig. 1 Name, and select sentences are performed to it, due to specifying selection nil objects in embodiment illustrated in fig. 1, then accordingly resolve to all row Row name, be not described in detail herein,
Additional function is resolved to the additional function switch statement of SQL statement Plays, should be resolved in embodiment illustrated in fig. 1 ORDER BY rowid DESC,
After SQL parameter layer is disposed, result is forwarded to SQL assembled layers by UserDBManager classes, by result group The SQL statement of standard is dressed up, select should be resolved in embodiment illustrated in fig. 1(Uid, uname ...) from user ORDER BY rowid DESC,
Finally, the SQL statement for the standard that SQL assembled layers finish assembling returns to UserDBManager classes as character string.
On the basis of above-mentioned technical proposal, the character string after commit instruction encapsulation by being transferred to SQL execution levels Processing.
On the basis of above-mentioned technical proposal, the character string after commit instruction encapsulation by being used as params parameters Value is transferred to the processing of SQL execution levels.
On the basis of above-mentioned technical proposal, the SQL languages of params parameters carrying in the parsing commit instructions of SQL execution levels After sentence, the DBQueue queues of FM execution levels are stored to,
In FM execution levels, pass through executeQuery()Method is instructed to inquire about database to assign select, is inquired about As a result resultSet,
Finally, Query Result resultSet is returned into FM interface layers by KWSqlResult parameters.
On the basis of above-mentioned technical proposal, data below is comprised at least in the KWSqlResult parameters:
Success Flag position success, the result performed for indicating SQL,
More data bit rows, the Query Result of multiple data is included for storing,
Forms data position id, the Query Result of a data is included for storing,
Meter digital num, the Query Result of statistics is included for storing.
The content not being described in detail in this specification belongs to prior art known to professional and technical personnel in the field.

Claims (7)

1. a kind of SQL statement method for packing based on FMDB, it is characterised in that comprise the following steps:
In FM interface layers, a UserDBManager classes are created, for being managed to customer data base,
The UserDBManager classes generate an object and call method:AllModel(), this method intrinsic call FMDB envelopes Fill function:
Table functions, for specifying the table in customer data base,
SelectArray functions, for specifying on-unit,
Additional function, for specifying optional extra-instruction,
After above parameter receives and parses through, after UserDBManager classes are encapsulated analysis result by commit instructions It is transferred to the processing of SQL execution levels.
2. the SQL statement method for packing based on FMDB as claimed in claim 1, it is characterised in that:The optional extra-instruction With operational order parameter association, include but is not limited to:Ordering instruction, quantity limitation instruction, conditional order.
3. the SQL statement method for packing based on FMDB as claimed in claim 1, it is characterised in that:The Parameter analysis of electrochemical refers to:
The parameter received is forwarded to SQL parameter layer by UserDBManager classes,
In SQL parameter layer,
Table name assignment statement by table name Parameter analysis of electrochemical for SQL statement Plays,
Operational order Parameter analysis of electrochemical for the operation of SQL statement Plays and is formulated into column name sentence,
Additional function is resolved to the additional function switch statement of SQL statement Plays,
After SQL parameter layer is disposed, result is forwarded to SQL assembled layers by UserDBManager classes, by result group The SQL statement of standard is dressed up,
Finally, the SQL statement for the standard that SQL assembled layers finish assembling returns to UserDBManager classes as character string.
4. the SQL statement method for packing based on FMDB as claimed in claim 3, it is characterised in that:The character string passes through The processing of SQL execution levels is transferred to after commit instruction encapsulation.
5. the SQL statement method for packing based on FMDB as claimed in claim 4, it is characterised in that:The character string passes through Value after commit instruction encapsulation as params parameters is transferred to the processing of SQL execution levels.
6. the SQL statement method for packing based on FMDB as claimed in claim 5, it is characterised in that:SQL execution levels parse After the SQL statement that params parameters carry in commit instructions, the DBQueue queues of FM execution levels are stored to,
In FM execution levels, pass through executeQuery()Method is instructed to inquire about database to assign select, is inquired about As a result resultSet,
Finally, Query Result resultSet is returned into FM interface layers by KWSqlResult parameters.
7. the SQL statement method for packing based on FMDB as claimed in claim 6, it is characterised in that:The KWSqlResult ginsengs Data below is comprised at least in number:
Success Flag position success, the result performed for indicating SQL,
More data bit rows, the Query Result of multiple data is included for storing,
Forms data position id, the Query Result of a data is included for storing,
Meter digital num, the Query Result of statistics is included for storing.
CN201711042735.0A 2017-10-31 2017-10-31 SQL statement packaging method based on FMDB Active CN107818157B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711042735.0A CN107818157B (en) 2017-10-31 2017-10-31 SQL statement packaging method based on FMDB

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711042735.0A CN107818157B (en) 2017-10-31 2017-10-31 SQL statement packaging method based on FMDB

Publications (2)

Publication Number Publication Date
CN107818157A true CN107818157A (en) 2018-03-20
CN107818157B CN107818157B (en) 2021-06-29

Family

ID=61604438

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711042735.0A Active CN107818157B (en) 2017-10-31 2017-10-31 SQL statement packaging method based on FMDB

Country Status (1)

Country Link
CN (1) CN107818157B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1294126A1 (en) * 2001-09-14 2003-03-19 Siemens Aktiengesellschaft Method to control the access to a fault management system of a communications network, fault management system and computer program
US20080270424A1 (en) * 2007-04-24 2008-10-30 Microsoft Corporation Standalone execution of incomplete data flows
CN101847142A (en) * 2009-03-25 2010-09-29 上海斯年信息技术有限公司 Web page development method based on data sheet mould encapsulation
US20120221512A1 (en) * 2011-02-28 2012-08-30 International Business Machines Corporation Dynamic database dump
CN104142944A (en) * 2013-05-07 2014-11-12 杭州勒卡斯广告策划有限公司 Method and system for encapsulating SQL statements
CN105630508A (en) * 2015-12-31 2016-06-01 广州亦云信息技术有限公司 Processing method and processing system for encapsulating SQL (Structured Query Language) in Java system
CN106095792A (en) * 2016-05-27 2016-11-09 ***股份有限公司 The method and apparatus generating database manipulation code
CN106294776A (en) * 2016-08-12 2017-01-04 北京东方车云信息技术有限公司 A kind of data processing method and device
CN106599139A (en) * 2016-12-05 2017-04-26 金蝶软件(中国)有限公司 MyBatis framework-based structured query language (SQL) processing method and apparatus

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1294126A1 (en) * 2001-09-14 2003-03-19 Siemens Aktiengesellschaft Method to control the access to a fault management system of a communications network, fault management system and computer program
US20080270424A1 (en) * 2007-04-24 2008-10-30 Microsoft Corporation Standalone execution of incomplete data flows
CN101847142A (en) * 2009-03-25 2010-09-29 上海斯年信息技术有限公司 Web page development method based on data sheet mould encapsulation
US20120221512A1 (en) * 2011-02-28 2012-08-30 International Business Machines Corporation Dynamic database dump
CN104142944A (en) * 2013-05-07 2014-11-12 杭州勒卡斯广告策划有限公司 Method and system for encapsulating SQL statements
CN105630508A (en) * 2015-12-31 2016-06-01 广州亦云信息技术有限公司 Processing method and processing system for encapsulating SQL (Structured Query Language) in Java system
CN106095792A (en) * 2016-05-27 2016-11-09 ***股份有限公司 The method and apparatus generating database manipulation code
CN106294776A (en) * 2016-08-12 2017-01-04 北京东方车云信息技术有限公司 A kind of data processing method and device
CN106599139A (en) * 2016-12-05 2017-04-26 金蝶软件(中国)有限公司 MyBatis framework-based structured query language (SQL) processing method and apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘丹: ""OOP 的封装性在各种编程语言中的试验研究"", 《信息与电脑(理论版)》 *
牛丽 等: ""iOS平台移动学习资源构建及终端实现研究"", 《中国教育信息化》 *

Also Published As

Publication number Publication date
CN107818157B (en) 2021-06-29

Similar Documents

Publication Publication Date Title
CN105138501B (en) A kind of configurable dynamic report generation method and system
CN103440273B (en) A kind of data cross-platform migration method and device
CN103500196B (en) EXCEL data export method and let-off gear(stand) thereof under many concurrent big data quantity environment
CN103488704B (en) A kind of date storage method and device
EP2924588A1 (en) Report creation method, device and system
CN103714145B (en) Relationship type and Key-Value type database spatial data index method
CN109978499B (en) Quick processing method for multi-station post telemetry data
CN106547729B (en) A kind of dynamic creation method and system of data sheet
CN101599067A (en) A kind of method of self-customizing report forms
CN110728123B (en) Report generation method, system and related equipment
CN106407302A (en) Method for supporting function of calling specific functions of middleware database through simple SQL
CN1786965A (en) Method for acquiring news web page text information
CN108536745A (en) Tables of data extracting method, terminal, equipment and storage medium based on Shell
CN104794203A (en) System and method for alga enumeration data voice rapid inputting and report generation
CN108256820A (en) A kind of PBOM methods of adjustment under three-dimensional assembled view based on MBD
CN100589101C (en) Data access method based on the Oracle relational database of routine call interface
CN113094355A (en) Model instantiation method, device, equipment and medium based on domestic communication protocol
CN110674195B (en) Form-based query method
CN109445768A (en) Database script generation method, device, computer equipment and storage medium
CN107818157A (en) A kind of SQL statement method for packing based on FMDB
CN106127863B (en) A kind of refrigerator foaming die series design system and its method
CN101751436A (en) Method and system for generating reports
CN107562955A (en) A kind of rapid generation of SQL statement
CN101714087A (en) System and method for mapping C language structure to relation database table
CN103793519A (en) Automatic tool supporting exportation of mass data

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