Module vtab_media :: Class Media
[hide private]
[frames] | no frames]

Class Media

source code

         object --+    
                  |    
database.ModuleBase --+
                      |
                     Media

Module to implements a virtual table that stores media data as native system files. The table has 2 fiels: __rowid__ and mediadata This class maintains its own rowid, cursor, and constraints parameters. The data of each row is stored in a file named Fxxxxxxx, where xxxxxxx is the rowid starting with 1 ie (F0000001, F0000002, etc)

Instance Methods [hide private]
 
__init__(self, pathname)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
getnextrowid(self)
Return the next row ID from a file called rowid
source code
 
incrementrowid(self) source code
 
saverowid(self, id) source code
 
filenamefromid(self, id) source code
 
idfromfilename(self, filename) source code
 
BestIndex(self, constraints, orderby)
Provide information on how to best access this table.
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 database.ModuleBase: Begin, Close, Commit, Connect, Create, Destroy, Disconnect, Open, Rollback, Sync

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, pathname)
(Constructor)

source code 

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

Overrides: object.__init__

BestIndex(self, constraints, orderby)

source code 

Provide information on how to best access this table.
Must be overriden by subclass.
@params constraints: a tuple of (column #, op) defining a constraints
@params 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)

Todo: store the constraints for subsequent evaluation, and tell
    sqlite to pass the constraints parameters to Filter.

Overrides: database.ModuleBase.BestIndex

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

Todo: evaluate actual constraints, will let sqlite do the orderby.

Overrides: database.ModuleBase.Filter

Eof(self)

source code 

Determines if the current cursor points to a valid row.

Returns:
False if valid row, True otherwise
Overrides: database.ModuleBase.Eof

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 We only have 2 columns: __rowid__ and mediadata
Overrides: database.ModuleBase.Column

Next(self)

source code 

Move the cursor to the next row.

Returns:
None
Overrides: database.ModuleBase.Next

Rowid(self)

source code 

Return the rowid of the current row.

Returns:
the rowid(int) of the current row.
Overrides: database.ModuleBase.Rowid

UpdateDeleteRow(self, rowid)

source code 

Delete row rowid

Parameters:
  • rowid
Returns:
None
Overrides: database.ModuleBase.UpdateDeleteRow

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.
Overrides: database.ModuleBase.UpdateInsertRow

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
Overrides: database.ModuleBase.UpdateChangeRow