Qore Schema Module Reference 1.4.2
|
the AbstractSchema class is a base class to assist with automatic schema management More...
#include <Schema.qm.dox.h>
Public Member Methods | |
int | align (bool force=False, int verbose=0, bool do_msgs=True) |
executes a schema alignment action on the database with the current schema template More... | |
hash< SchemaAlignmentInfo > | alignWithInfo (bool force=False, int verbose=0, bool do_msgs=True) |
executes a schema alignment action on the database with the current schema template More... | |
constructor (Qore::SQL::AbstractDatasource ds, *hash< SchemaOptionInfo > opts) | |
creates the object from the arguments More... | |
constructor (Qore::SQL::AbstractDatasource ds, *string dts, *string its, *hash opts) | |
creates the object from the arguments More... | |
private | doTable (AbstractTable table, list rows, int upsert_strategy, bool delete_others, int verbose, reference< hash< string, int > > sh) |
this method is called to perform schema reference data managment on the given table with the given data | |
drop (bool force=False, int verbose=0, bool do_msgs=True) | |
executes a schema drop operation in the database | |
*hash< auto > | getColumnOptions () |
returns column options More... | |
*hash< auto > | getCreateOnlyReferenceData () |
returns a hash of "create-only reference data", describing data that is written to the table when the table is created More... | |
*hash< auto > | getCreationOptions () |
returns schema creation options More... | |
SqlUtil::AbstractDatabase | getDatabase () |
returns the AbstractDatabase object used for the schema | |
Qore::SQL::AbstractDatasource | getDatasource () |
returns the datasource used for the schema | |
*hash< auto > | getFunctions () |
returns function definitions More... | |
*hash< auto > | getIndexOptions () |
returns index options More... | |
*hash< auto > | getInsertOnlyReferenceData () |
returns a hash of "create-only reference data", describing data that will only be inserted if missing, otherwise existing rows with changed data are left unchanged More... | |
*hash< auto > | getMaterializedViews () |
returns materialized view definitions More... | |
string | getName () |
returns the name of the schema | |
*hash< auto > | getPackages () |
returns (Oracle) package definitions More... | |
*hash< auto > | getProcedures () |
returns stored procedure definitions More... | |
*hash< auto > | getReferenceDataHash () |
returns a hash of "normal reference data", describing data that must appear in the target table, however additional rows are also acceptable More... | |
*hash< auto > | getSequences () |
returns sequence definitions More... | |
*hash< auto > | getStrictReferenceDataHash () |
returns a hash of "strict reference data", describing the only data that can appear in the target table More... | |
*hash< auto > | getTables () |
returns table definitions More... | |
*hash< auto > | getTypes () |
returns type definitions More... | |
string | getVersion () |
returns the version of the schema | |
log (string fmt) | |
outputs a log message More... | |
logpf (string fmt) | |
outputs a log message prefixed with the schema name More... | |
logProgress (string str) | |
outputs a log message without any newline More... | |
Static Public Member Methods | |
static hash | combineOptions (*hash h) |
combines option hashes into a single target option hash | |
static list | getRows (*softlist< auto > l) |
returns a list of hashes from a list of lists where the first list element in the top-level list is a list of column names, and subsequent lists are column values More... | |
Private Member Methods | |
SchemaCallbackHelper | alignIntern (bool force=False, int verbose=0, bool do_msgs=True) |
executes a schema alignment action on the database with the current schema template More... | |
bool | checkDropSchema (bool force) |
this method returns True if the schema can be dropped | |
bool | checkExistence () |
returns True if the method can detect that DB objects defined in the schema exist in the database More... | |
bool | checkFirstTimeInstall () |
returns True if checkExistence() returns False | |
bool | checkUpdateSchema (bool force, reference< hash< auto > > initial_schema_info) |
this method returns True if the schema can be updated | |
doPostAlignment (Tables table_cache, bool first_time_install, *hash< auto > initial_schema_info) | |
this method is called after schema structural alignment has been executed but before schema reference data management | |
doPostAlignment (Tables table_cache, bool first_time_install, *hash< auto > initial_schema_info, int verbose) | |
this method is called after schema structural alignment has been executed but before schema reference data management | |
*hash< auto > | getColumnOptionsImpl () |
returns column options More... | |
*hash< auto > | getCreateOnlyReferenceDataImpl () |
returns a hash of "create-only reference data", describing data that is written to the table when the table is created More... | |
*hash< auto > | getFunctionsImpl () |
returns function definitions More... | |
*hash< auto > | getGenericOptionsImpl () |
returns schema creation options More... | |
*hash< auto > | getIndexOptionsImpl () |
returns index options More... | |
*hash< auto > | getInsertOnlyReferenceDataImpl () |
returns a hash of "insert-only reference data", describing data that will only be inserted if missing, otherwise existing rows with changed data are left unchanged More... | |
*hash< auto > | getMaterializedViewsImpl () |
returns materialized view definitions More... | |
abstract string | getNameImpl () |
returns the name of the schema | |
*hash< auto > | getPackagesImpl () |
returns (Oracle) package definitions More... | |
*hash< auto > | getProceduresImpl () |
returns stored procedure definitions More... | |
*hash< auto > | getReferenceDataHashImpl () |
returns a hash of "normal reference data", describing data that must appear in the target table, however additional rows are also acceptable More... | |
*hash< auto > | getSequencesImpl () |
returns sequence definitions More... | |
*hash< auto > | getStrictReferenceDataHashImpl () |
returns a hash of "strict reference data", describing the only data that can appear in the target table More... | |
*hash< auto > | getTablesImpl () |
returns table definitions More... | |
*hash< auto > | getTypesImpl () |
returns type definitions More... | |
int | getUpsertStrategy (bool first_time_install) |
this method is called to return the upsert strategy before schema reference data management | |
abstract string | getVersionImpl () |
returns the version of the schema | |
init (Qore::SQL::AbstractDatasource ds, *hash< SchemaOptionInfo > opts) | |
shared constructor initialization | |
postDataActions (bool first_time_install) | |
this method is called after schema reference data has been managed | |
postDataActions (Tables table_cache, bool first_time_install, *hash< auto > initial_schema_info, int verbose) | |
this method is called after schema reference data has been managed | |
Private Attributes | |
*hash | all_options |
combined creation and column options | |
hash | callback_opts |
callback options plus all options | |
*hash | column_options |
column options, as provided by getColumnOptions() | |
*hash | creation_options |
creation options, as provided by getCreationOptions() | |
*string | data_ts |
explicit data tablespace name | |
SqlUtil::Database | db |
the Database object for the schema | |
string | drv |
the name of the database driver | |
Qore::SQL::AbstractDatasource | ds |
the datasource for the schema | |
*hash | index_options |
index options, as provided by getIndexOptions() | |
*string | index_ts |
explicit index tablespace name | |
code | info_callback |
the info callback for schema operations; can be used for explicit logging | |
string | name |
the name of the schema | |
hash | pure_callback_opts |
just callback options | |
hash | schema |
the schema template, as assembled from method callbacks providing schema element definitions | |
string | version |
the version of the schema | |
the AbstractSchema class is a base class to assist with automatic schema management
This class allows the following actions to be performed:
This class does not provide for any intelligence based on the schema template's version and a schema version string stored in the schema itself; this is provided instead by the AbstractVersionedSchema class.
The following abstract methods must be re-implemented in subclasses to define basic schema attributes:
The following methods should be re-implemented in subclasses to define schema definitions from which DDL will be generated::
The following methods should be re-implemented in subclasses to define schema creation options to affect the generated DDL:
The following methods should be re-implemented in subclasses to define schema reference data:
int Schema::AbstractSchema::align | ( | bool | force = False , |
int | verbose = 0 , |
||
bool | do_msgs = True |
||
) |
executes a schema alignment action on the database with the current schema template
this causes the database to be aligned with the schema template, which will result in:
|
private |
executes a schema alignment action on the database with the current schema template
this causes the database to be aligned with the schema template, which will result in:
hash< SchemaAlignmentInfo > Schema::AbstractSchema::alignWithInfo | ( | bool | force = False , |
int | verbose = 0 , |
||
bool | do_msgs = True |
||
) |
executes a schema alignment action on the database with the current schema template
this causes the database to be aligned with the schema template, which will result in:
|
private |
Schema::AbstractSchema::constructor | ( | Qore::SQL::AbstractDatasource | ds, |
*hash< SchemaOptionInfo > | opts | ||
) |
creates the object from the arguments
ds | the datasource for the schema |
dts | an optional data tablespace name for the schema |
its | an optional index tablespace name for the schema |
opts | options for SqlUtil::Database::constructor() |
Schema::AbstractSchema::constructor | ( | Qore::SQL::AbstractDatasource | ds, |
*string | dts, | ||
*string | its, | ||
*hash | opts | ||
) |
creates the object from the arguments
ds | the datasource for the schema |
dts | an optional data tablespace name for the schema |
its | an optional index tablespace name for the schema |
opts | options for SqlUtil::Database::constructor() |
*hash< auto > Schema::AbstractSchema::getColumnOptions | ( | ) |
returns column options
this function wraps getColumnOptionsImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getColumnOptionsImpl()
|
private |
returns column options
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom options
*hash< auto > Schema::AbstractSchema::getCreateOnlyReferenceData | ( | ) |
returns a hash of "create-only reference data", describing data that is written to the table when the table is created
this function wraps (); for forwards-compatibility, do not override this method in subclasses, instead re-implement ()
|
private |
returns a hash of "create-only reference data", describing data that is written to the table when the table is created
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getCreationOptions | ( | ) |
returns schema creation options
this function wraps getGenericOptionsImpl() and getIndexOptionsImpl() and sets the data and index tablespace names as creation options automatically if set in the constructor() if not already set
*hash< auto > Schema::AbstractSchema::getFunctions | ( | ) |
returns function definitions
this function wraps getFunctionsImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getFunctionsImpl()
|
private |
returns function definitions
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
|
private |
returns schema creation options
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom options
*hash< auto > Schema::AbstractSchema::getIndexOptions | ( | ) |
returns index options
this function wraps getIndexOptionsImpl() and sets the index tablespace name as an index option automatically if set in the constructor() if not already set
|
private |
returns index options
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom options
*hash< auto > Schema::AbstractSchema::getInsertOnlyReferenceData | ( | ) |
returns a hash of "create-only reference data", describing data that will only be inserted if missing, otherwise existing rows with changed data are left unchanged
this function wraps (); for forwards-compatibility, do not override this method in subclasses, instead re-implement ()
|
private |
returns a hash of "insert-only reference data", describing data that will only be inserted if missing, otherwise existing rows with changed data are left unchanged
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getMaterializedViews | ( | ) |
returns materialized view definitions
this function wraps getMaterializedViewsImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getMaterializedViewsImpl()
|
private |
returns materialized view definitions
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getPackages | ( | ) |
returns (Oracle) package definitions
this function wraps getPackagesImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getPackagesImpl()
|
private |
returns (Oracle) package definitions
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getProcedures | ( | ) |
returns stored procedure definitions
this function wraps getProceduresImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getProceduresImpl()
|
private |
returns stored procedure definitions
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getReferenceDataHash | ( | ) |
returns a hash of "normal reference data", describing data that must appear in the target table, however additional rows are also acceptable
this function wraps getReferenceDataHashImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getReferenceDataHashImpl()
|
private |
returns a hash of "normal reference data", describing data that must appear in the target table, however additional rows are also acceptable
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
|
static |
returns a list of hashes from a list of lists where the first list element in the top-level list is a list of column names, and subsequent lists are column values
meant to be used to translate reference data lists into lists of hashes to be used for upserting in reference data tables during schema management
*hash< auto > Schema::AbstractSchema::getSequences | ( | ) |
returns sequence definitions
this function wraps getSequencesImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getSequencesImpl()
|
private |
returns sequence definitions
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getStrictReferenceDataHash | ( | ) |
returns a hash of "strict reference data", describing the only data that can appear in the target table
this function wraps getStrictReferenceDataHashImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getStrictReferenceDataHashImpl()
|
private |
returns a hash of "strict reference data", describing the only data that can appear in the target table
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getTables | ( | ) |
returns table definitions
this function wraps getTablesImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getTablesImpl()
|
private |
returns table definitions
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
*hash< auto > Schema::AbstractSchema::getTypes | ( | ) |
returns type definitions
this function wraps getTypesImpl(); for forwards-compatibility, do not override this method in subclasses, instead re-implement getTypesImpl()
|
private |
returns type definitions
the default behavior of this method is to return NOTHING, reimplement in subclasses to return custom configuration
Schema::AbstractSchema::log | ( | string | fmt | ) |
outputs a log message
the log string is output with a following newline, and the terminal I/O is flushed
Schema::AbstractSchema::logpf | ( | string | fmt | ) |
outputs a log message prefixed with the schema name
the log string is output with a following newline, and the terminal I/O is flushed
Schema::AbstractSchema::logProgress | ( | string | str | ) |
outputs a log message without any newline
the terminal I/O is flushed as well