# class extractor

This is an abstract class to implement part of an extractor for a database. More...

Full name | `toExtract::extractor`
Definition | `#include <toextract.h>`
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- extractor ()
- virtual ~extractor ()
- virtual void initialize (toExtract &ext) const
- virtual void create (toExtract &ext, QTextStream &stream, const QString &type, const QString &schema, const QString &owner, const QString &name) const
- virtual void describe (toExtract &ext, std::list<QString> &lst, const QString &type, const QString &schema, const QString &owner, const QString &name) const
- virtual void migrate (toExtract &ext, QTextStream &stream, const QString &type, std::list<QString> &src, std::list<QString> &dst) const
- virtual void drop (toExtract &ext, QTextStream &stream, const QString &type, const QString &schema, const QString &owner, const QString &name) const
- virtual std::list<datatype> datatypes () const

#### Protected Methods

- void registerExtract (const QString &db, const QString &oper, const QString &type)
- void unregisterExtract (const QString &db, const QString &oper, const QString &type)

## Detailed Description

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.

void registerExtract (const QString &db, const QString &oper, const QString &type)

### registerExtract

[protected]

Register an operation to be handled by this extractor.

Parameters:

db | Database this extractor works on.
oper | What kind of operation to implement. Can be one of CREATE, DESCRIBE, MIGRATE or DROP.
type | The type of object that this is implemented for. Database specific.

void unregisterExtract (const QString &db, const QString &oper, const QString &type)

### unregisterExtract

[protected]

Unregister an operation to be handled by this extractor.

Parameters:

db | Database this extractor works on.
oper | What kind of operation to implement. Can be one of CREATE, DESCRIBE, MIGRATE or DROP.
type | The type of object that this is implemented for. Database specific.

extractor ()

### extractor

Create an extractor. Normally called from a statical instantiator. Should register objects it can handle registerExtract. Apart from the objects it handles one extractor per database can also register an empty operation and type parameter to registerExtract which will be called to initialize an extractor once per constructed toExtract object. operation.

~extractor ()

### ~extractor

[virtual]

Destructor.

void initialize (toExtract &ext)

### initialize

[const virtual]

Initiate an extractor for a given connection. Can be used to set up states necessary for further processing. Should probably set blocksize to be used for resizing (toExtract::setBlocksize).

Parameters:

ext | Extractor to generate script.

void create (toExtract &ext, QTextStream &stream, const QString &type, const QString &schema, const QString &owner, const QString &name)

### create

[const virtual]

Called to generate a script to recreate a database object.

Parameters:

ext | Extractor to generate script.
stream | Stream to write script to.
type | Type of object to recreate.
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.
owner | Owner of database object.
name | Name of database object.

Returns: A string containing a script to recreate an object.

void describe (toExtract &ext, std::list<QString> &lst, const QString &type, const QString &schema, const QString &owner, const QString &name)

### describe

[const virtual]

Called to describe a database object.

Parameters:

ext | Extractor to generate script.
lst | List of descriptions for the object. Should be appended.
type | Type of object to recreate.
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.
owner | Owner of database object.
name | Name of database object.

void migrate (toExtract &ext, QTextStream &stream, const QString &type, std::list<QString> &src, std::list<QString> &dst)

### migrate

[const virtual]

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

Parameters:

ext | Extractor to generate script.
type | Type of object to migrate.
src | Source description list.
dst | Destination description list.

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

void drop (toExtract &ext, QTextStream &stream, const QString &type, const QString &schema, const QString &owner, const QString &name)

### drop

[const virtual]

Called to generate a script to drop an object.

Parameters:

ext | Extractor to generate script.
type | Type of object to recreate.
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.
owner | Owner of database object.
name | Name of database object.

Returns: A string containing a script to recreate an object.

std::list<datatype> datatypes ()

### datatypes

[const virtual]

Get the available datatypes for the database.

Generated by: nneul on skyhawk on Wed Feb 23 19:49:58 2005, using kdoc 2.0a54.