Package Modeling :: Package DatabaseAdaptors :: Package SQLiteAdaptorLayer :: Module SQLiteSQLExpression :: Class SQLiteSQLExpression
[show private | hide private]
[frames | no frames]

Type SQLiteSQLExpression

   object --+    
            |    
SQLExpression --+
                |
               SQLiteSQLExpression


Sub-class of SQLExpression for the SQLiteAdaptor.
Method Summary
  addCreateClauseForAttribute(self, attribute)
Adds the create clause for the supplied 'attribute' to the receiver's listString.
  globPatternForShellPattern(self, pattern)
Transforms a shell pattern of a like/ilike qualifier to a shell pattern accepted by SQLite's GLOB statement.
  sqlStringForCaseInsensitiveLike(self, keyString, valueString)
Overrides the default implementation and returns the SQL string, to be inserted in a WHERE clause, for case-insensitive comparison between a lvalue and a rvalue.
  sqlStringForKeyValueQualifier(self, aQualifier)
Overrides the default behaviour to handle 'like' and 'ilike' correctly wrt the way sqlite works.
  sqlStringForSelector(self, selector, value)
Overrides the default behaviour to ensure that Qualifier operator 'LIKE' matches case-sensitively.
  valueTypeForExternalTypeMapping(self)
Extends the inherited method's result set and adds the SQL types: DATETIME, TEXT, NUMBER, DECIMAL, SMALLINT, REAL.
    Inherited from SQLExpression
  __init__(self, anEntity)
Initializer
  addBindVariableDictionary(self, binding)
  addInsertListAttribute(self, attribute, value)
Parameters:
  addJoinClause(self, leftName, rightName, semantic)
  addOrderByAttributeOrdering(self, sortOrdering)
  addSelectListAttribute(self, attribute)
Adds the sqlStringForAttributeNamed(attribute.name()) to the SQLExpression's listString().
  addUpdateListAttribute(self, attribute, value)
Uses appendItemToListString() to add to listString() a string formatted that way:
  aliasesByRelationshipPath(self)
Returns the dictionary of table aliases used by the SQLExpression ; the keys are relationshipPath and the values are the corresponding table aliases.
  allowsNullClauseForConstraint(self, flag)
Returns 'NOT NULL' is flag is false, '' (empty string) otherwise.
  appendItemToListString(self, itemString, aStringIO)
Appends 'itemString' to 'aStringIO' ; if aStringIO is not empty, a comma is appended to aStringIO before 'itemString'
  assembleDeleteStatementWithQualifier(self, aQualifier, tableList, whereClause)
Generates the SQL DELETE statement and assigns it to self's statement() The generated statement has the following format:
  assembleInsertStatementWithRow(self, row, tableList, columnList, valueList)
Generates the SQL INSERT statement and assigns it to self's statement() The generated statement has the following format:
  assembleSelectStatementWithAttributes(self, attributes, lock, qualifier, fetchOrder, selectString, columnList, tableList, whereClause, joinClause, orderByClause, lockClause)
  assembleUpdateStatementWithRow(self, row, aQualifier, tableList, updateList, whereClause)
Generates the SQL INSERT statement and assigns it to self's statement() The generated statement has the following format:
  bindVariableDictionaries(self)
  bindVariableDictionaryForAttribute(self, attribute, value)
  columnTypeStringForAttribute(self, attribute)
Returns the string corresponding to the attribute's column type definition when creating a table.
  entity(self)
Returns the Entity bound to that SQLExpression
  entityExternalNamesByAliases(self)
  externalNameQuoteCharacter(self)
Unimplemented
  formatSQLString(self, sqlString, format)
Unimplemented
  formatStringValue(self, string)
Unimplemented
  formatValueForAttribute(self, value, attribute)
Examines the attribute's externalType and forwards the request to the appropriate method.
  joinClauseString(self)
Unimplemented and unused: the joinClause is not used in this implementation of SQLExpression.
  joinExpression(self)
Unimplemented and not used: cf.
  listString(self)
