SQLite reads the database contents

Source: Internet
Author: User

1. Open an existing database.

Open Database

-(BOOL ) opendb

{// Red Section modified to its own database path

return (sqlite_ok = = Sqlite3_open([@ "/users/apple/ Desktop/text/black/black/province_city_zone.db" utf8string], &db));

}

2. Use the Select field from the table string sql to get the table and use it.

  

SQLITE_OK = = sqlite3_prepare_v2(db, SQL. Utf8string,-1, &stmt, NULL

Then use

while (sqlite_row = = sqlite3_step(stmt)) {

(index = = 0) {

Const unsigned char *name = sqlite3_column_text(stmt, 0);

int ids = sqlite3_column_int(stmt, 1);

int sort = sqlite3_column_int(stmt, 2);

Get the data and save it.

}

Compare the image. Today, we mainly read the data from a well-written database (with information about the provinces and cities).

SQLite reads the database contents

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.