background preloader

Android

Facebook Twitter

Pragma statements supported by SQLite - Iceweasel. Small. Fast. Reliable.Choose any three. The PRAGMA statement is an SQL extension specific to SQLite and used to modify the operation of the SQLite library or to query the SQLite library for internal (non-table) data. The PRAGMA statement is issued using the same interface as other SQLite commands (e.g. Specific pragma statements may be removed and others added in future releases of SQLite. The C-language API for SQLite provides the SQLITE_FCNTL_PRAGMAfile control which gives VFS implementations the opportunity to add new PRAGMA statements or to override the meaning of built-in PRAGMA statements. PRAGMA command syntax pragma-stmt: pragma-value: signed-number: A pragma can take either zero or one argument. 1 yes true on0 no false off Keyword arguments can optionally appear in quotes.

A pragma may have an optional database name before the pragma name. List Of PRAGMAs Notes: PRAGMA application_id; PRAGMA application_id = integer ; Query or set the auto-vacuum status in the database. Busybox for android - Iceweasel. The toolbox that is provided on the Android environment is pretty limited. I wanted something more useful and familiar. Busybox to the rescue! I have a busybox binary available for those who are interested. To use it simply do # mkdir /data/busybox, on your emulated console.

Then copy the busybox binary across: $ adb push busybox /data/busybox/busybox. Once you do this you can install the necessary hardlinks by doing: # cd /data/busybox; . You should now be able to get access to all the useful busybox applets. Update:busybox was a straight compile of the standard busybox 1.8.1 release. Detect if a table contains a column in Android/sqlite - Stack Overflow - Iceweasel. Export an Android SQLite db to an XML file on the SD Card | mgmblog.com - Iceweasel. Export an Android SQLite db to an XML file on the SD Card I’m pretty syched about this code. It took some figuring out and some hunting and asking questions on Google’s Android forum.

But thanks to the following posts File permissions for world read/write SQLite3 sql command to show tables in database I pieced together the beginnings of some code that will take an Android SQLite db and export it to XML data within a file on the SD Card. Backing up program data for importing later Archiving some of the data for an application for possible reprocessing later Archive some data to shrink the memory footprint of the application Export data to a web server Data could be further broken down so only updated rows since last upload would be sent to server (fill in your idea here) The code is still a little raw, not much error checking or exception handling, but I’m sure you can improve on it in those areas.

Can anybody point out any obvious issues here (again, other then error/exception handling). App Inventor for Android - Iceweasel. Android – How to poke around the sqlite3 databases « Show me the code! – By Davanum Srinivas - Iceweasel. Android – How to poke around the sqlite3 databases Find and connect to a database You can find busybox on Benno’s site. If you can find the location of the .db file, you don’t really need busybox. Though i highly recommend it since it has many useful utilities. Find the list of tables and their structure sqlite> .tables .tables _deleted_people contact_methods peopleLookup calls people phones sqlite> .schema people .schema people CREATE TABLE people (_id INTEGER PRIMARY KEY,_sync_account TEXT,_sync_id TEXT,_sync_time TEXT,_sync_version TEXT,_sync_local_id INTEGER,_sync_dirty INTEGER,_sync_mark INTEGER,name TEXT NOT NULL,notes TEXT,photo TEXT,company TEXT,title TEXT,preferred_phone INTEGER,preferred_email INTEGER); CREATE INDEX peopleSyncIdIndex ON people (_sync_id); CREATE TRIGGER contact_cleanup DELETE ON people BEGIN DELETE FROM peopleLookup WHERE source = old.

_id;DELETE FROM phones WHERE person = old. Print some of the information from the tables Other commands Notes Like this: How to set trigger on contacts database in Android - Stack Overflow - Iceweasel. Query Language: CREATE TRIGGER - Iceweasel. Small. Fast. Reliable.Choose any three. [Top] create-trigger-stmt: delete-stmt: qualified-table-name: with-clause: cte-table-name: expr: literal-value: raise-function: type-name: signed-number: insert-stmt: with-clause: cte-table-name: select-stmt: common-table-expression: compound-operator: join-clause: join-constraint: join-operator: ordering-term: result-column: table-or-subquery: update-stmt: qualified-table-name: cte-table-name: The CREATE TRIGGER statement is used to add triggers to the database schema.

A trigger may be specified to fire whenever a DELETE, INSERT, or UPDATE of a particular database table occurs, or whenever an UPDATE occurs on on one or more specified columns of a table. At this time SQLite supports only FOR EACH ROW triggers, not FOR EACH STATEMENT triggers. If a WHEN clause is supplied, the SQL statements specified are only executed for rows for which the WHEN clause is true. An ON CONFLICT clause may be specified as part of an UPDATE or INSERT action within the body of the trigger.