class toExtract

This class can be used to reverse engineered database objects. More...

Definition#include <toextract.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Public Members


Detailed Description

This class can be used to reverse engineered database objects.

extractor (class)

extractor

This is an abstract class to implement part of an extractor for a database. Observe that an extractor must be stateless and threadsafe except for constructors and destructors. Use the toExtract::context function for saving context.

 toExtract (toConnection &conn,QWidget *parent)

toExtract

Create a new extractor.

Parameters:
connConnection to extract from.
parentParent widget of progress indicator.

QString  create (std::list<QString> &object)

create

Create script to recreate list of objects.

Parameters:
objectList of object. This has the format {type}:{schema}.{object}. The type is database dependent but can as an example be of CONSTRAINT, DATABASE LINK, EXCHANGE INDEX, EXCHANGE TABLE, FUNCTION, INDEX, MATERIALIZED VIEW, MATERIALIZED VIEW LOG, PACKAGE, PACKAGE BODY, PROCEDURE, PROFILE, ROLE, ROLE GRANTS, ROLLBACK SEGMENT, SEQUENCE, SNAPSHOT, SNAPSHOT LOG, SYNONYM, TABLE, TABLE FAMILY, TABLE CONTENTS, TABLE REFERENCES, TABLESPACE, TRIGGER, TRIGGER, TYPE, USER, USER GRANTS for Oracle databases.

Returns: A string containing a script to recreate the specified objects.

void  create (QTextStream &stream,std::list<QString> &object)

create

Create script to recreate list of objects.

Parameters:
streamStream to write result to.
objectList of object. This has the format {type}:{schema}.{object}. The type is database dependent but can as an example be of CONSTRAINT, DATABASE LINK, EXCHANGE INDEX, EXCHANGE TABLE, FUNCTION, INDEX, MATERIALIZED VIEW, MATERIALIZED VIEW LOG, PACKAGE, PACKAGE BODY, PROCEDURE, PROFILE, ROLE, ROLE GRANTS, ROLLBACK SEGMENT, SEQUENCE, SNAPSHOT, SNAPSHOT LOG, SYNONYM, TABLE, TABLE FAMILY, TABLE CONTENTS, TABLE REFERENCES, TABLESPACE, TRIGGER, TRIGGER, TYPE, USER, USER GRANTS for Oracle databases.

std::list<QString>  describe (std::list<QString> &object)

describe

Create a description of objects.

Parameters:
objectList of object. This has the format {type}:{schema}.{object}. The type is database dependent but can as an example be of CONSTRAINT, DATABASE LINK, EXCHANGE INDEX, EXCHANGE TABLE, FUNCTION, INDEX, MATERIALIZED VIEW, MATERIALIZED VIEW LOG, PACKAGE, PACKAGE BODY, PROCEDURE, PROFILE, ROLE, ROLE GRANTS, ROLLBACK SEGMENT, SEQUENCE, SNAPSHOT, SNAPSHOT LOG, SYNONYM, TABLE, TABLE FAMILY, TABLE CONTENTS, TABLE REFERENCES, TABLESPACE, TRIGGER, TRIGGER, TYPE, USER, USER GRANTS for Oracle databases.

Returns: A list of strings describing the objects. Each string should be considered like a list of strings separated by the character '\001'. The later in each string the smaller item the change and it is hierachical.

QString  drop (std::list<QString> &object)

drop

Create script to drop a list of objects.

Parameters:
objectList of object. This has the format {type}:{schema}.{object}. The type is database dependent but can as an example be of CONSTRAINT, DATABASE LINK, EXCHANGE INDEX, EXCHANGE TABLE, FUNCTION, INDEX, MATERIALIZED VIEW, MATERIALIZED VIEW LOG, PACKAGE, PACKAGE BODY, PROCEDURE, PROFILE, ROLE, ROLE GRANTS, ROLLBACK SEGMENT, SEQUENCE, SNAPSHOT, SNAPSHOT LOG, SYNONYM, TABLE, TABLE FAMILY, TABLE CONTENTS, TABLE REFERENCES, TABLESPACE, TRIGGER, TRIGGER, TYPE, USER, USER GRANTS for Oracle databases.

