@@ -1078,6 +1078,8 @@ msgid ""
10781078"disconnect occurs, the data source name is not found, a transaction could "
10791079"not be processed, etc. It is a subclass of :exc:`DatabaseError`."
10801080msgstr ""
1081+ "与数据库操作相关而不一定能受程序员掌控的错误引发的异常,例如发生非预期的连接中断,数据源名称未找到,事务无法被执行等。 它是 "
1082+ ":exc:`DatabaseError` 的子类。"
10811083
10821084#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:849
10831085msgid ""
@@ -1086,6 +1088,8 @@ msgid ""
10861088"method on a connection that does not support transaction or has transactions"
10871089" turned off. It is a subclass of :exc:`DatabaseError`."
10881090msgstr ""
1091+ "在使用了某个数据库不支持的方法或数据库 API 时引发的异常,例如在一个不支持事务或禁用了事务的连接上调用 "
1092+ ":meth:`~Connection.rollback` 方法等。 它是 :exc:`DatabaseError` 的子类。"
10891093
10901094#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:858
10911095msgid "SQLite and Python types"
@@ -1180,10 +1184,12 @@ msgid ""
11801184"adaptation, and you can let the :mod:`sqlite3` module convert SQLite types "
11811185"to different Python types via converters."
11821186msgstr ""
1187+ ":mod:`sqlite3` 模块的类型系统可通过两种方式来扩展:你可以通过对象适配将额外的 Python 类型保存在 SQLite "
1188+ "数据库中,你也可以让 :mod:`sqlite3` 模块通过转换器将 SQLite 类型转换为不同的 Python 类型。"
11831189
11841190#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:908
11851191msgid "Using adapters to store additional Python types in SQLite databases"
1186- msgstr ""
1192+ msgstr "使用适配器将额外的 Python 类型保存在 SQLite 数据库中。 "
11871193
11881194#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:910
11891195msgid ""
@@ -1192,22 +1198,24 @@ msgid ""
11921198" sqlite3 module's supported types for SQLite: one of NoneType, int, float, "
11931199"str, bytes."
11941200msgstr ""
1201+ "如上文所述,SQLite 只包含对有限类型集的原生支持。 要让 SQLite 能使用其他 Python 类型,你必须将它们 **适配** 至 "
1202+ "sqlite3 模块所支持的 SQLite 类型中的一种:NoneType, int, float, str, bytes。"
11951203
11961204#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:915
11971205msgid ""
11981206"There are two ways to enable the :mod:`sqlite3` module to adapt a custom "
11991207"Python type to one of the supported ones."
1200- msgstr ""
1208+ msgstr "有两种方式能让 :mod:`sqlite3` 模块将某个定制的 Python 类型适配为受支持的类型。 "
12011209
12021210#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:920
12031211msgid "Letting your object adapt itself"
1204- msgstr "让对象自行调整 "
1212+ msgstr "让对象自行适配 "
12051213
12061214#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:922
12071215msgid ""
12081216"This is a good approach if you write the class yourself. Let's suppose you "
12091217"have a class like this::"
1210- msgstr "如果自己编写类,这是一种很好的方法。假设有这样的类:: "
1218+ msgstr "如果类是你自己编写的,这将是一个很好的方式。 假设你有这样一个类:: "
12111219
12121220#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:929
12131221msgid ""
@@ -1218,6 +1226,9 @@ msgid ""
12181226"protocol)`` which must return the converted value. The parameter *protocol* "
12191227"will be :class:`PrepareProtocol`."
12201228msgstr ""
1229+ "现在你想将这种点对象保存在一个 SQLite 列中。 首先你必须选择一种受支持的类型用来表示点对象。 让我们就用 str 并使用一个分号来分隔坐标值。 "
1230+ "然后你需要给你的类加一个方法 ``__conform__(self, protocol)``,它必须返回转换后的值。 形参 *protocol* 将为 "
1231+ ":class:`PrepareProtocol`。"
12211232
12221233#: /home/travis/build/python/cpython-doc-catalog/Doc/library/sqlite3.rst:939
12231234msgid "Registering an adapter callable"
0 commit comments