C Programming Interface of SQlite database (I) introduction -- Reading Notes of Using SQlite

Source: Internet
Author: User

C Programming Interface for SQlite database (I) Overview by Drizzle QQ: 253786989

Customer applications can interact with the SQlite library and database engine through the c api provided by SQlite to complete corresponding data operations. C/c ++ programming languages can directly use these native C APIs. For other programming languages, including Python and other scripting languages, you can use some third-party encapsulated libraries to access SQlite, the underlying layers of these encapsulated libraries are still implemented through C APIs. Therefore, if you want to use SQlite in your app, it is necessary to first understand the C APIs it provides.

These C APIs statements are passed to the SQlite database engine to query data, add, delete, modify, and perform other operations. Therefore, to learn how to use the SQlite database, you must learn to write basic SQL statements and understand basic standard SQL syntaxes. For more information, see this SQL-speaking book, the fastest way is to learn in practice.

C APIs of SQlite contains a certain number of data structures, nearly two hundred functions, and 200 or 300 constants. Although the number of APIS is large, it is not complicated to use. Only a part of the functions are frequently used, and many functions have similar functions, such:

For SQlite3, all API functions have a prefix: sqlite3 _. This prefix indicates that these APIs are provided by SQlite database products, and 3 indicates the version. All constants have a prefix: SQLITE _. The source code of the SQlite database is completely open. For APIs that is provided to the client application for calling, the function name is composed of lowercase characters. For example, sqlite3_create_function_v2 is a public api, while sqlite3CreateFunc is an internal SQlite function.

SQLITE_API int sqlite3_create_function_v2(){  ... ...  rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p, xFunc, xStep, xFinal, pArg);  ... ...}

For customers who use SQlite databases, it is very important to provide a stable set of APIs. Otherwise, each time SQlite comes out with a Release version, the previous APIs will be completely refreshed, therefore, the customer's application needs to modify its own APP, which costs a lot of maintenance. Therefore, the SQlite database API will not be deleted or modified once released. If an API does need to be improved, a new API function with the suffix "v2" will be provided, the old version is retained, so that the customer's APP can still run normally without modification. For example, sqlite3_create_function and sqlite3_create_function_v2.

When the SQlite API is called, SQLITE_ OK is returned if the call is successful. If the call fails, an Error code is returned, indicating what Error has occurred. You can check the returned values of API calls to improve program robustness.

C Programming Interface for SQlite database (I) Overview by Drizzle QQ: 253786989

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.