SQLite$B%i%$%V%i%j(B


#1

成瀬です。

Ruby 1.9でSQLiteライブラリを標準添付しませんか?

旧来からsqlite3-rubyという物は存在していましたが、
http://rubyforge.org/projects/sqlite-ruby
http://sqlite-ruby.rubyforge.org/sqlite3/

これに対して今回新しく起こしたライブラリでは、

  • nativeかつコンパクトな実装
  • それなりにやる気のあるメンテナ
    という利点があります。

使う際には以下のような感じになります。
多段transactionやbackupが特徴でしょうか。

SQLite.open(":memory:") do |db|
db.transaction do
db.exec(“CREATE TABLE foo (int INTEGER, text TEXT)”)
10.times do |i|
db.exec(“INSERT INTO foo VALUES (#{i}, ‘foo’)”)
end

  p db.exec("SELECT * FROM foo")[0][9999]
  p db.exec("SELECT * FROM foo")[0].colnames

  db.transaction do
    10.times do |i|
      db.exec("INSERT INTO foo VALUES (#{i}, 'foo')")
    end
    db.rollback
  end

  SQLite.open(":memory:") do |db2|
    db.backup(db2)
  end
end

end

ご意見等あればよろしくお願いします。


#2

e$B@uN$$H?=$7$^$9!#e(B

JRubye$B$r;H$&?HJ,$H$7$F$Oe(BFFIe$B7PM3$G$d$C$F$/$l$k$HM-$jFq$$$G$9!#e(B
e$B!VI8=`!W$H$$$&Lu$K$O9T$+$J$/$J$C$A$c$$$^$9$1$I!#e(B


Hirotsugu A.


#3

e$B@uN$$G$9!#e(B

On May 15, 2009, at 9:44 AM, NARUSE, Yui wrote:

e$B$^$!!"e(BSQLitee$B%l%Y%k$Oe(BJRubye$B$G$bD>@%5%]!<%H$7$?J}e(B
e$B$,$$$$5$$,$7$^$9$1$I!#e(B


NARUSE, Yui removed_email_address@domain.invalid

e$BD>@$d$k$K$O;d$O$"$^$je(BJavae$BCN$j$^$;$s$+$i!D:$$C$A$c$$$^$9$M!#e(B

e$B<B$r8@$&$H!">/$7$@$1$G$9$,e(Bsqlite3-rubye$B$N%I%i%$%P!<$H$7$Fe(BFFI
e$B;H$C$?$d$D=q$-;O$a$F$?$s$G$9$h$M!#e(B
e$B$I$&$7$h$&$+$J!D!#e(B

e$B$b$7e(BSQLitee$B$rI8=`E:IU$9$k$H!"e(BJRubye$B$H$N7s$M9g$$$O$Ie(B
e$B$&$J$C$A$c$&$s$G$7$g$&$+!#e(B
e$B!J$3$l$OB>$NJ}!9$N0U8+$,=P$F$+$i$G$$$$$N$+!#!Ke(B


#4

e$B@.@%$G$9!#e(B

Hirotsugu A. wrote:

e$B@uN$$H?=$7$^$9!#e(B

JRubye$B$r;H$&?HJ,$H$7$F$Oe(BFFIe$B7PM3$G$d$C$F$/$l$k$HM-$jFq$$$G$9!#e(B
e$B!VI8=`!W$H$$$&Lu$K$O9T$+$J$/$J$C$A$c$$$^$9$1$I!#e(B

e$B$=$b$=$be(BFFIe$B$,:#I8=`E:IU$G$O$"$j$^$;$s$+$i$M$’!#e(B

e$B$^$!!"e(BSQLitee$B%l%Y%k$Oe(BJRubye$B$G$bD>@%5%]!<%H$7$?J}$,$$$$5$$,$7$^$9$1$I!#e(B


#5

e$B$3$s$P$s$O!#e(B

In message removed_email_address@domain.invalid
on Fri, 15 May 2009 23:12:33 +0900,
“NARUSE, Yui” removed_email_address@domain.invalid wrote:

e$B$3$l$KBP$7$F:#2s?7$7$/5/$3$7$?%i%$%V%i%j$G$O!"e(B

  • nativee$B$+$D%3%s%Q%/%H$J<BAue(B
  • e$B$=$l$J$j$K$d$k5$$N$"$k%a%s%F%Je(B
    e$B$H$$$&MxE@$,$"$j$^$9!#e(B
    e$B?7$7$$%i%$%V%i%j$O!"$=$l$O$=$l$GNI$$$3$H$H;W$$$^$9!#e(B

e$B$?$@!"$?$V$s;d$O$h$/$o$+$C$F$$$J$$$N$@$H;W$$$^$9$,!"e(BRubye$B$KI8=`E:IU$,e(B
e$BI,MW$JM}M3$O2?$G$7$g$&$+e(B?

e$BI8=`E:IU$H$J$k$H!"e(B

o Rubye$BK\BN$N%F%9%H$Ke(Bsqlitee$B$,$J$$$H:$$k!#e(B
o
e$B%Q%C%1!<%8!&%7%9%F%`$G!"e(Brubye$B$N%Q%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k!#e(B

e$B$H$$$&$3$H$K$J$k$N$G$7$g$&$+!#e(Bsqlitee$B$bHf3SE*%P!<%8%g%s$N99?7$,B?$$$3$He(B
e$B$b$"$k$N$G!"8e<T$N>u67$OHr$1$?$$$H$3$m$G$9!#e(B

e$B%F%9%H$O%Q%C%A$K$bBgL#$JJ*$,0l1~$D$$$F$$$^$9$M!#e(B
e$B$3$l$O<h$j9~$_$^$G$K$b$C$H$^$H$b$JJ*$K$7$^$9!#e(B

e$B%Q%C%1!<%8!&%7%9%F%`$NJ}$GJL$N%Q%C%1!<%8$KJ,$1$k$3$H$b2DG=$G$O$"$j$^$9e(B
e$B$,!"JL$N$b$N$rJL$K%Q%C%1!<%8$K$^$H$a$k$N$H!“85$Oe(B1e$B$D$N$b$N$rJL$1$F%Q%Ce(B
e$B%1!<%82=$9$E$N$G$O!”:G=i$+$iJL$l$F$$$?J}$,2?$+$H<j4V$O>/$J$$$H8@$($^$9!#e(B

e$B?@8M$5$s$N%Q%C%1!<%8$K$O$*@$OC$K$J$C$F$$$k$N$G6D$C$F$$$k$3$H$O$o$+$k$N$G$9$,!“e(B
e$B$o$?$7$H$7$F$O$=$3$r2?$H$+!”$H$$$&$3$H$K$J$j$^$9!#e(B


#7

e$B?\F#$G$9!#e(B

In removed_email_address@domain.invalid
“[ruby-dev:38463] SQLitee$B%i%$%V%i%je(B” on Fri, 15 May 2009 23:12:33
+0900,
“NARUSE, Yui” removed_email_address@domain.invalid wrote:

Ruby 1.9e$B$Ge(BSQLitee$B%i%$%V%i%j$rI8=`E:IU$7$^$;$s$+!)e(B

e$BI8=E:IU$9$k$+$I$&$+$K4X$7$F$OFC$K0U8+$O$J$$$N$G$9$,!"$3$N<Be(B e$BAu!J$H$$$&$+e(BAPIe$B!K$GI8=E:IU$5$l$k$3$H$K$OH?BP$7$^$9!#e(B

e$B$3$l$KBP$7$F:#2s?7$7$/5/$3$7$?%i%$%V%i%j$G$O!"e(B

  • nativee$B$+$D%3%s%Q%/%H$J<BA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L e$B$r;HMQ$9$k>l9g!"e(BSQL injection
e$BBP:v$H$7$F!"e(B
e$B%P%$%s%IJQ?t$OI,?$G$9!#e(B

(snip)

e$B$f$($Ke(BSQLitee$B%i%$%V%i%j$Oe(BRubye$B$KI8=`E:IU$5$l$k$Y$-$@$H;W$C$F$$$^$9!#e(B
e$B$o$?$7$,$3$@$o$k$N$O$3$3$^$G$J$N$G!“e(B
e$B:#2s$N<BAu$h$j$h$$<BAu$,$”$l$P$=$l$KJQ$($k$3$H$K$OH?BP$7$^$;$s!#e(B

e$B$J$*!"e(BSQLite3/Rubye$B$O%a%s%F%J%s%9$,=*N;$7$F$$$k>e$K!“e(B
e$B0MB8@h$G$”$ke(Bdle$B$,%a%s%F%JIT:_$J$N$,LdBj$@$H;W$C$F$$$^$9!#e(B

amalgalite e$B$O$I$&$G$7$g$&$+!)e(B
e$B%W%m%8%’%/%H3+;O$+$i$b$&$=$m$=$m$GK~#1G/!#$+$J$j@Q6KE*$K3+H/Cf$G$9!#e(B
http://copiousfreetime.rubyforge.org/amalgalite/


#12

e$B?\F#$G$9!#e(B

In removed_email_address@domain.invalid
“[ruby-dev:38471] Re: SQLitee$B%i%$%V%i%je(B” on Sat, 16 May 2009
13:12:33 +0900,
“NARUSE, Yui” removed_email_address@domain.invalid wrote:

e$B$=$l$O$9$G$K$3$N%i%$%V%i%jB&$G9T$C$F$$$^$9!#e(B
e$B%?%$%%"%&%H$N;~4V$Oe(B1e$BIC$K8GDj$5$l$F$$$^$9$h$M!#e(B e$B>l9g$K$h$C$F$O$b$C$HD9$/$7$?$jC;$/$7$?$j$7$?$$$H;W$$$^$9!#e(B e$B%"%W%j%1!<%7%g%sB&$G@)8f$G$-$k$Y$-9L$@$H;W$$$^$9!#e(B

e$B$5$i$K$b$&$7$P$i$/BT$C$F$+$i%j%H%i%$$,M_$7$$$H$+!“e(B
e$BJL$N%1!<%9$rJa3M$7$F2?$+$7$?$$Nc$,$”$k$N$J$i$PNc30$rJ,$1$^$9$,!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B$r;HMQ$7$F$$$k$3$H$OK\e(B
e$B<AE*$JLdBj$G$O$J$$$H!#e(B

dl e$BA0Ds$N%3!<%I$r!“e(Bruby 1.9
e$B$X0?”$9$k$N$,BgJQ$J$N$+$H;W$C$?$+$ie(B
e$B?75,$N%i%$%V%i%j$b$"$j$+$H$O;W$C$?$1$I!“e(Bnative e$B$NItJ,$re(B ruby
1.9
e$B$X0?”$9$k$@$1$J$iBg$7$?<j4V$G$O$J$$$+$H!#<B:]!"e(Bgithub e$B>e$Ge(B
fork
e$B$7$F3+H/$rB3$1$F$$$kJ}$N2??M$+$Oe(B 1.9
e$BBP1~$r$9$G$K:Q$^$;$F$$$^$9!#e(B
http://github.com/jamis/sqlite3-ruby/network