Interested in improving this site? Please check the To Do page.
sqlite.getTableSchema
Retrieve the schema for a named table in SQL format.
Syntax
sqlite.getTableNames (dbID, tableName)
Params
dbID is the database ID returned by sqlite.open. tableName is the name of the table.
Returns
An SQL statement that could be used to create the table.
Examples
db = sqlite.open("C:\\temp\\world.db3");
output = sqlite.getTableSchema (db, "Country")
The value of output is:
CREATE TABLE "Country" (
"Code" TEXT NOT NULL,
"Name" TEXT NOT NULL,
"Continent" TEXT NOT NULL,
"Region" TEXT NOT NULL,
"SurfaceArea" REAL NOT NULL,
"IndepYear" INTEGER,
"Population" INTEGER NOT NULL,
"LifeExpectancy" REAL,
"GNP" REAL,
"GNPOld" REAL,
"LocalName" TEXT NOT NULL,
"GovernmentForm" TEXT NOT NULL,
"HeadOfState" TEXT,
"Capital" INTEGER,
"Code2" TEXT NOT NULL,
PRIMARY KEY ("Code")
)
Notes
sqlite.getTableSchema takes advantage of the table sqlite_master defined in all SQLite tables. sqlite_master contains all sorts of interesting information that may be useful to understanding the database definition.