Has a different meaning depending on what the SQLExpression was made for:
  lockClause(self)
  mustUseBindVariableForAttribute(self, attribute)
  orderByString(self)
  prepareConstraintStatementForRelationship(self, relationship, sourceColumns, destinationColumns)
  prepareDeleteExpressionForQualifier(self, aQualifier)
Prepares the internal state to generate a SQL delete statement, according to entity() and parameter 'aQualifier'.
  prepareInsertExpressionWithRow(self, row)
Generates an INSERT statement for the supplied 'row' and the SQLExpression's entity().
  prepareSelectCountExpressionWithAttributes(self, attributes, lock, fetchSpec)
Prepares a 'SELECT' statement from retrieving the number of rows corresponding to the request.
  prepareSelectExpressionWithAttributes(self, attributes, lock, fetchSpec)
Prepares a 'SELECT' statement.
  prepareUpdateExpressionWithRow(self, row, aQualifier)
Parameters:
  setStatement(self, statement)
Sets the object's SQL statement.
  setUseAliases(self, useAliases)
Tells the SQLExpression whether it should use table aliases.
  setUseBindVariables(self, flag)
Bind variables are not supported yet
  shouldUseBindVariableForAttribute(self, attribute)
Bind variables are not supported yet
  sqlEscapeChar(self)
  sqlPatternFromShellPattern(self, pattern)
Simply calls sqlPatternFromShellPatternWithEscapeCharacter() with 'escapeChar' equal to 'self.sqlEscapeChar()'
  sqlPatternFromShellPatternWithEscapeCharacter(self, pattern, escapeChar)
Transforms the shell 'pattern', using '*' and '?' as wildcards (the former matches 0 to many characters while the second matches one character) to an valid SQL pattern.
  sqlStringForAttribute(self, attribute)
Returns the attribute's columnName, prepended with the table alias for the empty string if the SQLExpression uses table aliases.
  sqlStringForAttributeNamed(self, name)
Returns the sql string for the attribute 'name'.
  sqlStringForAttributePath(self, path)
Given a path (see below), builds the corresponding sql string, completed with a table alias if the SQLExpression useAliases().
  sqlStringForConjoinedQualifiers(self, qualifiers)
Returns the SQL string, to be inserted in a WHERE clause, for the supplied ``to-be-conjoined'' qualifiers.
  sqlStringForData(self, data)
Not supported yet
  sqlStringForDate(self, aDate)
Formats the 'mxDateTime.DateTime' object 'aDate'.
  sqlStringForDisjoinedQualifiers(self, qualifiers)
Returns the SQL string, to be inserted in a WHERE clause, for the supplied ``to-be-disjoined'' qualifiers.
  sqlStringForInOperatorValue(self, aList, key)
Returns the SQL string suitable for operator IN and NOT IN.
  sqlStringForJoinSemantic(self, joinSemantic)
  sqlStringForKeyComparisonQualifier(self, aQualifier)
Returns the SQL string for the KeyComparisonQualifier supplied.
  sqlStringForNegatedQualifier(self, aQualifier)
Returns the SQL string for the supplied Qualifier
  sqlStringForNumber(self, aNumber, keyPath)
Formats 'aNumber' and returns the string suitable for inclusion in a SQL statement.
  sqlStringForQualifier(self, aQualifier)
Returns the SQL WHERE clause string built from 'aQualifier' ; NB: the generated statement does not include the 'WHERE' SQL keyword.
  sqlStringForSchemaObjectName(self, name)
Unimplemented
  sqlStringForString(self, aString)
Formats 'aString' and returns the string suitable for inclusion in a SQL statement.
  sqlStringForValue(self, value, keyPath)
Simply calls formatValueForAttribute() and return the formatted string
  statement(self)
Returns the statement assigned to this object.
  tableListWithRootEntity(self, anEntity)
  toString(self)
Simply returns self.statement()
  useAliases(self)
Returns whether the SQLExpression uses table aliases.
  useBindVariables(self)
Bind variables are not supported yet: return '0' (false)
  valueList(self)
This is set when prepareInsertExpressionWithRow() is called, and it holds the list of values to insert.
  valueTypeForExternalType(self, externalTypeName)