Returns: A string containing a script to drop the specified objects.

void  drop (QTextStream &stream,std::list<QString> &object)

drop

Create script to drop a list of objects.

Parameters:
streamStream to write result to.
objectList of object. This has the format {type}:{schema}.{object}. The type is database dependent but can as an example be of CONSTRAINT, DATABASE LINK, EXCHANGE INDEX, EXCHANGE TABLE, FUNCTION, INDEX, MATERIALIZED VIEW, MATERIALIZED VIEW LOG, PACKAGE, PACKAGE BODY, PROCEDURE, PROFILE, ROLE, ROLE GRANTS, ROLLBACK SEGMENT, SEQUENCE, SNAPSHOT, SNAPSHOT LOG, SYNONYM, TABLE, TABLE FAMILY, TABLE CONTENTS, TABLE REFERENCES, TABLESPACE, TRIGGER, TRIGGER, TYPE, USER, USER GRANTS for Oracle databases.

Returns: A string containing a script to drop the specified objects.

QString  migrate (std::list<QString> &drpLst,std::list<QString> &crtLst)

migrate

Called to generate a script to migrate a database object from one description to another description.

Parameters:
streamStream to write result to.
srcSource description list, generated by describes for the same database.
dstDestination description list, generated by describes for the same database.

Returns: A script to change the src database object to dst.

void  migrate (QTextStream &stream,std::list<QString> &drpLst,std::list<QString> &crtLst)

migrate

Called to generate a script to migrate a database object from one description to another description.

Parameters:
streamStream to write result to.
srcSource description list, generated by describes for the same database.
dstDestination description list, generated by describes for the same database.

Returns: A script to change the src database object to dst.

void  setState (const QCString &name,const QVariant &val)

setState

Set a context for this extractor.

Parameters:
nameName of this context
valValue of this context

QVariant  state (const QCString &name)

state

Get the value of a context for the current extractor.

Parameters:
nameName of the context to extract.

Returns: The value of the context.

void  setSchema (const QString &schema)

setSchema

Set the schema of the extraction.

Parameters:
schemaSpecify the schema of the output script or description. If empty don't specify any object. If the string "1" use same object as input. Otherwise use the specified schema.

void  setResize (const QString &resize)

setResize

Set sizes to use for resize of object on extraction.

Parameters:
Alist of sizes separated by ':'. Should be an even multiple of three where the first value is the largest current size to use these values. The next value is the initial value to use, the last is the next increment value to use. As a special case the string "1" can be used to set up auto resize.

void  setPrompt (bool prompt)

setPrompt

Set inclusion of prompts.

Parameters:
promptIf prompt generation should be generated.

void  setHeading (bool heading)

setHeading

Include heading in scripts.

Parameters:
headingInclude heading in scripts.

void  setConstraints (bool constraints)

setConstraints

Include constraints in extraction.

Parameters:
constraintsInclude constraints.

void  setIndexes (bool indexes)

setIndexes

Include indexes in extraction.

Parameters:
indexesInclude indexes.

void  setGrants (bool val)

setGrants

Include grants in extraction.

Parameters:
valInclude grants.

void  setStorage (bool val)

setStorage

Include storage specification in extraction.

Parameters:
valInclude storage specification.

void  setParallel (bool val)

setParallel

Include parallel specification in extraction.

Parameters:
valInclude parallel specification.

void  setPartition (bool val)

setPartition

Include partition specification in extraction.

Parameters:
valInclude partition specification.

void  setContents (bool val,int commitdistance)

setContents

Include contents of tables in scripts.

Parameters:
valInclude contents of tables.
commitdistanceThe commit distance of the contents 0 means whole tables.

