Sqlite-api-sqlite3_get_table ()

Source: Internet
Author: User
Tags sqlite

Reference--http://www.cnblogs.com/likebeta/archive/2012/06/17/2552784.html

http://babybandf.blog.163.com/blog/static/61993532010326133751/

Execute SQL statement

Get the result set and store

No callback function

int sqlite3_get_table (  sqlite3 *db,/          * An Open database */  const char *zsql,      Char ***pazresult, /    * Results of the query */  int *pnrow,/* Number of           result rows written here */  int *pncolumn,/* Number of        result columns written here *  /char **pzerrmsg       /* Error msg written here */); void Sqlite3_free_table (char **result);

The 1th argument no longer says more, look at the previous example.
The 2nd parameter is the SQL statement, which is the same as the SQL in Sqlite3_exec. is a very common char* string that ends with a.
The 3rd parameter is the query result, which is still a one-dimensional array (don't think of it as a two-dimensional array, let alone a three-dimensional array). its memory layout is: The field name, followed by the value of each field. here's an example.
The 4th parameter is how many records are queried (that is, how many rows are detected, excluding the row of field names).
The 5th parameter is the number of fields (how many columns).
The 6th parameter is the error message, just like the previous one, here is not much to say.
The number of strings returned by Pazresult is actually (*pnrow+1) * (*pncolumn), because the first (*pncolumn) is the field name


Sqlite-api-sqlite3_get_table ()

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.