Module database :: Class ModuleBase
[show private | hide private]
[frames | no frames]

Type ModuleBase

object --+
         |
        ModuleBase

Known Subclasses:
Media

Base class to implement a specific Virtual Table module with apsw. For more info: http://www.sqlite.org/cvstrac/wiki/wiki?p=VirtualTables http://www.sqlite.org/cvstrac/wiki/wiki?p=VirtualTableMethods http://www.sqlite.org/cvstrac/wiki/wiki?p=VirtualTableBestIndexMethod
Method Summary
  __init__(self, field_names)
  Begin(self)
  BestIndex(self, constraints, orderby)
Provide information on how to best access this table.
  Close(self)
Close a cursor previously created by Open By default, do nothing
  Column(self, N)
Find the value for the N-th column of the current row.
  Commit(self)
  Connect(self, connection, modulename, databasename, vtablename, *args)
Connect to an existing virtual table, by default it is identical to Create
  Create(self, connection, modulename, databasename, vtablename, *args)
Called when the virtual table is created.
  Destroy(self)
Release a connection to a virtual table and destroy the underlying table implementation.
  Disconnect(self)
Release a connection to a virtual table.
  Eof(self)
Determines if the current cursor points to a valid row.
  Filter(self, idxNum, idxStr, argv)
Begin a search of a virtual table.
  Next(self)
Move the cursor to the next row.
  Open(self)
Create/prepare a cursor used for subsequent reading.
  Rollback(self)
  Rowid(self)
Return the rowid of the current row.
  Sync(self)
  UpdateChangeRow(self, rowid, newrowid, fields)
Change the row of the current rowid with the new rowid and new values
  UpdateDeleteRow(self, rowid)
Delete row rowid
  UpdateInsertRow(self, rowid, fields)
Insert a new row of data into the table
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Method Details

BestIndex(self, constraints, orderby)

Provide information on how to best access this table.
Must be overriden by subclass.
@param constraints: a tuple of (column #, op) defining a constraints
@param orderby: a tuple of (column #, desc) defining the order by
@returns a tuple of up to 5 values:
    0: aConstraingUsage: a tuple of the same size as constraints.
        Each item is either None, argv index(int), or (argv index, omit(Bool)).
    1: idxNum(int)
    2: idxStr(string)
    3: orderByConsumed(Bool)
    4: estimatedCost(float)

Close(self)

Close a cursor previously created by Open By default, do nothing

Column(self, N)

Find the value for the N-th column of the current row.
Parameters:
N - the N-th column
Returns:
value of the N-th column

Connect(self, connection, modulename, databasename, vtablename, *args)

Connect to an existing virtual table, by default it is identical to Create

Create(self, connection, modulename, databasename, vtablename, *args)

Called when the virtual table is created.
Parameters:
connection - an instance of apsw.Connection
modulename - string name of the module being invoked
databasename - string name of this database
vtablename - string name of this new virtual table
args - additional arguments sent from the CREATE VIRTUAL TABLE statement
Returns:
a tuple of 2 values: an sql string describing the table, and an object implementing it: Me!

Destroy(self)

Release a connection to a virtual table and destroy the underlying table implementation. By default, we do nothing.

Disconnect(self)

Release a connection to a virtual table. By default, we do nothing.

Eof(self)

Determines if the current cursor points to a valid row. The Sqlite doc is wrong on this.
Returns:
True if NOT valid row, False otherwise

Filter(self, idxNum, idxStr, argv)

Begin a search of a virtual table.
Parameters:
idxNum - int value passed by BestIndex
idxStr - string valued passed by BestIndex
argv - constraint parameters requested by BestIndex
Returns:
None

Next(self)

Move the cursor to the next row.
Returns:
None

Open(self)

Create/prepare a cursor used for subsequent reading.
Returns:
the implementor object: Me!

Rowid(self)

Return the rowid of the current row.
Returns:
the rowid(int) of the current row.

UpdateChangeRow(self, rowid, newrowid, fields)

Change the row of the current rowid with the new rowid and new values
Parameters:
rowid - rowid of the current row
newrowid - new rowid
fields - a tuple of the field values in the order declared in Create/Connect
Returns:
rowid of the new row

UpdateDeleteRow(self, rowid)

Delete row rowid
Parameters:
rowid -
Returns:
None

UpdateInsertRow(self, rowid, fields)

Insert a new row of data into the table
Parameters:
rowid - if not None, use this rowid. If None, create a new rowid
fields - a tuple of the field values in the order declared in Create/Connet
Returns:
rowid of the new row.

Generated by Epydoc 2.1 on Fri Aug 15 18:58:25 2008 http://epydoc.sf.net