INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "Represents the notion of records set in table or selection"
project: "Visual Eiffel"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: dale
class RECORDSET
inherit

TRAVERSABLE_
redefine
cursor,
out
end

DALE_SERVER
redefine
out
end

MEMORY
export
{NONE}
all
redefine
dispose,
out
end
creation

attach,
build,
open
feature -- Attributes:

database: DATABASE

record: RECORD

query: SIMPLE_QUERY

tw_scrollable: BOOLEAN

fill_blob: BOOLEAN

cursors: LIST_ [RS_CURSOR]
feature -- Commands:

attach (db: DATABASE; q: SIMPLE_QUERY)
-- creation procedure; attach to the database and attach
-- the query to itself
require
valid_database: db /= void and then db.is_connected
valid_query: valid_query (q)
no_dbs_clash: q.is_attached implies (db.is_equal (q.database))
ensure
attached: is_attached

open_forward_only (db: DATABASE; q: SIMPLE_QUERY)
-- creation procedure; attach to the database and attach
-- the query to itself
require
valid_database: db /= void and then db.is_connected
valid_query: valid_query (q)
no_dbs_clash: q.is_attached implies (db.is_equal (q.database))
ensure
attached: is_attached

open (db: DATABASE; s: STRING)
-- creation procedure; attach to the database and build by the
-- specified query; if 's' is simply STRING then it'll be converted
-- to a QUERY before all
require
valid_database: db /= void and then db.is_connected
valid_string: s /= void and then not s.is_empty
ensure
attached: is_attached

build (q: SIMPLE_QUERY)
-- creation procedure; build by specified query; database and open
-- mode are taken from the query 'q'
require
valid_query: valid_query (q) and then q.is_attached
ensure
attached: is_attached

refresh
-- refresh the contents of the record list
-- note: all open cursors will be stopped automatically
require
attached: is_attached
ensure
not_protected: not is_protected

close
-- stop all open cursors, close recordset
require
attached: is_attached
ensure
not_attached: not is_attached
feature -- Query:

item_at (c: RS_CURSOR): like record
-- returns a RECORD where specified cursor rests
require
valid_cursor: c /= void and then not c.is_finished
ensure
not_void: Result /= void

field (c: RS_CURSOR; n: STRING): FIELD
-- returns a FIELD where specified cursor rests
-- by field's name
require
valid_cursor: c /= void and then not c.is_finished
ensure
not_void: Result /= void

field_no (c: RS_CURSOR; k: INTEGER): FIELD
-- returns a FIELD where specified cursor rests
-- by field's ordinal position
require
valid_cursor: c /= void and then not c.is_finished
ensure
not_void: Result /= void

cursor: RS_CURSOR
-- a new cursor pointing initially to the first element of the set
require
attached: is_attached

column_count, no_columns: INTEGER
-- number of recordset columns
require
attached: is_attached
available: record /= void
ensure
valid_result: Result >= 0

count: INTEGER
-- number of recordset rows
require
attached: is_attached
applicable: tw_scrollable
ensure
valid_result: Result >= 0

out: STRING
-- redefined from ANY

is_attached: BOOLEAN
-- is this recordset attached to some database?
feature -- Settings:

set_two_way_scrollable, set_static
-- set the recordset two-way scrollable (and, hence,
-- randomly accessible)
require
allowed: not query.is_active

set_forward_only
-- set the recordset forward only for faster
-- access to records; note, that only one cursor
-- is allowed in this mode
require
allowed: not query.is_active

set_fill_blob (b: BOOLEAN)
-- ...
feature -- Validations:

valid_query (q: SIMPLE_QUERY): BOOLEAN
-- returns True if this query is not void, is attached and
-- does not have attached recordset
feature -- Removal

dispose
-- redefined from MEMORY
end -- class RECORDSET

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES