Package lemon :: Package db :: Package drivers :: Module gc :: Class gadflyCursor
[show private | hide private]
[frames | no frames]

Class gadflyCursor

baseCursor --+
             |
            gadflyCursor


Method Summary
  alter(self, conn, table, mode, columnName, columnType, default)
Note: The code has been re-written and seems to work well so the info below may not be relevant.
  function(self, func, field, table, where)
Warning: Please note..
  setupFields(self)
For this to work the definitions must be tuples containing just one integer, otherwise the integer field...
  setupOptions(self)
    Inherited from baseCursor
  __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)
  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..
  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.
  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

alter(self, conn, table, mode, columnName, columnType=None, default=None)

Note: The code has been re-written and seems to work well so the info below may not be relevant.
      Also no commits are used.

Manually performs a table alteration in Gadfly.

WARNING: The function is not robust and may fail, make sure you read the docstring for the Gadfly ALTER()
         command and that you make a proper backup as described in the docstring for this module.
         
NOTE:    This function has a different syntax to ALTER(). This is because Gadfly doesn't suppot NULLs so you
         must specify a default value of the correct type for the column.
         
ALTER() does not have the same effect in the Gadfly cursor as in other cursors.

Differences:
    1. Gadfly doesn't support ALTER.
            This means that the implementation has been done manually by reading all the results
            from the table, deleting the table, creating a new table and putting all the results
            back in. This is not reliable. several self.commit() calls are made which menas 
            transactions could behave strangely. Also gadfly tends to like being disconnected from and
            reconnected to before any further calls are made.
            
If you really need to alter a gadfly table, make a backup and then connect to Gadfly in the 
way you would if you were creating a table for the first time (as described in the gadfly documentation)
then perform the alter, commit, and disconnect. The table should have been altered successfully.
Overrides:
lemon.db.drivers.base.baseCursor.alter

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

Warning: Please note.. no conversion is done here.
Overrides:
lemon.db.drivers.base.baseCursor.function

setupFields(self)

For this to work the definitions must be tuples containing just one integer, otherwise the integer field
causes problems when adding a column definition
Overrides:
lemon.db.drivers.base.baseCursor.setupFields

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