equal
deleted
inserted
replaced
|
1 |
|
2 |
|
3 API Python/RQL |
|
4 ~~~~~~~~~~~~~~ |
|
5 |
|
6 The Python API developped to interface with RQL is inspired from the standard db-api, |
|
7 with a Connection object having the methods cursor, rollback and commit essentially. |
|
8 The most important method is the `execute` method of a cursor : |
|
9 |
|
10 `execute(rqlstring, args=None, eid_key=None, build_descr=True)` |
|
11 |
|
12 :rqlstring: the RQL query to execute (unicode) |
|
13 :args: if the query contains substitutions, a dictionary containing the values to use |
|
14 :eid_key: |
|
15 an implementation detail of the RQL cache implies that if a substitution |
|
16 is used to introduce an eid *susceptible to raise the ambiguities in the query |
|
17 type resolution*, then we have to specify the corresponding key in the dictionary |
|
18 through this argument |
|
19 |
|
20 |
|
21 The `Connection` object owns the methods `commit` and `rollback`. You *should |
|
22 never need to use them* during the development of the web interface based on |
|
23 the `CubicWeb` framework as it determines the end of the transaction depending |
|
24 on the query execution success. |
|
25 |
|
26 .. note:: |
|
27 While executing update queries (SET, INSERT, DELETE), if a query generates |
|
28 an error related to security, a rollback is automatically done on the current |
|
29 transaction. |