A summary of SQLite functions

Source: Internet
Author: User

1. Open the Database

int Sqlite3_open (

const char *filename,//file path for database

Sqlite3 **ppdb//DB instance

);

2. Execute any SQL statement

int Sqlite3_exec (

sqlite3*,//an open DB instance

const char *sql,//SQL statement to execute

Int (*callback) (void*,int,char**,char**),//callback after the SQL statement is executed

void *,//The 1th parameter of the callback function

Char **errmsg//error message

);

3. Check the legality of the SQL statement (pre-query preparation)

int Sqlite3_prepare_v2 (

Sqlite3 *db,//DB instance

const char *zsql,//SQL statement to check

int Nbyte,//maximum byte length for SQL statements

Sqlite3_stmt **ppstmt,//sqlite3_stmt instance, used to obtain database data

const CHAR **pztail

);

4. Querying a row of data

int Sqlite3_step (sqlite3_stmt*);//If a row of data is queried, it returns Sqlite_row

5. Use stmt to get the value of a field (the subscript of a field starts with 0)

Double sqlite3_column_double (sqlite3_stmt*, int icol); Floating point data

int Sqlite3_column_int (sqlite3_stmt*, int icol); Integral type data

Sqlite3_int64 Sqlite3_column_int64 (sqlite3_stmt*, int icol); Long-integer data

const void *sqlite3_column_blob (sqlite3_stmt*, int icol); Binary Text data

Const unsigned char *sqlite3_column_text (sqlite3_stmt*, int icol); String data

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.