Class LiveJournal::Database
In: lib/livejournal/database.rb
Parent: Object

An interface for an SQLite database dump.

Methods

Classes and Modules

Class LiveJournal::Database::Error

Constants

EXPECTED_DATABASE_VERSION = "3"
SCHEMA = %q{ CREATE TABLE meta ( key TEXT PRIMARY KEY, value TEXT ); CREATE TABLE entry ( itemid INTEGER PRIMARY KEY, anum INTEGER, subject TEXT, event TEXT, moodid INTEGER, mood TEXT, music TEXT, location TEXT, taglist TEXT, pickeyword TEXT, preformatted INTEGER, backdated INTEGER, comments INTEGER, year INTEGER, month INTEGER, day INTEGER, timestamp INTEGER, security INTEGER ); CREATE INDEX dateindex ON entry (year, month, day); CREATE INDEX timeindex ON entry (timestamp); CREATE TABLE comment ( commentid INTEGER PRIMARY KEY, posterid INTEGER, itemid INTEGER, parentid INTEGER, state TEXT, -- screened/deleted/active subject TEXT, body TEXT, timestamp INTEGER -- unix timestamp ); CREATE INDEX commententry ON comment (itemid); CREATE TABLE users ( userid INTEGER PRIMARY KEY, username TEXT ); CREATE TABLE commentprop ( commentid INTEGER, -- not primary key 'cause non-unique key TEXT, value TEXT ); }.gsub(/^ /, '')

Attributes

db  [R]  The underlying SQLite3 database.

Public Class methods

Public Instance methods

Close the underlying database. (Is this necessary? Not sure.)

Yield a set of entries, ordered by ascending itemid (first to last).

Fetch a specific itemid.

The the actual journal stored by this Database. (This is different than simply the username when usejournal is specified.)

Given SQL that selects some entries, yield each Entry.

Given SQL that selects an entry, return that Entry.

Return the total number of entries.

Turn tracing on. Mostly useful for debugging.

Run a block within a single database transaction. Useful for bulk inserts.

[Validate]