對我的作品
$ perl -E'
use DBI;
my $dbh = DBI->connect("dbi:SQLite:", undef, undef,
{ PrintError => 0, RaiseError => 1, AutoCommit => 1 });
$dbh->do("CREATE TEMP TABLE MyTable (id INT)");
$dbh->do("INSERT INTO MyTable VALUES (?)", undef, $_) for 1..9;
my $sql = "SELECT * FROM MyTable LIMIT 3 OFFSET 4";
my $sth = $dbh->prepare($sql);
$sth->execute();
say for keys %{ $sth->fetchall_hashref("id") };
'
5
6
7
,或者在命令行客戶端
$ sqlite3
SQLite version 3.3.6
Enter ".help" for instructions
sqlite> CREATE TEMP TABLE MyTable (id INT);
sqlite> INSERT INTO MyTable VALUES (1);
sqlite> INSERT INTO MyTable VALUES (2);
sqlite> INSERT INTO MyTable VALUES (3);
sqlite> INSERT INTO MyTable VALUES (4);
sqlite> INSERT INTO MyTable VALUES (5);
sqlite> INSERT INTO MyTable VALUES (6);
sqlite> INSERT INTO MyTable VALUES (7);
sqlite> INSERT INTO MyTable VALUES (8);
sqlite> INSERT INTO MyTable VALUES (9);
sqlite> SELECT * FROM MyTable LIMIT 3 OFFSET 4;
5
6
7
sqlite> .q
版本:
$ perl -MDBI -E'
my $dbh = DBI->connect("dbi:SQLite:", undef, undef);
say for
$DBD::SQLite::VERSION,
$dbh->{sqlite_version}
'
1.40
3.7.17
我以前的git克隆工具,並從GitHub複製的例子中,保存的更改到文件,但沒有任何事情發生。 我剛剛創建了一個新文件,並將其全部移動到那裏,現在它可以工作,我不知道它爲什麼沒有工作。謝謝ikegami。 –