Книга: Beginning Android
Setting the Table
Setting the Table
For creating your tables and indexes, you will need to call execSQL()
on your SQLiteDatabase
, providing the DDL statement you wish to apply against the database. Barring a database error, this method returns nothing.
So, for example, you can use the following code:
db.execSQL("CREATE TABLE constants (_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, value REAL);");
This will create a table, named constants, with a primary key column named _id
that is an auto-incremented integer (i.e., SQLite will assign the value for you when you insert rows), plus two data columns: title
(text) and value
(a float, or “real” in SQLite terms). SQLite will automatically create an index for you on your primary-key column — you could add other indices here via some CREATE INDEX
statements, if you so chose.
Most likely, you will create tables and indexes when you first create the database, or possibly when the database needs upgrading to accommodate a new release of your application. If you do not change your table schemas, you might never drop your tables or indexes, but if you do, just use execSQL()
to invoke DROP INDEX
and DROP TABLE
statements as needed.
- Filter table
- Basics of the iptables command
- Setting up default policies
- Setting up user specified chains in the filter table
- PREROUTING chain of the nat table
- Use and Edit Files in the
- Finishing the Install
- Setting the TOS Bits Using iptables
- 4.4.4 The Dispatcher
- About the author
- Chapter 6. Traversing of tables and chains
- Chapter 7. The state machine