ITコンサルの日常

ITコンサル会社に勤務する普通のITエンジニアの日常です。

Rails2.0からsqliteがデフォルトになったのはいいが、どうやって中身みるんだ?

sqlite3コマンドが、フロントエンドになっているらしい。

>sqlite3 development.sqlite3
SQLite version 3.5.4
Enter ".help" for instructions
sqlite> .databases
seq  name             file

---  ---------------  ----------------------------------------------------------

0    main             rails_apps/depot/db/development.sqlite3

sqlite> .tables
products     schema_info  sessions
sqlite> .schema sessions
CREATE TABLE sessions ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "session
_id" varchar(255) NOT NULL, "data" text DEFAULT NULL, "created_at" datetime DEFA
ULT NULL, "updated_at" datetime DEFAULT NULL);
CREATE INDEX "index_sessions_on_session_id" ON sessions ("session_id");
CREATE INDEX "index_sessions_on_updated_at" ON sessions ("updated_at");
sqlite> select * from sessions;
sqlite> select * from products;
6|Pragmatic Project Automation|<p>
       <em>Pragmatic Project Automation</em> shows you how to improve the
       consistency and repeatability of your project's procedures using
       automation to reduce risk and errors.
      </p>
      <p>
        Simply put, we're going to put this thing called a computer to work
        for you doing the mundane (but important) project stuff. That means
        you'll have more time and energy to do the really
        exciting---and difficult---stuff, like writing quality code.
      </p>|/images/auto.jpg|2008-05-01 21:20:23|2008-05-01 21:20:23|29.95
7|Pragmatic Version Control|<p>
         This book is a recipe-based approach to using Subversion that will
         get you up and running quickly---and correctly. All projects need
         version control: it's a foundational piece of any project's
         infrastructure. Yet half of all project teams in the U.S. don't use
         any version control at all. Many others don't use it well, and end
         up experiencing time-consuming problems.
      </p>|/images/svn.jpg|2008-05-01 21:20:24|2008-05-01 21:20:24|28.5
8|Pragmatic Unit Testing (C#)|<p>
        Pragmatic programmers use feedback to drive their development and
        personal processes. The most valuable feedback you can get while
        coding comes from unit testing.
      </p>
      <p>
        Without good tests in place, coding can become a frustrating game of
        "whack-a-mole." That's the carnival game where the player strikes at a
        mechanical mole; it retreats and another mole pops up on the opposite si
de
        of the field. The moles pop up and down so fast that you end up flailing

        your mallet helplessly as the moles continue to pop up where you least
        expect them.
      </p>|/images/utc.jpg|2008-05-01 21:20:24|2008-05-01 21:20:24|27.75
9|abcdefghih|dflkasdf|http://hoge.com/abc.png|2008-05-01 21:48:34|2008-05-01 22:
02:10|250
sqlite>
sqlite> .quit

>

なるほど。