|
16 | 16 |
|
17 | 17 | Measures are taken to make the database connections thread-affine. |
18 | 18 | This means the same thread always uses the same cached connection, |
19 | | -and no other thread will use it. So even if the underlying DB-API module |
| 19 | +and no other thread will use it. So even if the underlying DB-API module |
20 | 20 | is not thread-safe at the connection level this will be no problem here. |
21 | 21 |
|
22 | 22 | For best performance, the application server should keep threads persistent. |
|
56 | 56 |
|
57 | 57 | The creator function or the connect function of the DB-API 2 compliant |
58 | 58 | database module specified as the creator will receive any additional |
59 | | - parameters such as the host, database, user, password etc. You may |
| 59 | + parameters such as the host, database, user, password etc. You may |
60 | 60 | choose some or all of these parameters in your own creator function, |
61 | 61 | allowing for sophisticated failover and load-balancing mechanisms. |
62 | 62 |
|
63 | 63 | For instance, if you are using pgdb as your DB-API 2 database module and want |
64 | 64 | every connection to your local database 'mydb' to be reused 1000 times: |
65 | 65 |
|
66 | | - import pgdb # import used DB-API 2 module |
| 66 | + import pgdb # import used DB-API 2 module |
67 | 67 | from DBUtils.PersistentDB import PersistentDB |
68 | 68 | persist = PersistentDB(pgdb, 1000, database='mydb') |
69 | 69 |
|
|
73 | 73 | db = persist.connection() |
74 | 74 |
|
75 | 75 | You can use these connections just as if they were ordinary |
76 | | -DB-API 2 connections. Actually what you get is the hardened |
| 76 | +DB-API 2 connections. Actually what you get is the hardened |
77 | 77 | SteadyDB version of the underlying DB-API 2 connection. |
78 | 78 |
|
79 | 79 | Closing a persistent connection with db.close() will be silently |
80 | 80 | ignored since it would be reopened at the next usage anyway and |
81 | | -contrary to the intent of having persistent connections. Instead, |
| 81 | +contrary to the intent of having persistent connections. Instead, |
82 | 82 | the connection will be automatically closed when the thread dies. |
83 | 83 | You can change this behavior be setting the closeable parameter. |
84 | 84 |
|
85 | 85 | Note that you need to explicitly start transactions by calling the |
86 | | -begin() method. This ensures that the transparent reopening will be |
| 86 | +begin() method. This ensures that the transparent reopening will be |
87 | 87 | suspended until the end of the transaction, and that the connection |
88 | 88 | will be rolled back before being reused by the same thread. |
89 | 89 |
|
@@ -199,7 +199,7 @@ def connection(self, shareable=False): |
199 | 199 | """Get a steady, persistent DB-API 2 connection. |
200 | 200 |
|
201 | 201 | The shareable parameter exists only for compatibility with the |
202 | | - PooledDB connection method. In reality, persistent connections |
| 202 | + PooledDB connection method. In reality, persistent connections |
203 | 203 | are of course never shared with other threads. |
204 | 204 |
|
205 | 205 | """ |
|
0 commit comments