13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Working with databaseshttp://www.zetcode.com/wxpython/databases/transactions are called transactional databases. An SQLite databaseis a transactional database. An SQL result set is a set of rows andmetadata about the query from a database. It is a set of records thatresults from running a query. A single unit of structured data within adatabase table is called a record or a row.sqlite3SQLite library includes a small command line utility called sqlite3. Itis used to manually enter and execute SQL commands against aSQLite database. To launch this utility, we type sqlite3 into the shell.<strong>The</strong> command is to be followed by a database name. If the databasedoes not exist, a new one is created. We work with sqlite3 with adefinite set of dot commands. To show all available commands, wetype .help. Some of the commands are shown in the following table.Command.databases.dump table.exit.headers ON|OFF.help.mode mode table.quit.read filename.show.tables pattern.width num num ...Descriptionshow a database namedump a table into an SQL text formatexit the sqlite3 programshow or hide column headersshow helpchange mode for a tablesame as .exitexecute SQL commands in a filenameshow sqlite3 settingslist tables that match patternset width for columnsFirst, we create a new database called people.$ sqlite3 peopleSQLite version 3.3.13Enter ".help" for instructionssqlite>sqlite> .databasesseq name file--- --------------- ----------------------------------------------------------0 main /home/vronskij/tmp/peoplesqlite> .exit$All commands of sqlite3 start with the dot "." character. To show allavailable commands, we simply type .help. <strong>The</strong> .databases commandshows our current database. <strong>The</strong> .exit command quits the sqlite3utility and returns to the shell.Next we create a table.3 de 12 27/04/2008 1:06

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

Saved successfully!

Ooh no, something went wrong!