Index of /2001/12/rubyrdf/squish/service
These files test various services wrapped around the basic SQL/Squish
system.
Node folding: defrag
RDF schema property hierarchies: addAllSuperProperties
danbri@w3.org
cd ..
../db/nt2sql.rb service/events.nt >> samples/_query_tests.sql
../db/nt2sql.rb samples/danbri.wot.nt >> samples/_query_tests.sql
../db/nt2sql.rb service/examples.rdf >> samples/_query_tests.sql
some handy excerpts from the Ruby DBI documentation
############
puts "inserting..."
1.upto(13) do |i|
sql = "insert into simple01 (SongName, SongLength_s) VALUES (?, ?)"
dbh.do(sql, "Song #{i}", "#{i*10}")
end
puts "selecting..."
sth=dbh.prepare('select * from simple01')
sth.execute
while row=sth.fetch do
p row
end
puts "deleting..."
dbh.do('delete from simple01 where internal_id > 10')
dbh.disconnect
The same using Ruby's features
require 'dbi'
DBI.connect('DBI:Mysql:test', 'testuser', 'testpwd') do | dbh |
puts "inserting..."
sql = "insert into simple01 (SongName, SongLength_s) VALUES (?, ?)"
dbh.prepare(sql) do | sth |
1.upto(13) { |i| sth.execute("Song #{i}", "#{i*10}") }
end
puts "selecting..."
dbh.select_all('select * from simple01') do | row |
p row
end
puts "deleting..."
dbh.do('delete from simple01 where internal_id > 10')
end