Qore SqlUtil Module Reference 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SqlUtil::AbstractUniqueConstraint Class Referenceabstract

represents a unique column constraint More...

Inheritance diagram for SqlUtil::AbstractUniqueConstraint:
[legend]

## Public Member Functions
| addSourceConstraint (string tname, AbstractForeignConstraint fk)
| adds a foreign constraint source to the unique constraint More...
| constructor (string n, *hash c, *string n_index)
| creates the object from the name an a hash of column information
| findMatchingIndex (*Indexes indexes)
| find an index that matches the constraint and marks both objects as related
abstract string | getCreateSql (string table_name, *hash opts)
| returns a string that can be used to create the constraint in the database
hash | getDisableReenableSql (AbstractDatasource ds, string table_name, *hash opts)
| returns lists of SQL strings to disable this constraint plus any dependent constraints and another list of SQL strings to reenable the same constraints; used when updating indexes that depend on constraints
Qore::AbstractIterator | getSourceConstraintIterator ()
| returns an iterator through all known source foreign constraints on the current table More...
bool | hasColumn (string cname)
| returns True if the constraint references the named column
| removeSourceConstraint (string tname, list cols)
| removes a source constraint
| renameSourceConstraintTable (string old_name, string new_name)
| renames a table in a source constraint
Public Member Functions inherited from SqlUtil::AbstractConstraint
abstract | clearIndex ()
| clears any index base for the constraint
| constructor (string n)
| creates the object and sets its name
bool | equal (AbstractConstraint c)
| returns True if the argument is equal to the current object, False if not
string | getDisableSql (string table_name)
| returns a string that can be used to temporarily disable the constraint from the database; if disabling constraints is not supported, then the constraint will be dropped
string | getDropSql (string table_name)
| returns a string that can be used to drop the constraint from the database
string | getEnableSql (string table_name, *hash opt)
| returns a string that can be used to enable the constraint in the database; if disabling constraints is not supported, then the constraint will be dropped
string | getName ()
| returns the constraint name
abstract list | getRenameSql (string table_name, string new_name)
| returns a list of SQL strings that can be used to rename the constraint in the database
bool | hasColumn (string cname)
| returns True if the constraint references the named column
| rename (string n)
| renames the constraint
abstract bool | setIndexBase (string ix)
| returns True if the object supports an index property and is set, False if not
Public Member Functions inherited from SqlUtil::Columns
| add (string k, AbstractColumn val)
| adds the given value to the hash with the given key name
bool | equal (Columns cols)
| returns True if the argument has the same columns in the same order as the current object, False if not
string | getElementName ()
| returns `"column"` since this object stores column objects
AbstractColumn | memberGate (string k)
| returns the AbstractColumn object corresponding to the key given or throws a KEY-ERROR exception More...
Columns | subset (softlist l)
| returns a subset of the current columns according to the list argument
AbstractColumn | take (string k)
| removes the given key from the contained hash and returns the value
Public Member Functions inherited from SqlUtil::AbstractHashContainer
| clear ()
| purges the contained data More...
| constructor (*hash nh)
| creates the object with the hash argument passed
| copy (AbstractHashContainer old)
| creates a "deep copy" of the object
bool | empty ()
| returns True if the container is empty, False if not
*string | firstKey ()
| Returns the first key name in the contained hash or NOTHING if the contained hash has no keys. More...
*hash | getHash ()
| returns the hash contained by this object
bool | hasKey (string k)
| Returns True if the key exists in the contained hash (may or may not be assigned a value), False if not. More...
bool | hasKeyValue (string k)
| Returns True if the key exists in the contained hash and is assigned a value, False if not. More...
Qore::AbstractIterator | iterator ()
| Returns a HashIterator object for the contained hash. More...
Qore::AbstractIterator | keyIterator ()
| Returns a HashKeyIterator object for the contained hash. More...
list | keys ()
| Returns a list of key names of the contained hash. More...
*string | lastKey ()
| Returns the last key name in the contained hash or NOTHING if the contained hash has no keys. More...
bool | matchKeys (hash h1)
| returns True if the hash argument has the same keys (in any order), False if not More...
bool | matchKeys (list l)
| returns True if the list argument has the same list of key strings as the keys in the object (in any order), False if not More...
bool | matchKeys (AbstractHashContainer c)
| returns True if the container argument has the same keys (in any order), False if not More...
any | memberGate (string k)
| returns the value of the given key in the contained hash if it exists, otherwise throws a `KEY-ERROR` exception More...
Qore::AbstractIterator | pairIterator ()
| Returns a HashPairIterator object for the contained hash. More...
bool | partialMatchKeys (hash h1)
| returns True if the hash argument has at least the same keys (in any order, can have more keys), False if not More...
bool | partialMatchKeys (list l)
| returns True if the list argument has at least the same keys (in any order, can have more keys), False if not More...
bool | partialMatchKeys (AbstractHashContainer c)
| returns True if the container argument has at least the same keys (in any order, can have more keys), False if not More...
| renameKey (string old_name, string new_name)
| renames the given key; maintains the key order
int | size ()
| Returns the number of keys in the contained hash. More...
bool | val ()
| Returns False if the contained hash has no keys, True if it does. More...
list | values ()
| Returns a list of values of the contained hash. More...

## Private Member Functions
bool | equalImpl (AbstractConstraint c)
| returns True if the argument is equal to the current object, False if not

## Private Attributes
*string | index
| the index supporting the constraint
hash | sourceConstraints
| a hash of ForeignConstraintSources, keyed by table name, the value is a hash of foreign constraints keyed by constraint name

## Detailed Description

represents a unique column constraint

## Member Function Documentation

SqlUtil::AbstractUniqueConstraint::addSourceConstraint | ( | string | tname,
|  | AbstractForeignConstraint | fk
| ) |  |

adds a foreign constraint source to the unique constraint

Example:
  $uk.addSourceConstraint($table_name, constraint_name);

Parameters

  tname | the name of the source table
  fk | the source constraint

Exceptions

  SOURCE-CONSTRAINT-ERROR | a different source constraint with the given name already exists

Qore::AbstractIterator SqlUtil::AbstractUniqueConstraint::getSourceConstraintIterator | ( |  | ) |

returns an iterator through all known source foreign constraints on the current table

each element is a hash with the following keys:

- `fk:` the AbstractForeignConstraint object
- `table:` the table name