Changeset: d5fb6e3e33d4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d5fb6e3e33d4
Added Files:
sql/test/Tests/unicode.sql
sql/test/Tests/unicode.stable.err
sql/test/Tests/unicode.stable.out
Modified Files:
clients/mapiclient/mclient.c
clients/odbc/samples/testgetinfo.c
sql/odbc/samples/Tests/All
sql/odbc/samples/Tests/odbcsample1.SQL.sh
sql/odbc/samples/Tests/testgetinfo.SQL.sh
sql/odbc/samples/Tests/testgetinfo.stable.out
sql/test/Tests/All
testing/Mtest.py.in
Branch: default
Log Message:
Merge with Apr2019 branch.
diffs (truncated from 1138 to 300 lines):
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -392,6 +392,14 @@ utf8strlenmax(char *s, char *e, size_t m
}
len++;
n = 0;
+ } else if (*s == '\t') {
+ assert(n == 0);
+ len++; /* rendered as single space */
+ n = 0;
+ } else if ((unsigned char) *s <= 0x1F || *s == '\177') {
+ assert(n == 0);
+ len += 4;
+ n = 0;
} else if ((*s & 0x80) == 0) {
assert(n == 0);
len++;
@@ -517,6 +525,9 @@ utf8strlenmax(char *s, char *e, size_t m
(0x20000 <= c && c <= 0x2FFFD) ||
(0x30000 <= c && c <= 0x3FFFD))
len++;
+ else if (0x0080 <= c && c <= 0x009F)
+ len += 5;
+
}
} else if ((*s & 0xE0) == 0xC0) {
assert(n == 0);
@@ -652,17 +663,6 @@ SQLrow(int *len, int *numeric, char **re
(int) (len[i] -
(ulen - utf8strlen(t, NULL))),
"");
- if (!numeric[i]) {
- /* replace tabs with a
- * single space to
- * avoid screwup the
- * width
- * calculations */
- for (s = rest[i]; *s != *t; s++)
- if (*s == '\t')
- *s = ' ';
- }
-
s = t;
if (trim == 1)
while (my_isspace(*s))
@@ -677,16 +677,38 @@ SQLrow(int *len, int *numeric, char **re
s++;
if (trim == 2 && *s == '\n')
s++;
- mnstr_printf(toConsole, "
%.*s...%*s",
- (int) (t -
rest[i]),
- rest[i],
+ mnstr_write(toConsole, " ", 1,
1);
+ for (char *p = rest[i]; p < t;
p++) {
+ if (*p == '\t')
+
mnstr_write(toConsole, " ", 1, 1);
+ else if ((unsigned
char) *p <= 0x1F || *p == '\177')
+
mnstr_printf(toConsole, "\\%03o", (unsigned char) *p);
+ else if (*p == '\302' &&
+ (p[1] & 0xE0)
== 0x80) {
+
mnstr_printf(toConsole, "\\u%04x", (p[1] & 0x3F) | 0x80);
+ p++;
+ } else
+
mnstr_write(toConsole, p, 1, 1);
+ }
+ mnstr_printf(toConsole,
"...%*s",
len[i] - 2 - (int)
utf8strlen(rest[i], t),
"");
croppedfields++;
} else {
- mnstr_printf(toConsole, " %.*s
",
- (int) (t -
rest[i]),
- rest[i]);
+ mnstr_write(toConsole, " ", 1,
1);
+ for (char *p = rest[i]; p < t;
p++) {
+ if (*p == '\t')
+
mnstr_write(toConsole, " ", 1, 1);
+ else if ((unsigned
char) *p <= 0x1F || *p == '\177')
+
mnstr_printf(toConsole, "\\%03o", (unsigned char) *p);
+ else if (*p == '\302' &&
+ (p[1] & 0xE0)
== 0x80) {
+
mnstr_printf(toConsole, "\\u%04x", (p[1] & 0x3F) | 0x80);
+ p++;
+ } else
+
mnstr_write(toConsole, p, 1, 1);
+ }
+ mnstr_write(toConsole, " ", 1,
1);
if (!numeric[i])
mnstr_printf(toConsole,
"%*s",
(int)
(len[i] - (ulen - utf8strlen(t, NULL))),
@@ -721,12 +743,20 @@ SQLrow(int *len, int *numeric, char **re
* avoid screwup the
* width
* calculations */
- for (p = rest[i]; *p != '\0';
p++)
+ mnstr_write(toConsole, " ", 1,
1);
+ for (p = rest[i]; *p; p++) {
if (*p == '\t')
- *p = ' ';
- mnstr_printf(toConsole, " %s ",
- rest[i]);
- mnstr_printf(toConsole, "%*s",
+
mnstr_write(toConsole, " ", 1, 1);
+ else if ((unsigned
char) *p <= 0x1F || *p == '\177')
+
mnstr_printf(toConsole, "\\%03o", (unsigned char) *p);
+ else if (*p == '\302' &&
+ (p[1] & 0xE0)
== 0x80) {
+
mnstr_printf(toConsole, "\\u%04x", (p[1] & 0x3F) | 0x80);
+ p++;
+ } else
+
mnstr_write(toConsole, p, 1, 1);
+ }
+ mnstr_printf(toConsole, " %*s",
(int) (len[i] -
ulen),
"");
}
diff --git a/clients/odbc/samples/testgetinfo.c
b/clients/odbc/samples/testgetinfo.c
--- a/clients/odbc/samples/testgetinfo.c
+++ b/clients/odbc/samples/testgetinfo.c
@@ -79,7 +79,7 @@ main(int argc, char **argv)
char *user = "monetdb";
char *pass = "monetdb";
SQLRETURN ret;
- char str[128];
+ char str[2048];
SQLSMALLINT resultlen;
SQLUSMALLINT si;
SQLUINTEGER i;
@@ -123,35 +123,35 @@ main(int argc, char **argv)
ret = SQLGetInfo(dbc, SQL_AGGREGATE_FUNCTIONS, &i, sizeof(i),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_AGGREGATE_FUNCTIONS: %u\n", (unsigned int) i);
+ printf("SQL_AGGREGATE_FUNCTIONS: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_ALTER_DOMAIN, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_ALTER_DOMAIN: %u\n", (unsigned int) i);
+ printf("SQL_ALTER_DOMAIN: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_ALTER_TABLE, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_ALTER_TABLE: %u\n", (unsigned int) i);
+ printf("SQL_ALTER_TABLE: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_ASYNC_MODE, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_ASYNC_MODE: %u\n", (unsigned int) i);
+ printf("SQL_ASYNC_MODE: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_BATCH_ROW_COUNT, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_BATCH_ROW_COUNT: %u\n", (unsigned int) i);
+ printf("SQL_BATCH_ROW_COUNT: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_BATCH_SUPPORT, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_BATCH_SUPPORT: %u\n", (unsigned int) i);
+ printf("SQL_BATCH_SUPPORT: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_BOOKMARK_PERSISTENCE, &i, sizeof(i),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_BOOKMARK_PERSISTENCE: %u\n", (unsigned int) i);
+ printf("SQL_BOOKMARK_PERSISTENCE: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CATALOG_LOCATION, &si, sizeof(si),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CATALOG_LOCATION: %u\n", (unsigned int) si);
+ printf("SQL_CATALOG_LOCATION: 0x%x\n", (unsigned int) si);
ret = SQLGetInfo(dbc, SQL_CATALOG_NAME_SEPARATOR, str, sizeof(str),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
@@ -167,7 +167,7 @@ main(int argc, char **argv)
ret = SQLGetInfo(dbc, SQL_CATALOG_USAGE, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CATALOG_USAGE: %u\n", (unsigned int) i);
+ printf("SQL_CATALOG_USAGE: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_COLLATION_SEQ, str, sizeof(str), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
@@ -179,127 +179,127 @@ main(int argc, char **argv)
ret = SQLGetInfo(dbc, SQL_CONCAT_NULL_BEHAVIOR, &si, sizeof(si),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONCAT_NULL_BEHAVIOR: %u\n", (unsigned int) si);
+ printf("SQL_CONCAT_NULL_BEHAVIOR: 0x%x\n", (unsigned int) si);
ret = SQLGetInfo(dbc, SQL_CONVERT_BIGINT, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_BIGINT: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_BIGINT: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_BINARY, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_BINARY: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_BINARY: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_BIT, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_BIT: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_BIT: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_CHAR, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_CHAR: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_CHAR: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_DATE, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_DATE: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_DATE: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_DECIMAL, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_DECIMAL: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_DECIMAL: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_DOUBLE, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_DOUBLE: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_DOUBLE: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_FLOAT, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_FLOAT: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_FLOAT: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_FUNCTIONS, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_FUNCTIONS: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_FUNCTIONS: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_INTEGER, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_INTEGER: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_INTEGER: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_INTERVAL_DAY_TIME, &i, sizeof(i),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_INTERVAL_DAY_TIME: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_INTERVAL_DAY_TIME: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_INTERVAL_YEAR_MONTH, &i, sizeof(i),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_INTERVAL_YEAR_MONTH: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_INTERVAL_YEAR_MONTH: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_LONGVARBINARY, &i, sizeof(i),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_LONGVARBINARY: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_LONGVARBINARY: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_LONGVARCHAR, &i, sizeof(i),
&resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_LONGVARCHAR: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_LONGVARCHAR: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_NUMERIC, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_NUMERIC: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_NUMERIC: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_REAL, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_REAL: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_REAL: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_SMALLINT, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_SMALLINT: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_SMALLINT: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_TIME, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_TIME: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_TIME: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_TIMESTAMP, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_TIMESTAMP: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_TIMESTAMP: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_TINYINT, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_TINYINT: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_TINYINT: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_VARBINARY, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_VARBINARY: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_VARBINARY: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CONVERT_VARCHAR, &i, sizeof(i), &resultlen);
check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
- printf("SQL_CONVERT_VARCHAR: %u\n", (unsigned int) i);
+ printf("SQL_CONVERT_VARCHAR: 0x%x\n", (unsigned int) i);
ret = SQLGetInfo(dbc, SQL_CORRELATION_NAME, &si, sizeof(si),
&resultlen);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list