INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "Kind of QUERY which incapsulates SQL UPDATE 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_UPDATE
inherit

QUERY
redefine
is_ready_for_execution,
reconstruct
end
creation

attach,
compose,
update
feature -- Sections contents:

update_section: STRING

columns_section: ARRAY [STRING]

values_section: ARRAY [ANY]

where_section: STRING
feature -- Sections contents setting:

compose (u: STRING; c: ARRAY [STRING]; v: ARRAY [ANY]; w: STRING)
-- creation procedure; allows to create simple SQL UPDATE
-- statement that consist only of the UPDATE, SET and WHERE
-- sections
require
valid_string: u /= void and then not u.is_empty and c /= void and then c.count > 0 and v /= void and then v.count = c.count and w /= void

update (s: STRING)
-- string 's' is the table's name
require
valid_string: s /= void and then not s.is_empty

set_columns (c: ARRAY [STRING]; v: ARRAY [ANY])
-- set columns from 'c' to the values from 'v'
require
valid_arrays: c /= void and then c.count > 0 and v /= void and then v.count = c.count

values (v: ARRAY [ANY])
-- set columns from 'c' to the values from 'v'
require
columns_set: columns_section /= void
valid_array: v /= void and then v.count = columns_section.count

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
feature -- Query:

is_ready_for_execution: BOOLEAN
-- redefined from SIMPLE_QUERY
end -- class SQL_UPDATE

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES