Package picalo :: Module Database :: Class Query
[show private | hide private]
[frames | no frames]

Class Query


Represents a query on a database.
Method Summary
  __init__(self, sql, parameters, conn)
Creates a new query object.
  __eq__(self, other)
Returns whether this query is equal to another query (or list of lists).
  __getattr__(self, name)
  execute(self, conn)
Run the query using the given database connection.
  get_sql(self)
Returns the SQL for this query
  is_changed(self)
Returns whether the table has been changed since loading
  save(self, filename)
Saves the query to the given filename
  set_sql(self, sql, parameters, conn)
Modifies the sql of this connection, potentially re-executing it with the given connection
  view(self)
Opens a spreadsheet-view of the table if Picalo is being run in GUI mode.

Method Details

__init__(self, sql, parameters=None, conn=None)
(Constructor)

Creates a new query object.
Parameters:
sql - The SQL string to execute.
           (type=string)
parameters - The parameters to be sent to the database.
           (type=List or Tuple)
conn - If not None, the query is immediately executed with the given connection. This parameter can also be a Picalo _Cursor object.
           (type=Database._Connection or Database._Cursor object)

__eq__(self, other)
(Equality operator)

Returns whether this query is equal to another query (or list of lists).

execute(self, conn)

Run the query using the given database connection.
Parameters:
conn - The connection to execute the query on. This parameter can also be a Picalo _Cursor object.
           (type=Database._Connection or Database._Cursor object)

get_sql(self)

Returns the SQL for this query

is_changed(self)

Returns whether the table has been changed since loading

save(self, filename)

Saves the query to the given filename

set_sql(self, sql, parameters=None, conn=None)

Modifies the sql of this connection, potentially re-executing it with the given connection

view(self)

Opens a spreadsheet-view of the table if Picalo is being run in GUI mode. If Picalo is being run in console mode, it redirects to prettyprint(). This is the preferred way of viewing the data in a table.

Generated by Epydoc 2.1 on Mon Aug 20 05:38:16 2007 http://epydoc.sf.net