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

Class _BaseQueryBuilder

Known Subclasses:
InsertQueryBuilder, SelectQueryBuilder, UpdateQueryBuilder

The base of query builder with common code.
Method Summary
  __init__(self, tablename, connection)
  __getitem__(self, field)
Returns the item with the given field name
  __len__(self)
Returns the number of fields in this query
  __setitem__(self, field, value)
Allows dictionary-use of the object to call the add method.
  __str__(self)
  add(self, field, value, add_if_empty)
Adds a field/value pair to the statement, optionally skipping the add if the value is None or empty ('').
  add_where(self, field, value, add_if_empty)
Adds a field/value pair to the statement for the WHERE clause.
  execute(self)
Executes the SQL statement.
  get(self, field, default)
Returns the item with the given field name, or the default value if none exists
  get_parameters(self)
Returns the parameters as they will be sent to the database
  get_query_string(self)
Returns the query string as it will be sent to the database.
  _format(self, st)
Helper method to ensure that special characters are escaped correctly

Method Details

__getitem__(self, field)
(Indexing operator)

Returns the item with the given field name

__len__(self)
(Length operator)

Returns the number of fields in this query

__setitem__(self, field, value)
(Index assignment operator)

Allows dictionary-use of the object to call the add method. It always adds the value, even if it is None or empty.

add(self, field, value, add_if_empty=True)

Adds a field/value pair to the statement, optionally skipping the add if the value is None or empty (''). This method is only valid for update-type queries and is ignored in select queries.

add_where(self, field, value, add_if_empty=True)

Adds a field/value pair to the statement for the WHERE clause. This method is only used in statements where this makes sense (select, update). It is ignored in insert queries.

execute(self)

Executes the SQL statement. This method should be called for insert and update queries. Does *not* commit if transactions are being used.

get(self, field, default=None)

Returns the item with the given field name, or the default value if none exists

get_parameters(self)

Returns the parameters as they will be sent to the database

get_query_string(self)

Returns the query string as it will be sent to the database.

_format(self, st)

Helper method to ensure that special characters are escaped correctly

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