New API reference documentation is available for testing at http://thewinecellarbook.com/daboDocTestAlt/. Please report any problems or suggestions on the dabo-users mailing list.

Class Firebird

Class providing Firebird connectivity. Uses kinterbasdb.

Properties

Application BaseClass BasePrefKey
Class Encoding KeepAliveInterval
LogEvents Name Parent
PreferenceManager

Events


Methods

addField addFrom addGroupBy
addJoin addOrderBy addWhere
afterInit autoBindEvents beforeInit
beginTransaction bindEvent bindEvents
commitTransaction createJustIndexes createJustTable
createTableAndIndexes dblQuoteField encloseNames
escQuote flush formSQL
formatBLOB formatDateTime formatForQuery
formatJoinType formatNone getAbsoluteName
getConnection getCursor getDaboFieldType
getDescription getDictCursorClass getFieldInfoFromDescription
getFields getLastInsertID getLimitWord
getProperties getStructureDescription getTableRecordCount
getTables getUpdateTablePrefix getWhereTablePrefix
getWordMatchFormat initEvents initProperties
isExistingTable isValidModule massageDescription
noResultsOnDelete noResultsOnSave pregenPK
prepareWhere processFields raiseEvent
rollbackTransaction setChildFilterClause setFieldClause
setFromClause setGroupByClause setJoinClause
setNonUpdateFields setOrderByClause setProperties
setPropertiesFromAtts setSQL setWhereClause
unbindEvent




Properties

Application
Read-only object reference to the Dabo Application object.  (dApp).

(inherited from dObject)
BaseClass
The base Dabo class of the object. Read-only.  (class)

(inherited from dObject)
BasePrefKey
Base key used when saving/restoring preferences  (str)

(inherited from dObject)
Class
The class the object is based on. Read-only.  (class)

(inherited from dObject)
Encoding
Backend encoding  (str)

(inherited from dBackend)
KeepAliveInterval
Specifies how often a KeepAlive query should be sent to the server.

Defaults to None, meaning we never send a KeepAlive query. The interval
is expressed in seconds.

(inherited from dBackend)
LogEvents
Specifies which events to log.  (list of strings)

If the first element is 'All', all events except the following listed events
will be logged.
Event logging is resource-intensive, so in addition to setting this LogEvents
property, you also need to make the following call:

	>>> dabo.eventLogging = True


(inherited from dObject)
Name
The name of the object.  (str)

(inherited from dObject)
Parent
The containing object.  (obj)

(inherited from dObject)
PreferenceManager
Reference to the Preference Management object  (dPref)

(inherited from dObject)



Events




Methods

addField(self, clause, exp, alias=None, autoQuote=True)
Add a field to the field clause.

(inherited from dBackend)
addFrom(self, clause, exp, alias=None, autoQuote=True)
Add a table to the sql statement.

(inherited from dBackend)
addGroupBy(self, clause, exp, autoQuote=True)
Add an expression to the group-by clause.

(inherited from dBackend)
addJoin(self, tbl, joinCondition, exp, joinType=None, autoQuote=True)
Add a joined table to the sql statement.

(inherited from dBackend)
addOrderBy(self, clause, exp, autoQuote=True)
Add an expression to the order-by clause.

(inherited from dBackend)
addWhere(self, clause, exp, comp='and', autoQuote=True)
Add an expression to the where clause.

(inherited from dBackend)
afterInit(self)
Subclass hook. Called after the object's __init__ has run fully.
Subclasses should place their __init__ code here in this hook, instead of
overriding __init__ directly, to avoid conflicting with base Dabo behavior.

(inherited from dObject)
autoBindEvents(self, force=True)
Automatically bind any on*() methods to the associated event.

User code only needs to define the callback, and Dabo will automatically
set up the event binding. This will satisfy lots of common cases where
you want an object or its parent to respond to the object's events.

To use this feature, just define a method on<EventName>(), or	if you
want a parent container to respond to the event, make a method in the
parent on<EventName>_<object Name or RegID>().

For example::
	
	class MyButton(dabo.ui.dButton):
		def onHit(self, evt):
			print "Hit!"

	class MyPanel(dabo.ui.dPanel):
		def afterInit(self):
			self.addObject(MyButton, RegID="btn1")

		def onHit_btn1(self, evt):
			print "panel: button hit!"

When the button is pressed, you'll see both 'hit' messages because of
auto event binding.

If you want to bind your events explicitly, you can turn off auto event
binding by calling::

	 dabo.autoBindEvents = False

This feature is inspired by PythonCard.

(inherited from EventMixin)
beforeInit(self, *args, **kwargs)
Subclass hook. Called before the object is fully instantiated.
Usually, user code should override afterInit() instead, but there may be
cases where you need to set an attribute before the init stage is fully
underway.

