IV.2.6.2 Retrieving objects from an SQLite database
This example, uses the database created in the example of section IV.2.6.1 and retrieves Results or
deletes some of the data. An example of statements that allow to retrieve Results is given
below:
sqldb.query("select * from dynam_results_1 where lcName = ? and realId1 = ?",
["SINUS_X",97.0] ).each do |tab|
puts tab[0],tab[1],tab[2],tab[8]
res=Post.convertBlob(tab[9])
puts res.Size()
end
Items can be deleted from database by statements of this type:
sqldb.execute("delete from dynam_results_1 where resName = ?",
"Strain Tensor (RI)" )
sqldb.execute("delete from dynam_results_1 where resName = ?",
"Applied Loads, Forces (RI)" )
sqldb.execute("delete from dynam_results_1 where resName = ?",
"Applied Loads, Moments (RI)" )
sqldb.execute("delete from dynam_results_1 where resName = ?",
"Accelerations, Rotational (RI)" )
sqldb.execute("delete from dynam_results_1 where resName = ?",
"Velocities, Rotational (RI)" )
sqldb.execute("delete from dynam_results_1 where resName = ?",
"Displacements, Rotational (RI)" )
sqldb.execute("delete from dynam_results_1 where realId1 < ?",
90.0 )
The example is provided in file "RUBY/EX20/deleteSomeResults.rb"