author | Julien Jehannet <julien.jehannet@logilab.fr> |
Fri, 03 Dec 2010 13:09:14 +0100 | |
branch | stable |
changeset 6731 | 3ea1f7a6311c |
parent 6385 | 9f91d09ee5fa |
child 8717 | 0436c231ac48 |
permissions | -rw-r--r-- |
5307
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
1 |
.. _dbapi: |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
2 |
|
5311
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
3 |
Python/RQL API |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
4 |
~~~~~~~~~~~~~~ |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
5 |
|
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
6 |
The Python API developped to interface with RQL is inspired from the standard db-api, |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
7 |
with a Connection object having the methods cursor, rollback and commit essentially. |
5189
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
8 |
The most important method is the `execute` method of a cursor. |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
9 |
|
5189
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
10 |
.. sourcecode:: python |
5257
a31fbcfa8c3b
[doc/book] misc fixes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5190
diff
changeset
|
11 |
|
5400
b7ab099b128a
[doc/book] various content fixes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5394
diff
changeset
|
12 |
execute(rqlstring, args=None, build_descr=True) |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
13 |
|
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
14 |
:rqlstring: the RQL query to execute (unicode) |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
15 |
:args: if the query contains substitutions, a dictionary containing the values to use |
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
16 |
|
5189
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
17 |
The `Connection` object owns the methods `commit` and `rollback`. You |
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
18 |
*should never need to use them* during the development of the web |
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
19 |
interface based on the *CubicWeb* framework as it determines the end |
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
20 |
of the transaction depending on the query execution success. They are |
5307
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
21 |
however useful in other contexts such as tests or custom controllers. |
1714
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
22 |
|
a721966779be
new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff
changeset
|
23 |
.. note:: |
5311
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
24 |
|
6361
843684a50e48
[transaction] to avoid potential db corruption, we should rollback systematically in case of ValidationError
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5400
diff
changeset
|
25 |
If a query generates an error related to security (:exc:`Unauthorized`) or to |
6385
9f91d09ee5fa
[repo transaction] fix rollback behaviour as discussed on the mailing-list: instead of rollbacking automatically on Unauthorized/ValidationError, mark the transaction as uncommitable and disallow commiting
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6361
diff
changeset
|
26 |
integrity (:exc:`ValidationError`), the transaction can still continue but you |
9f91d09ee5fa
[repo transaction] fix rollback behaviour as discussed on the mailing-list: instead of rollbacking automatically on Unauthorized/ValidationError, mark the transaction as uncommitable and disallow commiting
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6361
diff
changeset
|
27 |
won't be able to commit it, a rollback will be necessary to start a new |
9f91d09ee5fa
[repo transaction] fix rollback behaviour as discussed on the mailing-list: instead of rollbacking automatically on Unauthorized/ValidationError, mark the transaction as uncommitable and disallow commiting
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6361
diff
changeset
|
28 |
transaction. |
6361
843684a50e48
[transaction] to avoid potential db corruption, we should rollback systematically in case of ValidationError
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5400
diff
changeset
|
29 |
|
6385
9f91d09ee5fa
[repo transaction] fix rollback behaviour as discussed on the mailing-list: instead of rollbacking automatically on Unauthorized/ValidationError, mark the transaction as uncommitable and disallow commiting
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6361
diff
changeset
|
30 |
Also, a rollback is automatically done if an error occurs during commit. |
6361
843684a50e48
[transaction] to avoid potential db corruption, we should rollback systematically in case of ValidationError
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5400
diff
changeset
|
31 |
|
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
32 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
33 |
Executing RQL queries from a view or a hook |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
34 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
5189
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
35 |
|
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
36 |
When you're within code of the web interface, the db-api like connexion is |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
37 |
handled by the request object. You should not have to access it directly, but |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
38 |
use the `execute` method directly available on the request, eg: |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
39 |
|
5400
b7ab099b128a
[doc/book] various content fixes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5394
diff
changeset
|
40 |
.. sourcecode:: python |
b7ab099b128a
[doc/book] various content fixes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5394
diff
changeset
|
41 |
|
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
42 |
rset = self._cw.execute(rqlstring, kwargs) |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
43 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
44 |
Similarly, on the server side (eg in hooks), there is no db-api connexion (since |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
45 |
you're directly inside the data-server), so you'll have to use the execute method |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
46 |
of the session object. |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
47 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
48 |
|
5400
b7ab099b128a
[doc/book] various content fixes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5394
diff
changeset
|
49 |
Proper usage of `.execute` |
b7ab099b128a
[doc/book] various content fixes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5394
diff
changeset
|
50 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
51 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
52 |
Let's say you want to get T which is in configuration C, this translates to: |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
53 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
54 |
.. sourcecode:: python |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
55 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
56 |
self._cw.execute('Any T WHERE T in_conf C, C eid %s' % entity.eid) |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
57 |
|
5189
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
58 |
But it must be written in a syntax that will benefit from the use |
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
59 |
of a cache on the RQL server side: |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
60 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
61 |
.. sourcecode:: python |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
62 |
|
5189
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
63 |
self._cw.execute('Any T WHERE T in_conf C, C eid %(x)s', {'x': entity.eid}) |
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
64 |
|
5189
84d4587a92bc
[doc/book] rql/dbapi cleanup, rip cachekey (prematurely ?)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4441
diff
changeset
|
65 |
The syntax tree is built once for the "generic" RQL and can be re-used |
5190
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
66 |
with a number of different eids. There rql IN operator is an exception |
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
67 |
to this rule. |
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
68 |
|
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
69 |
.. sourcecode:: python |
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
70 |
|
5307
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
71 |
self._cw.execute('Any T WHERE T in_conf C, C name IN (%s)' |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
72 |
% ','.join(['foo', 'bar'])) |
5190
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
73 |
|
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
74 |
Alternativelly, some of the common data related to an entity can be |
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
75 |
obtained from the `entity.related()` method (which is used under the |
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
76 |
hood by the orm when you use attribute access notation on an entity to |
73bdc50d6af1
[doc/book] dbapi: talk about IN exception, simplify
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5189
diff
changeset
|
77 |
get a relation. The initial request would then be translated to: |
4441
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
78 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
79 |
.. sourcecode:: python |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
80 |
|
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
81 |
entity.related('in_conf', 'object') |
550cf406dbc6
moved content to the dbapi section
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2175
diff
changeset
|
82 |
|
5307
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
83 |
Additionnaly this benefits from the fetch_attrs policy (see |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
84 |
:ref:`FetchAttrs`) eventually defined on the class element, which says |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
85 |
which attributes must be also loaded when the entity is loaded through |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
86 |
the orm. |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
87 |
|
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
88 |
|
5312
d2dbba898a96
[doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5311
diff
changeset
|
89 |
.. _resultset: |
d2dbba898a96
[doc/book] misc on views, docstrings
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5311
diff
changeset
|
90 |
|
5311
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
91 |
The `ResultSet` API |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
92 |
~~~~~~~~~~~~~~~~~~~ |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
93 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
94 |
ResultSet instances are a very commonly manipulated object. They have |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
95 |
a rich API as seen below, but we would like to highlight a bunch of |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
96 |
methods that are quite useful in day-to-day practice: |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
97 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
98 |
* `__str__()` (applied by `print`) gives a very useful overview of both |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
99 |
the underlying RQL expression and the data inside; unavoidable for |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
100 |
debugging purposes |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
101 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
102 |
* `printable_rql()` produces back a well formed RQL expression as a |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
103 |
string; it is very useful to build views |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
104 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
105 |
* `entities()` returns a generator on all entities of the result set |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
106 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
107 |
* `get_entity(row, col)` gets the entity at row, col coordinates; one |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
108 |
of the most used result set method |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
109 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
110 |
.. autoclass:: cubicweb.rset.ResultSet |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
111 |
:members: |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
112 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
113 |
|
5307
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
114 |
The `Cursor` API |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
115 |
~~~~~~~~~~~~~~~~ |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
116 |
|
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
117 |
The whole cursor API is developped below. |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
118 |
|
5400
b7ab099b128a
[doc/book] various content fixes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5394
diff
changeset
|
119 |
.. note:: |
5311
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
120 |
|
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
121 |
In practice we use the `.execute` method on the _cw object of |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
122 |
appobjects. Usage of other methods is quite rare. |
34dc38456376
[doc/book] talk a bit of the Result Set class
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5307
diff
changeset
|
123 |
|
5307
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
124 |
.. autoclass:: cubicweb.dbapi.Cursor |
228932b4f8c5
[doc/book] complete/fix the dbapi stuff, including cursor
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5257
diff
changeset
|
125 |
:members: |