(inherited from dObject)
beginTransaction(self, cursor)
Begin a SQL transaction.
bindEvent(self, eventClass, function, _auto=False)
Bind a dEvent to a callback function.

(inherited from EventMixin)
bindEvents(self, bindings)
Bind a sequence of [dEvent, callback] lists.

(inherited from EventMixin)
commitTransaction(self, cursor)
Commit a SQL transaction.

(inherited from dBackend)
createJustIndexes(self, tabledef, cursor)

			
(inherited from dBackend)
createJustTable(self, tabledef, cursor)

			
(inherited from dBackend)
createTableAndIndexes(self, tabledef, cursor, createTable=True, createIndex=True)
Creates a table and/or indexes based on the dTable passed to it.

(inherited from dBackend)
dblQuoteField(self, txt)
Takes a string and returns the same string with
all occurrences of xx.yy replaced with xx."YY".
In other words, wrap the field name in double-quotes,
and change it to upper case.
encloseNames(self, exp, autoQuote=True, keywords=None)
When table/field names contain spaces, this will safely enclose them
in quotes or whatever delimiter is appropriate for the backend, unless
autoQuote is False, in which case it leaves things untouched. If there are
keywords that are part of the expression that should not be enclosed
within the field name, pass them as a tuple to the keywords parameter.

(inherited from dBackend)
escQuote(self, val)

			
		
flush(self, cursor)
Firebird requires an explicit commit in order to have changes
to the database written to disk.
formSQL(self, fieldClause, fromClause, joinClause, whereClause, groupByClause, orderByClause, limitClause)
Firebird wants the limit clause before the field clause.
formatBLOB(self, val)
Properly format a BLOB value to be included in an UPDATE
or INSERT statement for a specific backend.

(inherited from dBackend)
formatDateTime(self, val)
We need to wrap the value in quotes.
formatForQuery(self, val, fieldType=None)

			
(inherited from dBackend)
formatJoinType(self, jt)
Default formatting for jointype keywords. Override in subclasses if needed.

(inherited from dBackend)
formatNone(self)
Properly format a None value to be included in an update statement.

Each backend should override as needed. The default is to return "NULL".

(inherited from dBackend)
getAbsoluteName(self)
Return the fully qualified name of the object.

(inherited from dObject)
getConnection(self, connectInfo, **kwargs)

			
		
getCursor(self, cursorClass)
override in subclasses if necessary

(inherited from dBackend)
getDaboFieldType(self, backendFieldType)
Return the Dabo code (I, T, D, ...) for the passed backend Field Type.

If it can't be determined, the field type will be '?'.

(inherited from dBackend)
getDescription(self, cursor)
Normally, cursors should always be able to report their
description properly. However, some backends such as
SQLite will not report a description if there is no data in the
record set. This method provides a way for those backends
to deal with this. By default, though, just return the contents
of the description attribute.

(inherited from dBackend)
getDictCursorClass(self)

			
		
getFieldInfoFromDescription(self, cursorDescription)
Return field information from the cursor description.

(inherited from dBackend)
getFields(self, tableName, cursor)

			
		
getLastInsertID(self, cursor)
Return the ID of the last inserted row, or None.

When inserting a new record in a table that auto-generates a PK
value, different databases have their own way of retrieving that value.
This method should be coded in backend-specific subclasses to address
that database's approach.

(inherited from dBackend)
getLimitWord(self)
Override the default 'limit', since Firebird doesn't use that.
getProperties(self, propertySequence=(), propsToSkip=(), ignoreErrors=False, *propertyArguments)
Returns a dictionary of property name/value pairs.

If a sequence of properties is passed, just those property values
will be returned. Otherwise, all property values will be returned.
The sequence of properties can be a list, tuple, or plain string
positional arguments. For instance, all of the following are
equivilent::

	print self.getProperties("Caption", "FontInfo", "Form")
	print self.getProperties(["Caption", "FontInfo", "Form"])
	t = ("Caption", "FontInfo", "Form")
	print self.getProperties(t)
	print self.getProperties(\*t)

An exception will be raised if any passed property names don't
exist, aren't actual properties, or are not readable (do not have
getter functions).

However, if an exception is raised from the property getter function,
the exception will get caught and used as the property value in the
returned property dictionary. This allows the property list to be
returned even if some properties can't be evaluated correctly by the
object yet.

(inherited from PropertyHelperMixin)
getStructureDescription(self, cursor)
Return the basic field structure.

(inherited from dBackend)
getTableRecordCount(self, tableName, cursor)

			
		
getTables(self, cursor, includeSystemTables=False)

			
		
getUpdateTablePrefix(self, tbl, autoQuote=True)
By default, the update SQL statement will be in the form of

	tablename.fieldname

but some backends do no accept this syntax. If not, change
this method to return an empty string, or whatever should
preceed the field name in an update statement.

