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

Class ModuleBase

source code

object --+
         |
        ModuleBase
Known Subclasses:

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

Instance Methods [hide private]
 
__init__(self, field_names)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
Create(self, connection, modulename, databasename, vtablename, *args)
Called when the virtual table is created.
source code
 
Connect(self, connection, modulename, databasename, vtablename, *args)
Connect to an existing virtual table, by default it is identical to Create
source code
 
Destroy(self)
Release a connection to a virtual table and destroy the underlying table implementation.
source code
 
Disconnect(self)
Release a connection to a virtual table.
source code
 
BestIndex(self, constraints, orderby)
Provide information on how to best access this table.
source code
 
Begin(self) source code
 
Sync(self) source code
 
Commit(self) source code
 
Rollback(self) source code
 
Open(self)
Create/prepare a cursor used for subsequent reading.
source code
 
Close(self)
Close a cursor previously created by Open By default, do nothing
source code
 
Filter(self, idxNum, idxStr, argv)
Begin a search of a virtual table.
source code
 
Eof(self)
Determines if the current cursor points to a valid row.
source code
 
Column(self, N)
Find the value for the N-th column of the current row.
source code
 
Next(self)
Move the cursor to the next row.
source code
 
Rowid(self)
Return the rowid of the current row.
source code
 
UpdateDeleteRow(self, rowid)
Delete row rowid
source code
 
UpdateInsertRow(self, rowid, fields)
Insert a new row of data into the table
source code
 
UpdateChangeRow(self, rowid, newrowid, fields)
Change the row of the current rowid with the new rowid and new values
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, field_names)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

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

source code 

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)

source code 

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

Disconnect(self)

source code 

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

BestIndex(self, constraints, orderby)

source code 
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)

Open(self)

source code 

Create/prepare a cursor used for subsequent reading.

Returns:
the implementor object: Me!

Filter(self, idxNum, idxStr, argv)

source code 

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

Eof(self)

source code 

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

Column(self, N)

source code 

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

Next(self)

source code 

Move the cursor to the next row.

Returns:
None

Rowid(self)

source code 

Return the rowid of the current row.

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

UpdateDeleteRow(self, rowid)

source code 

Delete row rowid

Parameters:
  • rowid
Returns:
None

UpdateInsertRow(self, rowid, fields)

source code 

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.

UpdateChangeRow(self, rowid, newrowid, fields)

source code 

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