Returns the value type corresponding to 'externalTypeName'.
  whereClauseString(self)
Returns the WHERE clause string generated for a given SQL statement.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
    Inherited from SQLExpression
int SQL92_join = 1                                                                     

Method Details

addCreateClauseForAttribute(self, attribute)

Adds the create clause for the supplied 'attribute' to the receiver's listString. The default implementation appends a line of the following form:

<newline><COLUMN_NAME> <COLUMN_TYPE_STRING> <ALLOWS_NULL_CLAUSE>

where <COLUMN_NAME> is the attribute's columnName(), <COLUMN_TYPE_STRING> is 'columnTypeStringForAttribute(attribute)' and <ALLOWS_NULL_CLAUSE> is 'allowsNullClauseForConstraint(attribute.allowsNull())'.

See also:
appendItemToListString() listString() allowsNullClauseForConstraint() columnTypeStringForAttribute() SchemaGeneration.createTableStatementsForEntityGroup()
Overrides:
Modeling.SQLExpression.SQLExpression.addCreateClauseForAttribute

globPatternForShellPattern(self, pattern)

Transforms a shell pattern of a like/ilike qualifier to a shell pattern accepted by SQLite's GLOB statement.

There's little to be done, except that escaped characters '*' and '?' become, respectively, '[*]' and '[?]'

sqlStringForCaseInsensitiveLike(self, keyString, valueString)

Overrides the default implementation and returns the SQL string, to be inserted in a WHERE clause, for case-insensitive comparison between a lvalue and a rvalue. Note that sqlite LIKE sql operator is case-insensitive.

Returns the following string:

<keyString> LIKE <valueString>

Parameters:

keyString -- the left value

valueString -- the right value

See also: sqlStringForKeyValueQualifier(),
sqlStringForKeyComparisonQualifier()
Overrides:
Modeling.SQLExpression.SQLExpression.sqlStringForCaseInsensitiveLike

sqlStringForKeyValueQualifier(self, aQualifier)

Overrides the default behaviour to handle 'like' and 'ilike' correctly wrt the way sqlite works.

Returns:

  • the inherited SQLExpression.sqlStringForKeyValueQualifier() if aQualifier.operator() is not like or ilike,

  • if aQualifier.operator() is QualifierOperatorLike:

    <key> GLOB <globPatternForShellPattern(value)>

    for example, the qualifier 'title like "abc"' is turned into:

    title GLOB "abc"

  • if it is QualifierOperatorCaseInsensitiveLike, returns SQLExpression.sqlStringForKeyValueQualifier() with arguments keyString=<key> and valueString=self.sqlPatternFromShellPattern(<value>)

    For example, the qualifier 'title like "abc"' is turned into:

    title LIKE "%abc%"

Note: the LIKE operator is case-insensitive in sqlite, while GLOB is
case-sensitive
See also: SQLExpression.sqlStringForKeyValueQualifier()
globPatternForShellPattern()
Overrides:
Modeling.SQLExpression.SQLExpression.sqlStringForKeyValueQualifier

sqlStringForSelector(self, selector, value)

Overrides the default behaviour to ensure that Qualifier operator 'LIKE' matches case-sensitively.

Note: this is because the SQL LIKE operator is case-insensitive by default in mysql.

Returns:

  • if selector is Modeling.Qualifier.QualifierOperatorLike, returns "GLOB"
  • otherwise returns SQLExpression.sqlStringForSelector()
See also: SQLExpression.sqlStringForSelector()
sqlStringForKeyValueQualifier() globPatternForShellPattern()
Overrides:
Modeling.SQLExpression.SQLExpression.sqlStringForSelector

valueTypeForExternalTypeMapping(self)

Extends the inherited method's result set and adds the SQL types: DATETIME, TEXT, NUMBER, DECIMAL, SMALLINT, REAL.

See also: SQLExpression.valueTypeForExternalTypeMapping()

Overrides:
Modeling.SQLExpression.SQLExpression.valueTypeForExternalTypeMapping

Generated by Epydoc 2.1 on Sat Mar 4 13:36:27 2006 http://epydoc.sf.net