FrozenHeart
FrozenHeart

Reputation: 20746

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?

Upvotes: 0

Views: 446

Answers (1)

CL.
CL.

Reputation: 180080

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)

Upvotes: 2

Related Questions