Arena  1.0
A content management system
 All Classes Files Functions Variables Pages
Library.DataSource.DataSources.ADataSource Class Reference

The abstract interface to a data source. More...

+ Inheritance diagram for Library.DataSource.DataSources.ADataSource:

Public Member Functions

def __init__
 Construct a new data source. More...
 
def init
 Initializer.
 
def connect
 Connect to the data source. More...
 
def disconnect
 Disconnect from the data source. More...
 
def count
 Count the number of records that would be returned by the specified fetch operation. More...
 
def fetch
 Fetch data from the data source. More...
 
def insert
 Insert data into the data source. More...
 
def update
 Update data in the data source. More...
 
def delete
 Delete data from the data source. More...
 
def categories
 Retrieve a list of all categories (or tables) in the data source. More...
 
- Public Member Functions inherited from Library.Base.Events.ALoggingEventfulObject
def __init__
 Constructor. More...
 
def init
 Initializer.
 
def error
 Generate an error event. More...
 
def log
 Log the specified item. More...
 
def Log
 Retrieve the log used by the class.
 
- Public Member Functions inherited from Library.Base.Events.AnEventfulObject
def __init__
 Constructor. More...
 
def init
 Initializer.
 
def __del__
 Destructor.
 
def parseParams
 Parse the specified parameters, looking for named events and setting event handlers as appropriate. More...
 
def generate
 Generate the named event.
 
def update
 Update the events generated by the object.
 
def error
 Generate an error event. More...
 
def toString
 Construct a string representation of the object. More...
 
def on
 Set the handler for the specified event. More...
 
def onMultiple
 Set handlers for multiple events. More...
 
def handlerFor
 Retrieve the handler for the specified event. More...
 
def generates
 Determine whether or not the object generates the named event. More...
 
def __getitem__
 Retrieve the value of the named property.
 
def __setitem__
 Set the value of the named property.
 
- Public Member Functions inherited from Library.Base.Classwork.AnObject
def init
 Initialize a new object instance. More...
 
def __init__
 Construct and initialize a new instance of AnObject. More...
 
def __del__
 Destroy the object instance. More...
 
def displayName
 Construct a "pretty" display name for the class instance, based on the name of its class. More...
 
def implements
 Determine whether the class instance is related to the specified class. More...
 
def toString
 Return a string representation of the class, suitable for output to a console or text-based device. More...
 
def __str__
 Return a string representation of the class. More...
 
def classname
 Return the name of the class from which the instance was created. More...
 
def name
 Return the name of the class. More...
 
- Public Member Functions inherited from Library.String.Utilities.IsPrintable
def toString
 Return a string representation of the class conveniently. More...
 
def __str__
 Return a string representation of the class. More...
 
def printTo
 Print a string representation of the class to the specified stream. More...
 

Detailed Description

The abstract interface to a data source.

This class defines several routines that are meant to be implemented by descendant classes; as a result, this class should not be instantiated directly.

Constructor & Destructor Documentation

def Library.DataSource.DataSources.ADataSource.__init__ (   Self,
  params 
)

Construct a new data source.

Member Function Documentation

def Library.DataSource.DataSources.ADataSource.categories (   Self)

Retrieve a list of all categories (or tables) in the data source.

This method should return a list or tuple that contains the name of every category present in the data source. If there are no categories, it should return None.

This method generates the fetchCategories event.

def Library.DataSource.DataSources.ADataSource.connect (   Self,
  params 
)

Connect to the data source.

This routine should be implemented by descendant classes. A status code should be returned to indicate success or failure. Zero (0) is assumed to mean that a connection was successfully made.

This method generates the connect event.

def Library.DataSource.DataSources.ADataSource.count (   Self,
  categoryName,
  params 
)

Count the number of records that would be returned by the specified fetch operation.

This routine should be implemented by descendant classes. It should return the number of records that would be returned if the paramters provided to it were used in a call to ADataSource.fetch().

The parameters supplied to this function have the same meaning as those supplied to ADataSource.fetch()

This method generates the count event.

def Library.DataSource.DataSources.ADataSource.delete (   Self,
  categoryName,
  params 
)

Delete data from the data source.

This routine should be implemented by descendant classes. It should delete the specified data from the data source, using the specified criteria to determine which records to delete, and return a value that indicates success (0 or greater) or failure (less than zero).

The categoryName parameter is required; it specifies the category (or table) within the data source where the data to be deleted may be found.

Within params, the following parameters are expected:

  • criteria – A list() of criteria that is used to determine which record will be updated.

Other parameters may also be supplied within params, but these will have meaning only to descendant classes or event handlers attached to this method.

This method generates the delete event.

def Library.DataSource.DataSources.ADataSource.disconnect (   Self)

Disconnect from the data source.

This routine should be implemented by descendant classes. It should close the data source connection and release any associated resources.

This method generates the disconnect event.

def Library.DataSource.DataSources.ADataSource.fetch (   Self,
  categoryName,
  params 
)

Fetch data from the data source.

This routine should be implemented by descendant classes. It should search the data source for the specified data and return an iterable object that contains or retrieves each record fetched by this method.

Note that only the categoryName parameter is required: this is the name of the category (or table) within the data source that will be searched.

The params passed to this method may include:

  • fieldNames – A list() of which fields are to be returned. If this parameter is blank or if it is omitted, all fields should be returned.
  • criteria – A list() of filter criteria to apply to the search; only those records that meet the criteria should be returned
  • sort – A list() of fields and sort order indicators; the data returned should be sorted based on this criteria
  • limit – The maximum number of records to return
  • offset – How many records to skip before returning results.

This method should generate an error event if the data retrieval fails.

This method generates the fetch event.

def Library.DataSource.DataSources.ADataSource.insert (   Self,
  categoryName,
  params 
)

Insert data into the data source.

This routine should be implemented by descendant classes. It should insert the specified data into the data source and return a value that indicates success (0 or greater) or failure (less than zero).

The categoryName parameter is required; it specifies the category (or table) within the data source where the new data is to be stored.

Within params, the following parameters are expected:

  • fieldsValues – A dictionary object that contains the names of fields and their associated values.

Other parameters may also be supplied within params, but these will have meaning only to descendant classes or event handlers attached to this method.

This method generates the insert event.

This method should return the unique id associated with the record upon success (a positive integer value greater than zero); or an error code (a negative integer value less than zero) on failure.

def Library.DataSource.DataSources.ADataSource.update (   Self,
  categoryName,
  params 
)

Update data in the data source.

This routine should be implemented by descendant classes. It should update the specified data in the data source, using the specified criteria to determine which record to update, and return a value that indicates success (0 or greater) or failure (less than zero).

The categoryName parameter is required; it specifies the category (or table) within the data source where the data to update may be found.

Within params, the following parameters are expected:

  • fieldsValues – A dictionary object that contains the names of fields and their associated values.
  • criteria – A list() of criteria that is used to determine which record will be updated.

Other parameters may also be supplied within params, but these will have meaning only to descendant classes or event handlers attached to this method.

This method generates the update event.


The documentation for this class was generated from the following file: