13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Working with databaseshttp://www.zetcode.com/wxpython/databases/sqlite> .showecho: offexplain: offheaders: offmode: listnullvalue: ""output: stdoutseparator: "|"width:I prefer the column mode. In the next step we change the defaultsettings a bit.sqlite> .mode columnsqlite> .headers onsqlite> .width 10 4 15sqlite> select * from neighbours;name age remark---------- ---- ---------------sandy 7 stubbornjane 18 beautifulmark 28 lazysteven 34 friendlyalice 17 slicktom 25 cleverjack 89 wiselucy 18 cuteWe change the mode with the .mode command to the column mode.We set headers on with the .headers command. Finally we changethe width of each column with the .width command. <strong>The</strong> defaultvalue is ten characters.Backing up the data is the most important thing. sqlite3 has a simplesolution. We utilize command .dump.sqlite> .tablesneighbourssqlite> .dump neighboursBEGIN TRANSACTION;CREATE TABLE neighbours(name text, age numeric, remark text);INSERT INTO "neighbours" VALUES('sandy',7,'stubborn');INSERT INTO "neighbours" VALUES('jane',18,'beautiful');INSERT INTO "neighbours" VALUES('mark',28,'lazy');INSERT INTO "neighbours" VALUES('steven',34,'friendly');INSERT INTO "neighbours" VALUES('alice',17,'slick');INSERT INTO "neighbours" VALUES('tom',25,'clever');INSERT INTO "neighbours" VALUES('jack',89,'wise');INSERT INTO "neighbours" VALUES('lucy',18,'cute');COMMIT;<strong>The</strong> .dump command transforms the table into a set of SQL text5 de 12 27/04/2008 1:06

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!