|
|
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:
conn | Connection to extract from. |
parent | Parent widget of progress indicator. |
QString create (std::list<QString> &object)
| create |
Create script to recreate list of objects.
Parameters:
object | List 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:
stream | Stream to write result to. |
object | List 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:
object | List 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:
object | List 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:
stream | Stream to write result to. |
object | List 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:
stream | Stream to write result to. |
src | Source description list, generated by describes for the same database. |
dst | Destination 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:
stream | Stream to write result to. |
src | Source description list, generated by describes for the same database. |
dst | Destination 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:
name | Name of this context |
val | Value of this context |
QVariant state (const QCString &name)
| state |
Get the value of a context for the current extractor.
Parameters:
name | Name of the context to extract. |
Returns: The value of the context.
void setSchema (const QString &schema)
| setSchema |
Set the schema of the extraction.
Parameters:
schema | Specify 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:
A | list 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:
prompt | If prompt generation should be generated. |
void setHeading (bool heading)
| setHeading |
Include heading in scripts.
Parameters:
heading | Include heading in scripts. |
void setConstraints (bool constraints)
| setConstraints |
Include constraints in extraction.
Parameters:
constraints | Include constraints. |
void setIndexes (bool indexes)
| setIndexes |
Include indexes in extraction.
Parameters:
indexes | Include indexes. |
void setGrants (bool val)
| setGrants |
Include grants in extraction.
Parameters:
val | Include grants. |
void setStorage (bool val)
| setStorage |
Include storage specification in extraction.
Parameters:
val | Include storage specification. |
void setParallel (bool val)
| setParallel |
Include parallel specification in extraction.
Parameters:
val | Include parallel specification. |
void setPartition (bool val)
| setPartition |
Include partition specification in extraction.
Parameters:
val | Include partition specification. |
void setContents (bool val,int commitdistance)
| setContents |
Include contents of tables in scripts.
Parameters:
val | Include contents of tables. |
commitdistance | The commit distance of the contents 0 means whole tables. |
void setComments (bool val)
| setComments |
Include comments in extraction.
Parameters:
val | Include indexes. |
void setCode (bool val)
| setCode |
Include code in extraction.
Parameters:
val | Include code. |
void setBlockSize (int val)
| setBlockSize |
Set blocksize of database.
Parameters:
val | New value of blocksize. |
const QString & getSchema (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.
toConnection & connection ()
| 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:
blocks | Blocks currently allocated. |
initial | New initial value. |
next | New 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:
owner | Owner of object to get schema for. |
desc | Used 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:
source | Source list input (Will not be modified). |
destination | Destination list input (Will not be modified). |
drop | Drop list output (Will be overwritten). |
create | Create list output (Will be overwritten). |
bool canHandle (toConnection &conn)
| canHandle |
[static]
Check if a database is supported at all by the extractor.
Parameters:
conn | Connection 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:
ret | The return list to add a line to. |
ctx | The current description context. |
arg1 | First extra argument to add. |
std::list<QString> splitDescribe (const QString &str)
| splitDescribe |
[static]
Split a description line into its components.
Parameters:
str | The 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:
str | Description string |
level | The 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:
str | Description string |
level | The 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 |