test/SQLTest.rb in rubyfb-0.5.9 vs test/SQLTest.rb in rubyfb-0.6
- old
+ new
@@ -46,18 +46,18 @@
end
def test01
@database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
cxn.start_transaction do |tx|
- s = Statement.new(cxn, tx, INSERT_SQL, 3)
+ s = cxn.create_statement(INSERT_SQL)
f = 0.0
t = Time.new
1.upto(ITERATIONS) do |i|
f += 0.321
t = Time.at(t.to_i + 5)
- s.execute_for([i, i.to_s, f, t, nil, t])
+ s.exec([i, i.to_s, f, t, nil, t], tx)
end
s.close
end
end
@@ -127,13 +127,12 @@
r.close
@transactions[0].commit
@connections[0].start_transaction do |tx|
- s = Statement.new(@connections[0], tx,
- "UPDATE TEST_TABLE SET TESTSTAMP = NULL", 3)
- s.execute()
+ s = @connections[0].create_statement("UPDATE TEST_TABLE SET TESTSTAMP = NULL")
+ s.exec(nil, tx)
s.close
r = tx.execute("SELECT TESTSTAMP FROM TEST_TABLE")
total = 0
r.each do |row|
@@ -146,14 +145,14 @@
a = []
t = nil
@connections[0].start_transaction do |tx|
# Perform an insert via a parameterized statement.
- s = Statement.new(@connections[0], tx,
+ s = @connections[0].create_statement(
"INSERT INTO TEST_TABLE (TESTID, TESTTEXT, "\
- "TESTFLOAT, TESTSTAMP) VALUES(?, ?, ?, ?)", 3)
+ "TESTFLOAT, TESTSTAMP) VALUES(?, ?, ?, ?)")
t = Time.new
- s.execute_for([25000, 'La la la', 3.14, t])
+ s.exec([25000, 'La la la', 3.14, t], tx)
s.close
# Fetch the record and check the data.
r = tx.execute("SELECT TESTTEXT, TESTFLOAT, TESTSTAMP FROM "\
"TEST_TABLE WHERE TESTID = 25000")