Package lemon :: Package db :: Package drivers :: Module base :: Class baseCursor
[show private | hide private]
[frames | no frames]

Class baseCursor

Known Subclasses:
gadflyCursor, mysqlCursor, odbcCursor

Base class for database adaptation layer

Method Summary
  __init__(self, cursor, autoExecute, fetchMode, autoConvert, convertMode, colTypesName, types)
  __getattr__(self, name)
Delegate unrecognised methods/attributes to the cursor object.
  addColumnType(self, table, col, c)
Add a column type definition to the ColumnTypes table.
  ALTER(self, table, mode, columnName, dataType)
  alter(self, table, mode, columnName, columnType, autoExecute)
  average(self, field, table, where)
  checkTypes(self, table, cols)
Checks to see if the columns specified by 'cols' are all present in the cache.
  columnExists(self, table, column)
  CREATE(self, table, fields)
  create(self, table, fields, autoExecute)
Fields:...
  createColTypesTable(self)
Create the ColumnTypes table required by the DB layer.
  decodeBinary(self, field)
  decodeChar(self, field)
  decodeDate(self, field)
  decodeDateTime(self, field)
  decodeFloat(self, field)
  decodeInteger(self, field)
  decodeRow(self, types, values)
Called to convert the results of a select or function call to the correct types.
  decodeString(self, field)
  decodeTime(self, field)
  DELETE(self, table, WHERE, autoExecute)
  delete(self, table, where, autoExecute)
  DROP(self, table)
  drop(self, table, autoExecute)
Remove a table from the database.
  encodeBinary(self, field)
  encodeChar(self, field)
  encodeDate(self, field)
  encodeDateTime(self, field)
  encodeFloat(self, field)
  encodeInteger(self, field)
  encodeRow(self, types, values)
Called to encode the data sent as SQL to ensure all strings are handled correctly across each database.
  encodeString(self, field)
  encodeTime(self, field)
  execute(self, sql, values)
  fetchRows(self, fetchMode, types)
Retrieve all the rows from the query in the format of a sequence of results.
  fieldAlias(self, f)
  FUNCTION(self, func, field, table, WHERE)
Warning: Please note..
  function(self, func, field, table, where)
Warning: Please note..
  getColumnNames(self, table)
  getTableData(self, table)
Called to retrieve information on the types of each column for a particular database using the retrieval method set with the autoConvert option.
  getTypes(self, table, fields)
Called to get a list of field types from a table name and a list of field names.
  INSERT(self, table, fields, VALUES, types, autoConvert, autoExecute)
  insert(self, table, fields, values, types, autoConvert, autoExecute)
  max(self, field, table, where)
  mergeTypes(self, table, types)
  min(self, field, table, where)
  removeColumnType(self, table, col)
Remove a column type definition to the ColumnTypes table.
  removeTableTypes(self, table)
Remove all definitions for the table 'table' from the ColumnTypes table.
  SELECT(self, fields, FROM, WHERE, ORDERBY, REST, types, autoConvert, autoExecute, fetchMode)
  select(self, fields, table, where, orderby, rest, types, autoConvert, autoExecute, fetchMode)
fields should be either: 1.
  setupFields(self)
This function is overridden in derived classes.
  setupOptions(self)
  sum(self, field, table, where)
  tableExists(self, table)
  tables(self, FROM)
  tblalias(self, t)
  UPDATE(self, table, fields, VALUES, WHERE, types, autoConvert, autoExecute)
  update(self, table, fields, values, where, types, autoConvert, autoExecute)

Method Details

__getattr__(self, name)
(Qualification operator)

Delegate unrecognised methods/attributes to the cursor object.

addColumnType(self, table, col, c)

Add a column type definition to the ColumnTypes table.

checkTypes(self, table, cols)

Checks to see if the columns specified by 'cols' are all present in the cache.

create(self, table, fields, autoExecute=None)

Fields:
(name, type, notNULL, default, auto, primary, unique)

createColTypesTable(self)

Create the ColumnTypes table required by the DB layer.

decodeRow(self, types, values)

Called to convert the results of a select or function call to the correct types.

drop(self, table, autoExecute=None)

Remove a table from the database.

encodeRow(self, types, values)

Called to encode the data sent as SQL to ensure all strings are handled correctly across each database.

fetchRows(self, fetchMode=None, types=None)

Retrieve all the rows from the query in the format of a sequence of results.

The 'types' value should be a dictionary containing the table names with each table being the key to another dict containg the column names and types.

FUNCTION(self, func, field, table, WHERE=None)

Warning: Please note.. no conversin is done here.

function(self, func, field, table, where=None)

Warning: Please note.. no conversion is done here.

getTableData(self, table)

Called to retrieve information on the types of each column for a particular database using the retrieval method set with the autoConvert option.

getTypes(self, table, fields)

Called to get a list of field types from a table name and a list of field names.

removeColumnType(self, table, col)

Remove a column type definition to the ColumnTypes table.

removeTableTypes(self, table)

Remove all definitions for the table 'table' from the ColumnTypes table.

select(self, fields, table=None, where=None, orderby=None, rest=None, types=None, autoConvert=None, autoExecute=None, fetchMode=None)

fields should be either:
    1. A string
    2. A list of strings
    3. A list of strings and tuples of length 2 in the form (sql, alias)

    If a single list contaning two enties is passed it is taken to be 2. not 3.

table should be either:
    1. The table name as a string
    2. A list of table names
    
WHERE should be a valid where clause

ORDERBY should be a valid ORDER BY string

setupFields(self)

This function is overridden in derived classes. It is used to specify the column type integers and strings for each field type Lemon allows. You should also set the self.autoConvertOptions list in this function if it needs to be changed.

Generated by Epydoc 2.0 on Mon Nov 10 15:08:20 2003 http://epydoc.sf.net