Last page update: November 23, 2011
Main classes:
Other classes:
- SqlCompiledQuery
- SqlDataResolver
- SqlQueryCompiler
- SqlRecord
- SqlRecordBag
- SqlRelatedRecordResolver
- SqlRelatedSelectionResolver
Complete reference:
SqlCompiledQuery is a private class used by the SqlQueryCompiler class. It is used to store all parameters needed to compile a query string.
TODO
TODO
TODO
TODO
The SqlQuery class represents the way in which data can be extracted from a db. You can get data with these SqlQuery methods:
The __init__ method passes:
| Parameters: |
|
|---|
Return the compiledQuery() method.
| Parameters: | count – boolean. If True, optimize the sql query to get the number of resulting rows (like count(*)) |
|---|
Return rowcount. It does not save a selection
Get a cursor of the current selection.
Get a cursor of the current selection and fetch it
Return the fetch() as a Bag of the given key
| Parameters: | key – the key you give (if None, it takes the pkey). |
|---|
Return the fetch() as a dict that has as a key the parameter key you gave (or the pkey if you don’t specify any key) and as value the record you get from the query.
| Parameters: |
|
|---|
Return the fetch() as a dict of the given key
| Parameters: |
|
|---|
TODO
| Parameters: | arraysize – TODO |
|---|
Execute the query and return a SqlSelection
| Parameters: |
|
|---|
Get a cursor on dbserver
Get fetch of the servercursor() method.
| Parameters: | arraysize – TODO |
|---|
SqlQueryCompiler is a private class used by SqlQuery and SqlRecord to build an SqlCompiledQuery instance.
The __init__ method passes:
| Parameters: |
|
|---|
Prepare the SqlCompiledQuery to get the sql query for a selection.
| Parameters: |
|
|---|
Prepare the SqlCompiledQuery class to get the sql query for a selection.
| Parameters: |
|
|---|
Internal method: return a list of columns from a fake column starting with *
| Parameters: |
|
|---|
TODO
| Parameters: | m – TODO |
|---|
Internal method: returns the alias (t1, t2...) for the join table of the current relation. If the relation is traversed for the first time, it builds the join clause. Here case_insensitive relations and joinConditions are addressed.
| Parameters: |
|
|---|
Internal method. Translate fields path and related fields path in a valid sql string for the column.
It translates @relname.@rel2name.colname to t4.colname.
It has nothing to do with the AS operator, nor the name of the output columns.
It automatically adds the join tables as needed.
It can be recursive to resolve virtualColumns.
| Parameters: |
|
|---|
Internal method: get optional condition for a join clause from the joinConditions dict.
A joinCondition is a dict containing:
| Parameters: |
|
|---|
TODO
| Parameters: |
|
|---|
Internal method: search for columns or related columns in a string, add found columns to the relationDict (reldict) and replace related columns (@rel.colname) with a symbolic name like $_rel_colname. Return a string containing only columns expressed in the form $colname, so the found relations can be converted in sql strings (see getFieldAlias() method) and replaced into the returned string with templateReplace (see compiledQuery()).
| Parameters: |
|
|---|
TODO
TODO
TODO
| Parameters: |
|
|---|
TODO
TODO
TODO
| Parameters: |
|
|---|
TODO
TODO
| Parameters: | mode – TODO |
|---|
TODO
TODO
TODO
TODO
TODO
TODO
It is the resulting data from the execution of an istance of the SqlQuery. Through the SqlSelection you can get data into differents modes: you can use the output() method or you can freeze() it into a file. You can also use the sort() and the filter() methods on a SqlSelection.
Warning
deprecated since version 0.7
TODO
| Parameters: | cb – TODO |
|---|
TODO
| Parameters: |
|
|---|
TODO
| Parameters: |
|
|---|
TODO
TODO
| Parameters: |
|
|---|
TODO
| Parameters: | filterCb – TODO. |
|---|
TODO
| Parameters: |
|
|---|
TODO
TODO
| Parameters: | k – TODO |
|---|
TODO
| Parameters: |
|
|---|
Return the outsource
| Parameters: | outsource – TODO |
|---|
A generator function that returns a dict of the outsource’s rows.
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: | outsource – TODO |
|---|
Add a new row and return it
| Parameters: | values – TODO |
|---|
TODO
| Parameters: |
|
|---|
TODO
| Parameters: |
|
|---|
Return the number of rows in the outsource.
| Parameters: | outsource – TODO |
|---|
Return a list of the outsource’s rows.
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: |
|
|---|
Return the outsource
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: |
|
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: | outsource – TODO |
|---|
Return the outsource.
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: |
|
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: |
|
|---|
TODO
| Parameters: | outsource – TODO |
|---|
TODO
| Parameters: |
|
|---|
Return a Bag
| Parameters: | outsource – TODO |
|---|
Return the selection into differents format
| Parameters: |
|
|---|
TODO
| Parameters: | cb – TODO |
|---|
Internal method. Set the data of a SqlQuery in a dict
| Parameters: | key – the key. |
|---|
TODO
TODO
| Parameters: |
|
|---|
TODO
| Parameters: |
|
|---|
TODO
| Parameters: | path – TODO. |
|---|
TODO
| Parameters: |
|
|---|