Skip to content

Commit 1771acd

Browse files
committed
refs qorelanguage/qore#4710 automatically detect and set character encodings when the driver does not convert encodings for us
1 parent f107902 commit 1771acd

File tree

8 files changed

+306
-208
lines changed

8 files changed

+306
-208
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test-ubuntu:
2121
image: $CI_REGISTRY/infrastructure/qore-test-base/qore-test-base:develop
2222
script:
2323
- |
24+
printf "[rippy]\n host = rippy\n port = 1433\n tds version = 7.4" > /etc/freetds/freetds.conf
2425
if test/docker_test/test-ubuntu.sh; then
2526
curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \
2627
-X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \
@@ -38,6 +39,7 @@ test-alpine:
3839
image: $CI_REGISTRY/infrastructure/qore-test-base/qore-test-base:develop-alpine
3940
script:
4041
- |
42+
printf "[rippy]\n host = rippy\n port = 1433\n tds version = 7.4" > /etc/freetds.conf
4143
if test/docker_test/test-alpine.sh; then
4244
curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \
4345
-X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Process this file with autoconf to produce a configure script.
22

33
# AC_PREREQ(2.59)
4-
AC_INIT([qore-sybase-modules], [1.1],
4+
AC_INIT([qore-sybase-modules], [1.2],
55
[David Nichols <david@qore.org>],
66
[qore-sybase-modules])
77
AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2 tar-ustar])

docs/mainpage.dox.tmpl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,15 @@ exec get_values :string output, :int output");
252252
version of this driver should offer an alternative Datasource method allowing explicit stored procedure execution
253253
through ct-lib RPC functions, which will allow output parameters to be returned.\n\n
254254
There are other issues with data types, character encoding, and more when using this driver; please see
255-
http://www.freetds.org for more information.
255+
http://www.freetds.org for more information
256256

257257
@section sybasereleasenotes Release Notes
258258

259+
@subsection sybase_1_2 sybase Driver Version 1.2
260+
- detect and automatically set the server character encoding for MS SQL server connections to ensure that strings
261+
with invalid encodings are never sent to or retrieved from the server
262+
(<a href="https://github.com/qorelanguage/qore/issues/4710">issue 4710</a>)
263+
259264
@subsection sybase_1_1 sybase Driver Version 1.1
260265
- fixed a bug handliing \c DATETIME2 column data
261266
(<a href="https://github.com/qorelanguage/qore/issues/4401">issue 4401</a>)

src/command.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,16 +468,16 @@ QoreValue command::readOutput(connection& conn, command& cmd, bool list, bool& c
468468
}
469469

470470
int command::retr_colinfo(ExceptionSink* xsink) {
471-
unsigned columns = get_column_count(xsink);
472-
if (*xsink)
473-
return -1;
471+
unsigned columns = get_column_count(xsink);
472+
if (*xsink)
473+
return -1;
474474

475-
colinfo.reset();
476-
get_row_description(colinfo.datafmt, columns, xsink);
477-
setup_output_buffers(colinfo.datafmt, xsink);
478-
colinfo.dirty = false;
475+
colinfo.reset();
476+
get_row_description(colinfo.datafmt, columns, xsink);
477+
setup_output_buffers(colinfo.datafmt, xsink);
478+
colinfo.dirty = false;
479479

480-
return 0;
480+
return 0;
481481
}
482482

483483
void command::setupColumns(QoreHashNode& h, const Placeholders *ph) {
@@ -598,14 +598,15 @@ int command::get_row_description(row_result_t &result, unsigned column_count, Ex
598598

599599
CS_RETCODE err = ct_describe(m_cmd, i + 1, &datafmt);
600600
if (err != CS_SUCCEED) {
601-
m_conn.do_exception(xsink, "TDS-EXEC-ERROR", "ct_describe() failed with error %d", (int)err);
601+
m_conn.do_exception(xsink, "TDS-EXEC-ERROR", "ct_describe() failed with error %d on column %u / %u",
602+
(int)err, i + 1, column_count);
602603
return -1;
603604
}
604605
datafmt.count = 1; // fetch just single row per every ct_fetch()
605606
bool is_multi_byte = m_conn.getEncoding()->isMultiByte();
606607

607-
printd(5, "command::get_row_description(): name=%s type=%d usertype=%d\n",
608-
datafmt.name, datafmt.datatype, datafmt.usertype);
608+
printd(5, "command::get_row_description(): name: %s type: %d usertype: %d\n",
609+
datafmt.name, datafmt.datatype, datafmt.usertype);
609610

610611
datafmt.origin_datatype = datafmt.datatype;
611612
switch (datafmt.datatype) {

0 commit comments

Comments
 (0)