T
Tianshuo Deng
Hi, guys, I want to share my discovery with you. If you found I am =
wrong, pleas point it out
if you use dbi to generate a prepared statement by doing:
sth=3Ddbh.prepare("INSERT INTO WORDS VALUES(?,?,?)")
(0..1).each{|i|
sth.execute("1","2","3")
}
it will give you a /sqlite3-ruby-1.3.2/lib/sqlite3/statement.rb:41:in =
`bind_param': library routine called out of sequence =
(SQLite3::MisuseException).
I have no idea what the hell is that......
My Guess is it's a compatible issue... So I bypassed the 'dbi', and use =
sqlite3-ruby driver directly, and it works fine:
require 'rubygems'
require 'sqlite3'
db=3DSQLite3:atabase.new("shit.db")
db.execute(%q{
CREATE TABLE PEOPLE(
NAME CHAR(20),
ADDRESS CHAR(29) );})
st=3Ddb.prepare("INSERT INTO PEOPLE VALUES(?,?)")
(0..100).each do |i|
st.execute(i.to_s,i.to_s)
end
I'm using MacOSX(10.6.5),
Is there anybody using dbi??????
Is that very useful???I know it should be useful....but the only way I =
can make my program work is to bypass dbi.....
Help!!!!!!!!
wrong, pleas point it out
if you use dbi to generate a prepared statement by doing:
sth=3Ddbh.prepare("INSERT INTO WORDS VALUES(?,?,?)")
(0..1).each{|i|
sth.execute("1","2","3")
}
it will give you a /sqlite3-ruby-1.3.2/lib/sqlite3/statement.rb:41:in =
`bind_param': library routine called out of sequence =
(SQLite3::MisuseException).
I have no idea what the hell is that......
My Guess is it's a compatible issue... So I bypassed the 'dbi', and use =
sqlite3-ruby driver directly, and it works fine:
require 'rubygems'
require 'sqlite3'
db=3DSQLite3:atabase.new("shit.db")
db.execute(%q{
CREATE TABLE PEOPLE(
NAME CHAR(20),
ADDRESS CHAR(29) );})
st=3Ddb.prepare("INSERT INTO PEOPLE VALUES(?,?)")
(0..100).each do |i|
st.execute(i.to_s,i.to_s)
end
I'm using MacOSX(10.6.5),
Is there anybody using dbi??????
Is that very useful???I know it should be useful....but the only way I =
can make my program work is to bypass dbi.....
Help!!!!!!!!