void  setComments (bool val)

setComments

Include comments in extraction.

Parameters:
valInclude indexes.

void  setCode (bool val)

setCode

Include code in extraction.

Parameters:
valInclude code.

void  setBlockSize (int val)

setBlockSize

Set blocksize of database.

Parameters:
valNew value of blocksize.

const QStringgetSchema (void)

getSchema

Get schema specification.

Returns: Schema specification.

See also: setSchema

bool  getResize (void)

getResize

Get resize specification.

Returns: Resize specification.

See also: setResize

bool  getPrompt (void)

getPrompt

Check if prompt are generated.

Returns: If prompts are generated.

bool  getHeading (void)

getHeading

Check if headings are generated.

Returns: If headings are generated.

bool  getConstraints (void)

getConstraints

Check if constraints are generated.

Returns: If constraints are generated.

bool  getIndexes (void)

getIndexes

Check if indexes are generated.

Returns: If indexes are generated.

bool  getGrants (void)

getGrants

Check if grants are generated.

Returns: If grants are generated.

bool  getStorage (void)

getStorage

Check if storage specification are generated.

Returns: If storage specification are generated.

bool  getParallel (void)

getParallel

Check if parallell specification are generated.

Returns: If parallell specification are generated.

bool  getPartition (void)

getPartition

Check if partition specification are generated.

Returns: If partition specification are generated.

bool  getContents (void)

getContents

Check if contents of tables are generated.

Returns: If content is generated.

int  getCommitDistance (void)

getCommitDistance

Get the distance of the commits when content is generated.

Returns: Commit distance.

bool  getComments (void)

getComments

Check if comments are generated.

Returns: If comments are generated.

bool  getCode (void)

getCode

Check if code is generated.

Returns: If code is generated.

int  getBlockSize (void)

getBlockSize

Get blocksize.

toConnectionconnection ()

connection

Get the connection this extractor is working on.

void  initialNext (const QString &blocks,QString &initial,QString &next)

initialNext

Fill in the initial and next value for an object currently holding a number of allocated blocks. Uses the resize or default sizes.

Parameters:
blocksBlocks currently allocated.
initialNew initial value.
nextNew next value.

QString  intSchema (const QString &owner,bool desc)

intSchema

Get the schema name specified by the extractor setup. Will include the following '.' if needed.

Parameters:
ownerOwner of object to get schema for.
descUsed from describe and not to generate script.

Returns: The translated schema.

void  srcDst2DropCreate (std::list<QString> &source,std::list<QString> &destination, std::list<QString> &drop,std::list<QString> &creat)

srcDst2DropCreate

[static]

Create a source and destination object list to two other lists containing dropped and created objects or attributes.

Parameters:
sourceSource list input (Will not be modified).
destinationDestination list input (Will not be modified).
dropDrop list output (Will be overwritten).
createCreate list output (Will be overwritten).

bool  canHandle (toConnection &conn)

canHandle

[static]

Check if a database is supported at all by the extractor.

Parameters:
connConnection to check for support.

Returns: True if the database is supported.

void  addDescription (std::list<QString> &ret,std::list<QString> &ctx, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)

addDescription

[static]

Add a list to description.

Parameters:
retThe return list to add a line to.
ctxThe current description context.
arg1First extra argument to add.

std::list<QString>  splitDescribe (const QString &str)

splitDescribe

[static]

Split a description line into its components.

Parameters:
strThe description line to split.

Returns: The list of components.

QString  partDescribe (const QString &str,int level)

partDescribe

[static]

Get the part of a description indicated by the level

Parameters:
strDescription string
levelThe level to get (0 is the first level)

QString  contextDescribe (const QString &str,int level)

contextDescribe

[static]

Get the context of a given level.

Parameters:
strDescription string
levelThe level to get the context for (1 is the first to not return empty string.

Returns: The context, if not enough parts are available null is returned.

friend class extractor

extractor