FrozenHeart FrozenHeart - 1 year ago 142
C++ Question

SQLite C interface doesn't create sqlite_master table

It seems that SQLite C interface create database that doesn't contain

table described in the documentation:

From within a C/C++ program (or a script using Tcl/Ruby/Perl/Python
bindings) you can get access to table and index names by doing a
SELECT on a special table named "SQLITE_MASTER". Every SQLite database
has an SQLITE_MASTER table that defines the schema for the database

The following code creates a database that doesn't contain such table (
command returns nothing):

#include <sqlite3.h>

int main()
sqlite3* db;
sqlite3_open("helper.db", &db);

Why? What should I do to create it?

Answer Source

The .tables command does not show any of the internal tables, but they do exist:

sqlite> create table t(x);
sqlite> .tables
sqlite> select * from sqlite_master;
table|t|t|2|CREATE TABLE t(x)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download