(inherited from dBackend)
getWhereTablePrefix(self, tbl, autoQuote=True)
By default, the comparisons in the WHERE clauses of
SQL statements will be in the form of

	tablename.fieldname

but some backends do no accept this syntax. If not, change
this method to return an empty string, or whatever should
preceed the field name in a comparison in the WHERE clause
of an SQL statement.

(inherited from dBackend)
getWordMatchFormat(self)
By default, will return the standard format for an
equality test. If search by words is available, the format
must be implemented in each specific backend.

The format must have the expressions %(table)s, %(field)s,
and %(value)s, which will be replaced with the table, field,
and value strings, respectively.

(inherited from dBackend)
initEvents(self)
Hook for subclasses. User code should do custom event binding
here, such as::
	
	self.bindEvent(dEvents.GotFocus, self.customGotFocusHandler)
	

(inherited from dObject)
initProperties(self)
Hook for subclasses. User subclasses should set properties
here, such as::
	
	self.Name = "MyTextBox"
	self.BackColor = (192,192,192)
	

(inherited from dObject)
isExistingTable(self, table)
Returns whether or not the table exists.

(inherited from dBackend)
isValidModule(self)
Test the dbapi to see if it is supported on this computer.

(inherited from dBackend)
massageDescription(self, cursor)
Force all the field names to lower case.
noResultsOnDelete(self)
Firebird does not return the number of records deleted, so
we just have to ignore this, since we can't tell a failed delete apart
from a successful one.
noResultsOnSave(self)
Firebird does not return the number of records updated, so
we just have to ignore this, since we can't tell a failed save apart
from a successful one.
pregenPK(self, cursor)
Determines the generator for which a 'before-insert' trigger
is associated with the cursor's table. If one is found, get its
next value and return it. If not, return None.
prepareWhere(self, clause, autoQuote=True)
Normally, just return the original. Can be overridden as needed
for specific backends.

(inherited from dBackend)
processFields(self, txt)
Firebird requires that all field names be surrounded
by double quotes.
raiseEvent(self, eventClass, uiEvent=None, *args, **kwargs)
Send the event to all registered listeners.

If uiEvent is sent, dEvents.Event will be able to parse it for useful
information to send along to the callback. 

Additional arguments, if any, are sent along to the constructor	of the
event. While this feature exists so that UI-lib event handlers can pass
along information (such as the keystroke information in a key event), user
code may pass along additional arguments as well, which	will exist in the
event.EventData dictionary property.

In most cases, user code should call raiseEvent() with
the event class (dEvents.Hit, for example) as the only parameter.

(inherited from EventMixin)
rollbackTransaction(self, cursor)
Roll back (revert) a SQL transaction.

(inherited from dBackend)
setChildFilterClause(self, clause, autoQuote=True)

			
		
setFieldClause(self, clause, autoQuote=True)

			
		
setFromClause(self, clause, autoQuote=True)

			
		
setGroupByClause(self, clause, autoQuote=True)

			
		
setJoinClause(self, clause, autoQuote=True)

			
(inherited from dBackend)
setNonUpdateFields(self, cursor, autoQuote=True)
Normally, this routine should work for all backends. But
in the case of SQLite, the routine that grabs an empty cursor
doesn't fill in the description, so that backend has to use
an alternative approach.

(inherited from dBackend)
setOrderByClause(self, clause, autoQuote=True)

			
		
setProperties(self, propDict={}, ignoreErrors=False, **propKw)
Sets a group of properties on the object all at once.

You have the following options for sending the properties:
	
	1) Property/Value pair dictionary
	2) Keyword arguments
	3) Both

The following examples all do the same thing::

	self.setProperties(FontBold=True, ForeColor="Red")
	self.setProperties({"FontBold": True, "ForeColor": "Red"})
	self.setProperties({"FontBold": True}, ForeColor="Red")


(inherited from PropertyHelperMixin)
setPropertiesFromAtts(self, propDict={}, ignoreExtra=True, context=None)
Sets a group of properties on the object all at once. This
is different from the regular setProperties() method because
it only accepts a dict containing prop:value pairs, and it
assumes that the value is always a string. It will convert
the value to the correct type for the property, and then set
the property to that converted value. If the value needs to be evaluated
in a specific namespace, pass that as the 'context' parameter.

(inherited from PropertyHelperMixin)
setSQL(self, sql)

			
		
setWhereClause(self, clause, autoQuote=True)

			
		
unbindEvent(self, eventClass=None, function=None)
Remove a previously registered event binding.

Removes all registrations that exist for the given binding for this
object. If event is None, all bindings for the passed function are
removed. If function is None, all bindings for the passed event are
removed. If both event and function are None, all event bindings are
removed.

(inherited from EventMixin)

Dabo 0.9.4 (rev. 7089)
9 Feb 2012 23:31:09