INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "Kind of QUERY which incapsulates SQL SELECT statement"
project: "Visual Eiffel"
revision: "$Revision: 1.1 $"
copyright: "Copyright (C) 1996-2005 Object Tools Group"
license: "http://visual-eiffel.com/license"
cluster: dale
class SQL_SELECT
inherit

QUERY
redefine
is_ready_for_execution,
reconstruct
end
creation

attach,
compose,
from_,
select_,
select_distinct
feature -- Sections contents:

select_section: STRING

from_section: STRING

where_section: STRING

group_by_section: STRING

having_section: STRING

union_section: STRING

order_by_section: STRING

use_distinct: BOOLEAN

use_union_all: BOOLEAN
feature -- Sections contents setting:

compose (s, f, w: STRING)
-- creation procedure; allows to create simple SQL SELECT
-- statement that consist only of the SELECT, FROM and WHERE
-- sections
require
valid_strings: s /= void and then not s.is_empty and f /= void and then not f.is_empty and w /= void

select_ (s: STRING)
-- string 's' is the comma-delimited list of columns are
-- participating in selection
require
valid_string: s /= void and then not s.is_empty

select_distinct (s: STRING)
-- same as 'select_' but with "DISTINCT" right after "SELECT"
require
valid_string: s /= void and then not s.is_empty

and_select (s: STRING)
-- same as 'select_' but accumulates contents of the SELECT section
require
valid_string: s /= void

from_ (s: STRING)
-- string 's' is the comma-delimited list of tables/views
-- are participating in selection
require
valid_string: s /= void and then not s.is_empty
valid_select: select_section /= void implies not select_section.is_empty

and_from (s: STRING)
-- same as 'from_' but accumulates contents
require
valid_string: s /= void

where (s: STRING)
-- string 's' is the contents of the WHERE section
require
valid_string: s /= void

and_where (s: STRING)
-- this method assigns a new part of the WHERE section,
-- merging it with the previous one via AND
require
valid_string: s /= void

or_where (s: STRING)
-- this method assigns a new part of the WHERE section,
-- merging it with the previous one via OR
require
valid_string: s /= void

group_by (s: STRING)
-- this method assigns a new contents of the GROUP BY section
require
valid_string: s /= void

having (s: STRING)
-- This method assigns a new contents of the HAVING section.
require
valid_string: s /= void

union (s: STRING)
-- this method assigns a new contents of the UNION section
require
valid_string: s /= void
no_clash: no_union_clash (s)

union_all (s: STRING)
-- this method assigns a new contents of the UNION ALL section

order_by (s: STRING)
-- this method assigns a new contents of the ORDER BY section
require
valid_string: s /= void
feature -- Query:

tables: TABLES
-- returns tables list (the contents of the FROM section)
require
attached: is_attached
valid_source: from_section /= void and then not from_section.is_empty
ensure
well_done: Result /= void and then Result.count > 0

is_ready_for_execution: BOOLEAN
-- redefined from SIMPLE_QUERY

no_union_clash (s: STRING): BOOLEAN
-- ...
require
not_void: s /= void
end -- class SQL_SELECT

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES