DBD-SQLite-0.19 > DBD::SQLite
DBD-SQLite-0.19
Other versions:
DBD-SQLite-1.29

名前

DBD::SQLite - Self Contained RDBMS in a DBI Driver

DBD::SQLite - DBI ドライバでの自己完結型(Self Contained)RDBMS

概要

  use DBI;
  my $dbh = DBI->connect("dbi:SQLite:dbname=dbfile","","");

説明

SQLite is a public domain RDBMS database engine that you can find at http://www.hwaci.com/sw/sqlite/.

SQLite は、パブリックドメインのRDBMSデータベースエンジンです; この URL で見つけることが出来ます: http://www.hwaci.com/sw/sqlite/.

Rather than ask you to install SQLite first, because SQLite is public domain, DBD::SQLite includes the entire thing in the distribution. So in order to get a fast transaction capable RDBMS working for your perl project you simply have to install this module, and nothing else.

SQLite を先にインストールするように頼むよりも、SQLite が パブリックドメインであることから、DBD::SQLite は全てのものを ディストリビューションに含んでいます。 そのためあなたの perl プロジェクトのために、高速の トランザクション可能な RDBMS を動かすためには、単にこのモジュールを インストールすることだけが必要です。 他には 何もありません

SQLite supports the following features:

SQLiteは以下の機能をサポートしています:

Implements a large subset of SQL92

(SQL92 のサブセットの多くを実装)

See http://www.hwaci.com/sw/sqlite/lang.html for details.

詳細は http://www.hwaci.com/sw/sqlite/lang.html をご覧ください。

A complete DB in a single disk file

(単一のディスクファイルでの完全な DB)

Everything for your database is stored in a single disk file, making it easier to move things around than with DBD::CSV.

あなたのデータベースのための全ては一つのディスクファイルに格納されます。 これにより DBD::CSV よりも簡単に動かすことが出来ます。

Atomic commit and rollback

(アトミックなコミットとロールバック)

Yes, DBD::SQLite is small and light, but it supports full transactions!

そうです、DBD::SQLite は小さく、軽量ですが、 完全なトランザクションをサポートします。

There's lots more to it, but this is early development stages, so please refer to the docs on the SQLite web page, listed above, for SQL details.

これ以上のものがありますが、これままだ開発段階の初期です。 そのため SQL の詳細については、上に挙げた SQLite web ページにある ドキュメントを参照してください。

API

The API works exactly as every DBI module does. Please see DBI for more details.

API は厳密に各 DBI モジュールがするように機能します。 更なる詳細については DBI をご覧ください。

$dbh->func('last_insert_rowid')

This method returns the last inserted rowid. If you specify an INTEGER PRIMARY KEY as the first column in your table, that is the column that is returned. Otherwise, it is the hidden ROWID column. See the sqlite docs for details.

このメソッドは最後に挿入された rowid を返します。 もし INTEGER PRIMARY KEY をあなたのテーブルでの先頭カラムとして指定すれば、 返されるのはそのカラムになります。 そうでなければ、それは隠された ROWID カラムになります。 詳細については sqlite ドキュメントをご覧ください。

NOTES

To access the database from the command line, try using dbish which comes with the DBI module. Just type:

コマンドラインからデータベースにアクセスするためには、DBI モジュールに 入っている dbish を試してみてください。 以下のようにタイプして:

  dbish dbi:SQLite:foo.db

On the command line to access the file foo.db.

コマンドラインでファイル foo.db にアクセスします。

Alternatively you can install SQLite from the link above without conflicting with DBD::SQLite and use the supplied sqlite command line tool.

代わりとして、上記のリンクから DBD::SQLite にぶつかることなく SQLite を インストールし、提供される sqlite コマンドラインツールを使うことが 出来ます。

性能

SQLite is fast, very fast. I recently processed my 72MB log file with it, inserting the data (400,000+ rows) by using transactions and only committing every 1000 rows (otherwise the insertion is quite slow), and then performing queries on the data.

SQLiteは 高速です、非常に高速です。 私は最近、私の 72MB のログファイルをそれで処理しました。 単純に 1000 行毎にコミットしながら(そうでなければ挿入がとても遅くなります)、 トランザクションを使ってデータ(400,000 以上の行)を挿入し、 そのデータに問い合わせを実行しました。

Queries like count(*) and avg(bytes) took fractions of a second to return, but what surprised me most of all was:

count(*) と avg(bytes) のような問い合わせは、たちまち返ってきました。 しかし何より驚いたことは:

  SELECT url, count(*) as count FROM access_log
    GROUP BY url
    ORDER BY count desc
    LIMIT 20

To discover the top 20 hit URLs on the site (http://axkit.org), and it returned within 2 seconds. I'm seriously considering switching my log analysis code to use this little speed demon!

サイト (http://axkit.org) にヒットし たURL のトップ 20 を見つけることでした。 これを 2 秒以内で返しました。 私は真剣に私のログ解析コードを、この小さな スピードの魔物を使うように変更することを考えています。

Oh yeah, and that was with no indexes on the table, on a 400MHz PIII.

そうそう、テーブルにはインデックスをつけていませんし、400MHz PIII の上です。

For best performance be sure to tune your hdparm settings if you are using linux. Also you might want to set:

パフォーマンスを最高にするためには、linux を使っているのであれば、 hdparam のセッティングを確実にチューンしてください。 またこのように設定したいかもしれません:

  PRAGMA default_synchronous = OFF

Which will prevent sqlite from doing fsync's when writing, which will slow down non-transactional writes significantly, at the expense of some piece of mind. Also try playing with the cache_size pragma.

これは、いくらかの心配を犠牲にすることで、トランザクションを使わない 書込みを非常に遅くしてしまう fsync がすることから、sqlite を保護します。 cache_size pragma でも楽しんでみるようにしてください。

バグ

Likely to be many, please use http://rt.cpan.org/ for reporting bugs.

多くのものと同じように、バグの報告のためには http://rt.cpan.org/ を 使ってください。

作者

Matt Sergeant, matt@sergeant.org

SEE ALSO

DBI.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 53:

'=end or iginal' is invalid. (Stack: =begin original)