FrozenHeart FrozenHeart - 3 months ago 14
C++ Question

SQLite C interface doesn't create sqlite_master table

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

sqlite_master
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 (
.tables
command returns nothing):

#include <sqlite3.h>

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


Why? What should I do to create it?

CL. CL.
Answer

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

sqlite> create table t(x);
sqlite> .tables
t
sqlite> select * from sqlite_master;
table|t|t|2|CREATE TABLE t(x)