vsql-python 1.2.2__tar.gz → 1.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vsql_python-1.2.2 → vsql_python-1.2.3}/PKG-INFO +1 -1
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_convert.py +7 -2
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_libvsql.c +6 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/PKG-INFO +1 -1
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/scm_version.json +2 -2
- {vsql_python-1.2.2 → vsql_python-1.2.3}/tests/test_vsql.py +1 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/.github/workflows/release.yml +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/.github/workflows/test.yml +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/.gitignore +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/LICENSE +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/MANIFEST.in +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/README.md +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/example/main.py +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/LICENSE +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/LICENSE-V +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/libvsql.c +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/internal/amalgamation/libvsql.h +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/libvsql_flags.json +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/pyproject.toml +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/scripts/update-amalgamation.sh +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/setup.cfg +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/setup.py +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/__init__.py +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_connection.py +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql/_errors.py +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/SOURCES.txt +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/dependency_links.txt +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/scm_file_list.json +0 -0
- {vsql_python-1.2.2 → vsql_python-1.2.3}/src/vsql_python.egg-info/top_level.txt +0 -0
|
@@ -108,8 +108,13 @@ def to_param(value):
|
|
|
108
108
|
return (lib.SQL_DOUBLE, lib.SQL_DOUBLE, 0, 0, value)
|
|
109
109
|
|
|
110
110
|
if isinstance(value, str):
|
|
111
|
-
# A CHARACTER VARYING as long as the string (which can't be 0).
|
|
112
|
-
|
|
111
|
+
# A CHARACTER VARYING as long as the string (which can't be 0). A lone
|
|
112
|
+
# surrogate (such as from surrogateescape) can't be UTF-8.
|
|
113
|
+
try:
|
|
114
|
+
encoded = value.encode()
|
|
115
|
+
except UnicodeEncodeError as e:
|
|
116
|
+
raise DataError(f"{value!r} isn't valid Unicode: {e.reason}") from None
|
|
117
|
+
return (lib.SQL_CHAR, lib.SQL_VARCHAR, max(len(value), 1), 0, encoded)
|
|
113
118
|
|
|
114
119
|
if isinstance(value, decimal.Decimal):
|
|
115
120
|
if not value.is_finite():
|
|
@@ -607,6 +607,12 @@ static PyObject *get_string(SQLINTEGER stmt, SQLSMALLINT n) {
|
|
|
607
607
|
|
|
608
608
|
PyObject *s = PyUnicode_DecodeUTF8(buf, (Py_ssize_t)(length + ind), NULL);
|
|
609
609
|
PyMem_Free(large);
|
|
610
|
+
// vsql's strings are always UTF-8, but it should still be a DataError
|
|
611
|
+
// rather than a UnicodeDecodeError if one isn't.
|
|
612
|
+
if (s == NULL && PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) {
|
|
613
|
+
PyErr_Clear();
|
|
614
|
+
raise_error("22021", "character not in repertoire: the value isn't UTF-8", -1);
|
|
615
|
+
}
|
|
610
616
|
return s;
|
|
611
617
|
}
|
|
612
618
|
}
|
|
@@ -245,6 +245,7 @@ def test_parameters_in_where(conn):
|
|
|
245
245
|
([vsql.YearMonthInterval(1)], vsql.ProgrammingError, "07006"),
|
|
246
246
|
([object()], vsql.ProgrammingError, "unsupported type"),
|
|
247
247
|
([decimal.Decimal("NaN")], vsql.DataError, "finite"),
|
|
248
|
+
(["\ud800"], vsql.DataError, "parameter 1: .* isn't valid Unicode"),
|
|
248
249
|
([], vsql.ProgrammingError, "dynamic parameter"),
|
|
249
250
|
],
|
|
250
251
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|