Package gnue :: Package common :: Package datasources :: Package drivers :: Package sql :: Package maxdb :: Module Behavior :: Class Behavior
[show private | hide private]

Class Behavior

Behavior --+    
           |    
    Behavior --+
               |
              Behavior


Behavior class for MaxDB/SAP-DB backends.

Limitations:
Method Summary
  __init__(self, connection)
Create a new Behavior instance.
  _createDatabase_(self)
Create a new database instance as defined by the connection's parameters.
  _defaultwith_(self, code, field)
Handle special defaults like 'serial' and 'timestamp'.
  _readSchema_(self, parent)
Read the connection's schema and build a GSchema object tree connected to the given parent object (which is of type GSSchema).
  string(self, field)
Return the native datatype for string fields
    Inherited from Behavior
  _create_table_trailer_(self, table)
Create trailing SQL code for building a table.
  _createConstraint_(self, constraint)
Create a code triple for the given constraint.
  _createFields_(self, item)
Create a code-triple for the given GSTable or GSField.
  _createIndex_(self, index)
Create a code triple for the given index.
  _createPrimaryKey_(self, pkey)
Create a code triple for the given primary key.
  _createTable_(self, table)
Generate a code-triple to create or change the given table.
  _dropConstraint_(self, constraint)
Create a command sequence for dropping the given constraint.
  _dropIndex_(self, index)
Create a command sequence for dropping the given index.
  _integrateNullable_(self, code, field)
Handle the nullable-flag of a given field.
  _processField_(self, field)
Create a code-triple for a single field.
  _setColumnDefault_(self, code, field, default)
Set a default value for a given column.
  _writeSchema_(self, current, new, diff, simulation)
Integrate the given schema into the current connection's schema and return the commands used to achive this.
  number(self, field)
Return the native datatye for a numeric field.
    Inherited from Behavior
  __repr__(self)
  createDatabase(self)
Create a new database specified by the associated connection.
  readSchema(self)
Retrieve the connection's schema information and return it as GSchema object tree.
  writeSchema(self, schema, simulation)
Generate a command sequence to integrate the given schema tree into the connection's current schema.

Class Variable Summary
    Inherited from Behavior
bool _alterMultiple_: boolean flag indicating wether an 'alter table' statement can contain multiple fields or not.
bool _extraPrimaryKey_: boolean flag indicating wether primary keys must be added with an extra command (ie.
tuple _numbers_: triple specifying rules for datatype transformation of numeric types.
dict _type2native_: dictionary mapping field-types to native datatypes.
list _writeableTypes_: list of GSTables-types to be handled by writeSchema ().
    Inherited from Behavior
NoneType _maxIdLength_: maximum length of an identifier or None if no restriction.

Method Details

__init__(self, connection)
(Constructor)

Create a new Behavior instance.

This is usually done silently when creating a connection instance.
Parameters:
connection - The Connection.Connection instance bound to this Behavior instance.
Overrides:
gnue.common.datasources.drivers.Base.Behavior.Behavior.__init__ (inherited documentation)

_createDatabase_(self)

Create a new database instance as defined by the connection's parameters. The user will be asked for a username and password who is member of the SDBA group on the backend system and theirfore allowed to create new instances. If the database already exists no action takes place.
Overrides:
gnue.common.datasources.drivers.Base.Behavior.Behavior._createDatabase_

_defaultwith_(self, code, field)

Handle special defaults like 'serial' and 'timestamp'.
Parameters:
code - code-triple to merge the result in
field - GSField instance with the default definition
Overrides:
gnue.common.datasources.drivers.DBSIG2.Behavior.Behavior._defaultwith_

_readSchema_(self, parent)

Read the connection's schema and build a GSchema object tree connected to the given parent object (which is of type GSSchema).
Overrides:
gnue.common.datasources.drivers.Base.Behavior.Behavior._readSchema_

string(self, field)

Return the native datatype for string fields
Parameters:
field - GSField instance to get a native datatype for
Returns:
'VARCHAR (?)' or 'LONG'
Overrides:
gnue.common.datasources.drivers.DBSIG2.Behavior.Behavior.string


GNUe Home

Public API

Developer's Corner