Created
April 21, 2014 00:46
-
-
Save masayuki5160/11129245 to your computer and use it in GitHub Desktop.
PerlでSQLiteを使ってみる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use DBI; | |
my $database = 'test.db'; | |
my $data_src = "dbi:SQLite:dbname=$database"; | |
my $dbh = DBI->connect($data_src); | |
my $createTableQuery = 'CREATE TABLE BOOK (title,author);'; | |
$dbh->do($createTableQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perldoc DBD::SQLite perldoc DBI
でモジュールが入っているかチェック.
ないときは以下で追加する.
cpan DBD::SQLite cpan DBI
dbファイルはこの設定だと実行ファイルと同じとこに作成された.
sqlite3 test.db
で接続して確認してみれば大丈夫.