Skip to content

Commit

Permalink
Merge pull request #63 from qorelanguage/bugfix/4710_char_encoding_fix
Browse files Browse the repository at this point in the history
refs qorelanguage/qore#4710 automatically detect and set character en…
  • Loading branch information
davidnich authored Apr 9, 2023
2 parents f107902 + 1771acd commit 5725802
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 208 deletions.
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test-ubuntu:
image: $CI_REGISTRY/infrastructure/qore-test-base/qore-test-base:develop
script:
- |
printf "[rippy]\n host = rippy\n port = 1433\n tds version = 7.4" > /etc/freetds/freetds.conf
if test/docker_test/test-ubuntu.sh; then
curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \
-X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \
Expand All @@ -38,6 +39,7 @@ test-alpine:
image: $CI_REGISTRY/infrastructure/qore-test-base/qore-test-base:develop-alpine
script:
- |
printf "[rippy]\n host = rippy\n port = 1433\n tds version = 7.4" > /etc/freetds.conf
if test/docker_test/test-alpine.sh; then
curl "https://api.github.com/repos/qorelanguage/${REPO_NAME}/statuses/${CI_COMMIT_SHA}" \
-X POST -u omusil24:${GITHUB_ACCESS_TOKEN} -H "Content-Type: application/json" \
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.

# AC_PREREQ(2.59)
AC_INIT([qore-sybase-modules], [1.1],
AC_INIT([qore-sybase-modules], [1.2],
[David Nichols <[email protected]>],
[qore-sybase-modules])
AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2 tar-ustar])
Expand Down
7 changes: 6 additions & 1 deletion docs/mainpage.dox.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,15 @@ exec get_values :string output, :int output");
version of this driver should offer an alternative Datasource method allowing explicit stored procedure execution
through ct-lib RPC functions, which will allow output parameters to be returned.\n\n
There are other issues with data types, character encoding, and more when using this driver; please see
http://www.freetds.org for more information.
http://www.freetds.org for more information

@section sybasereleasenotes Release Notes

@subsection sybase_1_2 sybase Driver Version 1.2
- detect and automatically set the server character encoding for MS SQL server connections to ensure that strings
with invalid encodings are never sent to or retrieved from the server
(<a href="https://github.com/qorelanguage/qore/issues/4710">issue 4710</a>)

@subsection sybase_1_1 sybase Driver Version 1.1
- fixed a bug handliing \c DATETIME2 column data
(<a href="https://github.com/qorelanguage/qore/issues/4401">issue 4401</a>)
Expand Down
23 changes: 12 additions & 11 deletions src/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,16 +468,16 @@ QoreValue command::readOutput(connection& conn, command& cmd, bool list, bool& c
}

int command::retr_colinfo(ExceptionSink* xsink) {
unsigned columns = get_column_count(xsink);
if (*xsink)
return -1;
unsigned columns = get_column_count(xsink);
if (*xsink)
return -1;

colinfo.reset();
get_row_description(colinfo.datafmt, columns, xsink);
setup_output_buffers(colinfo.datafmt, xsink);
colinfo.dirty = false;
colinfo.reset();
get_row_description(colinfo.datafmt, columns, xsink);
setup_output_buffers(colinfo.datafmt, xsink);
colinfo.dirty = false;

return 0;
return 0;
}

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

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

printd(5, "command::get_row_description(): name=%s type=%d usertype=%d\n",
datafmt.name, datafmt.datatype, datafmt.usertype);
printd(5, "command::get_row_description(): name: %s type: %d usertype: %d\n",
datafmt.name, datafmt.datatype, datafmt.usertype);

datafmt.origin_datatype = datafmt.datatype;
switch (datafmt.datatype) {
Expand Down
Loading

0 comments on commit 5725802

Please sign in to comment.