diff options
author | Jamis Buck <jamis@37signals.com> | 2005-02-07 17:23:53 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2005-02-07 17:23:53 +0000 |
commit | 4c3f433efc54403478cbc56d348773167ee5a775 (patch) | |
tree | e7784809e0ca71949b191018ebb3fa00b5f6fc51 /lib/sqlite3/resultset.rb | |
parent | 372281cf9bef717f3a0b60167bc0fe1a35c6f352 (diff) | |
download | third_party-sqlite3-ruby-4c3f433efc54403478cbc56d348773167ee5a775.tar.gz third_party-sqlite3-ruby-4c3f433efc54403478cbc56d348773167ee5a775.tar.xz third_party-sqlite3-ruby-4c3f433efc54403478cbc56d348773167ee5a775.zip |
Added Database#query and made it possible to close a statement from a resultset. This should make it easier to create a sqlite3 adapter for Og.
Diffstat (limited to 'lib/sqlite3/resultset.rb')
-rw-r--r-- | lib/sqlite3/resultset.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/sqlite3/resultset.rb b/lib/sqlite3/resultset.rb index bef2a0d..d90073c 100644 --- a/lib/sqlite3/resultset.rb +++ b/lib/sqlite3/resultset.rb @@ -80,6 +80,7 @@ module SQLite3 # Reset the cursor, so that a result set which has reached end-of-file # can be rewound and reiterated. def reset( *bind_params ) + @stmt.must_be_open! @driver.reset( @stmt.handle ) @stmt.bind_params( *bind_params ) @eof = false @@ -107,6 +108,8 @@ module SQLite3 def next return nil if @eof + @stmt.must_be_open! + unless @first_row result = @driver.step( @stmt.handle ) check result @@ -159,10 +162,24 @@ module SQLite3 end end + # Closes the statement that spawned this result set. + # <em>Use with caution!</em> Closing a result set will automatically + # close any other result sets that were spawned from the same statement. + def close + @stmt.close + end + + # Queries whether the underlying statement has been closed or not. + def closed? + @stmt.closed? + end + + # Returns the types of the columns returned by this result set. def types @stmt.types end + # Returns the names of the columns returned by this result set. def columns @stmt.columns end |