![]() For indices, type is equal to 'index', name is the name of the index and tbl_name is the name of the table to which the index belongs. For tables, the type field will always be 'table' and the name field will be the name of the table. You can query SQLITE_MASTER table to get the tables and index names of all other tables and indexes this database contains. SQLITE_MASTER's schema looks like this:ĬREATE TABLE sqlite_master ( type TEXT, name TEXT, tbl_name TEXT, rootpage INTEGER, sql TEXT ) At this time there is no way to get a listing of temporary tables and indices. Temporary tables do not appear in the SQLITE_MASTER table. The SQLITE_MASTER table is read only, you can not use UPDATE, INSERT or DELETE commands with this table, and the table is automatically updated by CREATE TABLE, CREATE INDEX, DROP TABLE, and DROP INDEX commands. SQLite Nuts and Bolts Query what's in the database using sqlite3.exe from command line '.tables' delivers a list of all tables.Įvery SQLite database stores their tables in a internal special table called SQLITE_MASTER. CommandText = "INSERT INTO FOO (MYVALUE) VALUES(?)" Ĭmd. CommandText = "CREATE TABLE FOO (ID INTEGER PRIMARY KEY, MYVALUE VARCHAR(50))" Ĭmd. Using (DbConnection cnn = new SQLiteConnection ( "Data Source=test.db3" )) ExecuteReader ( "SELECT * FROM test " ))įor ( int pos = 0 pos < data. ExecuteNonQuery ( "insert into test values (2, \"hello\", \"eqqon!\") " ) ExecuteNonQuery ( "insert into test values (1, \"hello\", \"world!\n\") " ) ĭb. ExecuteNonQuery ( "create table test( nr int primary key, name varchar(30), text varchar(30) ) " ) ĭb. ![]() ExecuteNonQuery ( "drop table if exists test " ) ĭb. SQLiteConnection db = new SQLiteConnection ( "test.db" ) ĭb. Here is a small sample that creates a table, inserts some data and queries them back in C#. The easiest way for an application to set up a database back-end is SQLite. Check out Git#, the most advanced open source implementation of git for.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |