From d290e8a81d64776067792544633b66af05301b0d Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 18 Jun 2024 08:52:52 +0000 Subject: [PATCH 01/94] Updated version to 7.2.14-dev to mark the start of a new development cycle --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e03f6c411b..3db70d8393 100644 --- a/configure.ac +++ b/configure.ac @@ -30,8 +30,8 @@ AC_PREREQ(2.59) m4_define(vos_major, [7]) m4_define(vos_minor, [2]) -m4_define(vos_patch, [13]) -m4_define(vos_devel, []) +m4_define(vos_patch, [14]) +m4_define(vos_devel, [-dev]) AC_INIT([Virtuoso Open Source Edition (Column Store)], vos_major.vos_minor.vos_patch[]vos_devel, From c3b8d520e2c28bca2af21026283d4a28af980e8e Mon Sep 17 00:00:00 2001 From: Ted Thibodeau Jr Date: Tue, 18 Jun 2024 09:05:04 +0000 Subject: [PATCH 02/94] Fixed NEWS.md --- NEWS.md | 158 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/NEWS.md b/NEWS.md index d0dee9f008..cbc13106b1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,25 +2,25 @@ ## June 10, 2024, v7.2.13: * Virtuoso Engine - - Added safe logical_* bif names - - Fixed issues with clang 15 and newer compilers + - Added safe `logical_*` bif names + - Fixed issues with `clang` 15 and newer compilers - Fixed issues reported by link time optimizer (LTO) - Fixed 'Read/Write wait on column page...' should be debug messages - Fixed various missing BIF functions argument checks - Fixed issue with cube/rollup - - Fixed issue with bad date/time artithmetics + - Fixed issue with bad date/time arithmetics - Fixed issue getting client status during swapping or www maintenance - Fixed issue collecting freetext stats during checkpoint - Fixed issue on rehash if `dict_put` is used in select list - - Fixed issue with MaxMemPoolSize + - Fixed issue with `MaxMemPoolSize` - Fixed put MD5 context on connection global (fixes #1287) - - Fixed issue with hash in group by (fixes #1285) + - Fixed issue with hash in `group by` (fixes #1285) - Fixed missing sz check (fixes #1283) - - Fixed length calculation in REPEAT (fixes #1282) + - Fixed length calculation in `REPEAT` (fixes #1282) - Fixed offset overflow (fixes #1281) - Fixed issue trying to normalize an invalid numeric (fixes #1279) - Fixed unfolded bifs have to have serial to distinguish separate calls (fixes #1276) - - Fixed 64bit arith overflow (fixes #1270) + - Fixed 64-bit arith overflow (fixes #1270) - Fixed missing check for star (fixes #1269) - Fixed set dc type on grouping sets (Fixed #1268) - Fixed check num cols in union branches when subq non-terminal is used (fixes #1267) @@ -32,7 +32,7 @@ - Fixed memcopy buffer overflow (fixes #1259) - Fixed missing stack overflow check (fixes #1258) - Fixed alloc double dep on demand as as int (fixes #1257) - - Fixed vec input should be declared as boxed i.e. array (fixes #1254) + - Fixed vec input should be declared as boxed, i.e., array (fixes #1254) - Fixed ambiguous subq return (fixes #1253) - Fixed issue with non-string copy (fixes #1252) - Fixed missing check for const in predicate (fixed #1251) @@ -40,9 +40,9 @@ - Fixed issue on any ssl w/h nulls (fixes #1249) - Fixed issue with bad index op ref in table dft (fixes #1245) - Fixed small issues with `sql_to_c.awk` script (fixes #1244) - - Fixed issue with join and order by on null result (fixes #1241) + - Fixed issue with `join` and `order by` on null result (fixes #1241) - Fixed issue freeing n-way nic arrays - - Fixed issue building Windows binaries + - Fixed issue building Windows binaries - Fixed memory leak * SPARQL @@ -68,7 +68,7 @@ - Fixed missing check for optional table - Fixed issue when initialization of snapshot fails - Fixed issue with wrong vad file path during vad install - - Fixed save CORs via WS wizard duplicate cors options + - Fixed save CORS via WS wizard duplicate cors options - Fixed preserve qualifier when updating trigger - Fixed missing condition for sponger settings - Fixed constrain site-name field to non-space characters only @@ -82,91 +82,91 @@ * Virtuoso Engine - Added JSON-LD parser mode for handling blank nodes - - Added serialization support for missing datatypes in obj2json + - Added serialization support for missing datatypes in `obj2json` - Added statistics and setting to limit mem pool for chash - Added support for dumping `XML` and `varbinary` data in JSON - Added support for fetching `attributes` and `attributes_info` on user defined types - Added `create user .. with password` and `identified by` syntax - - Added uptime, virtual memory size, and page faults to status() output + - Added uptime, virtual memory size, and page faults to `status()` output - Updated CSV functionality - - Fixed NaN behaviour in cmp_double same as ordering (fixes #1213) - - Fixed check constraint cannot use CONTAINS text predicate (fixes #1177) + - Fixed NaN behaviour in `cmp_double` same as ordering (fixes #1213) + - Fixed check constraint cannot use `CONTAINS` text predicate (fixes #1177) - Fixed check for date/time/datetime/timestamp datatypes (fixes #1206) - Fixed check for table def (fixes #1212) - Fixed check if prev has a key (fixes #1216) - Fixed check number of arguments to geo contains (fixes #1209) - Fixed check values before copying invalid data (fixes #1208) - - Fixed get argument before place gets mangled when serializing ANY (fixes #1174) - - Fixed issue getting lock information for status() + - Fixed get argument before place gets mangled when serializing `ANY` (fixes #1174) + - Fixed issue getting lock information for `status()` - Fixed issue mixing numeric and int boxes in expression (fixes #1194, #1198) - Fixed issue mixing vectored and non vectored ops (fixes #1184) - - Fixed issue on cube/rollup with constant in select list (fixes #1195, #1197) - - Fixed issue right outer join with constant false (fixes #1214) + - Fixed issue on cube/rollup with constant in `select` list (fixes #1195, #1197) + - Fixed issue `right outer join` with constant false (fixes #1214) - Fixed issue skipping sort node on outer as hash join may put right side at top - Fixed issue when hash source is not available (fixes #1193) - - Fixed issue with TOP 1 on a cursor - - Fixed issue with TOP not working when DISTINCT is used (fixes #1158) + - Fixed issue with `TOP 1` on a cursor + - Fixed issue with `TOP` not working when `DISTINCT` is used (fixes #1158) - Fixed issue with all const in group (fixes #1204) - Fixed issue with bad index op ref in table dft (fixes #1190, #1191) - - Fixed issue with freetext index; missing check if term is mergable + - Fixed issue with freetext index; missing check if term is mergeable - Fixed issue with function inside control expression - Fixed issue with missing cast on return type (fixes #1172) - Fixed issue with outer hash build (fixes #1185) - - Fixed issue with outer hash join with GROUP BY via hash source - - Fixed issue with printf style functions not using explicit format string (fixes #1199) + - Fixed issue with outer hash join with `GROUP BY` via hash source + - Fixed issue with `printf` style functions not using explicit format string (fixes #1199) - Fixed issue with scalar subq (fixes #1183) - - Fixed issue with select (select ... union ...) or similar expressions + - Fixed issue with `select (select ... union ...)` or similar expressions - Fixed issue with setting type before col assign function (fixes #1178) - Fixed issue with sql fragment that has div operation - - Fixed issue with status for non dba user + - Fixed issue with status for non `dba` user - Fixed issue with user aggregates - Fixed issue with with dfe true/false shortcuts (fixes #1196) - - Fixed issues in orderby/groupby (fixes #1210) + - Fixed issues in `ORDER BY` and `GROUP BY` (fixes #1210) - Fixed issues with unix timestamp - - Fixed missing argument check to ORDER BY and GROUP BY (fixed #1182) + - Fixed missing argument check to `ORDER BY` and `GROUP BY` (fixed #1182) - Fixed missing check for freetext field (fixes #1220) - - Fixed obj2json and obj2xml should be public functions + - Fixed `obj2json` and `obj2xml` should be public functions - Fixed remove duplicate keys in oby/gby (fixes #1205) - - Fixed sprintf format for windows (fixes #1203) + - Fixed `sprintf` format for windows (fixes #1203) * SPARQL - - Added support for GRAPH decorations in TriG (fixes #1169) + - Added support for `GRAPH` decorations in TriG (fixes #1169) - Fixed issue in ontology generation - Fixed issue with drop quad map graph - Fixed issue with restriction on number of deleted triples (fixes #1164) - Fixed issue with turtle/n-triples media type legacy and recent spec. compatibility (fixes #1187) - - Fixed issue with very long sparql queries + - Fixed issue with very long SPARQL queries - Fixed issues with `Default Graph IRI` from table `SYS_SPARQL_HOSTS` (fixes #1086) - - Fixed `virtrdf:Geometry` should be replaced with wktLiteral (fixes #806) + - Fixed `virtrdf:Geometry` should be replaced with `wktLiteral` (fixes #806) * Web Server and DAV - - Added HTTP CORs pattern support + - Added HTTP CORS pattern support - Added support to avoid redundant check for 401 handlers - Added support for Azure Storage Account as a DET mounting option - - Added support for Access-Control-Allow-Methods different than Allow, for AJAX CORs + - Added support for Access-Control-Allow-Methods different than Allow, for AJAX CORS - Added `security_realm` to access realm from VD - Added support for ping/pong for websock - Added support for binary frames in websocket - Fixed FS directory browsing does not need SQL/VSP user account - Fixed HTTP 101/204/304 responses MUST not return content - - Fixed LDP sparql queries delete/insert should search physical graph only + - Fixed LDP SPARQL queries `delete`/`insert` should search physical graph only - Fixed check DET HTTP status code - Fixed check for missing graph - - Fixed clear http method at session cleanup - - Fixed do not use gzip if no content is allowed - - Fixed http log records partial request over 4k + - Fixed clear HTTP method at session cleanup + - Fixed do not use `gzip` if no content is allowed + - Fixed HTTP log records partial request over 4k - Fixed issue checking `is_https` on websocket - Fixed issue getting dtp in rdf box case - Fixed issue when ODS is not installed - - Fixed issue when response is chunked/gzip by app + - Fixed issue when response is chunked/gzipped by app - Fixed issue with `DAV_LINK` double escape UTF-8 - - Fixed issue with bad Accept header + - Fixed issue with bad `Accept` header - Fixed issue with double free - Fixed issue with updating permissions on wiki - Fixed issues with encoding of DAV URLs - Fixed websocket error message indicating what frame type is - Fixed websocket framing on text messages - - Fixed missing entry for .md text/markdown + - Fixed missing entry for `.md` text/markdown * Faceted Browser - Fixed grants must be added to `SPARQL_SELECT` role @@ -184,7 +184,7 @@ * R2RML - Added quap map iri parameter - - Fixed rr:template by default is IRI unless column, dt or lang are given + - Fixed `rr:template` by default is IRI unless column, dt, or lang is given - Fixed complete table name before quoting - Fixed case to ucase for case insensitive lookup - Fixed issue with column CaSeMoDe @@ -197,20 +197,20 @@ * Virtuoso Engine - Added log info on manual enable/disable scheduler and checkpoint intervals - - Added sprintf format %[xx]s for registry settings - - Added CPU% and RSS usage to status() output - - Added BIF jsonld_ctx_to_dict - - Added input state in explain output where missing - - Fixed issue with SPARQL UUID() function (fixes #515) - - Fixed missing grant from SPARQL_UPDATE role (fixes #1152) - - Fixed issue with DROP TABLE/VIEW not checking target + - Added sprintf format `%[xx]s` for registry settings + - Added CPU% and RSS usage to `status()` output + - Added BIF `jsonld_ctx_to_dict` + - Added input state in `explain` output where missing + - Fixed issue with SPARQL `UUID()` function (fixes #515) + - Fixed missing grant from `SPARQL_UPDATE` role (fixes #1152) + - Fixed issue with `DROP TABLE/VIEW` not checking target - Fixed issue when copying constants in union - Fixed several issues in json parser - - Fixed issue with get_keyword with soap options vector + - Fixed issue with `get_keyword` with soap options vector - Fixed issue with chash on many threads - Fixed issue with lang matches - Fixed issue loading graphql plugin with musl C library - - Fixed do not replace trx log prefix with CHECKPOINT command + - Fixed do not replace trx log prefix with `CHECKPOINT` command - Fixed small typos in documentation and error messages * SPARQL @@ -219,16 +219,16 @@ - Fixed issue with heterogeneous data column leading to range assert - Fixed issue reusing boxes - Fixed RDF quad sanity check for 'O' column - - Fixed entities in /sparql UI for maximum X(HT)ML compatibility + - Fixed entities in `/sparql` UI for maximum X(HT)ML compatibility * Web Server and DAV - - Added option http_options_no_exec for http virtual path - - Added support for Content-Security-Policy header - - Added optional base url to http_xslt function as 3rd parameter - - Fixed issues mixing valid and invalid MIME types in Accept header - - Fixed issue writing log on delete/put/patch etc + - Added option `http_options_no_exec` for http virtual path + - Added support for `Content-Security-Policy` header + - Added optional base url to `http_xslt` function as 3rd parameter + - Fixed issues mixing valid and invalid MIME types in `Accept` header + - Fixed issue writing log on `delete`, `put`, `patch`, etc. - Fixed missing entry for JSON-LD in RDF DET - - Fixed issue with missing href in PROPPATCH response + - Fixed issue with missing href in `PROPPATCH` response - Fixed issue with base64 decode and trailing zeroes - Fixed issue with dead http session @@ -242,52 +242,52 @@ * Virtuoso Engine - Added checkpoint to end of online backup - - Added support for IF EXISTS and IF NOT EXISTS in ALTER TABLE - - Added support for DROP TYPE .... IF EXISTS - - Added support for bulkloading .jsonld and .jsonld.gz files + - Added support for `IF EXISTS` and `IF NOT EXISTS` in `ALTER TABLE` + - Added support for `DROP TYPE .... IF EXISTS` + - Added support for bulkloading `.jsonld` and `.jsonld.gz` files - Added new testsuite entries for recent fixes - Fixed missing escape of identifiers in log replay - Fixed issue if original dfe not there; see error in optimizer - Fixed issue with transaction mutex inside checkpoint - - Fixed obj2json output should be canonical + - Fixed `obj2json` output should be canonical - Fixed issue in short-circuit evaluation (fixes #777) - Fixed compare only up to cha key parts (fixes #1117) - Fixed missing arguments in table def (fixes #1118) - Fixed expand column list during parsing (fixes #1119) - Fixed missing check for max number of key parts (fixes #1120) - Fixed missing reuse check for dv bin (fixes #1121) - - Fixed 64bit arith exception (fixes #1122) - - Fixed 64bit arith overflow (fixes #1123) - - Fixed do not change col_dtp if already set before (fixes #1124) + - Fixed 64-bit arith exception (fixes #1122) + - Fixed 64-bit arith overflow (fixes #1123) + - Fixed do not change `col_dtp` if already set before (fixes #1124) - Fixed save/restore temp refs (fixes #1127) - - Fixed issue using case/when inside arg simple functions like min/max/count fixes #1128) + - Fixed issue using `case`/`when` inside arg simple functions like `min`/`max`/`count` fixes #1128) - Fixed handling of aliases in output (fixes #1129) - Fixed cannot add non-null column to existing data (fixes #1130) - Fixed check number of values vs cols when inserting into view (fixes #1134) - - Fixed missing check for table in positioned delete (fixes #1135) + - Fixed missing check for table in positioned `delete` (fixes #1135) - Fixed non-terminal in union branch is not supported (fixes #1136) - Fixed missing check if column exists (fixes #1137) - - Fixed missing check for non-terminals in WITH DATA (fixes #1138) - - Fixed wrap unions etc. if non-select for EXISTS ( subq ) (fixes #1139) - - Fixed first argument of CONTAINS() cannot be star (fixes #1140) + - Fixed missing check for non-terminals in `WITH DATA` (fixes #1138) + - Fixed wrap unions, etc., if non-select for `EXISTS` ( subq ) (fixes #1139) + - Fixed first argument of `CONTAINS()` cannot be star (`*`) (fixes #1140) - Fixed missing variable declaration (fixes #1148) - Fixed small memory leaks * SPARQL - Backported duration and interval fixes to v7 engine (fixes #1147) - Added N-QUADS support for SPARQL CRUD using REST (fixes #1142) - - Added option to limit number of triples in a SPARQL CONSTRUCT query + - Added option to limit number of triples in a SPARQL `CONSTRUCT` query - Fixed issue deleting strings with language tag (Fixes #1055) - - Fixed IRI patterns for SPARQL LOAD SERVICE (fixes #879) + - Fixed IRI patterns for SPARQL `LOAD SERVICE` (fixes #879) - Fixed issues with Turtle 1.1 parser (fixes #1059) - Fixed rdf_regex is set to work with UTF-8 by default (fixes #705) - - Fixed suppress errors on loading even for wktLiterals, just like dates/integer types etc. + - Fixed suppress errors on loading even for `wktLiterals`, just like `dates`, integer types, etc. - Fixed small SPARQL UI issues * Web Server and DAV - - Added function to return the current HTTP status code 20x/30x/40x etc. or NULL if not set + - Added function to return the current HTTP status code `20x`, `30x`, `40x`, etc., or `NULL` if not set - Fixed HTTPS accept timeout - - Fixed issue with client_protocol mode + - Fixed issue with `client_protocol` mode - Fixed issue with TCN - Fixed issues with SOAP endpoint @@ -295,7 +295,7 @@ - Added support for showing custom datatypes (fixes #963) - Fixed issues truncating lists using '>>more>>' - Fixed show language when available - - Fixed issue generating labels in urilbl_ac_init_db + - Fixed issue generating labels in `urilbl_ac_init_db` - Fixed file permissions in VAD packages * Conductor @@ -315,7 +315,7 @@ posts, plus enhancements to the existing * Virtuoso Engine - Added new JSON-LD parser - - Added IRI validation bif: functions + - Added IRI validation `bif:` functions - Added `GIT SHA1` signature to status and log output - Added current value of backup prefix to status report - Added option for soft `CHECKPOINT`, i.e., only perform a `CHECKPOINT` when the server is in idle state @@ -341,7 +341,7 @@ posts, plus enhancements to the existing - Fixed issue with explicit datatype of literal class; must cast value to a string - Fixed issue with label insert when using `with_delete` - Fixed issue with literals that have both `LANG` & `TYPE` - - Fixed issue with load get:accept pragma + - Fixed issue with load `get:accept` pragma - Fixed issue with permissions; users with `SPARQL_SELECT` role can now use REST interface - Fixed issue with serialization when `datatype` is missing, or `lang` is an empty string - Fixed issue with unnamed result from view From 06ac26454d060339de4fab69a8ef3e27a4abc946 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Tue, 18 Jun 2024 13:06:54 +0000 Subject: [PATCH 03/94] Fixed issue with lenght calculation in rdf_encode_for_uri() --- libsrc/Wi/sqlbif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/Wi/sqlbif.c b/libsrc/Wi/sqlbif.c index 73fc65cc42..ae76f7618f 100644 --- a/libsrc/Wi/sqlbif.c +++ b/libsrc/Wi/sqlbif.c @@ -16664,7 +16664,7 @@ bif_rdf_encode_for_uri_impl (caddr_t * qst, caddr_t * err_ret, state_slot_t ** a case DV_LONG_WIDE: { ses = strses_allocate (); - dks_esc_write (ses, str, box_length (str) - 1, CHARSET_UTF8, CHARSET_WIDE, DKS_ESC_URI); + dks_esc_write (ses, str, box_length (str) - sizeof (wchar_t), CHARSET_UTF8, CHARSET_WIDE, DKS_ESC_URI); } break; default: From c7f420a8dc6b1a437a1ef9a37f44ca8192f9786c Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Tue, 18 Jun 2024 13:09:37 +0000 Subject: [PATCH 04/94] Fixed issue calling concat(wide, utf8) (fixes 944) A missing check for box_flags caused the result to be a broken wide string. --- libsrc/Wi/sqlbif.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/libsrc/Wi/sqlbif.c b/libsrc/Wi/sqlbif.c index ae76f7618f..5657965cc0 100644 --- a/libsrc/Wi/sqlbif.c +++ b/libsrc/Wi/sqlbif.c @@ -3390,6 +3390,7 @@ bif_trim (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) return res; } +#define DV_STRING_MAYBE_UTF8(a) (BF_UTF8 == box_flags(a) || BF_IRI == box_flags(a)) /* Modified by AK 29-OCT-1997 to skip all NULL arguments (i.e. the result being exactly like they were empty strings "") */ @@ -3402,7 +3403,7 @@ bif_concat (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) caddr_t *cast_args = NULL; int alen; caddr_t a; - int len = 0, fill = 0; + int len = 0, wlen = 0, fill = 0; caddr_t res; int haveWides = 0, haveWeirds = 0; dtp_t dtp1; @@ -3419,11 +3420,27 @@ bif_concat (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) case DV_STRING: case DV_UNAME: len += box_length (a) - 1; + if (DV_STRING_MAYBE_UTF8 (a)) /* the IRIs may be UTF-8 so we try */ + { + size_t wide_len = wide_char_length_of_utf8_string (a, box_length (a) - 1); + if (wide_len >= 0) + wlen += wide_len; + else /* in case utf8 is not a proper sequence, then gigo, we set flag here and do not try converting below */ + { + if (NULL == cast_args) + cast_args = dk_alloc_list_zero (n_args); + cast_args[inx] = box_num (1); + wlen += box_length (a) - 1; + } + } + else + wlen += box_length (a) - 1; break; case DV_WIDE: case DV_LONG_WIDE: haveWides = 1; len += box_length (a) / sizeof (wchar_t) - 1; + wlen += box_length (a) / sizeof (wchar_t) - 1; break; default: if (NULL == cast_args) @@ -3456,24 +3473,27 @@ bif_concat (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) sprintf (buf, BOXINT_FMT, unbox (a)); cast_args[inx] = box_dv_short_string (buf); len += box_length (cast_args[inx]) - 1; + wlen += box_length (cast_args[inx]) - 1; break; } /* no break */ default: { char save = qi->qi_no_cast_error; - qi->qi_no_cast_error = 0; /* concat may get vector as input, this is not a cast to be done w/o error here */ + qi->qi_no_cast_error = 0; /* concat may get vector as input, this is not a cast to be done w/o error here */ QR_RESET_CTX { if (haveWides) { cast_args[inx] = box_cast (qst, a, st_nvarchar, dtp1); len += box_length (cast_args[inx]) / sizeof (wchar_t) - 1; + wlen += box_length (cast_args[inx]) / sizeof (wchar_t) - 1; } else { cast_args[inx] = box_cast (qst, a, st_varchar, dtp1); len += box_length (cast_args[inx]) - 1; + wlen += box_length (cast_args[inx]) - 1; } } QR_RESET_CODE @@ -3495,6 +3515,8 @@ bif_concat (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) } } sizeof_char = haveWides ? sizeof (wchar_t) : sizeof (char); + if (haveWides) + len = wlen; if (((len + 1) * sizeof_char) > 10000000) { /*dk_free_box ((caddr_t)orig_args); */ @@ -3506,7 +3528,7 @@ bif_concat (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) { /*dk_free_box ((caddr_t)orig_args); */ dk_free_tree ((caddr_t) cast_args); - qi_signal_if_trx_error (qi); + qi_signal_if_trx_error (qi); } for (inx = 0; inx < n_args; inx++) { @@ -3521,7 +3543,10 @@ bif_concat (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) if (haveWides) { alen = box_length (a) - 1; - box_narrow_string_as_wide ((unsigned char *) a, res + fill * sizeof_char, alen, QST_CHARSET (qst), err_ret, 1); + if (DV_STRING_MAYBE_UTF8 (a) && (!cast_args || !cast_args[inx])) + alen = (size_t) box_utf8_as_wide_char (a, res + fill * sizeof_char, alen, len - fill); + else + box_narrow_string_as_wide ((unsigned char *) a, res + fill * sizeof_char, alen, QST_CHARSET (qst), err_ret, 1); break; } /* no break */ From 7f6d02db8373519f462644fa2d52b41a2e3265c4 Mon Sep 17 00:00:00 2001 From: Ivan Mikhailov Date: Thu, 20 Jun 2024 18:29:17 +0300 Subject: [PATCH 05/94] Added support for (a relatively small amount of) blank nodes in SPARQL INSERT DATA Fixes #126 --- libsrc/Wi/rdfbox.c | 9 ++++---- libsrc/Wi/sparql.h | 14 ++++++++++-- libsrc/Wi/sparql_core.c | 30 ++++++++++++++++++++------ libsrc/Wi/sparql_p.y | 22 ++++++------------- libsrc/Wi/sparul2sql.c | 47 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 29 deletions(-) diff --git a/libsrc/Wi/rdfbox.c b/libsrc/Wi/rdfbox.c index 7a5835c614..b852a9d843 100644 --- a/libsrc/Wi/rdfbox.c +++ b/libsrc/Wi/rdfbox.c @@ -2793,7 +2793,7 @@ iri_cast_and_split_ttl_qname_impl (query_instance_t *qi, caddr_t iri, caddr_t *n if (min_named_bnode_iri_id () > iid) { ns_prefix_ret[0] = uname___empty; - local_ret[0] = BNODE_IID_TO_TTL_LABEL_LOCAL (iid); + local_ret[0] = BNODE_IID_TO_LABEL_LOCAL (iid); is_bnode_ret[0] = 1; return 1; } @@ -2891,7 +2891,7 @@ iri_cast_rdfxml_qname (query_instance_t *qi, caddr_t iri, caddr_t *uri_ret, ptrl { if (min_named_bnode_iri_id () > iid) { - uri_ret[0] = BNODE_IID_TO_TTL_LABEL_LOCAL (iid); + uri_ret[0] = BNODE_IID_TO_LABEL_LOCAL (iid); is_bnode_ret[0] = 1; dk_free_box (old_uri_ret); return 1; @@ -2920,9 +2920,10 @@ iri_cast_nt_absname (query_instance_t *qi, caddr_t iri, caddr_t *iri_ret, ptrlon /* 0123456789 */ if ((iri_boxlen > 9) && !memcmp (iri, "nodeID://", 9)) { - iri_ret[0] = box_dv_short_nchars (iri + (9-2), iri_boxlen - (9-2)); + iri_ret[0] = box_dv_short_nchars (iri + (9-3), iri_boxlen - (9-3)); iri_ret[0][0] = '_'; iri_ret[0][1] = ':'; + iri_ret[0][2] = 'v'; is_bnode_ret[0] = 1; return 1; } @@ -3201,7 +3202,7 @@ ttl_http_write_ref (dk_session_t *ses, ttl_env_t *env, ttl_iriref_t *ti) sqlr_new_error ("22023", "SR645", "Turtle serialization of RDF data has got NULL instead of an URI"); if (ti->is_bnode) { - session_buffered_write (ses, "_:", 2); + session_buffered_write (ses, "_:v", 3); session_buffered_write (ses, loc, strlen (loc)); return; } diff --git a/libsrc/Wi/sparql.h b/libsrc/Wi/sparql.h index 75f04f3997..40c308163c 100644 --- a/libsrc/Wi/sparql.h +++ b/libsrc/Wi/sparql.h @@ -173,6 +173,16 @@ extern void sparp_debug_weird (struct sparp_s *sparp, const char *file, int line #define SPARP_PU_IN_READ 2 #define SPARP_PU_BGP 3 +#define SPARP_PRECODE_NO_LOCAL_VARS 0x01 /*!< Parser reads a precode expression that can not contain non-global variables */ +#define SPARP_PRECODE_NO_GLOBAL_VARS 0x02 /*!< Parser reads a precode expression that can not contain global variables */ +#define SPARP_PRECODE_NO_BNODES 0x04 /*!< Parser reads a precode expression that can not contain blank nodes */ +#define SPARP_PRECODE_NO_AGGREGATES 0x08 /*!< Parser reads a precode expression that can not contain aggreages */ +#define SPARP_PRECODE_NO_FN_CONTEXT 0x10 /*!< Parser reads a precode expression that can not contain content-dependant functions (only BMD_IS_PURE are OK) */ +#define SPARP_PRECODE_NO_BACKQUOTES 0x20 /*!< Parser reads a constructor context that does not permit generic backquotes */ +#define SPARP_PRECODE_SQL_BEGIN_ONLY (SPARP_PRECODE_NO_LOCAL_VARS | SPARP_PRECODE_NO_BNODES | SPARP_PRECODE_NO_AGGREGATES) +#define SPARP_PRECODE_CTOR_DATA_ONLY (SPARP_PRECODE_NO_LOCAL_VARS | SPARP_PRECODE_NO_GLOBAL_VARS | SPARP_PRECODE_NO_AGGREGATES | SPARP_PRECODE_NO_FN_CONTEXT | SPARP_PRECODE_NO_BACKQUOTES) +#define SPARP_PRECODE_PURE_ONLY (SPARP_PRECODE_NO_LOCAL_VARS | SPARP_PRECODE_NO_GLOBAL_VARS | SPARP_PRECODE_NO_BNODES | SPARP_PRECODE_NO_AGGREGATES | SPARP_PRECODE_NO_FN_CONTEXT) + struct spar_sqlgen_s; struct spar_tree_s; @@ -374,7 +384,6 @@ typedef struct sparp_e4qm_s { dk_set_t e4qm_deleted; /*!< Backstack of deleted JS objects, class IRI pushed first, instance IRI pushed after so it's above) */ } sparp_e4qm_t; - typedef struct sparp_s { /* Generic environment */ spar_query_env_t *sparp_sparqre; /*!< External environment of the query */ @@ -401,7 +410,7 @@ typedef struct sparp_s { int sparp_total_lexems_parsed; spar_lexem_t *sparp_curr_lexem; spar_lexbmk_t sparp_curr_lexem_bmk; - int sparp_in_precode_expn; /*!< If nonzero (usually 1) then the parser reads precode-safe expression so it can not contain non-global variables, if bit 2 is set then even global variables are prohibited (like it is in INSERT DATA statement) */ + int sparp_in_precode_expn; /*!< This bitmask is non-zero when the parser reads precode-safe expressions and the like. Otherwise it is combination of SPARP_PRECODE_xxx bits */ int sparp_in_ctor_from_where; /*!< If nonzero then the parser reads WHERE clause of CONSTRUCT WHERE or DELETE WHERE statement */ int sparp_allow_aggregates_in_expn; /*!< The parser reads result-set expressions, GROUP BY, ORDER BY, or HAVING. Each bit is responsible for one level of nesting. */ int sparp_scalar_subq_count; /*!< Counter of scalar subqueries. It's primary purpose is to track whether BIND expression contain scalar subqueries and hence is non-repeatable. */ @@ -1011,6 +1020,7 @@ extern void spar_compose_retvals_of_delete_from_wm (sparp_t *sparp, SPART *tree, extern int spar_optimize_delete_of_single_triple_pattern (sparp_t *sparp, SPART *top); extern void spar_optimize_retvals_of_insert_or_delete (sparp_t *sparp, SPART *top); extern void spar_optimize_retvals_of_modify (sparp_t *sparp, SPART *top); +extern SPART *spar_make_insertdata_or_deletedata (sparp_t *sparp, ptrlong subtype, SPART *dflt_g, SPART *ctor); extern SPART **spar_retvals_of_describe (sparp_t *sparp, SPART *req_top, SPART **retvals, SPART *limit, SPART *offset); extern void spar_add_rgc_vars_and_consts_from_retvals (sparp_t *sparp, SPART **retvals); extern SPART *spar_make_wm (sparp_t *sparp, SPART *pattern, SPART **groupings, SPART *having, SPART **order, SPART *limit, SPART *offset, SPART *binv); diff --git a/libsrc/Wi/sparql_core.c b/libsrc/Wi/sparql_core.c index 207260233f..66f79f225a 100644 --- a/libsrc/Wi/sparql_core.c +++ b/libsrc/Wi/sparql_core.c @@ -4139,21 +4139,20 @@ spar_make_variable (sparp_t *sparp, caddr_t name) #endif if (is_global) { + if (sparp->sparp_in_precode_expn & SPARP_PRECODE_NO_GLOBAL_VARS) + spar_error (sparp, "Global variable '%.100s' is not allowed in a constant clause", name); t_set_push_new_string (&(sparp->sparp_env->spare_global_var_names), name); } - if (sparp->sparp_in_precode_expn) + else { - if (2 & sparp->sparp_in_precode_expn) - spar_error (sparp, "Variable '%.100s' is not allowed in a constant clause", name); - else if (!is_global) + if (sparp->sparp_in_precode_expn & SPARP_PRECODE_NO_LOCAL_VARS) spar_error (sparp, "non-global variable '%.100s' can not be used outside any group pattern or result-set list", name); } if (is_global) /* say, 'insert in graph ?:someglobalvariable {...} where {...} */ selid = t_box_dv_uname_string ("(global)"); else if (SPART_VARNAME_IS_SPECIAL(name)) /* say, '@"limofs"."describe-1"' */ selid = t_box_dv_uname_string ("(special)"); - /*!!! TBD finda replacement for - else + /*!!! TBD find a replacement for spar_internal_error (sparp, "non-global variable outside any group pattern or result-set list"); */ else selid = NULL; @@ -4175,7 +4174,7 @@ spar_make_macropu (sparp_t *sparp, caddr_t name, ptrlong pos) SPART *spar_make_blank_node (sparp_t *sparp, caddr_t name, int bracketed) { SPART *res; - if ((sparp->sparp_in_precode_expn) && !(bracketed & 0x2)) + if ((sparp->sparp_in_precode_expn & SPARP_PRECODE_NO_BNODES) && !(bracketed & 0x2)) spar_error (sparp, "Blank node '%.100s' is not allowed in a constant clause", name); /*if (NULL == env->spare_selids) spar_error (sparp, "Blank nodes (e.g., '%.100s') can not be used outside any group pattern or result-set list", name);*/ @@ -5379,6 +5378,23 @@ spar_make_topmost_sparul_sql (sparp_t *sparp, SPART **actions) SPART **action_sqls; caddr_t volatile err = NULL; int action_ctr, action_count = BOX_ELEMENTS (actions); +/* INSERT DATA can be converted to a pair of INSERT DATA (w/o blank nodes) and INSERT (with blank nodes), then it's stored in list of actions as a SPAR_LIST with 2 items */ + for (action_ctr = action_count; action_ctr--; /* no step */) + { + SPART *actn = actions [action_ctr]; + if (SPAR_LIST == SPART_TYPE (actn)) + { + int lst_len = BOX_ELEMENTS (actn->_.list.items); + if (0 == lst_len) + actions = (SPART **)t_list_remove_nth ((caddr_t)actions, action_ctr); + else + { + actions = (SPART **)t_list_insert_many_before_nth ((caddr_t)actions, (caddr_t *)(actn->_.list.items + 1), lst_len - 1, action_ctr + 1); + actions[action_ctr] = actn->_.list.items[0]; + } + action_count = BOX_ELEMENTS (actions); + } + } if ((1 == action_count) && unbox (spar_compose_report_flag (sparp))) return actions[0]; /* No need to make grouping around single action. */ /* First of all, every tree for every action is compiled into string literal containing SQL text. */ diff --git a/libsrc/Wi/sparql_p.y b/libsrc/Wi/sparql_p.y index 9a254de839..d4aab0add1 100644 --- a/libsrc/Wi/sparql_p.y +++ b/libsrc/Wi/sparql_p.y @@ -999,7 +999,7 @@ spar_sponge_option_commalist /* ::= SpongeOption ( ',' SpongeOption )* */ ; spar_precode_expn /* [Virt] PrecodeExpn ::= Expn (* Only global variables can occur in Expn, local can not *) */ - : { sparp_arg->sparp_in_precode_expn = 1; } + : { sparp_arg->sparp_in_precode_expn = SPARP_PRECODE_SQL_BEGIN_ONLY; } spar_expn %prec PRECODE_EXPN_PREC { sparp_arg->sparp_in_precode_expn = 0; $$ = $2; } ; @@ -2201,7 +2201,7 @@ spar_expn /* [43] Expn ::= ConditionalOrExpn ( 'AS' ( VAR1 | VAR2 ) ) */ sparp_arg->sparp_allow_aggregates_in_expn >>= 1; } | spar_ret_agg_call { $$ = $1; - if (sparp_arg->sparp_in_precode_expn) + if (sparp_arg->sparp_in_precode_expn & SPARP_PRECODE_NO_AGGREGATES) sparyyerror (sparp_arg, "Aggregates are not allowed in 'precode' expressions that should be calculated before the result-set of the query"); if (!(sparp_arg->sparp_allow_aggregates_in_expn & 1)) sparyyerror (sparp_arg, "Aggregates are allowed only in result sets"); } @@ -2542,15 +2542,10 @@ spar_sparul_insertdata /* [DML]* InsertDataAction ::= */ /*... ConstructTemplate */ : INSERT_L DATA_L spar_in_graph_precode_opt _LBRA { t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); - sparp_arg->sparp_in_precode_expn = 2; } + sparp_arg->sparp_in_precode_expn = SPARP_PRECODE_CTOR_DATA_ONLY; } spar_ctor_template_nolbra { - SPART *fake = spar_make_fake_action_solution (sparp_arg); - SPART *dflt_g = $3; - if ((NULL == dflt_g) && spar_ctor_uses_default_graph ($6)) - dflt_g = spar_default_sparul_target (sparp_arg, "triple in INSERT DATA {...} without GRAPH {...}", 0); sparp_arg->sparp_in_precode_expn = 0; - $$ = spar_make_top_or_special_case_from_wm (sparp_arg, SPARUL_INSERT_DATA, NULL, fake ); - spar_compose_retvals_of_insert_or_delete (sparp_arg, $$, dflt_g, $6); } + $$ = spar_make_insertdata_or_deletedata (sparp_arg, SPARUL_INSERT_DATA, $3, $6); } ; spar_sparul_delete /* [DML]* DeleteAction ::= */ @@ -2573,15 +2568,10 @@ spar_sparul_deletedata /* [DML]* DeleteDataAction ::= */ /*... ConstructTemplate */ : DELETE_L DATA_L spar_from_graph_precode_opt _LBRA { t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); - sparp_arg->sparp_in_precode_expn = 2; } + sparp_arg->sparp_in_precode_expn = (SPARP_PRECODE_CTOR_DATA_ONLY | SPARP_PRECODE_NO_BNODES); } spar_ctor_template_nolbra { - SPART *fake = spar_make_fake_action_solution (sparp_arg); - SPART *dflt_g = $3; - if ((NULL == dflt_g) && spar_ctor_uses_default_graph ($6)) - dflt_g = spar_default_sparul_target (sparp_arg, "triple in DELETE DATA {...} without GRAPH {...}", 0); sparp_arg->sparp_in_precode_expn = 0; - $$ = spar_make_top_or_special_case_from_wm (sparp_arg, SPARUL_DELETE_DATA, NULL, fake ); - spar_compose_retvals_of_insert_or_delete (sparp_arg, $$, dflt_g, $6); } + $$ = spar_make_insertdata_or_deletedata (sparp_arg, SPARUL_DELETE_DATA, $3, $6); } ; spar_sparul_modify /* [DML]* ModifyAction ::= */ diff --git a/libsrc/Wi/sparul2sql.c b/libsrc/Wi/sparul2sql.c index 27d4c6588b..5ad4042e78 100644 --- a/libsrc/Wi/sparul2sql.c +++ b/libsrc/Wi/sparul2sql.c @@ -1233,3 +1233,50 @@ ins_is_bad: ; (SPART **)t_list_to_array (bad_ins_triples) ); retvals[0]->_.funcall.argtrees[0] = good_ctor_call; } + +SPART * +spar_make_insertdata_or_deletedata (sparp_t *sparp, ptrlong subtype, SPART *dflt_g, SPART *ctor) +{ + SPART *const_data_op; + dk_set_t bnoded_triples = NULL; + SPART *fake = spar_make_fake_action_solution (sparp); + if ((NULL == dflt_g) && spar_ctor_uses_default_graph (ctor)) + dflt_g = sparp->sparp_env->spare_found_default_sparul_target = spar_default_sparul_target (sparp, + (SPARUL_INSERT_DATA == subtype) ? "triple in INSERT DATA {...} without GRAPH {...}" : "triple in DELETE DATA {...} without GRAPH {...}", + 0 ); + if (SPARUL_INSERT_DATA == subtype) + { + SPART **membs = ctor->_.gp.members; + int triple_count = BOX_ELEMENTS (membs); + int last_used_idx = triple_count-1; + int ctr; + for (ctr = triple_count; ctr--; /* no step */) + { + SPART *memb = membs[ctr]; + if ((SPAR_BLANK_NODE_LABEL != SPART_TYPE (memb->_.triple.tr_subject)) && (SPAR_BLANK_NODE_LABEL != SPART_TYPE (memb->_.triple.tr_object))) + continue; + t_set_push (&bnoded_triples, memb); + membs[ctr] = membs[last_used_idx]; + membs[last_used_idx] = NULL; + last_used_idx--; + } + if (NULL != bnoded_triples) + { + SPART **new_membs = (SPART **)t_alloc_list (last_used_idx+1); + memcpy (new_membs, membs, sizeof (SPART *) * (last_used_idx+1)); + ctor->_.gp.members = new_membs; + } + } + const_data_op = spar_make_top_or_special_case_from_wm (sparp, subtype, NULL, fake); + spar_compose_retvals_of_insert_or_delete (sparp, const_data_op, dflt_g, ctor); + if (NULL != bnoded_triples) + { + SPART *fake2 = spar_make_fake_action_solution (sparp); + SPART *bnode_ctor = (SPART *)t_box_copy ((caddr_t)ctor); + SPART *bnode_op = spar_make_top_or_special_case_from_wm (sparp, INSERT_L, NULL, fake2); + bnode_ctor->_.gp.members = (SPART **)t_revlist_to_array (bnoded_triples); + spar_compose_retvals_of_insert_or_delete (sparp, bnode_op, dflt_g, bnode_ctor); + return spartlist (sparp, 2, SPAR_LIST, (SPART **)t_list (2, const_data_op, bnode_op)); + } + return const_data_op; + } From a93d79d388ccf170d61244be30d40716744c75ba Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 24 Jun 2024 12:42:21 +0000 Subject: [PATCH 06/94] Fixed tested building against openssl 3.3.x --- README.GIT.md | 2 +- README.md | 2 +- configure.ac | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.GIT.md b/README.GIT.md index 06716eac76..746e27d375 100644 --- a/README.GIT.md +++ b/README.GIT.md @@ -85,7 +85,7 @@ installed on your system. | gawk | 3.1.1 | 5.3.0 | http://www.gnu.org/software/gawk/ | | m4 | 1.4.1 | 1.4.18 | http://www.gnu.org/software/m4/ | | make | 3.79.1 | 4.2.1 | http://www.gnu.org/software/make/ | -| OpenSSL | 0.9.8e | 3.2.x | http://www.openssl.org/ | +| OpenSSL | 0.9.8e | 3.3.x | http://www.openssl.org/ | and any GNU packages required by these. The autogen.sh and configure scripts check for the presence and right version of some of the required diff --git a/README.md b/README.md index bf5da22fde..4f12544f59 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ installed on your system. | gawk | 3.1.1 | 5.3.0 | http://www.gnu.org/software/gawk/ | | m4 | 1.4.1 | 1.4.18 | http://www.gnu.org/software/m4/ | | make | 3.79.1 | 4.2.1 | http://www.gnu.org/software/make/ | -| OpenSSL | 0.9.8e | 3.2.x | http://www.openssl.org/ | +| OpenSSL | 0.9.8e | 3.3.x | http://www.openssl.org/ | and any GNU packages required by these. The autogen.sh and configure scripts check for the presence and right version of some of the required diff --git a/configure.ac b/configure.ac index 3db70d8393..83f0089189 100644 --- a/configure.ac +++ b/configure.ac @@ -914,8 +914,8 @@ then /* LibreSSL defines OPENSSL_VERSION_NUMBER 0x20000000L but uses a compatible API to OpenSSL v1.0.x */ #elif OPENSSL_VERSION_NUMBER < 0x1020000fL /* OpenSSL versions 0.9.8e - 1.1.1 are supported */ - #elif OPENSSL_VERSION_NUMBER < 0x30300000L - /* OpenSSL version 3.2.x is supported */ + #elif OPENSSL_VERSION_NUMBER < 0x30400000L + /* OpenSSL versions 3.0.x - 3.3.x are supported */ #else #error OpenSSL version too new #endif From 76c467d9cd947cf3b771d0d73ddb9f79ce5b5e88 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Wed, 26 Jun 2024 12:04:29 +0000 Subject: [PATCH 07/94] Fixed issue with GROUP BY/ORDER BY on LEFT OUTER JOIN --- libsrc/Wi/sqldf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/sqldf.c b/libsrc/Wi/sqldf.c index a961939c06..f6342a3ce8 100644 --- a/libsrc/Wi/sqldf.c +++ b/libsrc/Wi/sqldf.c @@ -1700,7 +1700,7 @@ dfe_is_super (df_elt_t *super, df_elt_t * sub) df_elt_t * -dfe_skip_to_min_card (df_elt_t * place, df_elt_t * super, df_elt_t * dfe) +dfe_skip_to_min_card (df_elt_t * place, df_elt_t * super, df_elt_t * dfe, int skip_gby_oby) { /* when placing a func, see if some place later in the query has lower card */ df_elt_t * best = place, *org_place = place; @@ -1748,6 +1748,9 @@ dfe_skip_to_min_card (df_elt_t * place, df_elt_t * super, df_elt_t * dfe) ptrlong top_cnt; if (place->_.setp.is_being_placed) goto over; + /* coalesce & case exp may ref a col in gby the following oby has dc cleared ref */ + if (skip_gby_oby && place->dfe_prev && DFE_GROUP == place->dfe_prev->dfe_type) + goto over; top_cnt = place->_.setp.top_cnt; if (top_cnt) { @@ -2287,7 +2290,7 @@ sqlo_place_exp (sqlo_t * so, df_elt_t * super, df_elt_t * dfe) } END_DO_BOX; placed = dfe_skip_exp_dfes (placed, &dfe, 1); - placed = dfe_skip_to_min_card (placed, super, dfe); + placed = dfe_skip_to_min_card (placed, super, dfe, 1); so->so_mark_gb_dep = 1; sqlo_place_dfe_after (so, pref_loc, placed, dfe); return dfe; @@ -2347,7 +2350,7 @@ sqlo_place_exp (sqlo_t * so, df_elt_t * super, df_elt_t * dfe) { placed = dfe_latest (so, n_args, args, 1); placed = dfe_skip_exp_dfes (placed, &dfe, 1); - placed = dfe_skip_to_min_card (placed, super, dfe); + placed = dfe_skip_to_min_card (placed, super, dfe, 0); } so->so_mark_gb_dep = 1; sqlo_place_dfe_after (so, pref_loc, placed, dfe); From a4349d4df278147259d5ee57bc439f060cbd2555 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Wed, 26 Jun 2024 12:05:49 +0000 Subject: [PATCH 08/94] Fixed issue when there are no parts to split --- libsrc/Wi/sqlvrun.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libsrc/Wi/sqlvrun.c b/libsrc/Wi/sqlvrun.c index 9a52fecd83..ff6e5dd254 100644 --- a/libsrc/Wi/sqlvrun.c +++ b/libsrc/Wi/sqlvrun.c @@ -3057,6 +3057,8 @@ int tsp_next (ts_split_state_t * tsp, it_cursor_t * itc, buffer_desc_t ** buf_ret, it_cursor_t * prev) { int nth = ++tsp->tsp_nth_call; + if (!tsp->tsp_n_parts) + return TSS_NO_SPLIT; if (itc->itc_insert_key->key_is_col && enable_col_split) return tsp_next_col (tsp, itc, buf_ret, prev); for (;;) From a09ba100dec26a428a642325856da848eacc847f Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Thu, 8 Aug 2024 20:28:55 +0000 Subject: [PATCH 09/94] Fixed issue with "Content-Encoding: gzip" (fixes #1308) --- libsrc/Wi/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index 2d2e5843e5..355ef3aed4 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -2524,7 +2524,7 @@ ws_strses_reply (ws_connection_t * ws, const char * volatile code) accept_gz = ws_get_packed_hf (ws, "Accept-Encoding:", ""); if (IS_CHUNKED_OUTPUT (ws)) cnt_enc = WS_CE_CHUNKED; - else if (enable_gzip && accept_gz && strstr (accept_gz, "gzip") && ws->ws_proto_no == 11 && ws->ws_status_code > 199 && CONTENT_ALLOWED(ws)) + else if (enable_gzip && accept_gz && strstr (accept_gz, "gzip") && ws->ws_proto_no == 11 && CONTENT_ALLOWED(ws)) { cnt_enc = WS_CE_GZIP; ws->ws_try_pipeline = 0; /* browsers based on webkit workaround */ From d038735fd8570e07d3771ef265ebc8eedc5a85e3 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 9 Aug 2024 13:05:25 +0000 Subject: [PATCH 10/94] Fixed issue with {col} When a single column is specified as IRI then do not escape, e.g. {col} means an IRI string --- binsrc/rdb2rdf/r2rml.sql | 8 ++++++-- binsrc/rdb2rdf/vad_version | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/binsrc/rdb2rdf/r2rml.sql b/binsrc/rdb2rdf/r2rml.sql index f0c732d0d5..0a727eef77 100644 --- a/binsrc/rdb2rdf/r2rml.sql +++ b/binsrc/rdb2rdf/r2rml.sql @@ -505,7 +505,7 @@ create method R2RML_GEN_CREATE_IOL_CLASS_OR_REF (in fld_idx integer, in mode int { declare format_string, class_iri varchar; declare format_ses, format_parts, col_descs, argtypes, class_digest any; - declare argctr, argcount integer; + declare argctr, argcount, raw_string integer; -- dbg_obj_princ ('R2RML_GEN_CREATE_IOL_CLASS_OR_REF (', fld_idx, mode, triplesmap_iid, src_template, termtype, dt, lang, ')'); if (termtype = 'http://www.w3.org/ns/r2rml#BlankNode') { @@ -513,6 +513,10 @@ create method R2RML_GEN_CREATE_IOL_CLASS_OR_REF (in fld_idx integer, in mode int termtype := 'http://www.w3.org/ns/r2rml#IRI'; } format_parts := DB.DBA.R2RML_SPLIT_TEMPLATE (src_template); + -- Pure {col} case, should not escape + raw_string := 0; + if (termtype = 'http://www.w3.org/ns/r2rml#IRI' and length(format_parts) = 3 and aref(format_parts,0) = '' and aref(format_parts,2) = '') + raw_string := 1; argcount := (length (format_parts) - 1) / 2; if (0 = argcount) -- constant written as a template for some reason. { @@ -540,7 +544,7 @@ create method R2RML_GEN_CREATE_IOL_CLASS_OR_REF (in fld_idx integer, in mode int when (coltype[1] in (__tag of bigint)) then '%ld' when (coltype[1] in (__tag of real, __tag of double precision, __tag of numeric)) then '%g' when (coltype[1] in (__tag of varchar, __tag of nvarchar, __tag of long varchar, __tag of long nvarchar)) then - case (termtype) when 'http://www.w3.org/ns/r2rml#Literal' then '%s' else '%U' end + case when termtype = 'http://www.w3.org/ns/r2rml#Literal' or raw_string then '%s' else '%U' end else signal ('R2RML', sprintf ('Unsupported column type %d, column %s of %s', diff --git a/binsrc/rdb2rdf/vad_version b/binsrc/rdb2rdf/vad_version index 5326dceb13..1f8086cdb4 100644 --- a/binsrc/rdb2rdf/vad_version +++ b/binsrc/rdb2rdf/vad_version @@ -1 +1 @@ -1.00.291 +1.00.292 From 01d0077a479b68d4502fd01f524a61a80a723da2 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 9 Aug 2024 13:12:10 +0000 Subject: [PATCH 11/94] Fixed issue with SN DETs errors --- binsrc/conductor/dav/dav_browser.sql | 2 ++ binsrc/conductor/vad_version | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/binsrc/conductor/dav/dav_browser.sql b/binsrc/conductor/dav/dav_browser.sql index 2bfff9d79f..b005f12136 100644 --- a/binsrc/conductor/dav/dav_browser.sql +++ b/binsrc/conductor/dav/dav_browser.sql @@ -3292,6 +3292,8 @@ create procedure WEBDAV.DBA.DAV_PERROR ( S := replace (S, 'Resource', 'File'); S := subseq (S, 6); } + if (-44 = x and isstring (connection_get('__sql_message'))) + S := connection_get('__sql_message'); return S; } ; diff --git a/binsrc/conductor/vad_version b/binsrc/conductor/vad_version index 6fff371893..54110c37f1 100644 --- a/binsrc/conductor/vad_version +++ b/binsrc/conductor/vad_version @@ -1 +1 @@ -1.00.8869 +1.00.8870 From a54e6a76b49987b7d49b0387f7ef76b149d3f868 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 9 Aug 2024 13:15:19 +0000 Subject: [PATCH 12/94] Fixed issue with user defined types (UDT) --- binsrc/tests/suite/sqlo.sql | 17 +++++++++++++++++ libsrc/Wi/sqltype.c | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/binsrc/tests/suite/sqlo.sql b/binsrc/tests/suite/sqlo.sql index fb44a57a50..891ed567cb 100644 --- a/binsrc/tests/suite/sqlo.sql +++ b/binsrc/tests/suite/sqlo.sql @@ -2092,5 +2092,22 @@ ECHO BOTH $IF $EQU $LAST[1] 1 "PASSED" "***FAILED"; SET ARGV[$LIF] $+ $ARGV[$LIF] 1; ECHO BOTH ": " $U{caseno} " STATE=" $STATE " MESSAGE=" $MESSAGE "\n"; +create table TBUDTSTR (id0 varchar, id1 varchar, primary key(id0,id1)) if not exists; +create unique index TBUDTSTR_i0 on TBUDTSTR(id0) if not exists; +drop type UDT2STR if exists; +create type UDT2STR as (id varchar, u utr0) +constructor method UDT2STR(id varchar); + +create constructor method UDT2STR(in id varchar) for UDT2STR { self.id := id; }; + +insert soft TBUDTSTR values ('1','1'); +insert soft TBUDTSTR values ('2','1'); +insert soft TBUDTSTR values ('3','1'); + +select * from TBUDTSTR where id0 = UDT2STR(1).id; +ECHO BOTH $IF $EQU $STATE OK "PASSED" "***FAILED"; +SET ARGV[$LIF] $+ $ARGV[$LIF] 1; +ECHO BOTH ": member observer any type STATE=" $STATE " MESSAGE=" $MESSAGE "\n"; + ECHO BOTH "COMPLETED: SQL Optimizer tests (sqlo.sql) WITH " $ARGV[0] " FAILED, " $ARGV[1] " PASSED\n\n"; diff --git a/libsrc/Wi/sqltype.c b/libsrc/Wi/sqltype.c index e67dc64981..6dba7e26f5 100644 --- a/libsrc/Wi/sqltype.c +++ b/libsrc/Wi/sqltype.c @@ -2634,7 +2634,11 @@ sqlc_udt_is_udt_call (sql_comp_t * sc, char *name, dk_set_t * code, cv_call (code, NULL, t_sqlp_box_id_upcase (UDT_MEMBER_HANDLER_BIF), ret, bif_parms); qr_uses_type (sc->sc_cc->cc_query, udt->scl_name); if (ret && IS_REAL_SSL (ret) && ret->ssl_dtp == DV_UNKNOWN) - ret->ssl_sqt = udt->scl_member_map[fld_inx]->sfl_sqt; + { + ret->ssl_sqt = udt->scl_member_map[fld_inx]->sfl_sqt; + if (!ret->ssl_sqt.sqt_class) + ret->ssl_dtp = DV_ANY; + } if (ret && udt->scl_ext_lang == UDT_LANG_SQL) ret->ssl_is_observer = 1; retc = 1; From c9270e6346b83dd82547c89d5fbc99e9ac317603 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 9 Aug 2024 13:17:51 +0000 Subject: [PATCH 13/94] Fixed memory leak and error when service sets error status code --- libsrc/Wi/bif_soap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c index 59d07df9b8..1442a33e08 100644 --- a/libsrc/Wi/bif_soap.c +++ b/libsrc/Wi/bif_soap.c @@ -11546,7 +11546,7 @@ ws_soap_http (ws_connection_t * ws) } end: - if (err && http_resp_code != 200) + if (err && http_resp_code != 200 && !ws->ws_status_line) { ws->ws_status_line = ws_http_error_header (http_resp_code); ws->ws_status_code = http_resp_code; From 4f21c0ab695207279b5f2f90839a93d92a8df9af Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 9 Aug 2024 13:18:51 +0000 Subject: [PATCH 14/94] Fixed inc. estimate on transitive with unbound input --- libsrc/Wi/bif_explain.c | 17 +++++++++++++++-- libsrc/Wi/sqlcost.c | 4 +++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/bif_explain.c b/libsrc/Wi/bif_explain.c index 0e44ce8b01..427c45e641 100644 --- a/libsrc/Wi/bif_explain.c +++ b/libsrc/Wi/bif_explain.c @@ -1171,6 +1171,19 @@ qn_print_reuse (data_source_t * qn) } } +const char * +tn_direction_string(int dir) +{ + switch (dir) + { + case TRANS_ANY: return "any"; + case TRANS_LR: return "LR"; + case TRANS_RL: return "RL"; + case TRANS_LRRL: return "LRRL"; + default: return "???"; + } +} + const char * predicate_name_of_gsop (int gsop) { @@ -2246,14 +2259,14 @@ node_print (data_source_t * node) stmt_printf ((" %s\n", tn->tn_lowest_sas ? "min same-as id" : "")); if (tn->tn_sas_g) { - stmt_printf (("g = ")); + stmt_printf (("G = ")); ssl_array_print (tn->tn_sas_g); stmt_printf (("\n")); } } else { - stmt_printf (("Transitive dt dir %d, input: ", tn->tn_direction)); + stmt_printf (("Transitive DT dir %s(%d), input: ", tn_direction_string(tn->tn_direction), tn->tn_direction)); ssl_array_print (tn->tn_input); stmt_printf (("\n input shadow: ")); ssl_array_print (tn->tn_input_ref); diff --git a/libsrc/Wi/sqlcost.c b/libsrc/Wi/sqlcost.c index 39bd90c7ac..5de0d3659c 100644 --- a/libsrc/Wi/sqlcost.c +++ b/libsrc/Wi/sqlcost.c @@ -3780,7 +3780,7 @@ sqlo_use_p_stat (df_elt_t * dfe, df_elt_t ** lowers, int inx_const_fill, int64 e if (!enable_p_stat || !inx_const_fill) return 0; if (0 != strcmp (((dbe_column_t*)key->key_parts->data)->col_name, "P") - || !strstr (key->key_table->tb_name, "RDF_QUAD")) + || !tb_is_rdf_quad (key->key_table)) return 0; col2 = (dbe_column_t*)key->key_parts->next->data; so_dfe = sqlo_key_part_best (col2, dfe->_.table.col_preds, 0); @@ -4688,6 +4688,8 @@ dfe_unit_cost (df_elt_t * dfe, float input_arity, float * u1, float * a1, float if (dfe->dfe_type == DFE_DT && dfe->_.sub.ot->ot_is_outer) *a1 = MAX (1, *a1); /* right siode of left oj has min cardinality 1 */ + if (dfe->_.sub.trans && TRANS_LR == dfe->_.sub.trans->tl_direction) /* in unkn est. potentially increase */ + *u1 *= MAX (dfe->_.sub.in_arity, 1.0); break; case DFE_QEXP: From 2b2e156f0dc8d20d2faf3b279163fe019c81bbee Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 30 Aug 2024 16:24:09 +0000 Subject: [PATCH 15/94] Updated Vadpacker to v1.10 --- binsrc/vadpacker/AUTHORS | 2 + binsrc/vadpacker/ChangeLog | 46 + binsrc/vadpacker/Makefile.am | 36 - binsrc/vadpacker/NEWS | 13 + binsrc/vadpacker/README-elementtree | 3 - binsrc/vadpacker/elementtree/ElementPath.py | 196 --- binsrc/vadpacker/elementtree/ElementTree.py | 1254 ------------------- binsrc/vadpacker/elementtree/__init__.py | 30 - binsrc/vadpacker/vadpacker.py | 154 ++- configure.ac | 2 +- 10 files changed, 175 insertions(+), 1561 deletions(-) delete mode 100644 binsrc/vadpacker/Makefile.am delete mode 100644 binsrc/vadpacker/README-elementtree delete mode 100644 binsrc/vadpacker/elementtree/ElementPath.py delete mode 100644 binsrc/vadpacker/elementtree/ElementTree.py delete mode 100644 binsrc/vadpacker/elementtree/__init__.py diff --git a/binsrc/vadpacker/AUTHORS b/binsrc/vadpacker/AUTHORS index 78fa63eb41..0b7f081fa3 100644 --- a/binsrc/vadpacker/AUTHORS +++ b/binsrc/vadpacker/AUTHORS @@ -18,3 +18,5 @@ Sebastian Trueg trueg{at}openlinksw.com Contributors ============ +Tim Haynes thaynes{at}openlinksw.com +Mitko Iliev imitko{at}openlinksw.com diff --git a/binsrc/vadpacker/ChangeLog b/binsrc/vadpacker/ChangeLog index 7b931add0f..75115f0f86 100644 --- a/binsrc/vadpacker/ChangeLog +++ b/binsrc/vadpacker/ChangeLog @@ -1,5 +1,51 @@ +2024-08-30 Patrick van Kleef + + Updated NEWS + + Updated version number to 1.10 + + Updated AUTHORS + + Merge branch 'feature/fixes' into develop + + Added exception handler to catch errors in createSticker() + + Added exception handler to catch errors in createVad() + + Fixed readability of argument parsing + + Fixed use mtime=0 during gzip compression + + Fixed use BytesIO and GzipFile for Python 2.7 and newer + + Removed old copy of elementtree + + Fixed issue with python 2.7.5 + + Fixed check if we are running Python 2.7.5 or newer + +2024-05-20 Patrick van Kleef + + Merge tag 'v1.9' into develop + Tagged for release + + Merge branch 'release/1.9' + + Updates NEWS and ChangeLog + + Updated version to 1.9 + + Fixed warning of invalid escape sequence + 2024-03-14 Patrick van Kleef + Merge tag 'v1.8' into develop + Tagged for release + + Merge branch 'release/1.8' + + Updated NEWS and Changelog + Updated version to 1.8 Fixed issue if source_uri is missing from sticker diff --git a/binsrc/vadpacker/Makefile.am b/binsrc/vadpacker/Makefile.am deleted file mode 100644 index 1e4cace425..0000000000 --- a/binsrc/vadpacker/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# -# This file is part of the OpenLink Software Virtuoso Open-Source (VOS) -# project. -# -# Copyright (C) 1998-2024 OpenLink Software -# -# This project is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; only version 2 of the License, dated June 1991. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# - -# ---------------------------------------------------------------------- -# -# Additional files to distribute -# -# ---------------------------------------------------------------------- -EXTRA_DIST = \ - $(srcdir)/*.py \ - $(srcdir)/.gitignore \ - $(srcdir)/AUTHORS \ - $(srcdir)/ChangeLog \ - $(srcdir)/COPYING \ - $(srcdir)/NEWS \ - $(srcdir)/README \ - $(srcdir)/README-elementtree \ - $(srcdir)/elementtree/*.py diff --git a/binsrc/vadpacker/NEWS b/binsrc/vadpacker/NEWS index 27d9e48db5..ff9d5cbac3 100644 --- a/binsrc/vadpacker/NEWS +++ b/binsrc/vadpacker/NEWS @@ -1,3 +1,16 @@ +Aug 30, 2024, v1.10: + * Added exception handler to catch errors in createSticker() + * Added exception handler to catch errors in createVad() + * Fixed readability of argument parsing + * Fixed use mtime=0 during gzip compression + * Fixed use BytesIO and GzipFile for Python 2.7 and newer + * Removed old copy of elementtree + * Fixed issue with python 2.7.5 + * Fixed check if we are running Python 2.7.5 or newer + +May 20, 2024, v1.9: + * Fixed warning of invalid escape sequence + Mar 14, 2024, v1.8: * Fixed issue if source_uri is missing from sticker diff --git a/binsrc/vadpacker/README-elementtree b/binsrc/vadpacker/README-elementtree deleted file mode 100644 index b5c840e034..0000000000 --- a/binsrc/vadpacker/README-elementtree +++ /dev/null @@ -1,3 +0,0 @@ -The "elementtree" sub-folder is a copy of parts of the original -ElementTree python package. The only reason for including it in -the source is easier deployment. diff --git a/binsrc/vadpacker/elementtree/ElementPath.py b/binsrc/vadpacker/elementtree/ElementPath.py deleted file mode 100644 index 558b560aff..0000000000 --- a/binsrc/vadpacker/elementtree/ElementPath.py +++ /dev/null @@ -1,196 +0,0 @@ -# -# ElementTree -# $Id: ElementPath.py 1858 2004-06-17 21:31:41Z Fredrik $ -# -# limited xpath support for element trees -# -# history: -# 2003-05-23 fl created -# 2003-05-28 fl added support for // etc -# 2003-08-27 fl fixed parsing of periods in element names -# -# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved. -# -# fredrik@pythonware.com -# http://www.pythonware.com -# -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2004 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- - -## -# Implementation module for XPath support. There's usually no reason -# to import this module directly; the ElementTree does this for -# you, if needed. -## - -import re - -xpath_tokenizer = re.compile( - "(::|\.\.|\(\)|[/.*:\[\]\(\)@=])|((?:\{[^}]+\})?[^/:\[\]\(\)@=\s]+)|\s+" - ).findall - -class xpath_descendant_or_self: - pass - -## -# Wrapper for a compiled XPath. - -class Path: - - ## - # Create an Path instance from an XPath expression. - - def __init__(self, path): - tokens = xpath_tokenizer(path) - # the current version supports 'path/path'-style expressions only - self.path = [] - self.tag = None - if tokens and tokens[0][0] == "/": - raise SyntaxError("cannot use absolute path on element") - while tokens: - op, tag = tokens.pop(0) - if tag or op == "*": - self.path.append(tag or op) - elif op == ".": - pass - elif op == "/": - self.path.append(xpath_descendant_or_self()) - continue - else: - raise SyntaxError("unsupported path syntax (%s)" % op) - if tokens: - op, tag = tokens.pop(0) - if op != "/": - raise SyntaxError( - "expected path separator (%s)" % (op or tag) - ) - if self.path and isinstance(self.path[-1], xpath_descendant_or_self): - raise SyntaxError("path cannot end with //") - if len(self.path) == 1 and isinstance(self.path[0], type("")): - self.tag = self.path[0] - - ## - # Find first matching object. - - def find(self, element): - tag = self.tag - if tag is None: - nodeset = self.findall(element) - if not nodeset: - return None - return nodeset[0] - for elem in element: - if elem.tag == tag: - return elem - return None - - ## - # Find text for first matching object. - - def findtext(self, element, default=None): - tag = self.tag - if tag is None: - nodeset = self.findall(element) - if not nodeset: - return default - return nodeset[0].text or "" - for elem in element: - if elem.tag == tag: - return elem.text or "" - return default - - ## - # Find all matching objects. - - def findall(self, element): - nodeset = [element] - index = 0 - while 1: - try: - path = self.path[index] - index = index + 1 - except IndexError: - return nodeset - set = [] - if isinstance(path, xpath_descendant_or_self): - try: - tag = self.path[index] - if not isinstance(tag, type("")): - tag = None - else: - index = index + 1 - except IndexError: - tag = None # invalid path - for node in nodeset: - new = list(node.getiterator(tag)) - if new and new[0] is node: - set.extend(new[1:]) - else: - set.extend(new) - else: - for node in nodeset: - for node in node: - if path == "*" or node.tag == path: - set.append(node) - if not set: - return [] - nodeset = set - -_cache = {} - -## -# (Internal) Compile path. - -def _compile(path): - p = _cache.get(path) - if p is not None: - return p - p = Path(path) - if len(_cache) >= 100: - _cache.clear() - _cache[path] = p - return p - -## -# Find first matching object. - -def find(element, path): - return _compile(path).find(element) - -## -# Find text for first matching object. - -def findtext(element, path, default=None): - return _compile(path).findtext(element, default) - -## -# Find all matching objects. - -def findall(element, path): - return _compile(path).findall(element) - diff --git a/binsrc/vadpacker/elementtree/ElementTree.py b/binsrc/vadpacker/elementtree/ElementTree.py deleted file mode 100644 index 98d0208792..0000000000 --- a/binsrc/vadpacker/elementtree/ElementTree.py +++ /dev/null @@ -1,1254 +0,0 @@ -# -# ElementTree -# $Id: ElementTree.py 2326 2005-03-17 07:45:21Z fredrik $ -# -# light-weight XML support for Python 1.5.2 and later. -# -# history: -# 2001-10-20 fl created (from various sources) -# 2001-11-01 fl return root from parse method -# 2002-02-16 fl sort attributes in lexical order -# 2002-04-06 fl TreeBuilder refactoring, added PythonDoc markup -# 2002-05-01 fl finished TreeBuilder refactoring -# 2002-07-14 fl added basic namespace support to ElementTree.write -# 2002-07-25 fl added QName attribute support -# 2002-10-20 fl fixed encoding in write -# 2002-11-24 fl changed default encoding to ascii; fixed attribute encoding -# 2002-11-27 fl accept file objects or file names for parse/write -# 2002-12-04 fl moved XMLTreeBuilder back to this module -# 2003-01-11 fl fixed entity encoding glitch for us-ascii -# 2003-02-13 fl added XML literal factory -# 2003-02-21 fl added ProcessingInstruction/PI factory -# 2003-05-11 fl added tostring/fromstring helpers -# 2003-05-26 fl added ElementPath support -# 2003-07-05 fl added makeelement factory method -# 2003-07-28 fl added more well-known namespace prefixes -# 2003-08-15 fl fixed typo in ElementTree.findtext (Thomas Dartsch) -# 2003-09-04 fl fall back on emulator if ElementPath is not installed -# 2003-10-31 fl markup updates -# 2003-11-15 fl fixed nested namespace bug -# 2004-03-28 fl added XMLID helper -# 2004-06-02 fl added default support to findtext -# 2004-06-08 fl fixed encoding of non-ascii element/attribute names -# 2004-08-23 fl take advantage of post-2.1 expat features -# 2005-02-01 fl added iterparse implementation -# 2005-03-02 fl fixed iterparse support for pre-2.2 versions -# -# Copyright (c) 1999-2005 by Fredrik Lundh. All rights reserved. -# -# fredrik@pythonware.com -# http://www.pythonware.com -# -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2005 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- - -__all__ = [ - # public symbols - "Comment", - "dump", - "Element", "ElementTree", - "fromstring", - "iselement", "iterparse", - "parse", - "PI", "ProcessingInstruction", - "QName", - "SubElement", - "tostring", - "TreeBuilder", - "VERSION", "XML", - "XMLTreeBuilder", - ] - -## -# The Element type is a flexible container object, designed to -# store hierarchical data structures in memory. The type can be -# described as a cross between a list and a dictionary. -#

-# Each element has a number of properties associated with it: -#

    -#
  • a tag. This is a string identifying what kind of data -# this element represents (the element type, in other words).
  • -#
  • a number of attributes, stored in a Python dictionary.
  • -#
  • a text string.
  • -#
  • an optional tail string.
  • -#
  • a number of child elements, stored in a Python sequence
  • -#
-# -# To create an element instance, use the {@link #Element} or {@link -# #SubElement} factory functions. -#

-# The {@link #ElementTree} class can be used to wrap an element -# structure, and convert it from and to XML. -## - -import string, sys, re - -class _SimpleElementPath: - # emulate pre-1.2 find/findtext/findall behaviour - def find(self, element, tag): - for elem in element: - if elem.tag == tag: - return elem - return None - def findtext(self, element, tag, default=None): - for elem in element: - if elem.tag == tag: - return elem.text or "" - return default - def findall(self, element, tag): - if tag[:3] == ".//": - return element.getiterator(tag[3:]) - result = [] - for elem in element: - if elem.tag == tag: - result.append(elem) - return result - -try: - import ElementPath -except ImportError: - # FIXME: issue warning in this case? - ElementPath = _SimpleElementPath() - -# TODO: add support for custom namespace resolvers/default namespaces -# TODO: add improved support for incremental parsing - -VERSION = "1.2.6" - -## -# Internal element class. This class defines the Element interface, -# and provides a reference implementation of this interface. -#

-# You should not create instances of this class directly. Use the -# appropriate factory functions instead, such as {@link #Element} -# and {@link #SubElement}. -# -# @see Element -# @see SubElement -# @see Comment -# @see ProcessingInstruction - -class _ElementInterface: - # text...tail - - ## - # (Attribute) Element tag. - - tag = None - - ## - # (Attribute) Element attribute dictionary. Where possible, use - # {@link #_ElementInterface.get}, - # {@link #_ElementInterface.set}, - # {@link #_ElementInterface.keys}, and - # {@link #_ElementInterface.items} to access - # element attributes. - - attrib = None - - ## - # (Attribute) Text before first subelement. This is either a - # string or the value None, if there was no text. - - text = None - - ## - # (Attribute) Text after this element's end tag, but before the - # next sibling element's start tag. This is either a string or - # the value None, if there was no text. - - tail = None # text after end tag, if any - - def __init__(self, tag, attrib): - self.tag = tag - self.attrib = attrib - self._children = [] - - def __repr__(self): - return "" % (self.tag, id(self)) - - ## - # Creates a new element object of the same type as this element. - # - # @param tag Element tag. - # @param attrib Element attributes, given as a dictionary. - # @return A new element instance. - - def makeelement(self, tag, attrib): - return Element(tag, attrib) - - ## - # Returns the number of subelements. - # - # @return The number of subelements. - - def __len__(self): - return len(self._children) - - ## - # Returns the given subelement. - # - # @param index What subelement to return. - # @return The given subelement. - # @exception IndexError If the given element does not exist. - - def __getitem__(self, index): - return self._children[index] - - ## - # Replaces the given subelement. - # - # @param index What subelement to replace. - # @param element The new element value. - # @exception IndexError If the given element does not exist. - # @exception AssertionError If element is not a valid object. - - def __setitem__(self, index, element): - assert iselement(element) - self._children[index] = element - - ## - # Deletes the given subelement. - # - # @param index What subelement to delete. - # @exception IndexError If the given element does not exist. - - def __delitem__(self, index): - del self._children[index] - - ## - # Returns a list containing subelements in the given range. - # - # @param start The first subelement to return. - # @param stop The first subelement that shouldn't be returned. - # @return A sequence object containing subelements. - - def __getslice__(self, start, stop): - return self._children[start:stop] - - ## - # Replaces a number of subelements with elements from a sequence. - # - # @param start The first subelement to replace. - # @param stop The first subelement that shouldn't be replaced. - # @param elements A sequence object with zero or more elements. - # @exception AssertionError If a sequence member is not a valid object. - - def __setslice__(self, start, stop, elements): - for element in elements: - assert iselement(element) - self._children[start:stop] = list(elements) - - ## - # Deletes a number of subelements. - # - # @param start The first subelement to delete. - # @param stop The first subelement to leave in there. - - def __delslice__(self, start, stop): - del self._children[start:stop] - - ## - # Adds a subelement to the end of this element. - # - # @param element The element to add. - # @exception AssertionError If a sequence member is not a valid object. - - def append(self, element): - assert iselement(element) - self._children.append(element) - - ## - # Inserts a subelement at the given position in this element. - # - # @param index Where to insert the new subelement. - # @exception AssertionError If the element is not a valid object. - - def insert(self, index, element): - assert iselement(element) - self._children.insert(index, element) - - ## - # Removes a matching subelement. Unlike the find methods, - # this method compares elements based on identity, not on tag - # value or contents. - # - # @param element What element to remove. - # @exception ValueError If a matching element could not be found. - # @exception AssertionError If the element is not a valid object. - - def remove(self, element): - assert iselement(element) - self._children.remove(element) - - ## - # Returns all subelements. The elements are returned in document - # order. - # - # @return A list of subelements. - # @defreturn list of Element instances - - def getchildren(self): - return self._children - - ## - # Finds the first matching subelement, by tag name or path. - # - # @param path What element to look for. - # @return The first matching element, or None if no element was found. - # @defreturn Element or None - - def find(self, path): - return ElementPath.find(self, path) - - ## - # Finds text for the first matching subelement, by tag name or path. - # - # @param path What element to look for. - # @param default What to return if the element was not found. - # @return The text content of the first matching element, or the - # default value no element was found. Note that if the element - # has is found, but has no text content, this method returns an - # empty string. - # @defreturn string - - def findtext(self, path, default=None): - return ElementPath.findtext(self, path, default) - - ## - # Finds all matching subelements, by tag name or path. - # - # @param path What element to look for. - # @return A list or iterator containing all matching elements, - # in document order. - # @defreturn list of Element instances - - def findall(self, path): - return ElementPath.findall(self, path) - - ## - # Resets an element. This function removes all subelements, clears - # all attributes, and sets the text and tail attributes to None. - - def clear(self): - self.attrib.clear() - self._children = [] - self.text = self.tail = None - - ## - # Gets an element attribute. - # - # @param key What attribute to look for. - # @param default What to return if the attribute was not found. - # @return The attribute value, or the default value, if the - # attribute was not found. - # @defreturn string or None - - def get(self, key, default=None): - return self.attrib.get(key, default) - - ## - # Sets an element attribute. - # - # @param key What attribute to set. - # @param value The attribute value. - - def set(self, key, value): - self.attrib[key] = value - - ## - # Gets a list of attribute names. The names are returned in an - # arbitrary order (just like for an ordinary Python dictionary). - # - # @return A list of element attribute names. - # @defreturn list of strings - - def keys(self): - return self.attrib.keys() - - ## - # Gets element attributes, as a sequence. The attributes are - # returned in an arbitrary order. - # - # @return A list of (name, value) tuples for all attributes. - # @defreturn list of (string, string) tuples - - def items(self): - return self.attrib.items() - - ## - # Creates a tree iterator. The iterator loops over this element - # and all subelements, in document order, and returns all elements - # with a matching tag. - #

- # If the tree structure is modified during iteration, the result - # is undefined. - # - # @param tag What tags to look for (default is to return all elements). - # @return A list or iterator containing all the matching elements. - # @defreturn list or iterator - - def getiterator(self, tag=None): - nodes = [] - if tag == "*": - tag = None - if tag is None or self.tag == tag: - nodes.append(self) - for node in self._children: - nodes.extend(node.getiterator(tag)) - return nodes - -# compatibility -_Element = _ElementInterface - -## -# Element factory. This function returns an object implementing the -# standard Element interface. The exact class or type of that object -# is implementation dependent, but it will always be compatible with -# the {@link #_ElementInterface} class in this module. -#

-# The element name, attribute names, and attribute values can be -# either 8-bit ASCII strings or Unicode strings. -# -# @param tag The element name. -# @param attrib An optional dictionary, containing element attributes. -# @param **extra Additional attributes, given as keyword arguments. -# @return An element instance. -# @defreturn Element - -def Element(tag, attrib={}, **extra): - attrib = attrib.copy() - attrib.update(extra) - return _ElementInterface(tag, attrib) - -## -# Subelement factory. This function creates an element instance, and -# appends it to an existing element. -#

-# The element name, attribute names, and attribute values can be -# either 8-bit ASCII strings or Unicode strings. -# -# @param parent The parent element. -# @param tag The subelement name. -# @param attrib An optional dictionary, containing element attributes. -# @param **extra Additional attributes, given as keyword arguments. -# @return An element instance. -# @defreturn Element - -def SubElement(parent, tag, attrib={}, **extra): - attrib = attrib.copy() - attrib.update(extra) - element = parent.makeelement(tag, attrib) - parent.append(element) - return element - -## -# Comment element factory. This factory function creates a special -# element that will be serialized as an XML comment. -#

-# The comment string can be either an 8-bit ASCII string or a Unicode -# string. -# -# @param text A string containing the comment string. -# @return An element instance, representing a comment. -# @defreturn Element - -def Comment(text=None): - element = Element(Comment) - element.text = text - return element - -## -# PI element factory. This factory function creates a special element -# that will be serialized as an XML processing instruction. -# -# @param target A string containing the PI target. -# @param text A string containing the PI contents, if any. -# @return An element instance, representing a PI. -# @defreturn Element - -def ProcessingInstruction(target, text=None): - element = Element(ProcessingInstruction) - element.text = target - if text: - element.text = element.text + " " + text - return element - -PI = ProcessingInstruction - -## -# QName wrapper. This can be used to wrap a QName attribute value, in -# order to get proper namespace handling on output. -# -# @param text A string containing the QName value, in the form {uri}local, -# or, if the tag argument is given, the URI part of a QName. -# @param tag Optional tag. If given, the first argument is interpreted as -# an URI, and this argument is interpreted as a local name. -# @return An opaque object, representing the QName. - -class QName: - def __init__(self, text_or_uri, tag=None): - if tag: - text_or_uri = "{%s}%s" % (text_or_uri, tag) - self.text = text_or_uri - def __str__(self): - return self.text - def __hash__(self): - return hash(self.text) - def __cmp__(self, other): - if isinstance(other, QName): - return cmp(self.text, other.text) - return cmp(self.text, other) - -## -# ElementTree wrapper class. This class represents an entire element -# hierarchy, and adds some extra support for serialization to and from -# standard XML. -# -# @param element Optional root element. -# @keyparam file Optional file handle or name. If given, the -# tree is initialized with the contents of this XML file. - -class ElementTree: - - def __init__(self, element=None, file=None): - assert element is None or iselement(element) - self._root = element # first node - if file: - self.parse(file) - - ## - # Gets the root element for this tree. - # - # @return An element instance. - # @defreturn Element - - def getroot(self): - return self._root - - ## - # Replaces the root element for this tree. This discards the - # current contents of the tree, and replaces it with the given - # element. Use with care. - # - # @param element An element instance. - - def _setroot(self, element): - assert iselement(element) - self._root = element - - ## - # Loads an external XML document into this element tree. - # - # @param source A file name or file object. - # @param parser An optional parser instance. If not given, the - # standard {@link XMLTreeBuilder} parser is used. - # @return The document root element. - # @defreturn Element - - def parse(self, source, parser=None): - if not hasattr(source, "read"): - source = open(source, "rb") - if not parser: - parser = XMLTreeBuilder() - while 1: - data = source.read(32768) - if not data: - break - parser.feed(data) - self._root = parser.close() - return self._root - - ## - # Creates a tree iterator for the root element. The iterator loops - # over all elements in this tree, in document order. - # - # @param tag What tags to look for (default is to return all elements) - # @return An iterator. - # @defreturn iterator - - def getiterator(self, tag=None): - assert self._root is not None - return self._root.getiterator(tag) - - ## - # Finds the first toplevel element with given tag. - # Same as getroot().find(path). - # - # @param path What element to look for. - # @return The first matching element, or None if no element was found. - # @defreturn Element or None - - def find(self, path): - assert self._root is not None - if path[:1] == "/": - path = "." + path - return self._root.find(path) - - ## - # Finds the element text for the first toplevel element with given - # tag. Same as getroot().findtext(path). - # - # @param path What toplevel element to look for. - # @param default What to return if the element was not found. - # @return The text content of the first matching element, or the - # default value no element was found. Note that if the element - # has is found, but has no text content, this method returns an - # empty string. - # @defreturn string - - def findtext(self, path, default=None): - assert self._root is not None - if path[:1] == "/": - path = "." + path - return self._root.findtext(path, default) - - ## - # Finds all toplevel elements with the given tag. - # Same as getroot().findall(path). - # - # @param path What element to look for. - # @return A list or iterator containing all matching elements, - # in document order. - # @defreturn list of Element instances - - def findall(self, path): - assert self._root is not None - if path[:1] == "/": - path = "." + path - return self._root.findall(path) - - ## - # Writes the element tree to a file, as XML. - # - # @param file A file name, or a file object opened for writing. - # @param encoding Optional output encoding (default is US-ASCII). - - def write(self, file, encoding="us-ascii"): - assert self._root is not None - if not hasattr(file, "write"): - file = open(file, "wb") - if not encoding: - encoding = "us-ascii" - elif encoding != "utf-8" and encoding != "us-ascii": - file.write("\n" % encoding) - self._write(file, self._root, encoding, {}) - - def _write(self, file, node, encoding, namespaces): - # write XML to file - tag = node.tag - if tag is Comment: - file.write("" % _escape_cdata(node.text, encoding)) - elif tag is ProcessingInstruction: - file.write("" % _escape_cdata(node.text, encoding)) - else: - items = node.items() - xmlns_items = [] # new namespaces in this scope - try: - if isinstance(tag, QName) or tag[:1] == "{": - tag, xmlns = fixtag(tag, namespaces) - if xmlns: xmlns_items.append(xmlns) - except TypeError: - _raise_serialization_error(tag) - file.write("<" + _encode(tag, encoding)) - if items or xmlns_items: - items.sort() # lexical order - for k, v in items: - try: - if isinstance(k, QName) or k[:1] == "{": - k, xmlns = fixtag(k, namespaces) - if xmlns: xmlns_items.append(xmlns) - except TypeError: - _raise_serialization_error(k) - try: - if isinstance(v, QName): - v, xmlns = fixtag(v, namespaces) - if xmlns: xmlns_items.append(xmlns) - except TypeError: - _raise_serialization_error(v) - file.write(" %s=\"%s\"" % (_encode(k, encoding), - _escape_attrib(v, encoding))) - for k, v in xmlns_items: - file.write(" %s=\"%s\"" % (_encode(k, encoding), - _escape_attrib(v, encoding))) - if node.text or len(node): - file.write(">") - if node.text: - file.write(_escape_cdata(node.text, encoding)) - for n in node: - self._write(file, n, encoding, namespaces) - file.write("") - else: - file.write(" />") - for k, v in xmlns_items: - del namespaces[v] - if node.tail: - file.write(_escape_cdata(node.tail, encoding)) - -# -------------------------------------------------------------------- -# helpers - -## -# Checks if an object appears to be a valid element object. -# -# @param An element instance. -# @return A true value if this is an element object. -# @defreturn flag - -def iselement(element): - # FIXME: not sure about this; might be a better idea to look - # for tag/attrib/text attributes - return isinstance(element, _ElementInterface) or hasattr(element, "tag") - -## -# Writes an element tree or element structure to sys.stdout. This -# function should be used for debugging only. -#

-# The exact output format is implementation dependent. In this -# version, it's written as an ordinary XML file. -# -# @param elem An element tree or an individual element. - -def dump(elem): - # debugging - if not isinstance(elem, ElementTree): - elem = ElementTree(elem) - elem.write(sys.stdout) - tail = elem.getroot().tail - if not tail or tail[-1] != "\n": - sys.stdout.write("\n") - -def _encode(s, encoding): - try: - return s.encode(encoding) - except AttributeError: - return s # 1.5.2: assume the string uses the right encoding - -if sys.version[:3] == "1.5": - _escape = re.compile(r"[&<>\"\x80-\xff]+") # 1.5.2 -else: - _escape = re.compile(eval(r'u"[&<>\"\u0080-\uffff]+"')) - -_escape_map = { - "&": "&", - "<": "<", - ">": ">", - '"': """, -} - -_namespace_map = { - # "well-known" namespace prefixes - "http://www.w3.org/XML/1998/namespace": "xml", - "http://www.w3.org/1999/xhtml": "html", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", - "http://schemas.xmlsoap.org/wsdl/": "wsdl", -} - -def _raise_serialization_error(text): - raise TypeError( - "cannot serialize %r (type %s)" % (text, type(text).__name__) - ) - -def _encode_entity(text, pattern=_escape): - # map reserved and non-ascii characters to numerical entities - def escape_entities(m, map=_escape_map): - out = [] - append = out.append - for char in m.group(): - text = map.get(char) - if text is None: - text = "&#%d;" % ord(char) - append(text) - return string.join(out, "") - try: - return _encode(pattern.sub(escape_entities, text), "ascii") - except TypeError: - _raise_serialization_error(text) - -# -# the following functions assume an ascii-compatible encoding -# (or "utf-16") - -def _escape_cdata(text, encoding=None, replace=string.replace): - # escape character data - try: - if encoding: - try: - text = _encode(text, encoding) - except UnicodeError: - return _encode_entity(text) - text = replace(text, "&", "&") - text = replace(text, "<", "<") - text = replace(text, ">", ">") - return text - except (TypeError, AttributeError): - _raise_serialization_error(text) - -def _escape_attrib(text, encoding=None, replace=string.replace): - # escape attribute value - try: - if encoding: - try: - text = _encode(text, encoding) - except UnicodeError: - return _encode_entity(text) - text = replace(text, "&", "&") - text = replace(text, "'", "'") # FIXME: overkill - text = replace(text, "\"", """) - text = replace(text, "<", "<") - text = replace(text, ">", ">") - return text - except (TypeError, AttributeError): - _raise_serialization_error(text) - -def fixtag(tag, namespaces): - # given a decorated tag (of the form {uri}tag), return prefixed - # tag and namespace declaration, if any - if isinstance(tag, QName): - tag = tag.text - namespace_uri, tag = string.split(tag[1:], "}", 1) - prefix = namespaces.get(namespace_uri) - if prefix is None: - prefix = _namespace_map.get(namespace_uri) - if prefix is None: - prefix = "ns%d" % len(namespaces) - namespaces[namespace_uri] = prefix - if prefix == "xml": - xmlns = None - else: - xmlns = ("xmlns:%s" % prefix, namespace_uri) - else: - xmlns = None - return "%s:%s" % (prefix, tag), xmlns - -## -# Parses an XML document into an element tree. -# -# @param source A filename or file object containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLTreeBuilder} parser is used. -# @return An ElementTree instance - -def parse(source, parser=None): - tree = ElementTree() - tree.parse(source, parser) - return tree - -## -# Parses an XML document into an element tree incrementally, and reports -# what's going on to the user. -# -# @param source A filename or file object containing XML data. -# @param events A list of events to report back. If omitted, only "end" -# events are reported. -# @return A (event, elem) iterator. - -class iterparse: - - def __init__(self, source, events=None): - if not hasattr(source, "read"): - source = open(source, "rb") - self._file = source - self._events = [] - self._index = 0 - self.root = self._root = None - self._parser = XMLTreeBuilder() - # wire up the parser for event reporting - parser = self._parser._parser - append = self._events.append - if events is None: - events = ["end"] - for event in events: - if event == "start": - try: - parser.ordered_attributes = 1 - parser.specified_attributes = 1 - def handler(tag, attrib_in, event=event, append=append, - start=self._parser._start_list): - append((event, start(tag, attrib_in))) - parser.StartElementHandler = handler - except AttributeError: - def handler(tag, attrib_in, event=event, append=append, - start=self._parser._start): - append((event, start(tag, attrib_in))) - parser.StartElementHandler = handler - elif event == "end": - def handler(tag, event=event, append=append, - end=self._parser._end): - append((event, end(tag))) - parser.EndElementHandler = handler - elif event == "start-ns": - def handler(prefix, uri, event=event, append=append): - try: - uri = _encode(uri, "ascii") - except UnicodeError: - pass - append((event, (prefix or "", uri))) - parser.StartNamespaceDeclHandler = handler - elif event == "end-ns": - def handler(prefix, event=event, append=append): - append((event, None)) - parser.EndNamespaceDeclHandler = handler - - def next(self): - while 1: - try: - item = self._events[self._index] - except IndexError: - if self._parser is None: - self.root = self._root - try: - raise StopIteration - except NameError: - raise IndexError - # load event buffer - del self._events[:] - self._index = 0 - data = self._file.read(16384) - if data: - self._parser.feed(data) - else: - self._root = self._parser.close() - self._parser = None - else: - self._index = self._index + 1 - return item - - try: - iter - def __iter__(self): - return self - except NameError: - def __getitem__(self, index): - return self.next() - -## -# Parses an XML document from a string constant. This function can -# be used to embed "XML literals" in Python code. -# -# @param source A string containing XML data. -# @return An Element instance. -# @defreturn Element - -def XML(text): - parser = XMLTreeBuilder() - parser.feed(text) - return parser.close() - -## -# Parses an XML document from a string constant, and also returns -# a dictionary which maps from element id:s to elements. -# -# @param source A string containing XML data. -# @return A tuple containing an Element instance and a dictionary. -# @defreturn (Element, dictionary) - -def XMLID(text): - parser = XMLTreeBuilder() - parser.feed(text) - tree = parser.close() - ids = {} - for elem in tree.getiterator(): - id = elem.get("id") - if id: - ids[id] = elem - return tree, ids - -## -# Parses an XML document from a string constant. Same as {@link #XML}. -# -# @def fromstring(text) -# @param source A string containing XML data. -# @return An Element instance. -# @defreturn Element - -fromstring = XML - -## -# Generates a string representation of an XML element, including all -# subelements. -# -# @param element An Element instance. -# @return An encoded string containing the XML data. -# @defreturn string - -def tostring(element, encoding=None): - class dummy: - pass - data = [] - file = dummy() - file.write = data.append - ElementTree(element).write(file, encoding) - return string.join(data, "") - -## -# Generic element structure builder. This builder converts a sequence -# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link -# #TreeBuilder.end} method calls to a well-formed element structure. -#

-# You can use this class to build an element structure using a custom XML -# parser, or a parser for some other XML-like format. -# -# @param element_factory Optional element factory. This factory -# is called to create new Element instances, as necessary. - -class TreeBuilder: - - def __init__(self, element_factory=None): - self._data = [] # data collector - self._elem = [] # element stack - self._last = None # last element - self._tail = None # true if we're after an end tag - if element_factory is None: - element_factory = _ElementInterface - self._factory = element_factory - - ## - # Flushes the parser buffers, and returns the toplevel documen - # element. - # - # @return An Element instance. - # @defreturn Element - - def close(self): - assert len(self._elem) == 0, "missing end tags" - assert self._last != None, "missing toplevel element" - return self._last - - def _flush(self): - if self._data: - if self._last is not None: - text = string.join(self._data, "") - if self._tail: - assert self._last.tail is None, "internal error (tail)" - self._last.tail = text - else: - assert self._last.text is None, "internal error (text)" - self._last.text = text - self._data = [] - - ## - # Adds text to the current element. - # - # @param data A string. This should be either an 8-bit string - # containing ASCII text, or a Unicode string. - - def data(self, data): - self._data.append(data) - - ## - # Opens a new element. - # - # @param tag The element name. - # @param attrib A dictionary containing element attributes. - # @return The opened element. - # @defreturn Element - - def start(self, tag, attrs): - self._flush() - self._last = elem = self._factory(tag, attrs) - if self._elem: - self._elem[-1].append(elem) - self._elem.append(elem) - self._tail = 0 - return elem - - ## - # Closes the current element. - # - # @param tag The element name. - # @return The closed element. - # @defreturn Element - - def end(self, tag): - self._flush() - self._last = self._elem.pop() - assert self._last.tag == tag,\ - "end tag mismatch (expected %s, got %s)" % ( - self._last.tag, tag) - self._tail = 1 - return self._last - -## -# Element structure builder for XML source data, based on the -# expat parser. -# -# @keyparam target Target object. If omitted, the builder uses an -# instance of the standard {@link #TreeBuilder} class. -# @keyparam html Predefine HTML entities. This flag is not supported -# by the current implementation. -# @see #ElementTree -# @see #TreeBuilder - -class XMLTreeBuilder: - - def __init__(self, html=0, target=None): - try: - from xml.parsers import expat - except ImportError: - raise ImportError( - "No module named expat; use SimpleXMLTreeBuilder instead" - ) - self._parser = parser = expat.ParserCreate(None, "}") - if target is None: - target = TreeBuilder() - self._target = target - self._names = {} # name memo cache - # callbacks - parser.DefaultHandlerExpand = self._default - parser.StartElementHandler = self._start - parser.EndElementHandler = self._end - parser.CharacterDataHandler = self._data - # let expat do the buffering, if supported - try: - self._parser.buffer_text = 1 - except AttributeError: - pass - # use new-style attribute handling, if supported - try: - self._parser.ordered_attributes = 1 - self._parser.specified_attributes = 1 - parser.StartElementHandler = self._start_list - except AttributeError: - pass - encoding = None - if not parser.returns_unicode: - encoding = "utf-8" - # target.xml(encoding, None) - self._doctype = None - self.entity = {} - - def _fixtext(self, text): - # convert text string to ascii, if possible - try: - return _encode(text, "ascii") - except UnicodeError: - return text - - def _fixname(self, key): - # expand qname, and convert name string to ascii, if possible - try: - name = self._names[key] - except KeyError: - name = key - if "}" in name: - name = "{" + name - self._names[key] = name = self._fixtext(name) - return name - - def _start(self, tag, attrib_in): - fixname = self._fixname - tag = fixname(tag) - attrib = {} - for key, value in attrib_in.items(): - attrib[fixname(key)] = self._fixtext(value) - return self._target.start(tag, attrib) - - def _start_list(self, tag, attrib_in): - fixname = self._fixname - tag = fixname(tag) - attrib = {} - if attrib_in: - for i in range(0, len(attrib_in), 2): - attrib[fixname(attrib_in[i])] = self._fixtext(attrib_in[i+1]) - return self._target.start(tag, attrib) - - def _data(self, text): - return self._target.data(self._fixtext(text)) - - def _end(self, tag): - return self._target.end(self._fixname(tag)) - - def _default(self, text): - prefix = text[:1] - if prefix == "&": - # deal with undefined entities - try: - self._target.data(self.entity[text[1:-1]]) - except KeyError: - from xml.parsers import expat - raise expat.error( - "undefined entity %s: line %d, column %d" % - (text, self._parser.ErrorLineNumber, - self._parser.ErrorColumnNumber) - ) - elif prefix == "<" and text[:9] == "": - self._doctype = None - return - text = string.strip(text) - if not text: - return - self._doctype.append(text) - n = len(self._doctype) - if n > 2: - type = self._doctype[1] - if type == "PUBLIC" and n == 4: - name, type, pubid, system = self._doctype - elif type == "SYSTEM" and n == 3: - name, type, system = self._doctype - pubid = None - else: - return - if pubid: - pubid = pubid[1:-1] - self.doctype(name, pubid, system[1:-1]) - self._doctype = None - - ## - # Handles a doctype declaration. - # - # @param name Doctype name. - # @param pubid Public identifier. - # @param system System identifier. - - def doctype(self, name, pubid, system): - pass - - ## - # Feeds data to the parser. - # - # @param data Encoded data. - - def feed(self, data): - self._parser.Parse(data, 0) - - ## - # Finishes feeding data to the parser. - # - # @return An element structure. - # @defreturn Element - - def close(self): - self._parser.Parse("", 1) # end of data - tree = self._target.close() - del self._target, self._parser # get rid of circular references - return tree diff --git a/binsrc/vadpacker/elementtree/__init__.py b/binsrc/vadpacker/elementtree/__init__.py deleted file mode 100644 index cef1a6bba1..0000000000 --- a/binsrc/vadpacker/elementtree/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# $Id: __init__.py 1821 2004-06-03 16:57:49Z fredrik $ -# elementtree package - -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2004 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- diff --git a/binsrc/vadpacker/vadpacker.py b/binsrc/vadpacker/vadpacker.py index 3da68c6acc..c4903fb899 100755 --- a/binsrc/vadpacker/vadpacker.py +++ b/binsrc/vadpacker/vadpacker.py @@ -27,6 +27,7 @@ import struct import os import sys +import platform import optparse import datetime import re @@ -36,21 +37,15 @@ # -# Use xml.etree.ElementTree on python > 2.6 +# Use xml.etree.ElementTree # -try: - import xml.etree.ElementTree as ET -except ImportError: - import elementtree.ElementTree as ET +import xml.etree.ElementTree as ET # -# Use StringIO for python 2.7 +# Use BytesIO # -try: - from StringIO import StringIO # python 2.7 -except ImportError: - pass +from io import BytesIO # @@ -144,7 +139,7 @@ def vadWriteLong(s, val): val -- The value to write. ctx -- The hash object to update. """ - be = struct.pack('>i', val) + be = struct.pack(str('>i'), val) s.write(be) ctx.update(be) @@ -195,15 +190,14 @@ def vadWriteFile(s, name, fname, use_gz): # compress the file if requested if use_gz == "yes": - if sys.version_info[0] == 3: - # Python 3.x - val = gzip.compress (val, compresslevel=9) - else: - # Python 2.7 - buf = StringIO() - with gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=9) as f: + if sys.version_info > (2, 7): # Python 2.7 and newer + buf = BytesIO() + with gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=9, mtime=0) as f: f.write(val) val = buf.getvalue() + else: + raise Exception("use_gzip requires python 2.7 or newer") + if verbose: f_len = os.path.getsize(fname) logging.info("compress: original size=%ld, compressed size=%ld compression=%.2f%%" % @@ -372,39 +366,117 @@ def main(): global prefix global targetprefix - # Command line args - optparser = optparse.OptionParser(usage="vadpacker.py [-h] --output PATH [--verbose] [--prefix PREFIX] [--targetprefix PREFIX] [--var [VAR [VAR ...]]] sticker_template [files [files ...]]", - version="Virtuoso VAD Packer 1.9", - description="Copyright (C) 2012-2024 OpenLink Software. Vadpacker can be used to build Virtuoso VAD packages by providing the tool with a sticker template file. Vadpacker supports variable replacement and wildcards for file resources.", - epilog="The optional list of files at the end will be packed in addition to the files in the sticker. vadpacker will create additional resource entries with default permissions (dav, administrators, 111101101NN for vsp and php pages, 110100100NN for all other files) in the packed sticker using the relative paths of the given files.") - optparser.add_option('--output', '-o', type="string", metavar='PATH', dest='output', help='The destination VAD file.') - optparser.add_option('--verbose', '-v', action="store_true", dest="verbose", default=False, help="Be verbose about the packing.") - optparser.add_option('--prefix', '-p', type="string", default="", metavar='PREFIX', dest='prefix', help='An optional prefix to be used for locating local files. This prefix is prepended to all resource source_uris in the sticker template. The final target_uri will not contain the prefix."') - optparser.add_option('--targetprefix', '-t', type="string", default="", metavar='PREFIX', dest='targetprefix', help='An optional prefix to be used for target_uri values in additional resource entries created through the files list."') - optparser.add_option('--var', type="string", metavar='VAR', dest='var', default=[], action="append", help='Set variable values to be replaced in the sticker. Example: --var="VARNAME=xyz" will replace any occurence of $VARNAME$ with "xyz"') - optparser.add_option('--print-sticker', action="store_true", dest="printsticker", default=False, help="Do not pack the vad, only print the final sticker to stdout.") - - # extract arguments - (options, args) = optparser.parse_args() + # + # Check mimimal python version + # + if sys.version_info < (2, 7, 5): + logging.error("Vadpacker requires Python 2.7.5 or newer instead of Python %s" % platform.python_version()) + exit (1); + + # + # Parse command line args + # + usage="""\ +vadpacker.py [-h] --output PATH [--verbose] [--prefix PREFIX] +[--targetprefix PREFIX] [--var [VAR [VAR ...]]] sticker_template +[files [files ...]]""" + description="""\ +Copyright (C) 2012-2024 OpenLink Software. Vadpacker can be used +to build Virtuoso VAD packages by providing the tool with a sticker +template file. Vadpacker supports variable replacement and wildcards +for file resources.""" + epilog="""\ +The optional list of files at the end will be packed in addition to the +files in the sticker. +Vadpacker will create additional resource entries with default permissions +(dav, administrators, 111101101NN for vsp, vspx, and php pages; 110100100NN +for all other files) in the packed sticker using the relative paths of +the given files.""" + + # create parser + parser = optparse.OptionParser( + usage=usage, + version='Virtuoso VAD Packer v1.10', + description=description, + epilog=epilog + ) + + # add options + parser.add_option('--output', '-o', + type="string", metavar='PATH', dest='output', + help='The destination VAD file.') + + parser.add_option('--verbose', '-v', + action="store_true", dest="verbose", default=False, + help="Be verbose about the packing.") + + parser.add_option('--prefix', '-p', + type="string", default="", metavar='PREFIX', dest='prefix', + help='An optional prefix to be used for locating local files. This prefix is prepended to all resource source_uris in the sticker template. The final target_uri will not contain the prefix.') + + parser.add_option('--targetprefix', '-t', + type="string", default="", metavar='PREFIX', dest='targetprefix', + help='An optional prefix to be used for target_uri values in additional resource entries created through the files list.') + + parser.add_option('--var', + type="string", metavar='VAR', dest='var', default=[], action="append", + help='Set variable values to be replaced in the sticker. Example: --var="VARNAME=xyz" will replace any occurence of $VARNAME$ with "xyz"') + + parser.add_option('--print-sticker', + action="store_true", dest="printsticker", default=False, + help="Do not pack the vad, only print the final sticker to stdout.") + + # parse arguments + (options, args) = parser.parse_args() + if len(args) < 1: + parser.error("missing sticker_template argument") + + # store arguments verbose = options.verbose prefix = options.prefix targetprefix = options.targetprefix + stickerUrl = args[0] - if len(args) < 1: - optparser.error("missing sticker_template argument") - stickerUrl = args[0] - if verbose: - logging.info("Creating sticker file from template '%s'" % stickerUrl) - sticker = createSticker(stickerUrl, buildVariableMap(options.var), args[1:]) - if options.printsticker: - print (sticker) - else: + # + # Parse the sticker + # + try: + if verbose: + logging.info("Creating sticker from template '%s'" % stickerUrl) + sticker = createSticker(stickerUrl, buildVariableMap(options.var), args[1:]) + except Exception as ex: + if verbose: + logging.exception("Error parsing sticker template '%s': %s" % (stickerUrl, ex)) + else: + logging.error("Error parsing sticker template '%s': %s" % (stickerUrl, ex)) + exit (1) + finally: + if options.printsticker: + print (sticker) + exit (0) + + + # + # Generate the VAD package + # + try: # Open the target file and write the VAD with open(options.output, "wb") as s: if verbose: logging.info("Packing VAD file '%s'" % (options.output)) createVad(os.path.dirname(os.path.realpath(stickerUrl)), sticker, s) + except Exception as ex: + if verbose: + logging.exception("Error packing VAD file '%s': %s" % (options.output, ex)) + else: + logging.error("Error packing VAD file '%s': %s" % (options.output, ex)) + logging.warning ("Removing partial VAD file") + os.remove (options.output) + exit (1) + finally: + # success + logging.info ("Vadpacker completed without errors") if __name__ == "__main__": diff --git a/configure.ac b/configure.ac index 83f0089189..db9e904d11 100644 --- a/configure.ac +++ b/configure.ac @@ -431,7 +431,7 @@ AC_PATH_PROG(FLEX, flex, flex) AC_PATH_PROG(GAWK, gawk, gawk) AC_PATH_PROG(GPERF, gperf, gperf) AC_PATH_PROG(PERL, perl, perl) -AM_PATH_PYTHON([2.7]) +AM_PATH_PYTHON([2.7.5]) AC_PATH_PROG(RUBY, ruby, ruby) #AC_DECL_YYTEXT From ae6817debf57dbd589ab3191e30c7531b72b8222 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 3 Sep 2024 14:12:16 +0000 Subject: [PATCH 16/94] Added new function get_usec_real_time --- libsrc/Dk/Dktypes.h | 2 ++ libsrc/Dk/Dkutil.c | 84 +++++++++++++++++++++++++++++++++++++++++++++ libsrc/Dk/Dkutil.h | 1 + 3 files changed, 87 insertions(+) diff --git a/libsrc/Dk/Dktypes.h b/libsrc/Dk/Dktypes.h index dadaa47eef..67310668a2 100644 --- a/libsrc/Dk/Dktypes.h +++ b/libsrc/Dk/Dktypes.h @@ -146,6 +146,8 @@ typedef struct /* General time for specifying timestamps in msec from EPOCH */ typedef uint64 time_msec_t; +/* General time for specifying timestamps in µsec from EPOCH */ +typedef uint64 time_usec_t; #ifdef FILE64 diff --git a/libsrc/Dk/Dkutil.c b/libsrc/Dk/Dkutil.c index 161f83668d..1b577d438d 100644 --- a/libsrc/Dk/Dkutil.c +++ b/libsrc/Dk/Dkutil.c @@ -215,6 +215,90 @@ get_msec_real_time (void) } +time_usec_t +get_usec_real_time (void) +{ + time_usec_t now_usec = 0; + int done = 0; + +#if defined (WIN32) + if (!done) + { + timeout_t time_now; + LARGE_INTEGER count; + static LARGE_INTEGER freq; + static int initialized = 0; + + if (!initialized) + { + QueryPerformanceFrequency (&freq); + initialized = 1; + } + + if (freq.QuadPart > 0 && QueryPerformanceCounter (&count)) + { + time_now.to_sec = (time_t) (count.QuadPart / freq.QuadPart); + time_now.to_usec = (int) ((count.QuadPart % freq.QuadPart) * 1000000UL / freq.QuadPart); + + now_usec = (time_usec_t) time_now.to_sec * 1000000UL + time_now.to_usec; + done = 1; + } + } +#endif + +#if defined (CLOCK_MONOTONIC) + /* + * Use clock_gettime which works on Linux/macOS/FreeBSD + */ + if (!done) + { + struct timespec ts; + int have_clock_gettime = 1; + +#if defined (CLOCK_MONOTONIC_FAST) + clockid_t cop = CLOCK_MONOTONIC_FAST; /* FreeBSD */ +#else + clockid_t cop = CLOCK_MONOTONIC; /* Linux and macOS */ +#endif + +#if defined (__APPLE__) + have_clock_gettime = 0; + if (__builtin_available (macOS 10.12, iOS 10, tvOS 10, watchOS 3, *)) + have_clock_gettime = 1; +#endif + + if (have_clock_gettime && clock_gettime (cop, &ts) == 0) + { + now_usec = (time_usec_t) ts.tv_sec * 1000000ULL + (ts.tv_nsec / 1000ULL); + done = 1; + } + } +#endif + + /* + * Fallback if any of the above fail + */ + if (!done) + { + timeout_t time_now; + + get_real_time (&time_now); + + now_usec = (time_usec_t) time_now.to_sec * 1000000ULL + time_now.to_usec; + } + + /* + * Save approx time in msec + */ + time_now_msec = (now_usec + 500) / 1000; + + /* + * Finally return the value + */ + return now_usec; +} + + void time_add (timeout_t * time1, timeout_t * time2) { diff --git a/libsrc/Dk/Dkutil.h b/libsrc/Dk/Dkutil.h index ed21711589..8c0265a8d3 100644 --- a/libsrc/Dk/Dkutil.h +++ b/libsrc/Dk/Dkutil.h @@ -33,6 +33,7 @@ BEGIN_CPLUSPLUS NORETURN int gpf_notice (const char *file, int line, const char *text); void get_real_time (timeout_t * time_ret); time_msec_t get_msec_real_time (void); +time_usec_t get_usec_real_time (void); time_msec_t approx_msec_real_time (void); void time_add (timeout_t * time1, timeout_t * time2); int time_gt (timeout_t * time1, timeout_t * time2); From 01f0967b25da01b7bab878b45bfc4e0dc49e526e Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 3 Sep 2024 14:12:49 +0000 Subject: [PATCH 17/94] Fixed use usec for cli_start_time for custom %T and %D http log format --- libsrc/Wi/bif_explain.c | 6 +++--- libsrc/Wi/sqlintrp.c | 4 ++-- libsrc/Wi/sqlnode.h | 2 +- libsrc/Wi/sqlsrv.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libsrc/Wi/bif_explain.c b/libsrc/Wi/bif_explain.c index 427c45e641..bd2146c379 100644 --- a/libsrc/Wi/bif_explain.c +++ b/libsrc/Wi/bif_explain.c @@ -4321,7 +4321,7 @@ qi_log_stats_1 (query_instance_t * qi, caddr_t err, caddr_t ext_text) client_connection_t * cli = qi->qi_client; dk_session_t * ses; uint64 rt; - time_msec_t now; + time_usec_t now; /* milos: allocate memory for the comment structure */ qr_comment_t comm; @@ -4332,7 +4332,7 @@ qi_log_stats_1 (query_instance_t * qi, caddr_t err, caddr_t ext_text) if (!qi->qi_log_stats) return; - now = get_msec_real_time (); + now = get_usec_real_time (); CLI_THREAD_TIME (cli); rt = rdtsc (); if (!(ses = cli->cli_ql_strses)) @@ -4344,7 +4344,7 @@ qi_log_stats_1 (query_instance_t * qi, caddr_t err, caddr_t ext_text) session_buffered_write_char (DV_DATETIME, ses); session_buffered_write (ses, (char*)cli->cli_start_dt, DT_LENGTH); /*1*/ - print_int ((boxint) (now - cli->cli_start_time), ses); + print_int ((boxint) ((now - cli->cli_start_time_usec) / 1000UL), ses); /* value in msec */ /*2*/ print_int (cli->cli_run_clocks, ses); /*3*/ diff --git a/libsrc/Wi/sqlintrp.c b/libsrc/Wi/sqlintrp.c index e6b3c4099c..0de978ad91 100644 --- a/libsrc/Wi/sqlintrp.c +++ b/libsrc/Wi/sqlintrp.c @@ -2245,8 +2245,8 @@ qi_check_trx_error (query_instance_t * qi, int flags) sqlr_resignal (err); } - if (cli->cli_start_time && - time_now_msec - cli->cli_start_time > BURST_STOP_TIMEOUT + if (cli->cli_start_time_usec && + time_now_msec - (cli->cli_start_time_usec / 1000UL) > BURST_STOP_TIMEOUT && cli->cli_session && cli_is_interactive (cli) && !cli->cli_ws) diff --git a/libsrc/Wi/sqlnode.h b/libsrc/Wi/sqlnode.h index 40bfd6dba2..c8ee3991d9 100644 --- a/libsrc/Wi/sqlnode.h +++ b/libsrc/Wi/sqlnode.h @@ -1879,7 +1879,7 @@ typedef struct client_connection_s #ifdef INPROCESS_CLIENT int cli_inprocess; #endif - time_msec_t cli_start_time; + time_usec_t cli_start_time_usec; time_msec_t cli_ws_check_time; caddr_t * cli_info; cl_thread_t * cli_clt; /* if cli of a cluster server thread, this is the clt */ diff --git a/libsrc/Wi/sqlsrv.c b/libsrc/Wi/sqlsrv.c index 25c6d44ab7..3801d715d9 100644 --- a/libsrc/Wi/sqlsrv.c +++ b/libsrc/Wi/sqlsrv.c @@ -709,7 +709,7 @@ client_connection_reset (client_connection_t * cli) cli->cli_not_char_c_escape = 0; cli->cli_utf8_execs = 0; cli->cli_no_system_tables = 0; - cli->cli_start_time = 0; + cli->cli_start_time_usec = 0; cli->cli_terminate_requested = 0; if (client_connection_reset_hook) cli->cli_outp_worker = client_connection_reset_hook (cli->cli_outp_worker); @@ -1564,7 +1564,7 @@ sf_stmt_prepare (caddr_t stmt_id, char *text, long explain, if (!stmt && err) goto report_error; cli->cli_terminate_requested = 0; - cli->cli_start_time = time_now_msec; + cli->cli_start_time_usec = get_usec_real_time(); if (!stmt || stmt->sst_cursor_state) { /* There's an instance. can't do it */ @@ -1747,8 +1747,8 @@ cli_set_start_times (client_connection_t * cli) { if (prof_on) dt_now ((caddr_t)&cli->cli_start_dt); - cli->cli_start_time = get_msec_real_time (); - cli->cli_ws_check_time = cli->cli_start_time; + cli->cli_start_time_usec = get_usec_real_time(); + cli->cli_ws_check_time = cli->cli_start_time_usec / 1000UL; cli->cli_cl_start_ts = rdtsc (); cli->cli_activity.da_thread_time = 0; } @@ -1799,7 +1799,7 @@ sf_sql_execute (caddr_t stmt_id, char *text, char *cursor_name, #endif cli->cli_terminate_requested = 0; - cli->cli_start_time = time_now_msec; + cli->cli_start_time_usec = get_usec_real_time(); if (!stmt || stmt->sst_cursor_state) { /* Busy */ From e96635e6d58f618b89048567d911cbd6c61b6b66 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 3 Sep 2024 14:18:38 +0000 Subject: [PATCH 18/94] Fixed use get_usec_real_time() for rate limiting --- libsrc/Wi/http.c | 12 +++++------- libsrc/Wi/http.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index 355ef3aed4..0ca861fde6 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -373,13 +373,11 @@ static int http_acl_check_rate (ws_acl_t * elm, caddr_t name, int check_rate, in else if (check_rate == ACL_CHECK_HITS) { acl_hit_t * hit, **place; - int64 now; - timeout_t tv; + time_usec_t now_usec; res = elm->ha_flag; - get_real_time (&tv); - now = ((int64)tv.to_sec * 1000000) + (int64) tv.to_usec; - /*now = get_msec_real_time ();*/ + now_usec = get_usec_real_time (); + mutex_enter (http_acl_mtx); loc_hash = elm->ha_hits; #ifdef DEBUG @@ -394,7 +392,7 @@ static int http_acl_check_rate (ws_acl_t * elm, caddr_t name, int check_rate, in hit = *place; - elapsed = (float) (now - hit->ah_initial) / 1000000; + elapsed = (float) (now_usec - hit->ah_initial) / 1000000; if (elapsed < 1) elapsed = 0.5; rate = (float)((hit->ah_count + 1) / elapsed); hit->ah_avg = rate; @@ -414,7 +412,7 @@ static int http_acl_check_rate (ws_acl_t * elm, caddr_t name, int check_rate, in memset (hit, 0, sizeof (acl_hit_t)); id_hash_set (loc_hash, (caddr_t) &new_name, (caddr_t) &hit); } - if (!hit->ah_initial) hit->ah_initial = now; + if (!hit->ah_initial) hit->ah_initial = now_usec; hit->ah_count ++; if (hit_ret) *hit_ret = hit; diff --git a/libsrc/Wi/http.h b/libsrc/Wi/http.h index 6152955057..33c9dc20ed 100644 --- a/libsrc/Wi/http.h +++ b/libsrc/Wi/http.h @@ -178,7 +178,7 @@ typedef struct ws_acl_s typedef struct acl_hit_s { - int64 ah_initial; /*!< initial time */ + time_usec_t ah_initial; /*!< initial time */ long ah_count; /*!< hits since initial */ float ah_avg; /*!< for statistics */ } acl_hit_t; From fc1d2baefa61c66691cfcc9fe60f43f9c1f2ebcb Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 3 Sep 2024 14:19:58 +0000 Subject: [PATCH 19/94] Added support for custom %T and %D http log format The following format codes are added: %T time to serve the request in seconds %D time to serve the request in microseconds %{s}T time to serve the request in seconds (same as %T) %{ms}T time to serve the request in milliseconds %{us}T time to serve the request in microseconds (same as %D) %{rt}T time to serve the request using CPU timestamp counter --- libsrc/Wi/http.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index 0ca861fde6..97bb8712ab 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -991,6 +991,8 @@ log_info_http (ws_connection_t * ws, const char * code, OFF_T clen) const char * str; int volatile len; int http_resp_code = 0; + client_connection_t *cli = ws->ws_cli; + time_usec_t time_usec_now = 0; time_t now; struct tm *tm; #if defined (HAVE_LOCALTIME_R) && !defined (WIN32) @@ -1081,8 +1083,36 @@ log_info_http (ws_connection_t * ws, const char * code, OFF_T clen) dk_free_tree (connvar_value); } break; - default: - WS_LOG_ERROR; + case 'T': + if (!time_usec_now) + time_usec_now = get_usec_real_time (); + if (!strcmp (format, "s")) + { + snprintf (tmp, sizeof (tmp), "%lld", (time_usec_now - cli->cli_start_time_usec) / 1000000UL); + session_buffered_write (ses, tmp, strlen (tmp)); + break; + } + else if (!strcmp (format, "ms")) + { + snprintf (tmp, sizeof (tmp), "%lld", (time_usec_now - cli->cli_start_time_usec) / 1000UL); + session_buffered_write (ses, tmp, strlen (tmp)); + break; + } + else if (!strcmp (format, "us")) + { + snprintf (tmp, sizeof (tmp), "%lld", (time_usec_now - cli->cli_start_time_usec)); + session_buffered_write (ses, tmp, strlen (tmp)); + break; + } + else if (!strcmp (format, "rt")) + { + snprintf (tmp, sizeof (tmp), "%lld", rdtsc () - cli->cli_cl_start_ts); + session_buffered_write (ses, tmp, strlen (tmp)); + break; + } + /* no break; */ + default: + WS_LOG_ERROR; } goto get_next; } @@ -1109,8 +1139,19 @@ log_info_http (ws_connection_t * ws, const char * code, OFF_T clen) (tm->tm_mday), monthname [month - 1], year, tm->tm_hour, tm->tm_min, tm->tm_sec, TZ_TO_HHMM(dt_local_tz_for_logs)); } break; + case 'T': + if (!time_usec_now) + time_usec_now = get_usec_real_time (); + snprintf (tmp, sizeof (tmp), "%lld", (time_usec_now - cli->cli_start_time_usec) / 1000000UL); + break; + case 'D': + if (!time_usec_now) + time_usec_now = get_usec_real_time (); + snprintf (tmp, sizeof (tmp), "%lld", time_usec_now - cli->cli_start_time_usec); + break; case 'r': - snprintf (tmp, sizeof (tmp), "%.*s", tmp_len, ws->ws_req_line ? ws->ws_req_line : "GET unspecified"); + snprintf (tmp, sizeof (tmp), "%.*s", tmp_len, ws->ws_req_line + && ws->ws_method != WM_ERROR ? ws->ws_req_line : "GET unspecified"); strcat_ck (tmp, ws->ws_proto); tmp [sizeof (tmp) - 1] = 0; break; From 8da52432cda953538aee20af87213aad57871ff7 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Tue, 3 Sep 2024 14:21:01 +0000 Subject: [PATCH 20/94] Fixed key estimate on single only --- libsrc/Wi/sparql.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libsrc/Wi/sparql.sql b/libsrc/Wi/sparql.sql index 7d78e01350..2b035d6093 100644 --- a/libsrc/Wi/sparql.sql +++ b/libsrc/Wi/sparql.sql @@ -8185,7 +8185,10 @@ create function DB.DBA.SPARUL_CLEAR (in graph_iris any, in inside_sponge integer repl_text ('__rdf_repl', sprintf ('sparql define input:storage "" define sql:log-enable %d clear graph iri ( ?? )', lm), g_iri); } declare exit handler for sqlstate '*' { log_enable (old_log_mode, 1); resignal; }; - kesg := __max (1, key_estimate('DB.DBA.RDF_QUAD', 'RDF_QUAD_GS', iri_to_id (g_iri, 0))); + if (1 = sys_stat ('cl_run_local_only')) + kesg := __max (1, key_estimate('DB.DBA.RDF_QUAD', 'RDF_QUAD_GS', iri_to_id (g_iri, 0))); + else + kesg := 10000; if (kesg <= 1000) { -- if graph is relatively small From 7c1cdcd41ab47deb73eed84c1826ccf7e1394d24 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Tue, 3 Sep 2024 14:21:43 +0000 Subject: [PATCH 21/94] Added put/delete http methods --- libsrc/Wi/http.c | 6 ++++++ libsrc/Wi/http.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index 97bb8712ab..a8e86591c3 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -1589,6 +1589,8 @@ ws_path_and_params (ws_connection_t * ws) case 3: if (0 == memcmp (ws->ws_req_line, "GET", 3)) ws->ws_method = WM_GET; + if (0 == memcmp (ws->ws_req_line, "PUT", 3)) + ws->ws_method = WM_PUT; break; case 4: if (0 == memcmp (ws->ws_req_line, "POST", 4)) @@ -1600,6 +1602,10 @@ ws_path_and_params (ws_connection_t * ws) else if (0 == memcmp (ws->ws_req_line, "MPUT", 4)) ws->ws_method = WM_URIQA_MPUT; break; + case 6: + if (0 == memcmp (ws->ws_req_line, "DELETE", 6)) + ws->ws_method = WM_DELETE; + break; case 7: if (0 == memcmp (ws->ws_req_line, "MDELETE", 7)) ws->ws_method = WM_URIQA_MDELETE; diff --git a/libsrc/Wi/http.h b/libsrc/Wi/http.h index 33c9dc20ed..950d5207b8 100644 --- a/libsrc/Wi/http.h +++ b/libsrc/Wi/http.h @@ -204,6 +204,8 @@ extern long tws_bad_request; #define WM_ERROR 4 /*!< comment out this definition to stop sending 401 Bad request */ #define WM_HEAD 5 #define WM_OPTIONS 6 +#define WM_PUT 7 +#define WM_DELETE 8 #define WM_URIQA_FIRST 100 #define WM_URIQA_MGET 100 From f54cc3665fee192d2bdca59dc99bbf0ccbdc51d0 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 3 Sep 2024 14:22:25 +0000 Subject: [PATCH 22/94] Fixed issue re-initializing the pconfig struct --- libsrc/util/ncfg.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/libsrc/util/ncfg.c b/libsrc/util/ncfg.c index 1df2b7c948..4c4ba0c27d 100644 --- a/libsrc/util/ncfg.c +++ b/libsrc/util/ncfg.c @@ -142,14 +142,20 @@ _cfg_freeent (PCFGENTRY e) static int _cfg_freeimage (PCONFIG pconfig) { - char *saveName; - OPL_MUTEX_DECLARE (saveMtx); - PCFGENTRY e; u_int i; + /* + * Reset flag so cfg_valid fails + */ + pconfig->flags = 0; + + /* + * Free allocated allocated content + */ if (pconfig->image) free (pconfig->image); + if (pconfig->entries) { e = pconfig->entries; @@ -158,11 +164,20 @@ _cfg_freeimage (PCONFIG pconfig) free (pconfig->entries); } - saveName = pconfig->fileName; - saveMtx = pconfig->mtx; - memset (pconfig, 0, sizeof (TCONFIG)); - pconfig->fileName = saveName; - pconfig->mtx = saveMtx; + /* + * Partially re-initialize struct + * + * Dont reset the fileName and mtx fields + */ + pconfig->image = pconfig->entries = NULL; + pconfig->dirty = 0; + pconfig->size = 0L; + pconfig->mtime = 0L; + pconfig->numEntries = 0; + pconfig->maxEntries = 0; + pconfig->cursor = 0; + pconfig->section = pconfig->id = pconfig->value = pconfig->comment = NULL; + memset (pconfig->digest, 0, sizeof (digest_t)); return 0; } From f7ae56264fd6826849b226ce56f46829fa32f32f Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Wed, 4 Sep 2024 08:28:43 +0000 Subject: [PATCH 23/94] Fixed distribution of vadpacker --- binsrc/Makefile.am | 13 +++++++++++-- configure.ac | 1 - 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/binsrc/Makefile.am b/binsrc/Makefile.am index dbfc2bd6ff..f1b2ee0bca 100644 --- a/binsrc/Makefile.am +++ b/binsrc/Makefile.am @@ -19,7 +19,7 @@ # # -SUBDIRS = vadpacker dav mono virtuoso tests rdf_mappers driver maildrop sqldoc hosting graphql bpel fct tutorial conductor samples vsp ws sync vspx vad cached_resources virtodbc virtoledb virtuoso_sink xddl VirtuosoClient.Net oat isparql jena jena2 jena3 jena4 sesame sesame2 sesame3 sesame4 redland hibernate dbpedia rdb2rdf rdf4j rdf4j_4 websocket +SUBDIRS = dav mono virtuoso tests rdf_mappers driver maildrop sqldoc hosting graphql bpel fct tutorial conductor samples vsp ws sync vspx vad cached_resources virtodbc virtoledb virtuoso_sink xddl VirtuosoClient.Net oat isparql jena jena2 jena3 jena4 sesame sesame2 sesame3 sesame4 redland hibernate dbpedia rdb2rdf rdf4j rdf4j_4 websocket # ---------------------------------------------------------------------- @@ -27,4 +27,13 @@ SUBDIRS = vadpacker dav mono virtuoso tests rdf_mappers driver maildrop sqldoc h # Additional files to distribute # # ---------------------------------------------------------------------- -EXTRA_DIST = config/ccdefs.c config/libxml.m4 +EXTRA_DIST = \ + $(srcdir)/config/ccdefs.c \ + $(srcdir)/config/libxml.m4 \ + $(srcdir)/vadpacker/*.py \ + $(srcdir)/vadpacker/.gitignore \ + $(srcdir)/vadpacker/AUTHORS \ + $(srcdir)/vadpacker/ChangeLog \ + $(srcdir)/vadpacker/COPYING \ + $(srcdir)/vadpacker/NEWS \ + $(srcdir)/vadpacker/README diff --git a/configure.ac b/configure.ac index db9e904d11..67be67cf41 100644 --- a/configure.ac +++ b/configure.ac @@ -3270,7 +3270,6 @@ AC_CONFIG_FILES([ binsrc/tutorial/web/Makefile binsrc/tutorial/xml/Makefile binsrc/vad/Makefile - binsrc/vadpacker/Makefile binsrc/virtodbc/Makefile binsrc/virtoledb/Makefile binsrc/VirtuosoClient.Net/Makefile From 9f0cdf120914b71c6d42a3d3b4ebc85b84a027c8 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Wed, 4 Sep 2024 08:38:49 +0000 Subject: [PATCH 24/94] Added temp space usage in db activity --- libsrc/Wi/hash.c | 4 ++++ libsrc/Wi/sqlnode.h | 1 + libsrc/Wi/srvstat.c | 11 ++++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libsrc/Wi/hash.c b/libsrc/Wi/hash.c index 069a5d0351..724931a9ca 100644 --- a/libsrc/Wi/hash.c +++ b/libsrc/Wi/hash.c @@ -459,6 +459,8 @@ hi_bp_set (hash_index_t * hi, it_cursor_t *itc, uint32 code, dp_addr_t dp, short itc->itc_ltrx->lt_error = LTE_NO_DISK; itc_bust_this_trx (itc, &hb_buf, ITC_BUST_THROW); } + if (itc->itc_ltrx && itc->itc_ltrx->lt_client) + itc->itc_ltrx->lt_client->cli_activity.da_temp_pages++; HI_BUCKET_PTR_PAGE (hi, code) = hb_buf->bd_page; memset (hb_buf->bd_buffer + DP_DATA, 0, PAGE_DATA_SZ); set_dbg_fprintf ((stdout, "hi_bp_set:new bp: page=%lu\n", (unsigned long) hb_buf->bd_page)); @@ -929,6 +931,8 @@ itc_ha_disk_row (it_cursor_t * itc, buffer_desc_t * buf, hash_area_t * ha, caddr itc->itc_ltrx->lt_error = LTE_NO_DISK; itc_bust_this_trx (itc, &buf, ITC_BUST_THROW); } + if (itc->itc_ltrx && itc->itc_ltrx->lt_client) + itc->itc_ltrx->lt_client->cli_activity.da_temp_pages++; if (!tree->it_hash_first) tree->it_hash_first = new_buf->bd_page; if (hash_buf) diff --git a/libsrc/Wi/sqlnode.h b/libsrc/Wi/sqlnode.h index c8ee3991d9..69d0c47592 100644 --- a/libsrc/Wi/sqlnode.h +++ b/libsrc/Wi/sqlnode.h @@ -1733,6 +1733,7 @@ typedef struct db_activity_s int da_batch_size_request; char da_anytime_result; /* if set, this means the recipient has run out of time and should return an answer */ char da_trans_partial; /* if transitive ops incomplete due to time or mem limit */ + int64 da_temp_pages; } db_activity_t; diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index 68bd79305b..e89b2ef150 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -4530,7 +4530,7 @@ rep_num_scale (double n, char ** scale_ret, int is_base_2) void da_string (db_activity_t * da, char * out, int len) { - char *rans, *seqs, *rs, * bs, *ms, *same_segs, *same_pages, *same_pars, *specs, *qps; + char *rans, *seqs, *rs, * bs, *ms, *same_segs, *same_pages, *same_pars, *specs, *qps, *tps; double ran = rep_num_scale (da->da_random_rows, &rans, 0); double seq = rep_num_scale (da->da_seq_rows, &seqs, 0); double same_seg = rep_num_scale (da->da_same_seg, &same_segs, 0); @@ -4541,10 +4541,11 @@ da_string (db_activity_t * da, char * out, int len) double bytes = rep_num_scale (da->da_cl_bytes, &bs, 1); double msgs = rep_num_scale (da->da_cl_messages, &ms, 0); double qp = rep_num_scale (da->da_qp_thread, &qps, 0); - snprintf (out, len, "%6.4g%s rnd %6.4g%s seq %6.4g%s same seg %6.4g%s same pg %6.4g%s same par %6.4g%s disk %6.4g%s spec disk %6.4g%sB / %6.4g%s messages %6.4g%s fork", + double tp = rep_num_scale (da->da_temp_pages, &tps, 0); + snprintf (out, len, "%6.4g%s rnd %6.4g%s seq %6.4g%s same seg %6.4g%s same pg %6.4g%s same par %6.4g%s disk %6.4g%s spec disk %6.4g%sB / %6.4g%s messages %6.4g%s fork %6.4g%s temp", ran, rans, seq, seqs, same_seg, same_segs, same_page, same_pages, same_par, same_pars, - reads, rs, spec_reads, specs, bytes, bs, msgs, ms, qp, qps); + reads, rs, spec_reads, specs, bytes, bs, msgs, ms, qp, qps, tp, tps); } @@ -4562,9 +4563,9 @@ bif_db_activity (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) : &qi->qi_client->cli_activity; caddr_t res; if ((flag & 1)) - res = list (9, box_num (da->da_random_rows), box_num (da->da_seq_rows), box_num (da->da_lock_waits), + res = list (10, box_num (da->da_random_rows), box_num (da->da_seq_rows), box_num (da->da_lock_waits), box_num (da->da_lock_wait_msec), box_num (da->da_disk_reads), box_num (da->da_spec_disk_reads), - box_num (da->da_cl_messages), box_num (da->da_cl_bytes), box_num (da->da_same_seg)); + box_num (da->da_cl_messages), box_num (da->da_cl_bytes), box_num (da->da_same_seg), box_num(da->da_temp_pages)); else { char txt[200]; From 9cc7f241c5fd58bb5fae2dcc0a508e334fd70d1c Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Wed, 4 Sep 2024 08:29:41 +0000 Subject: [PATCH 25/94] Added support for restricting the size of the tempdb --- libsrc/Wi/disk.c | 24 ++++++++++++++++++++++++ libsrc/Wi/extent.c | 4 +++- libsrc/Wi/hash.c | 2 ++ libsrc/Wi/page.c | 6 ++++++ libsrc/Wi/space.c | 2 +- libsrc/Wi/srvstat.c | 2 ++ libsrc/Wi/wifn.h | 1 + 7 files changed, 39 insertions(+), 2 deletions(-) diff --git a/libsrc/Wi/disk.c b/libsrc/Wi/disk.c index 980d128509..56b3b284de 100644 --- a/libsrc/Wi/disk.c +++ b/libsrc/Wi/disk.c @@ -738,6 +738,30 @@ DBG_NAME (it_temp_free) (DBG_PARAMS index_tree_t * it) return 1; } +void +it_temp_write_cancel (index_tree_t * tree) +{ + int inx; + ptrlong dp; + buffer_desc_t * buf; + dk_hash_iterator_t hit; + if (KI_TEMP != tree->it_key->key_id) + GPF_T1 ("it_temp_write_cancel is supposed to use with temp tree only"); + for (inx = 0; inx < IT_N_MAPS; inx++) + { + it_map_t * itm = &tree->it_maps[inx]; + dk_hash_iterator (&hit, &itm->itm_dp_to_buf); + while (dk_hit_next (&hit, (void**) &dp, (void **) &buf)) + { + if (!BUF_WIRED(buf)) + continue; + if (buf->bd_iq) + buf_cancel_write (buf); + BD_SET_IS_WRITE (buf, 0); + } + } +} + page_map_t * map_allocate (ptrlong sz) diff --git a/libsrc/Wi/extent.c b/libsrc/Wi/extent.c index 78d2774674..d4ce5fbc03 100644 --- a/libsrc/Wi/extent.c +++ b/libsrc/Wi/extent.c @@ -257,7 +257,7 @@ dbs_extend_ext_cache (dbe_storage_t * dbs) } int32 dbs_check_extent_free_pages = 1; - +int64 dbs_max_temp_db_pages = 0; int dbs_file_extend (dbe_storage_t * dbs, extent_t ** new_ext_ret, int is_in_sys_em) @@ -269,6 +269,8 @@ dbs_file_extend (dbe_storage_t * dbs, extent_t ** new_ext_ret, int is_in_sys_em) ASSERT_IN_DBS (dbs); if (dbf_no_disk) return 0; + if (dbs_max_temp_db_pages > EXTENT_SZ && DBS_TEMP == dbs->dbs_type && (dbs->dbs_n_pages + EXTENT_SZ) > dbs_max_temp_db_pages) + return 0; if (dbs->dbs_disks) { int quota = DBS_ELASTIC == dbs->dbs_type ? 8 * EXTENT_SZ : EXTENT_SZ; diff --git a/libsrc/Wi/hash.c b/libsrc/Wi/hash.c index 724931a9ca..bcc4c4115e 100644 --- a/libsrc/Wi/hash.c +++ b/libsrc/Wi/hash.c @@ -2438,6 +2438,8 @@ setp_order_row (setp_node_t * setp, caddr_t * qst) { /* this node may be invoked from inside itc_row_check. If so and there is a trx error, come out as an error, not as RST_DEADLOCK. * This will cause itc_next to exit its buffer properly */ + if (LTE_NO_DISK == qi->qi_trx->lt_error) + it_temp_write_cancel (tree); sqlr_resignal (srv_make_trx_error (qi->qi_trx->lt_error, NULL)); } END_FAIL (ins_itc); diff --git a/libsrc/Wi/page.c b/libsrc/Wi/page.c index 13ee177d20..6b54045ce8 100644 --- a/libsrc/Wi/page.c +++ b/libsrc/Wi/page.c @@ -1916,6 +1916,12 @@ pf_rd_append (page_fill_t * pf, row_delta_t * rd, row_size_t * split_after) { extend = it_new_page (pf->pf_itc->itc_tree, pf->pf_org->bd_page, DPF_INDEX, 0, pf->pf_itc); + if (!extend && DBS_TEMP == pf->pf_itc->itc_tree->it_storage->dbs_type) + { + log_error ("Out of disk space for temp table"); + pf->pf_itc->itc_ltrx->lt_error = LTE_NO_DISK; + itc_bust_this_trx (pf->pf_itc, &extend, ITC_BUST_THROW); + } if (!extend) GPF_T1("Can't get page buffer from it_new_page"); if (pf->pf_itc->itc_is_ac) diff --git a/libsrc/Wi/space.c b/libsrc/Wi/space.c index f074ace33e..43eebd3b6b 100644 --- a/libsrc/Wi/space.c +++ b/libsrc/Wi/space.c @@ -234,7 +234,7 @@ it_new_page (index_tree_t * it, dp_addr_t addr, int type, oid_t col_id, if (!physical_dp) { log_error ("Out of disk space for database"); - if (DPF_INDEX == type) + if (DPF_INDEX == type && DBS_TEMP != em->em_dbs->dbs_type) { /* a split must never fail to get a page. Use the remap hold as a backup */ physical_dp = em_new_dp (it->it_extent_map, EXT_REMAP, 0, &has_hold->itc_n_pages_on_hold); diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index e89b2ef150..4c69c466ed 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -331,6 +331,7 @@ long vt_batch_size_limit = 1000000L; /* flags for simulated exceptions */ long dbf_no_disk = 0; +extern int64 dbs_max_temp_db_pages; long dbf_log_no_disk; extern int32 dbf_log_always; extern int32 dbf_no_atomic; @@ -1879,6 +1880,7 @@ dbf_protected_param (stat_desc_t * sd) stat_desc_t dbf_descs [] = { {"dbf_no_disk", &dbf_no_disk, NULL}, + {"dbs_max_temp_db_pages", &dbs_max_temp_db_pages, SD_INT64}, {"dbf_2pc_prepare_wait", &dbf_2pc_prepare_wait, NULL}, {"dbf_2pc_wait", &dbf_2pc_wait, NULL}, {"dbf_branch_transact_wait", &dbf_branch_transact_wait, NULL}, diff --git a/libsrc/Wi/wifn.h b/libsrc/Wi/wifn.h index 7dfa5ff3fc..c9e3bd6937 100644 --- a/libsrc/Wi/wifn.h +++ b/libsrc/Wi/wifn.h @@ -555,6 +555,7 @@ void * pm_get (buffer_desc_t * buf, size_t sz); index_tree_t *DBG_NAME (it_allocate) (DBG_PARAMS dbe_storage_t *); index_tree_t *DBG_NAME (it_temp_allocate) (DBG_PARAMS dbe_storage_t *); int DBG_NAME (it_temp_free) (DBG_PARAMS index_tree_t * it); /*!< \returns zero is the \c it is actually kept, just with smaller it_ref_count; non-zero means real free */ +void it_temp_write_cancel (index_tree_t *tree); #ifdef MALLOC_DEBUG #define it_allocate(s) dbg_it_allocate (__FILE__, __LINE__, (s)) #define it_temp_allocate(s) dbg_it_temp_allocate (__FILE__, __LINE__, (s)) From 8978714eabc3ee4d82120b8120a8c180afe85190 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Wed, 4 Sep 2024 08:40:50 +0000 Subject: [PATCH 26/94] Added new MaxTempDBPages setting to virtuoso.ini This setting limits the maximum size of the TempDatabase file on disk to a fixed amount of used pages. If the engine detects this limit has been exceeded, the query that was filling up the TempDatabase will return an error and its transaction is killed. [TempDatabase] MaxTempDBPages = 50G ; Limit size of the TempDatabase to 50GB on disk Values ending in B, K, M, G will be converted to number of pages that can fit into that size. Plain values are interpreted as number of pages. For example 50G = (50 * 1024 * 1024 * 1024) / 8192 = 6553600 pages The default value is 0 which means that the TempDatabase file can fill up the whole disk partition it is located on. --- binsrc/samples/demo/default-virtuoso.ini | 2 +- binsrc/virtuoso/viconfig.c | 13 +++++++++++++ libsrc/Wi/wifn.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/binsrc/samples/demo/default-virtuoso.ini b/binsrc/samples/demo/default-virtuoso.ini index 18ac607725..cc1d49c99c 100644 --- a/binsrc/samples/demo/default-virtuoso.ini +++ b/binsrc/samples/demo/default-virtuoso.ini @@ -39,7 +39,7 @@ DatabaseFile = @DBDIR@/@DBNAME@-temp.db TransactionFile = @DBDIR@/@DBNAME@-temp.trx MaxCheckpointRemap = 2000 Striping = 0 - +;MaxTempDBPages = 50G ; Limit size of the TempDatabase file to 50GB on disk ; ; Server parameters diff --git a/binsrc/virtuoso/viconfig.c b/binsrc/virtuoso/viconfig.c index e5aa3ae3ea..7aff436c2e 100644 --- a/binsrc/virtuoso/viconfig.c +++ b/binsrc/virtuoso/viconfig.c @@ -2380,6 +2380,19 @@ new_dbs_read_cfg (dbe_storage_t * dbs, const char *ignore_file_name) else if (dbs->dbs_type == DBS_RECOVER) section = "Database"; + if (DBS_TEMP == dbs->dbs_type) + { + char *str; + unsigned long c_pages; + + if (cfg_getstring (pconfig, section, "MaxTempDBPages", &str) == -1 + || cfg_parse_size_with_modifier (str, NULL, NULL, &c_pages) == -1 ) + c_pages = 0; + if (c_pages < 2 * EXTENT_SZ) + c_pages = 0; + dbs_max_temp_db_pages = c_pages; + } + if (cfg_getstring (pconfig, section, "DatabaseFile", &c_database_file) == -1) c_database_file = s_strdup (setext (prefix, s_db, EXT_SET)); diff --git a/libsrc/Wi/wifn.h b/libsrc/Wi/wifn.h index c9e3bd6937..16da495fdf 100644 --- a/libsrc/Wi/wifn.h +++ b/libsrc/Wi/wifn.h @@ -1360,6 +1360,7 @@ typedef enum { SQW_OFF, SQW_ON, SQW_ERROR } sqw_mode; extern sqw_mode sql_warning_mode; extern long sql_warnings_to_syslog; extern long temp_db_size; +extern int64 dbs_max_temp_db_pages; void srv_set_cfg( From 85115b423d837cc796d8c991db33e37f8d01eded Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Wed, 4 Sep 2024 09:17:14 +0000 Subject: [PATCH 27/94] Added support for WKT rendition --- binsrc/fct/rdfdesc/description.vsp | 21 ++++++++++++++++++++- binsrc/fct/sql/description.sql | 28 +++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/binsrc/fct/rdfdesc/description.vsp b/binsrc/fct/rdfdesc/description.vsp index e55b700ae9..6e61e6c68c 100644 --- a/binsrc/fct/rdfdesc/description.vsp +++ b/binsrc/fct/rdfdesc/description.vsp @@ -69,6 +69,7 @@ declare auto_sponge_on_empty_graph int; declare q_txt any; declare safetolink integer; + declare jsses any; set http_charset='utf-8'; { @@ -83,6 +84,7 @@ err := null; deadl := 0; + jsses := null; declare exit handler for sqlstate '40001' { rollback work; @@ -497,6 +499,14 @@ again: + + + @@ -757,7 +767,7 @@ if (_subject <> '') { curr_pred := pred; curr_flag := FLAG; } - vis := b3s_http_print_r (OBJECT, sid, PRED, langs, 1, all_langs, _from, FLAG); + vis := b3s_http_print_r (OBJECT, sid, PRED, langs, 1, all_langs, _from, FLAG, jsses); nxt1:; inx := inx + 1; skip:; @@ -849,6 +859,15 @@ if (_subject <> '') { + '); + http (''); + } + ?>

diff --git a/binsrc/fct/sql/description.sql b/binsrc/fct/sql/description.sql index c64095830c..63e5c360f9 100644 --- a/binsrc/fct/sql/description.sql +++ b/binsrc/fct/sql/description.sql @@ -887,10 +887,11 @@ create procedure b3s_o_is_img (in x any) ; create procedure -b3s_http_print_r (in _object any, in sid varchar, in prop any, in langs any, in rel int := 1, in acc any := null, in _from varchar := null, in flag int := 0) +b3s_http_print_r (in _object any, in sid varchar, in prop any, in langs any, in rel any, in acc any, in _from varchar, in flag int, inout js any) { declare lang, rdfs_type, rdfa, visible any; declare robotsrel varchar; + declare obj_id int; if (_object is null) return; @@ -926,10 +927,35 @@ again: if (__tag (_object) = 246) { declare dat any; + obj_id := rdf_box_ro_id (_object); dat := __rdf_sqlval_of_obj (_object, 1); _object := dat; goto again; } + else if (prop = 'http://www.opengis.net/ont/geosparql#asWKT' and __proc_exists ('GEOS getCentroid',2) is not null) + { + declare cent varchar; + http (sprintf ('
', obj_id)); + if (js is null) + { + js := string_output (); + http ('var raster = new ol.layer.Tile({ source: new ol.source.OSM() });\n', js); + http ('var format = new ol.format.WKT();\n', js); + + } + cent := "GEOS getCentroid"(ST_GeomFromEWKT(cast (_object as varchar))); + http (sprintf ('var wkt_%d = "', obj_id), js); http_value (_object, null, js); http ('";\n', js); + http (sprintf ('var cent_%d = "%s";\n', obj_id, cast (cent as varchar)), js); + http (sprintf ('var feature_%d = format.readFeature(wkt_%d);\n', obj_id, obj_id), js); + http (sprintf ('feature_%d.getGeometry().transform("EPSG:4326", "EPSG:3857");\n', obj_id), js); + http (sprintf ('var centerXY_%d = format.readGeometry(cent_%d).transform("EPSG:4326", "EPSG:3857").getCoordinates();\n', obj_id, obj_id), js); + http (sprintf ('var vector_%d = new ol.layer.Vector({ source: new ol.source.Vector({ features: [feature_%d] }) });\n', obj_id, obj_id), js); + http (sprintf ('var map_%d = new ol.Map({ layers: [raster, vector_%d],target:"map_%d",view:new ol.View({center: centerXY_%d, zoom: 6 })});\n', + obj_id, obj_id, obj_id, obj_id), js); + http (sprintf ('', rdfa)); + http_value (_object); + http (''); + } else if (__tag (_object) = 243 or (isstring (_object) and (__box_flags (_object)= 1 or _object like 'nodeID://%' or _object like 'http://%' or _object like 'https://%'))) { declare _url, p_t any; From 71d6c19e7e0be377e8946e3166c3674959b7d392 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Wed, 4 Sep 2024 09:21:25 +0000 Subject: [PATCH 28/94] Fixed make 'x_content > iframe' content resizable --- binsrc/fct/css/default.css | 2 ++ binsrc/fct/css/style.css | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/binsrc/fct/css/default.css b/binsrc/fct/css/default.css index c85af484a3..5e6ed78bb9 100644 --- a/binsrc/fct/css/default.css +++ b/binsrc/fct/css/default.css @@ -614,3 +614,5 @@ a.desc_permalink { font-size: 9pt; font-weight: normal } img.dicon { border-width:0; height:20px; vertical-align: middle; } +div.content.embedded > iframe { resize: auto; } +div.content.embedded { resize: auto; overflow: auto; } diff --git a/binsrc/fct/css/style.css b/binsrc/fct/css/style.css index 738e91ca12..3d9edcfa76 100644 --- a/binsrc/fct/css/style.css +++ b/binsrc/fct/css/style.css @@ -74,4 +74,3 @@ a.rdf_source img { vertical-align: middle;margin-right: 5px;} #ft_r { float: right;} #ft_l label { margin-right: 5px;} -div.content.embedded { padding: 0.25em; height: 105%; margin-bottom: 1em; display: block; float: none; clear: both; } From bdba38c170d47e86ded19fb2a37f1c5519f85c93 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Wed, 4 Sep 2024 09:23:09 +0000 Subject: [PATCH 29/94] Updated FCT vad version --- binsrc/fct/vad_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binsrc/fct/vad_version b/binsrc/fct/vad_version index 0ffd6fbb1a..cc1fbc7583 100644 --- a/binsrc/fct/vad_version +++ b/binsrc/fct/vad_version @@ -1 +1 @@ -1.16.118 +1.16.119 From f8a5e6ba5c8a3571d009c5cd4d2bb492d53c991e Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 23 Sep 2024 15:25:29 +0000 Subject: [PATCH 30/94] Fixed issue when there are no more inits to skip --- libsrc/Wi/rdfinf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/Wi/rdfinf.c b/libsrc/Wi/rdfinf.c index a1cc3e5be4..718f4e2520 100644 --- a/libsrc/Wi/rdfinf.c +++ b/libsrc/Wi/rdfinf.c @@ -2513,7 +2513,7 @@ data_source_t * qn_skip_inits (data_source_t * qn) { data_source_t * next; - while ((next = qn_next (qn))) + while (qn && (next = qn_next (qn))) { if (!IS_QN (qn, hash_fill_node_input)) break; From d5a04b1caf9b5c01717b8e62c74c843dcfcd4714 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 23 Sep 2024 15:31:39 +0000 Subject: [PATCH 31/94] Fixed DAV escape href should escape apos --- libsrc/Wi/dks_esc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/Wi/dks_esc.c b/libsrc/Wi/dks_esc.c index adc646bbdd..0cdbcb0686 100644 --- a/libsrc/Wi/dks_esc.c +++ b/libsrc/Wi/dks_esc.c @@ -100,7 +100,7 @@ dks_charclass_props_t dks_charclasses['R'+1-'>'] = { /* F 0x0D */ {0 ,SOAPCR ,LATTICE,LATTICE,0 ,0 ,PCT ,0 ,PCT ,PCT ,BSLASHC,BSLASHC,BSLAU8 ,BSLASHC,BSLASHC,BSLASHC,BSLASHC,BSLAU8 ,BSLASHC,BSLASHC,BAD }, /* G " */ {0 ,QUOT ,0 ,QUOT ,0 ,0 ,PCT ,PCT ,PCT ,PCT ,0 ,BSLASHC,BSLAU8 ,0 ,BSLASHC,QUOT ,BSLASHC,BSLAU8 ,0 ,BSLASHC,BAD }, /* H & */ {0 ,AMP ,AMPATTR,AMPATTR,0 ,0 ,PCT ,PCT ,PCT ,0 ,0 ,0 ,0 ,0 ,0 ,AMP ,AMP ,AMP ,0 ,0 ,0 }, -/* I ' */ {0 ,LATTICE,LATTICE,0 ,0 ,0 ,PCT ,0 ,0 ,0 ,BSLASHC,0 ,BSLAU8 ,BSLASHC,0 ,BSLASHC,LATTICE,BSLAU8 ,BSLASHC,0 ,0 }, +/* I ' */ {0 ,LATTICE,LATTICE,0 ,0 ,0 ,PCT ,0 ,0 ,PCT ,BSLASHC,0 ,BSLAU8 ,BSLASHC,0 ,BSLASHC,LATTICE,BSLAU8 ,BSLASHC,0 ,0 }, /* J 0x20 */ {0 ,0 ,0 ,0 ,0 ,0 ,PCT ,PCT ,PCT ,PCT ,0 ,0 ,BSLAU8 ,0 ,0 ,0 ,0 ,BSLAU8 ,0 ,0 ,0 }, /* K < */ {0 ,LT ,LTATTR ,LTATTR ,0 ,0 ,PCT ,PCT ,PCT ,PCT ,0 ,0 ,BSLAU8 ,0 ,0 ,LT ,LT ,BSLAU8 ,0 ,0 ,BAD }, /* L > */ {0 ,GT ,GTATTR ,GTATTR ,COMMENT,CDATA ,PCT ,PCT ,PCT ,PCT ,0 ,0 ,BSLAU8 ,0 ,0 ,GT ,GT ,BSLAU8 ,0 ,0 ,BAD }, From a52d25b1dd93afb7c8836da38ddcfcddafe09124 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 23 Sep 2024 15:33:14 +0000 Subject: [PATCH 32/94] Updated version to 7.2.14-rc1 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 67be67cf41..a7985d2ed4 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ AC_PREREQ(2.59) m4_define(vos_major, [7]) m4_define(vos_minor, [2]) m4_define(vos_patch, [14]) -m4_define(vos_devel, [-dev]) +m4_define(vos_devel, [-rc1]) AC_INIT([Virtuoso Open Source Edition (Column Store)], vos_major.vos_minor.vos_patch[]vos_devel, From 439f65eace1ffecad47f3f40594c2eaf3eb5e8a7 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 7 Oct 2024 17:46:06 +0000 Subject: [PATCH 33/94] Fixed issue with generated names longer than 100 characters The GraphQL query generator may compose name over 100 chars, leading to truncated and bad sql. Fixed by making part after 80 chars a sha256 sum. --- binsrc/graphql/graphql.sql | 71 ++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/binsrc/graphql/graphql.sql b/binsrc/graphql/graphql.sql index 37834a3896..5a04734f65 100644 --- a/binsrc/graphql/graphql.sql +++ b/binsrc/graphql/graphql.sql @@ -579,6 +579,20 @@ GQL_DIRECTIVES_CHECK (in directives_list any, inout variables any, inout known_d } ; +create procedure GQL_VAR_NAME(in x any) +{ + declare wb int; + declare pref varchar; + if (length(x) <= 80) + return x; + pref := subseq(x, 0, 80); + wb := strrchr(pref, '·'); + if (wb is not null) + pref := subseq(x, 0, wb); + return concat (pref,'·',subseq (bin2hex (xenc_digest (x, 'sha256')), 0, 10)); +} +; + create procedure GQL_DIECTIVES_APPLY (in var_name varchar, in directives any, inout variables any, inout tp varchar, inout sql_table_option varchar, inout filter_exp varchar, inout graph_exp varchar) @@ -644,6 +658,7 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, declare i, j int; declare elm, args, directives any; declare var_name, var_name_only varchar; + declare vn, vno, pn varchar; declare sql_table_option, filter_exp, graph_exp varchar; if (not isvector (tree)) @@ -664,6 +679,7 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, { parent_cls := parent[0]; parent_name := parent[1]; + pn := GQL_VAR_NAME (parent_name); parent_prop := parent[2]; prefix := parent_name || '·'; } @@ -673,6 +689,8 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, field_type := tree[5]; var_name_only := var_name := tree[1]; var_name := concat (prefix, var_name); + vno := GQL_VAR_NAME (var_name_only); + vn := GQL_VAR_NAME (var_name); local_filter := ''; tree := tree[3]; if ((isvector (tree) or parent_name is null) and var_name <> '__typename') @@ -729,21 +747,22 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, var_name <> '__schema' and not (gqt_is_list (cls_type)) and parent_cls is null and not isvector (args)) signal ('GQLAR', sprintf ('The field `%s` is an Object and no parent field or arguments.', var_name_only)); - GQL_DIECTIVES_APPLY (var_name, directives, variables, cls_type, sql_table_option, filter_exp, graph_exp); + GQL_DIECTIVES_APPLY (vn, directives, variables, cls_type, sql_table_option, filter_exp, graph_exp); dict_put (dict, var_name, cls_type); parent := vector (iri_to_id (cls), var_name, null); if (parent_cls is null and var_name <> '__type') - http (sprintf ('%s ?%s a <%s> %s. %s\n', graph_exp, var_name, cls, sql_table_option, filter_exp), patterns); + http (sprintf ('%s ?%s a <%s> %s. %s\n', graph_exp, vn, cls, sql_table_option, filter_exp), patterns); else if (parent_cls is null and var_name = '__type') - http (sprintf (' ?%s a [] . \n', var_name), patterns); + http (sprintf (' ?%s a [] . \n', vn), patterns); if (parent_name is null) - http (sprintf (' :data :%s ?%s . \n', var_name, var_name), triples); + http (sprintf (' :data :%s ?%s . \n', var_name, vn), triples); } if (gql_args (args)) { declare arg_name, arg_value, expression, neg, iri_given any; declare arg_iid, fld_iid iri_id_8; + declare an varchar; iri_given := 0; fld_iid := GQL_IID (var_name_only); @@ -752,6 +771,7 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, { arg_name := args[j]; arg_value := args[j + 1]; + an := GQL_VAR_NAME (arg_name); if (gql_var (arg_value)) arg_value := get_keyword (arg_value[1], variables, NULL); arg_iid := GQL_IID (arg_name); @@ -765,18 +785,18 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, ftx := DB.DBA.FTI_MAKE_SEARCH_STRING (arg_value); if (ftx is null) signal ('GQLFX', sprintf ('Can not search "%s" with an empty pattern', var_name)); - http (sprintf (' ?%s ?%s·search ?%s . \n', var_name, arg_name, arg_name), patterns); - http (sprintf (' FILTER (bif:contains (?%s, \'%s\')) \n', arg_name, ftx), vals); + http (sprintf (' ?%s ?%s·search ?%s . \n', vn, an, an), patterns); + http (sprintf (' FILTER (bif:contains (?%s, \'%s\')) \n', an, ftx), vals); } else if (arg_name = 'iri') { - http (sprintf (' FILTER (?%s = <%s>) \n', var_name, arg_value), vals); + http (sprintf (' FILTER (?%s = <%s>) \n', vn, arg_value), vals); if (for_update and id_prop is not null) signal ('GQLSX', '`ID` and `iri` arguments conflict for update operation'); iri_given := 1; } else if (arg_name = 'lang') -- similarly we may add various functions - local_filter := concat (local_filter, sprintf (' FILTER (lang(?%s) = \'%s\') \n', var_name, arg_value)); + local_filter := concat (local_filter, sprintf (' FILTER (lang(?%s) = \'%s\') \n', vn, arg_value)); else { declare xsd_type varchar; @@ -826,16 +846,17 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, signal ('GQLSX', '`ID` and `iri` arguments conflict for update operation'); arg_name := concat (prefix, var_name_only, '·', arg_name); + an := GQL_VAR_NAME (arg_name); expression := GQL_FUNCTION_EXP (arg_value, neg); - http (sprintf (' ?%s <%s> ?%s . \n', var_name, prop, arg_name), patterns); + http (sprintf (' ?%s <%s> ?%s . \n', vn, prop, an), patterns); if (arg_value is null) - http (sprintf ('FILTER (?%s = rdf:nil) \n', arg_name), vals); + http (sprintf ('FILTER (?%s = rdf:nil) \n', an), vals); else if (expression is not null) { arg_value := arg_value[1][0][2]; if (gql_var (arg_value)) arg_value := get_keyword (arg_value[1], variables, NULL); - http (sprintf ('FILTER (%s %s (?%s, %s)) \n', neg, expression, arg_name, GQL_VAL_PRINT (arg_value, xsd_type)), vals); + http (sprintf ('FILTER (%s %s (?%s, %s)) \n', neg, expression, an, GQL_VAL_PRINT (arg_value, xsd_type)), vals); } else if (gql_expression (arg_value)) { @@ -845,7 +866,7 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, arg_value := arg_value[2]; if (gql_var (arg_value)) arg_value := get_keyword (arg_value[1], variables, NULL); - http (sprintf ('FILTER (%s ?%s %s %s ) \n', neg, arg_name, op, GQL_VAL_PRINT (arg_value, xsd_type)), vals); + http (sprintf ('FILTER (%s ?%s %s %s ) \n', neg, an, op, GQL_VAL_PRINT (arg_value, xsd_type)), vals); } else if (gql_obj (arg_value)) { @@ -859,12 +880,12 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, { declare vlist varchar; vlist := GQL_SQL_ARRAY_STR (arg_value, xsd_type); - http (sprintf (' FILTER (?%s IN %s) \n', arg_name, vlist), vals); + http (sprintf (' FILTER (?%s IN %s) \n', an, vlist), vals); } else if (tp = 'IRI' or gqt_is_obj (tp) or gqt_is_list (tp)) - http (sprintf (' FILTER (?%s = <%s>) \n', arg_name, arg_value), vals); + http (sprintf (' FILTER (?%s = <%s>) \n', an, arg_value), vals); else - http (sprintf (' FILTER (?%s = %s) \n', arg_name, GQL_VAL_PRINT (arg_value, xsd_type)), vals); + http (sprintf (' FILTER (?%s = %s) \n', an, GQL_VAL_PRINT (arg_value, xsd_type)), vals); has_filter := 1; skip_filter:; } @@ -929,24 +950,24 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, if (var_name_only not in ('__typename', 'iri')) { tp := iri_split (tp, null, 0,1); - GQL_DIECTIVES_APPLY (var_name, directives, variables, tp, sql_table_option, filter_exp, graph_exp); + GQL_DIECTIVES_APPLY (vn, directives, variables, tp, sql_table_option, filter_exp, graph_exp); dict_put (dict, var_name, tp); parent [2] := prop; - http (sprintf (' ?%s :%s ?%s . \n', parent_name, var_name, var_name), triples); + http (sprintf (' ?%s :%s ?%s . \n', pn, var_name, vn), triples); if (not has_filter) http (sprintf (' OPTIONAL {%s', graph_exp), patterns); else http (sprintf (' {%s\t', graph_exp), patterns); -- IMPORTANT: make it hash, huge unions exhibit weird SQL engine problem on loop if (connection_get ('__intro') = 1) - http (sprintf (' ?%s <%s> ?%s option (table_option "hash") . \n', parent_name, prop, var_name), patterns); + http (sprintf (' ?%s <%s> ?%s option (table_option "hash") . \n', pn, prop, vn), patterns); else - http (sprintf (' ?%s <%s> ?%s %s. %s\n', parent_name, prop, var_name, sql_table_option, filter_exp), patterns); + http (sprintf (' ?%s <%s> ?%s %s. %s\n', pn, prop, vn, sql_table_option, filter_exp), patterns); -- we filter non literals when not expected, in theory should not be needed, but practice shows different -- do this with config setting and never for introspection if (atoi (registry_get ('graphql-enable-non-object-fitering', '0')) and not(connection_get ('__intro')) and (gqt_is_obj (tp) or gqt_is_list (tp))) - http (sprintf (' FILTER (isIRI (?%s)) . \n', var_name), patterns); + http (sprintf (' FILTER (isIRI (?%s)) . \n', vn), patterns); } else if (var_name_only = '__typename') { @@ -974,19 +995,19 @@ GQL_CONSTRUCT (in g_iid any, in tree any, in variables any, in parent any, } if (sdl_name is not null) - http (sprintf (' ?%s :%s "%s" . \n', parent_name, var_name, sdl_name), triples); + http (sprintf (' ?%s :%s "%s" . \n', pn, var_name, sdl_name), triples); else - http (sprintf (' ?%s :%s `bif:iri_split(coalesce(?%s,""),0,0,1)` . \n', parent_name, var_name, var_name), triples); + http (sprintf (' ?%s :%s `bif:iri_split(coalesce(?%s,""),0,0,1)` . \n', pn, var_name, vn), triples); - http (sprintf (' { ?%s rdf:type ?%s . \n', parent_name, var_name), patterns); + http (sprintf (' { ?%s rdf:type ?%s . \n', pn, vn), patterns); } else { -- no selection, containing field already added to patern, so we just put in results - http (sprintf (' ?%s :%s ?%s . \n', parent_name, var_name, parent_name), triples); + http (sprintf (' ?%s :%s ?%s . \n', pn, var_name, pn), triples); -- IRI ref must be object, the top level is always an S i.e. have no interpunct in name if (var_name_only = 'iri' and strchr (parent_name, '·') is not null) - http (sprintf (' FILTER (isIRI (?%s)) . \n', parent_name), patterns); + http (sprintf (' FILTER (isIRI (?%s)) . \n', pn), patterns); } } -- XXX: currently is disabled as it is very strict type checking, so relax for now From e00a000137d49bb2f7ba4401902b0701cd292322 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 25 Oct 2024 14:09:49 +0000 Subject: [PATCH 34/94] Fixed issue with JSON registered REST services JSON services should return JSON formatted error, not HTML body --- libsrc/Wi/bif_soap.c | 64 +++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c index 1442a33e08..c7159f5433 100644 --- a/libsrc/Wi/bif_soap.c +++ b/libsrc/Wi/bif_soap.c @@ -11355,7 +11355,35 @@ soap_http_params (query_t *qr, caddr_t * in_params, caddr_t * text, caddr_t * er return params; } -#define SOAP_HTTP +static void +ws_rest_handle_error (dk_session_t * ses, char * media_type, caddr_t * err_ret, char * code, int * http_resp_code, soap_ctx_t * ctx, int mode) +{ + char tmp[64]; + char *state, *message; + caddr_t err = err_ret ? *err_ret : NULL; + if (!IS_BOX_POINTER(err)) + return; + state = ERR_STATE (err); + if (!strcmp (state, "VSPRT")) /* service generated error, do not replace with built-in error */ + return; + message = ERR_MESSAGE (err); + if (!mode) /* SOAP like service */ + { + err_ret[0] = ws_soap_error (ses, code, state, message, ctx->soap_version, 0 /* no uddi */, http_resp_code, ctx); + dk_free_tree (err); + } + else if (media_type && strstr (media_type, "json")) /* RESTful services registered to return json */ + { + strses_flush (ses); + *http_resp_code = (code && '3' == code[0]) ? 400 : 500; + snprintf (tmp, sizeof (tmp), "{\"error\":\"%s\",\"code\":\"%s\",\"message\":\"", state, code); + session_buffered_write (ses, tmp, strlen (tmp)); + dks_esc_write (ses, message, strlen (message), CHARSET_UTF8, CHARSET_UTF8, DKS_ESC_JSWRITE_DQ); + session_buffered_write (ses, "\"}", 2); + err_ret[0] = srv_make_new_error ("VSPRT", "SP003", "%s", message); + dk_free_tree (err); + } +} caddr_t ws_soap_http (ws_connection_t * ws) @@ -11425,14 +11453,6 @@ ws_soap_http (ws_connection_t * ws) is_http = (qr->qr_proc_place & SOAP_MSG_HTTP); -#ifndef SOAP_HTTP - if (!is_http) - { - err = srv_make_new_error ("37000", "SOH04", "There is no such procedure"); - goto end; - } -#endif - if (!ws->ws_header) { if (is_http) /* we should do this only when no error */ @@ -11441,13 +11461,11 @@ ws_soap_http (ws_connection_t * ws) qr->qr_proc_alt_ret_type, CHARSET_NAME (charset, "ISO-8859-1")); ws->ws_header = box_dv_short_string (mime_type); } -#ifdef SOAP_HTTP else { snprintf (mime_type, sizeof (mime_type), "Content-Type: text/xml; charset=\"%s\"\r\n", CHARSET_NAME (charset, "ISO-8859-1")); ws->ws_header = box_dv_short_string (mime_type); } -#endif } ctx.literal = (SOAP_MSG_LITERAL & qr->qr_proc_place); pars = soap_http_params (qr, params, &text, &err, &ctx); @@ -11455,16 +11473,7 @@ ws_soap_http (ws_connection_t * ws) { dk_free_tree ((box_t) pars); dk_free_box (text); -#ifdef SOAP_HTTP - if (!is_http) - { - caddr_t err1; - err1 = ws_soap_error (ses, "320", ERR_STATE (err), ERR_MESSAGE (err), ctx.soap_version, 0, - &http_resp_code, &ctx); - dk_free_tree (err); - err = err1; - } -#endif + ws_rest_handle_error (ses, qr->qr_proc_alt_ret_type, &err, "320", &http_resp_code, &ctx, is_http); goto end; } @@ -11493,28 +11502,17 @@ ws_soap_http (ws_connection_t * ws) if (lc) lc_free (lc); qr_free (call_qry); -#ifdef SOAP_HTTP - if (!is_http) - { - caddr_t err1; - err1 = ws_soap_error (ses, "400", ERR_STATE (err), ERR_MESSAGE (err), ctx.soap_version, 0, - &http_resp_code, &ctx); - dk_free_tree (err); - err = err1; - } -#endif + ws_rest_handle_error (ses, qr->qr_proc_alt_ret_type, &err, "400", &http_resp_code, &ctx, is_http); goto end; } if (lc) { if (IS_BOX_POINTER (lc->lc_proc_ret)) { -#ifdef SOAP_HTTP if (!is_http) err = soap_serialize (ses, cli, qr, lc, &ctx, schema_ns, 0, &http_resp_code, szMethod, SOAP_OPT (RESP_NS, qr, -1, NULL)); else -#endif { caddr_t *proc_ret = (caddr_t *) lc->lc_proc_ret; int nProcRet = BOX_ELEMENTS (lc->lc_proc_ret); From 537cf65514eb70a259631497b11071831438b730 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 25 Oct 2024 14:20:07 +0000 Subject: [PATCH 35/94] Fixed check which options are handled by endpoint Check defines on rest method for additional http methods allowed --- libsrc/Wi/bif_soap.c | 27 +++++++++++++++++++++++++++ libsrc/Wi/http.h | 1 + 2 files changed, 28 insertions(+) diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c index c7159f5433..70d99e864d 100644 --- a/libsrc/Wi/bif_soap.c +++ b/libsrc/Wi/bif_soap.c @@ -11355,6 +11355,32 @@ soap_http_params (query_t *qr, caddr_t * in_params, caddr_t * text, caddr_t * er return params; } +void +ws_soap_qr_opt_check (ws_connection_t * ws, query_t * qr) +{ + int inx, m; + caddr_t opts, tmp[BOX_AUTO_OVERHEAD+5], item; + dk_set_t set = NULL; + if (!qr || !ARRAYP(qr->qr_proc_soap_opts)) + return; + BOX_AUTO_TYPED (caddr_t, item, tmp, 5, DV_STRING); + strcpy_box_ck (item,"Http"); + inx = find_index_to_vector (item, qr->qr_proc_soap_opts, BOX_ELEMENTS(qr->qr_proc_soap_opts), DV_ARRAY_OF_POINTER, 0, 2, "http_rest"); + if (!inx || !DV_STRINGP (qr->qr_proc_soap_opts[inx])) + goto done; + split_string (qr->qr_proc_soap_opts[inx], NULL, &set); + http_set_default_options (ws); + DO_SET (caddr_t, meth, &set) + { + m = http_method_id (meth); + ws->ws_options [m] = '\x1'; + } + END_DO_SET(); +done: + dk_free_tree (list_to_array (set)); + BOX_DONE(item,tmp); +} + static void ws_rest_handle_error (dk_session_t * ses, char * media_type, caddr_t * err_ret, char * code, int * http_resp_code, soap_ctx_t * ctx, int mode) { @@ -11469,6 +11495,7 @@ ws_soap_http (ws_connection_t * ws) } ctx.literal = (SOAP_MSG_LITERAL & qr->qr_proc_place); pars = soap_http_params (qr, params, &text, &err, &ctx); + ws_soap_qr_opt_check (ws, qr); if (err) { dk_free_tree ((box_t) pars); diff --git a/libsrc/Wi/http.h b/libsrc/Wi/http.h index 950d5207b8..e55c679708 100644 --- a/libsrc/Wi/http.h +++ b/libsrc/Wi/http.h @@ -441,6 +441,7 @@ size_t http_threads_mem_report (void); extern dk_hash_t * ws_cli_sessions; extern dk_mutex_t * ws_cli_mtx; int ws_is_https (ws_connection_t * ws); +void http_set_default_options (ws_connection_t * ws); extern int www_maintenance; #endif /* _HTTP_H */ From 57d8cc725effd00fb56db07ba17f8ed4c29f1eef Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 25 Oct 2024 14:20:57 +0000 Subject: [PATCH 36/94] Fixed errror state A missing procedure should return 'not found' instead of 'internal error' --- libsrc/Wi/bif_soap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c index 70d99e864d..0e4fbdbefe 100644 --- a/libsrc/Wi/bif_soap.c +++ b/libsrc/Wi/bif_soap.c @@ -11466,6 +11466,7 @@ ws_soap_http (ws_connection_t * ws) qrs = get_granted_qrs (cli, NULL, NULL, 0); if (!(qr = proc_find_in_grants (szMethod, &qrs, NULL))) { + http_resp_code = 404; err = srv_make_new_error ("37000", "SOH03", "There is no such procedure: %.500s", szFullProcName); goto end; } From 316ee7375563747c2ff81777e8f011c885cb2a1a Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 25 Oct 2024 14:24:43 +0000 Subject: [PATCH 37/94] Fixed allow soap_boolean to accept null for nullable arguments --- libsrc/Wi/bif_soap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c index 0e4fbdbefe..55f65addd1 100644 --- a/libsrc/Wi/bif_soap.c +++ b/libsrc/Wi/bif_soap.c @@ -4220,9 +4220,11 @@ bif_soap_box_structure (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) static caddr_t bif_soap_boolean (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) { - char *szMe = "soap_boolean"; - ptrlong val = bif_long_arg (qst, args, 0, szMe); - + const char *szMe = "soap_boolean"; + int is_null; + ptrlong val = bif_long_or_null_arg (qst, args, 0, szMe, &is_null); + if (is_null) + return NEW_DB_NULL; return list (2, dk_alloc_box (0, DV_COMPOSITE), box_num_nonull (val)); } From c506c57475262f06dc4d9248a682e910773e6518 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 25 Oct 2024 14:38:02 +0000 Subject: [PATCH 38/94] Fixed order of checking options and parameters Options must be checked before parameters; params are for execution only --- libsrc/Wi/bif_soap.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c index 55f65addd1..629b69104d 100644 --- a/libsrc/Wi/bif_soap.c +++ b/libsrc/Wi/bif_soap.c @@ -11422,7 +11422,7 @@ ws_soap_http (ws_connection_t * ws) const char *usr_own; client_connection_t *cli = ws->ws_cli; query_t *qr = NULL; - caddr_t err = NULL, *pars, text; + caddr_t err = NULL, *pars = NULL, text; dk_session_t *ses = ws->ws_strses; ws_http_map_t *vd = ws->ws_map; wcharset_t *volatile charset = ws->ws_charset; @@ -11497,8 +11497,10 @@ ws_soap_http (ws_connection_t * ws) } } ctx.literal = (SOAP_MSG_LITERAL & qr->qr_proc_place); - pars = soap_http_params (qr, params, &text, &err, &ctx); ws_soap_qr_opt_check (ws, qr); + if (NULL != vd && vd->hm_exec_opts && WM_OPTIONS == ws->ws_method) + goto end; + pars = soap_http_params (qr, params, &text, &err, &ctx); if (err) { dk_free_tree ((box_t) pars); @@ -11518,11 +11520,6 @@ ws_soap_http (ws_connection_t * ws) dk_free_tree ((box_t) pars); goto end; } - if (NULL != vd && vd->hm_exec_opts && WM_OPTIONS == ws->ws_method) - { - dk_free_tree ((box_t) pars); - goto end; - } err = qr_exec (cli, call_qry, CALLER_LOCAL, NULL, NULL, &lc, pars, NULL, 1); dk_free_box ((box_t) pars); From 169a56221f196406c007ad139bd780e3b22317ed Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 09:06:39 +0000 Subject: [PATCH 39/94] Added flag to encode if API used as WSock client --- binsrc/websocket/websocket.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/binsrc/websocket/websocket.sql b/binsrc/websocket/websocket.sql index c329918b48..8826bffb7d 100644 --- a/binsrc/websocket/websocket.sql +++ b/binsrc/websocket/websocket.sql @@ -17,10 +17,10 @@ -- with this program; if not, write to the Free Software Foundation, Inc., -- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -- -create procedure WSOCK.DBA.WEBSOCKET_WRITE_MESSAGE (in sid int, in message varchar) +create procedure WSOCK.DBA.WEBSOCKET_WRITE_MESSAGE (in sid int, in message varchar, in encode int default 0) { declare ses, data, payload any; - payload := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE (message); + payload := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE (message, encode); -- get cached ses := http_recall_session (sid, 0); -- write something @@ -49,12 +49,12 @@ create procedure WSOCK.DBA.WEBSOCKET_CLOSE_MESSAGE (in sid int, in code int, in } ; -create procedure WSOCK.DBA.SEND_PING (in sid bigint, in message varchar := null) +create procedure WSOCK.DBA.SEND_PING (in sid bigint, in message varchar := null, in encode int default 0) { declare ping varchar; declare ses any; message := subseq (message, 0, 125); - ping := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE(message); + ping := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE(message, encode); aset (ping, 0, 137); ses := http_recall_session (sid, 0); ses_write (ping, ses); From 726121416897bb469ca3876c3d9ef964f14b411a Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 09:08:00 +0000 Subject: [PATCH 40/94] Added WSOCK.DBA.WEBSOCKET_CONNECT() for client operations --- binsrc/websocket/websocket.sql | 78 ++++++++++++++++++++++++++++++---- libsrc/Wi/http.c | 7 ++- 2 files changed, 74 insertions(+), 11 deletions(-) diff --git a/binsrc/websocket/websocket.sql b/binsrc/websocket/websocket.sql index 8826bffb7d..7689527d88 100644 --- a/binsrc/websocket/websocket.sql +++ b/binsrc/websocket/websocket.sql @@ -69,9 +69,23 @@ create procedure WSOCK.DBA.WEBSOCKET_ECHO (in message varchar, in args any) ; create procedure WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK (inout ses any, inout cd any) +{ + return WSOCK.DBA.WEBSOCKET_CALLBACK (ses, cd, 1); +} +; + +create procedure WSOCK.DBA.WEBSOCKET_ON_SERVER_MESSAGE_CALLBACK (inout ses any, inout cd any) +{ + return WSOCK.DBA.WEBSOCKET_CALLBACK (ses, cd, 0); +} +; + +create procedure WSOCK.DBA.WEBSOCKET_CALLBACK (inout ses any, inout cd any, in server int) { declare data any; declare service_hook, args, response, payload any; + declare mask_message int; + declare callback_name varchar; if (isvector (cd) and length (cd) > 1) { service_hook := aref (cd, 0); @@ -82,6 +96,16 @@ create procedure WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK (inout ses any, inout cd { return; } + if (server) + { + callback_name := 'WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK'; + mask_message := 0; + } + else + { + callback_name := 'WSOCK.DBA.WEBSOCKET_ON_SERVER_MESSAGE_CALLBACK'; + mask_message := 1; + } -- input is there, read a line data := ses_read (ses, 2); if (0 <> data) @@ -96,8 +120,10 @@ create procedure WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK (inout ses any, inout cd fin := bit_shift (firstByte, -7); is_masked := case when (bit_and (secondByte, 128) = 128) then 1 else 0 end; payload_len := bit_and (secondByte, 127); - if (not is_masked) -- client message must be masked + if (not is_masked and server) -- client message must be masked signal ('22023', 'Request must be masked.'); + if (is_masked and not server) -- client message must be masked + signal ('22023', 'Request must NOT be masked.'); if (opcode <> 1 and opcode <> 2 and opcode <> 8 and opcode <> 0 and opcode <> 9 and opcode <> 10) -- supported: text, binary, close, ping, pong, frame signal ('22023', sprintf ('A frame of type %d is not supported.', opcode)); @@ -114,12 +140,19 @@ create procedure WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK (inout ses any, inout cd tmp := ses_read (ses, 2); payload_len := tmp[1] + 256 * tmp[0]; } - mask := ses_read (ses, 4); - result := make_string (payload_len); - request := ses_read (ses, payload_len); - for (i := 0; i < payload_len; i := i + 1) + if (server) + { + mask := ses_read (ses, 4); + result := make_string (payload_len); + request := ses_read (ses, payload_len); + for (i := 0; i < payload_len; i := i + 1) + { + result[i] := bit_xor(request[i], mask[mod(i, 4)]); + } + } + else { - result[i] := bit_xor(request[i], mask[mod(i, 4)]); + result := ses_read (ses, payload_len); } if (opcode = 8) return; @@ -127,7 +160,7 @@ create procedure WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK (inout ses any, inout cd if (opcode = 9) -- ping, send pong { - reply := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE(payload); + reply := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE(payload, mask_message); aset (reply, 0, 138); ses_write(reply, ses); payload := null; @@ -156,12 +189,12 @@ create procedure WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK (inout ses any, inout cd if (response is not null) { -- write a reply (optional) - reply := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE (response); + reply := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE (response, mask_message); ses_write(reply, ses); } } -- set recv handler back - http_on_message (ses, 'WSOCK.DBA.WEBSOCKET_ONMESSAGE_CALLBACK', cd, 0); + http_on_message (ses, callback_name, cd, 0); } ; @@ -315,3 +348,30 @@ create procedure WSOCK.DBA."websockets" () __SOAP_HTTP 'text/plain' return ''; } ; + +create procedure WSOCK.DBA.WEBSOCKET_CONNECT(in url varchar, in headers varchar default null, in sid bigint default null, + in callback varchar default null, in args any default null) +{ + declare resp, conn any; + declare token, sec varchar; + token := encode_base64(xenc_rand_bytes(16,0)); + if (sid is null) + sid := long_ref (xenc_rand_bytes (4,0),0); + if (headers is not null) + headers := concat(rtrim(headers, '\r\n'), '\r\n'); + headers := concat (headers, 'Sec-WebSocket-Version: 13\r\n', + 'Sec-WebSocket-Key: ', token, '\r\n', + 'Connection: Upgrade\r\n', + 'Upgrade: websocket\r\n'); + conn := HTTP_CLIENT_EXT(url, http_method=>'GET', http_headers=>headers, headers=>resp); + sec := http_request_header (resp, 'Sec-WebSocket-Accept', null, null); + if (sec <> sha1_digest (concat (token, '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'))) + signal('37000', 'Can not connect to websocket'); + if (__tag(conn) = 241) + { + http_on_message (conn, 'WSOCK.DBA.WEBSOCKET_ON_SERVER_MESSAGE_CALLBACK', vector (callback, args, null), 1, 1); + http_keep_session(conn, sid, 0); + } + return sid; +} +; diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index a8e86591c3..fe867b01d9 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -11690,18 +11690,21 @@ bif_http_on_message (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) caddr_t func = bif_string_arg (qst, args, 1, "http_on_message"); caddr_t cd = bif_arg (qst, args, 2, "http_on_message"); int signal_on_disconnected = BOX_ELEMENTS(args) > 3 ? bif_long_arg (qst, args, 3, "http_on_message") : 1; + int keep_conn_ref = BOX_ELEMENTS(args) > 4 ? bif_long_arg (qst, args, 4, "http_on_message") : 0; /* use on client side to keep ses ref */ dk_session_t * ses = NULL; ws_connection_t * ws = qi->qi_client->cli_ws; if (DV_CONNECTION == DV_TYPE_OF (conn)) { + int server_session = 0; ses = (dk_session_t *) conn[0]; + server_session = (ws && ses && ses == ws->ws_session); if (ses && DKSESSTAT_ISSET (ses, SST_OK)) - conn[0] = NULL; + conn[0] = keep_conn_ref && !server_session ? ses : NULL; else ses = NULL; mutex_enter (thread_mtx); - if (ws && ses && ses == ws->ws_session) + if (server_session) { ws->ws_session->dks_ws_status = DKS_WS_CACHED; ws->ws_session->dks_n_threads++; From b179d4f0bb1ebb705fa2a3843cc8428821378326 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 09:09:05 +0000 Subject: [PATCH 41/94] Fixed missing encode flag --- binsrc/websocket/websocket.sql | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/binsrc/websocket/websocket.sql b/binsrc/websocket/websocket.sql index 7689527d88..476d01a136 100644 --- a/binsrc/websocket/websocket.sql +++ b/binsrc/websocket/websocket.sql @@ -30,17 +30,16 @@ create procedure WSOCK.DBA.WEBSOCKET_WRITE_MESSAGE (in sid int, in message varch } ; -create procedure WSOCK.DBA.WEBSOCKET_CLOSE_MESSAGE (in sid int, in code int, in message varchar) +create procedure WSOCK.DBA.WEBSOCKET_CLOSE_MESSAGE (in sid int, in code int, in message varchar, in encode int default 0) { - declare h, c, ses, payload any; + declare c, ses, payload any; message := subseq (message, 0, 125 - 2); -- only short errors if (code <> bit_and (code, 0hex7fff)) signal ('22023', 'Only short int is allowed for code'); - h := '\x88\x00'; -- 10001000 FIN x80 | opcode 0x8 - h[1] := length (message) + 2; c := '00'; c := short_set (c, 0, code); - payload := concat (h,c,message); + payload := WSOCK.DBA.WEBSOCKET_ENCODE_MESSAGE (concat (c,message), encode); + aset(payload, 0, 136); ses := http_recall_session (sid, 0); ses_write (payload, ses); From 1afbc44579b073ac53617aa305a3c09b78d354ab Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 09:11:17 +0000 Subject: [PATCH 42/94] Added flag to see if connection session is server or client --- libsrc/Wi/http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index fe867b01d9..519172f6a5 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -11665,7 +11665,7 @@ bif_http_get_cli_sessions (caddr_t * qst, caddr_t * err_ret, state_slot_t ** arg while (dk_hit_next (&hit, (void**) &sid, (void**) &ses)) { caddr_t * args = (caddr_t *) DKS_DB_DATA (ses); - dk_set_push (&set, list (2, box_num(sid), add_args ? box_copy_tree (args) : NEW_DB_NULL)); + dk_set_push (&set, list (3, box_num(sid), add_args ? box_copy_tree (args) : NEW_DB_NULL, box_num((boxint)ses->dks_n_threads))); } mutex_leave (ws_cli_mtx); return list_to_array (dk_set_nreverse (set)); @@ -11676,9 +11676,11 @@ bif_http_client_session_cached (caddr_t * qst, caddr_t * err_ret, state_slot_t * { boxint id = bif_long_arg (qst, args, 0, "http_client_session_cached"); boxint ret; + dk_session_t * ses; mutex_enter (ws_cli_mtx); - ret = ((NULL != gethash ((void *) (ptrlong) id, ws_cli_sessions)) ? 1 : 0); + ses = (dk_session_t *) gethash ((void *) (ptrlong) id, ws_cli_sessions); mutex_leave (ws_cli_mtx); + ret = (ses && ses->dks_n_threads ? 1 : (ses ? 2 : 0)); return box_num (ret); } From 321160632292b45c263e402097b0306c30880d66 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 09:13:28 +0000 Subject: [PATCH 43/94] Added support to handle 101 connection upgrade in http_client --- libsrc/Wi/http_client.c | 43 +++++++++++++++++++++++++++++++++++++++++ libsrc/Wi/http_client.h | 6 ++++++ 2 files changed, 49 insertions(+) diff --git a/libsrc/Wi/http_client.c b/libsrc/Wi/http_client.c index 6a2e6aed47..71b6040c78 100644 --- a/libsrc/Wi/http_client.c +++ b/libsrc/Wi/http_client.c @@ -2288,6 +2288,39 @@ http_cli_parse_authorize_headers (http_cli_ctx * ctx) return (HC_RET_OK); } +HC_RET +http_cli_std_handle_upgrade (http_cli_ctx * ctx, caddr_t parm, caddr_t ret_val, caddr_t err_ret) +{ + int ret; + char *s = NULL, *last; + caddr_t url, loc, err = NULL, cookie_header = NULL; + dk_set_t cookies = NULL; + CATCH_ABORT (http_cli_read_resp_hdrs, ctx, ret); + DO_SET (caddr_t, hdr, &ctx->hcctx_resp_hdrs) + { + if (!strnicmp ("Upgrade:", hdr, 8)) + { + last = hdr + box_length (hdr) - 3; + s = hdr + 8; + s = skip_lwsp (s, last); + if (!strnicmp ("websocket", s, 9)) + ctx->hcctx_connection_upgrade = HC_U_WEBSOCKET; + else + ctx->hcctx_connection_upgrade = HC_U_UNKNOWN; + } + else if (!strnicmp ("Connection:", hdr, 11)) + { + last = hdr + box_length (hdr) - 3; + s = hdr + 11; + s = skip_lwsp (s, last); + if (!strnicmp ("upgrade", s, 7)) + F_SET (ctx, HC_F_UPGRADE); + } + } + END_DO_SET (); + return (HC_RET_OK); +} + HC_RET http_cli_std_handle_redir (http_cli_ctx * ctx, caddr_t parm, caddr_t ret_val, caddr_t err_ret) { @@ -2464,6 +2497,8 @@ http_cli_std_init (char * url, caddr_t * qst) h = http_cli_make_handler_frame (http_cli_handle_socks_conn_post, NULL, NULL, NULL); http_cli_push_hook (ctx, HC_HTTP_CONN_POST, h); + http_cli_push_resp_evt (ctx, 101, http_cli_make_handler_frame (http_cli_std_handle_upgrade, NULL, NULL, NULL)); + return (ctx); } @@ -2847,6 +2882,14 @@ bif_http_client_impl (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args, co start_dt = get_msec_real_time (); if (!http_cli_main (ctx)) ret = box_copy_tree (ctx->hcctx_resp_body); + if (HC_U_WEBSOCKET == ctx->hcctx_connection_upgrade) + { + dk_free_tree (ret); + ret = dk_alloc_box (2 * sizeof (caddr_t), DV_CONNECTION); + ((caddr_t *)ret)[0] = (caddr_t) ctx->hcctx_http_out; + ((caddr_t *)ret)[1] = (caddr_t) 1L; + ctx->hcctx_http_out = NULL; + } if (NULL == ret) ret = box_dv_short_string (""); diff --git a/libsrc/Wi/http_client.h b/libsrc/Wi/http_client.h index c85e91ff1f..011e12927a 100644 --- a/libsrc/Wi/http_client.h +++ b/libsrc/Wi/http_client.h @@ -87,6 +87,11 @@ #define HC_F_REPLY_READ (uint32)0x0040 #define HC_F_HDRS_READ (uint32)0x0080 #define HC_F_BODY_READ (uint32)0x0100 +#define HC_F_UPGRADE (uint32)0x0200 + +#define HC_U_NONE (uint32)0x0000 /* No upgrade at all */ +#define HC_U_WEBSOCKET (uint32)0x0001 /* Websocket upgrade */ +#define HC_U_UNKNOWN (uint32)0x0002 /* Upgrade happens but of unknown type */ /* States */ @@ -210,6 +215,7 @@ typedef struct http_cli_ctx_s caddr_t * hcctx_callback_args; int hcctx_redirects; char hcctx_accept_cookies; + int32 hcctx_connection_upgrade; } http_cli_ctx; From 0fdbf019f93841838ae0dcefce783e4bd522b34c Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 09:22:21 +0000 Subject: [PATCH 44/94] Fixed issue with RSS menu not working on Firefox --- binsrc/conductor/dav/dav_browser.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/binsrc/conductor/dav/dav_browser.js b/binsrc/conductor/dav/dav_browser.js index 30e69cebfe..32c4418da8 100644 --- a/binsrc/conductor/dav/dav_browser.js +++ b/binsrc/conductor/dav/dav_browser.js @@ -1405,14 +1405,8 @@ WEBDAV.menuMouseOut = function (event) return false; } - if (window.event) - { - current = this; - related = window.event.toElement; - } else { - current = event.currentTarget; - related = event.relatedTarget; - } + current = event.currentTarget; + related = event.relatedTarget; if ((current != related) && !menuMouseIn(current, related)) OAT.Dom.hide(current); } From a0ce52d3b50b9ff5ff65559f67939218583a7d18 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 28 Oct 2024 09:23:11 +0000 Subject: [PATCH 45/94] Fixed typo in generation of Transient view urls --- binsrc/conductor/db_rdf_view_3.vspx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binsrc/conductor/db_rdf_view_3.vspx b/binsrc/conductor/db_rdf_view_3.vspx index cf9a371be3..8378c9cced 100644 --- a/binsrc/conductor/db_rdf_view_3.vspx +++ b/binsrc/conductor/db_rdf_view_3.vspx @@ -338,7 +338,7 @@ exec (qr, stat, msg, vector (), 0, meta, data); if (stat = '00000' and length (data) and length (data[0])) { - http (sprintf ('
Transient Views: %V
', gr, gr)); + http (sprintf ('
Transient Views: %V
', gr, gr)); foreach (any _row in data) do { if (_row[0] not like '%/stat#%') From fdc5f6a35aafafe24952833765a4c200d00b668d Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 16:41:25 +0000 Subject: [PATCH 46/94] Fixed issue when filename starts with underscore An underscore is a valid start character for visible files --- binsrc/conductor/dav/dav_browser.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binsrc/conductor/dav/dav_browser.sql b/binsrc/conductor/dav/dav_browser.sql index b005f12136..3da4663f10 100644 --- a/binsrc/conductor/dav/dav_browser.sql +++ b/binsrc/conductor/dav/dav_browser.sql @@ -2524,7 +2524,7 @@ create procedure WEBDAV.DBA.settings_tbLabels ( create procedure WEBDAV.DBA.settings_hiddens ( inout settings any) { - return get_keyword ('hiddens', settings, '.,_'); + return get_keyword ('hiddens', settings, '.'); } ; From 8a12f70d18a069ff2aeba7d38868a0a565979cc9 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 28 Oct 2024 09:27:11 +0000 Subject: [PATCH 47/94] Updated Conductor VAD version --- binsrc/conductor/vad_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binsrc/conductor/vad_version b/binsrc/conductor/vad_version index 54110c37f1..57eb8b8d7f 100644 --- a/binsrc/conductor/vad_version +++ b/binsrc/conductor/vad_version @@ -1 +1 @@ -1.00.8870 +1.00.8871 From 07bebcfc6c5bf7726cf607668388b650187bf5a6 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Mon, 28 Oct 2024 10:20:59 +0000 Subject: [PATCH 48/94] Fixed arbitrary XML with CDATA having html tags has MIME re-placed with text/html --- libsrc/Wi/rdf_sponge.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/rdf_sponge.sql b/libsrc/Wi/rdf_sponge.sql index 7c926aff12..c82ef938e9 100644 --- a/libsrc/Wi/rdf_sponge.sql +++ b/libsrc/Wi/rdf_sponge.sql @@ -1344,9 +1344,12 @@ create function DB.DBA.RDF_SPONGE_GUESS_CONTENT_TYPE (in origin_uri varchar, in return 'application/sparql-results+xml'; if (xpath_eval ('[xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"] /rdf:rdf', ret_html) is not null) return 'application/rdf+xml'; - if (strstr (ret_begin, '') is not null or - strstr (ret_begin, '') is not null ) - return 'text/html'; + -- we may guess html if and only if text/plain and nothing else, also html/xhtml should be at start of document + if ((ret_content_type is null or + strstr (ret_content_type, 'text/plain') is not null or + strstr (ret_content_type, 'application/octet-stream') is not null) + and regexp_match('^(?:\\s*(?:<\\?xml[^>]+>||]+>))*\\s* Date: Mon, 30 Sep 2024 11:05:17 +0000 Subject: [PATCH 49/94] Removed rbuf_test function --- libsrc/Dk/Dkbasket.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libsrc/Dk/Dkbasket.c b/libsrc/Dk/Dkbasket.c index efd4f946c0..c2ad339b26 100644 --- a/libsrc/Dk/Dkbasket.c +++ b/libsrc/Dk/Dkbasket.c @@ -411,6 +411,7 @@ rbuf_destroy (rbuf_t * rb) } +#if 0 rbuf_t test_rbuf; void @@ -458,6 +459,7 @@ rbuf_test () rbuf_rewrite_done (&rb); if (rb.rb_count != 99000) GPF_T1 ("bad rewrite"); } +#endif #ifdef MALLOC_DEBUG dk_mutex_t *spare_rbufs_mtx = NULL; From c33bfec3f753e78c4ba2c1daf2bec1ce7e18c0bc Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 1 Oct 2024 08:32:14 +0000 Subject: [PATCH 50/94] Fixed memory leak in X509 cert chain --- libsrc/Wi/xmlenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/xmlenc.c b/libsrc/Wi/xmlenc.c index fe2a88d42d..b5a4b4359e 100644 --- a/libsrc/Wi/xmlenc.c +++ b/libsrc/Wi/xmlenc.c @@ -1414,7 +1414,7 @@ xenc_key_t * xenc_key_create_from_x509_cert (char * name, char * certificate, ch X509_STORE_add_cert (CA_certs, x); } mutex_leave (xenc_keys_mtx); - sk_free (ca_list); + sk_X509_pop_free (ca_list, X509_free); } } else if (type == CERT_DER_FORMAT) @@ -7280,7 +7280,7 @@ bif_xenc_pkcs12_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) certs = sk_X509_new_null (); for (i = 1; i < sk_X509_num (chain) ; i++) sk_X509_push (certs, sk_X509_value (chain, i)); - sk_free (chain); + sk_X509_pop_free (chain, X509_free); } if (inf) { @@ -7303,7 +7303,8 @@ bif_xenc_pkcs12_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) } BIO_free (b); PKCS12_free (p12); - sk_free (certs); + if (certs) + sk_X509_pop_free (certs, X509_free); if (inf) sk_X509_INFO_pop_free (inf, X509_INFO_free); return ret; From edbd8516e258f6b9b557f2e1aea229d07abea40e Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 29 Oct 2024 12:57:42 +0000 Subject: [PATCH 51/94] Renamed last_majflt to swap_guard_last_majflt --- libsrc/Wi/lock.c | 10 +++++----- libsrc/Wi/srvstat.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libsrc/Wi/lock.c b/libsrc/Wi/lock.c index 424e40b123..6480177a6e 100644 --- a/libsrc/Wi/lock.c +++ b/libsrc/Wi/lock.c @@ -2220,7 +2220,7 @@ time_msec_t checkpointed_last_time = 0; #include #endif -long last_majflt = 0; +long swap_guard_last_majflt = 0; long swap_guard_threshold = 300; int32 swap_guard_on = 0; int process_is_swapping = 0; @@ -2258,15 +2258,15 @@ the_grim_mem_guard () return; getrusage (RUSAGE_SELF, &ru); #ifdef GPF_ON_SWAPPING - if (ru.ru_majflt - last_majflt > swap_guard_threshold) + if (ru.ru_majflt - swap_guard_last_majflt > swap_guard_threshold) GPF_T1 ("started swapping"); #endif if (swap_guard_on & 0x10) { - if ((ru.ru_majflt - last_majflt > swap_guard_threshold) && !wi_inst.wi_is_checkpoint_pending) + if ((ru.ru_majflt - swap_guard_last_majflt > swap_guard_threshold) && !wi_inst.wi_is_checkpoint_pending) GPF_T1 ("The process started swapping and SwapGuard parameter has bit 0x10 set on, forcing immediate kill. "); } - if (virtuoso_server_initialized && ru.ru_majflt - last_majflt > swap_guard_threshold) + if (virtuoso_server_initialized && ru.ru_majflt - swap_guard_last_majflt > swap_guard_threshold) { if (!process_is_swapping) log_error ("The process started swapping, all pending transactions will be killed"); @@ -2276,7 +2276,7 @@ the_grim_mem_guard () { if (process_is_swapping) process_is_swapping = 0; - last_majflt = ru.ru_majflt; + swap_guard_last_majflt = ru.ru_majflt; } #endif } diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index 4c69c466ed..80da3facc1 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -1287,7 +1287,7 @@ get_total_sys_mem () extern int process_is_swapping; extern long swap_guard_threshold; -extern long last_majflt; +extern long swap_guard_last_majflt; extern int64 max_proc_vm_size; extern int64 vm_size_wd_threshold; extern double curr_cpu_pct; @@ -1537,7 +1537,7 @@ stat_desc_t stat_descs [] = {"tc_cl_consensus_rollback", &tc_cl_consensus_rollback, NULL}, {"tc_cl_consensus_commit", &tc_cl_consensus_commit, NULL}, {"tc_cl_consensus_deferred", &tc_cl_consensus_deferred, NULL}, - {"swap_guard_last_majflt", &last_majflt, NULL }, + {"swap_guard_last_majflt", &swap_guard_last_majflt, NULL }, {"tc_cl_branch_missed_rb", &tc_cl_branch_missed_rb, NULL}, {"tc_cl_keep_alive_timeouts", &tc_cl_keep_alive_timeouts, NULL}, From 839a455b9c71182f6aa41af6f7fc8f5f39a3b97a Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Wed, 30 Oct 2024 16:43:48 +0000 Subject: [PATCH 52/94] Fixed compiler warnings from -Wmultistatement-macros --- libsrc/Wi/sqlfn.h | 16 +++++++++------- libsrc/Wi/sqlparext.h | 4 +++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libsrc/Wi/sqlfn.h b/libsrc/Wi/sqlfn.h index 6a1f0fb8a4..fdfae78727 100644 --- a/libsrc/Wi/sqlfn.h +++ b/libsrc/Wi/sqlfn.h @@ -1046,13 +1046,15 @@ extern void qi_check_stack (query_instance_t *qi, void *addr, ptrlong margin); #define QI_CHECK_STACK(qi,addr,margin) qi_check_stack (qi, addr, margin) #else #define QI_CHECK_STACK(qi, addr, margin) \ - if (THR_IS_STACK_OVERFLOW (qi->qi_thread, addr, margin)) \ - sqlr_new_error ("42000", "SR178", "Stack overflow (stack size is %ld, more than %ld is in use)", (long)(qi->qi_thread->thr_stack_size), (long)(qi->qi_thread->thr_stack_size - margin)); \ - if (DK_MEM_RESERVE) \ - { \ - SET_DK_MEM_RESERVE_STATE(qi->qi_trx); \ - qi_signal_if_trx_error (qi); \ - } + do { \ + if (THR_IS_STACK_OVERFLOW (qi->qi_thread, addr, margin)) \ + sqlr_new_error ("42000", "SR178", "Stack overflow (stack size is %ld, more than %ld is in use)", (long)(qi->qi_thread->thr_stack_size), (long)(qi->qi_thread->thr_stack_size - margin)); \ + if (DK_MEM_RESERVE) \ + { \ + SET_DK_MEM_RESERVE_STATE(qi->qi_trx); \ + qi_signal_if_trx_error (qi); \ + } \ + } while (0) #endif #define DEL_STACK_MARGIN (2*PAGE_SZ + 200 * sizeof (caddr_t)) diff --git a/libsrc/Wi/sqlparext.h b/libsrc/Wi/sqlparext.h index 6609a89b54..3fe9ada637 100644 --- a/libsrc/Wi/sqlparext.h +++ b/libsrc/Wi/sqlparext.h @@ -851,7 +851,9 @@ extern long sqlp_bin_op_serial; BIN_OP (target, BOP_DIV, t1, t2); \ } \ else \ - FN_REF_1 (target, n, all_dist, argp); + { \ + FN_REF_1 (target, n, all_dist, argp); \ + } #define FN_REF(target, n, all_dist, argp) \ if (ST_COLUMN (((ST *) (argp)), COL_DOTTED) && ((ST *) (argp))->_.col_ref.prefix == NULL && ((ST *) (argp))->_.col_ref.name == STAR) \ From e2a01e0376ccdfdf12be6c55dd80b3a7e64562ee Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Thu, 31 Oct 2024 16:33:03 +0000 Subject: [PATCH 53/94] Fixed missing DB.DBA.SPARQL_BINDINGS_VIEW_C_0 for empty solution bindings --- libsrc/Wi/sparql.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libsrc/Wi/sparql.sql b/libsrc/Wi/sparql.sql index 2b035d6093..9a73729ec8 100644 --- a/libsrc/Wi/sparql.sql +++ b/libsrc/Wi/sparql.sql @@ -8486,6 +8486,18 @@ create procedure view DB.DBA.SPARQL_BINDINGS_VIEW as DB.DBA.SPARQL_BINDINGS_VIEW grant select on DB.DBA.SPARQL_BINDINGS_VIEW to public ; +--!AWK PUBLIC +create procedure DB.DBA.SPARQL_BINDINGS_VIEW_C_0_IMP (in dta any) +{ + declare rcount, rctr integer; + declare BND0 any; + result_names (BND0); + rcount := length (dta); + for (rctr := 0; rctr < rcount; rctr := rctr+1) + result (NULL); +} +; + --!AWK PUBLIC create procedure DB.DBA.SPARQL_BINDINGS_VIEW_C_1_IMP (in dta any) { @@ -8534,6 +8546,9 @@ create procedure DB.DBA.SPARQL_BINDINGS_VIEW_C_4_IMP (in dta any) } ; +create procedure view DB.DBA.SPARQL_BINDINGS_VIEW_C_0 as DB.DBA.SPARQL_BINDINGS_VIEW_C_0_IMP (dta) (BND0 any) +; + create procedure view DB.DBA.SPARQL_BINDINGS_VIEW_C_1 as DB.DBA.SPARQL_BINDINGS_VIEW_C_1_IMP (dta) (BND0 any) ; @@ -8546,6 +8561,9 @@ create procedure view DB.DBA.SPARQL_BINDINGS_VIEW_C_3 as DB.DBA.SPARQL_BINDINGS_ create procedure view DB.DBA.SPARQL_BINDINGS_VIEW_C_4 as DB.DBA.SPARQL_BINDINGS_VIEW_C_4_IMP (dta) (BND0 any, BND1 any, BND2 any, BND3 any) ; +grant select on DB.DBA.SPARQL_BINDINGS_VIEW_C_0 to public +; + grant select on DB.DBA.SPARQL_BINDINGS_VIEW_C_1 to public ; From 64d8ef398ae2aeade08a9516fb49ec31b38e986e Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 5 Nov 2024 11:14:08 +0000 Subject: [PATCH 54/94] Fixed wrong ODBC datatype --- binsrc/tests/b3078.c | 4 ++-- binsrc/tests/paramstats.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/binsrc/tests/b3078.c b/binsrc/tests/b3078.c index 8f7d523733..b2f6596be4 100644 --- a/binsrc/tests/b3078.c +++ b/binsrc/tests/b3078.c @@ -337,10 +337,10 @@ ODBC_Execute() SQLCHAR * Statement = "select * from BTEST where id > ?"; SQLUINTEGER IDArray[ARRAY_SIZE]; - SQLINTEGER IDIndArray[ARRAY_SIZE]; + SQLULEN IDIndArray[ARRAY_SIZE]; SQLUSMALLINT i, ParamStatusArray[ARRAY_SIZE]; - SQLUINTEGER ParamsProcessed; + SQLULEN ParamsProcessed; if (SQLParamOptions(hstmt, ARRAY_SIZE, &ParamsProcessed) != SQL_SUCCESS) { diff --git a/binsrc/tests/paramstats.c b/binsrc/tests/paramstats.c index e34dc2b768..d575e7b146 100644 --- a/binsrc/tests/paramstats.c +++ b/binsrc/tests/paramstats.c @@ -34,7 +34,7 @@ typedef struct { - SQLINTEGER length; + SQLLEN length; SQLINTEGER value; } PARAM; From d7aff1c11da04a61373bca160d99ccbdf0958477 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 23 Aug 2024 10:52:41 +0000 Subject: [PATCH 55/94] Fixed bad argument cast in virt_mbsnrtowcs and virt_wcsnrtombs This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Dk/Dksesstr.c | 10 +++++----- libsrc/Wi/bif_regexp.c | 2 +- libsrc/Wi/sqlbif.c | 8 ++++---- libsrc/Wi/srvmultibyte.c | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libsrc/Dk/Dksesstr.c b/libsrc/Dk/Dksesstr.c index 36b8470e74..42230d0643 100644 --- a/libsrc/Dk/Dksesstr.c +++ b/libsrc/Dk/Dksesstr.c @@ -707,7 +707,7 @@ strses_chars_length (dk_session_t * ses) virt_mbstate_t mb; unsigned char *ptr = (unsigned char *) ses->dks_out_buffer; memset (&mb, 0, sizeof (mb)); - last_len = virt_mbsnrtowcs (NULL, &ptr, ses->dks_out_fill, 0, &mb); + last_len = virt_mbsnrtowcs (NULL, (const unsigned char **) &ptr, ses->dks_out_fill, 0, &mb); if (last_len != (size_t) - 1) len += (long) last_len; } @@ -1370,7 +1370,7 @@ strses_get_part_1 (dk_session_t * ses, void *buf2, int64 starting_ofs, long nbyt virt_mbstate_t mb; unsigned char *ptr = (unsigned char *) ses->dks_out_buffer; memset (&mb, 0, sizeof (mb)); - last_len_chars = virt_mbsnrtowcs (NULL, &ptr, ses->dks_out_fill, 0, &mb); + last_len_chars = virt_mbsnrtowcs (NULL, (const unsigned char **) &ptr, ses->dks_out_fill, 0, &mb); if (last_len_chars == (size_t) - 1) GPF_T; } @@ -1458,7 +1458,7 @@ read_wides_from_utf8_file ( } else { - converted = virt_mbsnrtowcs ((wchar_t *) dest, &data_ptr, readed, nchars, &mb); + converted = virt_mbsnrtowcs ((wchar_t *) dest, (const unsigned char **) &data_ptr, readed, nchars, &mb); if (converted == (size_t) - 1) { log_error ("Invalid utf-8 data in file %s", ses->dks_session->ses_file->ses_temp_file_name); @@ -1502,7 +1502,7 @@ strses_get_wide_part (dk_session_t * ses, wchar_t * buf, long starting_ofs, long return 0; /* get the copychars worth of wides into the buffer */ - if (virt_mbsnrtowcs (buf, &data_ptr, + if (virt_mbsnrtowcs (buf, (const unsigned char **) &data_ptr, elt->fill - (data_ptr - (unsigned char *) elt->data), copychars, &mb) == (size_t) -1) return 0; @@ -1575,7 +1575,7 @@ strses_get_wide_part (dk_session_t * ses, wchar_t * buf, long starting_ofs, long if ((data_ptr - data_ptr_start) < ses->dks_out_fill) { /* get the copychars worth of wides into the buffer */ - if ((converted = virt_mbsnrtowcs (buf, &data_ptr_start, + if ((converted = virt_mbsnrtowcs (buf, (const unsigned char **) &data_ptr_start, ses->dks_out_fill - (data_ptr - data_ptr_start), nchars, &mb) == (size_t) - 1)) return 0; } diff --git a/libsrc/Wi/bif_regexp.c b/libsrc/Wi/bif_regexp.c index 65ea9c118a..3fd3e4db86 100644 --- a/libsrc/Wi/bif_regexp.c +++ b/libsrc/Wi/bif_regexp.c @@ -609,7 +609,7 @@ However all out-of-order E-s form a proper backstack. */ } else { - int wide_len_diff = (int) virt_mbsnrtowcs (NULL, &str, ofs - prev_ofs, 0, &mb); + int wide_len_diff = (int) virt_mbsnrtowcs (NULL, (const unsigned char **) &str, ofs - prev_ofs, 0, &mb); prev_wide_len += wide_len_diff; prev_ofs = ofs; ret_vec [idx_to_fill] = prev_wide_len; diff --git a/libsrc/Wi/sqlbif.c b/libsrc/Wi/sqlbif.c index 5657965cc0..9412031093 100644 --- a/libsrc/Wi/sqlbif.c +++ b/libsrc/Wi/sqlbif.c @@ -10713,7 +10713,7 @@ box_cast (caddr_t * qst, caddr_t data, ST * dtp, dtp_t arg_dtp) wide_work = wide; memset (&state, 0, sizeof (virt_mbstate_t)); - utf8_len = (long) virt_wcsnrtombs (NULL, &wide_work, wide_len, 0, &state); + utf8_len = (long) virt_wcsnrtombs (NULL, (const wchar_t **) &wide_work, wide_len, 0, &state); if (utf8_len < 0) sqlr_new_error ("22005", "IN014", "Invalid data supplied in NVARCHAR -> VARBINARY conversion"); @@ -10721,7 +10721,7 @@ box_cast (caddr_t * qst, caddr_t data, ST * dtp, dtp_t arg_dtp) wide_work = wide; memset (&state, 0, sizeof (virt_mbstate_t)); - actual_utf8_len = virt_wcsnrtombs ((unsigned char *) res, &wide_work, wide_len, utf8_len, &state); + actual_utf8_len = virt_wcsnrtombs ((unsigned char *) res, (const wchar_t **) &wide_work, wide_len, utf8_len, &state); if (utf8_len != actual_utf8_len) GPF_T1("non consistent wide char to multi-byte translation of a buffer"); if (NULL != tmp_res) @@ -10778,14 +10778,14 @@ box_cast (caddr_t * qst, caddr_t data, ST * dtp, dtp_t arg_dtp) virt_mbstate_t state; utf8work = utf8; memset (&state, 0, sizeof (virt_mbstate_t)); - wide_len = virt_mbsnrtowcs (NULL, &utf8work, utf8_len, 0, &state); + wide_len = virt_mbsnrtowcs (NULL, (const unsigned char **) &utf8work, utf8_len, 0, &state); if (((long) wide_len) < 0) sqlr_new_error ("22005", "IN015", "Invalid data supplied in UNAME -> NVARCHAR conversion"); ret = dk_alloc_box ((int) (wide_len + 1) * sizeof (wchar_t), DV_WIDE); utf8work = utf8; memset (&state, 0, sizeof (virt_mbstate_t)); - if (wide_len != virt_mbsnrtowcs ((wchar_t *) ret, &utf8work, utf8_len, wide_len, &state)) + if (wide_len != virt_mbsnrtowcs ((wchar_t *) ret, (const unsigned char **) &utf8work, utf8_len, wide_len, &state)) { dk_free_box (ret); sqlr_new_error ("22005", "IN015", diff --git a/libsrc/Wi/srvmultibyte.c b/libsrc/Wi/srvmultibyte.c index 15dade6e60..b4247814a3 100644 --- a/libsrc/Wi/srvmultibyte.c +++ b/libsrc/Wi/srvmultibyte.c @@ -325,7 +325,7 @@ bh_string_output_w (/* this was before 3.0: index_space_t * isp, */ lock_trx_t * } byte_len = LONG_REF (buf->bd_buffer + DP_BLOB_LEN); mbc = buf->bd_buffer + DP_DATA; - char_len = (long) virt_mbsnrtowcs (wpage, &mbc, byte_len, PAGE_DATA_SZ, &state); + char_len = (long) virt_mbsnrtowcs (wpage, (const unsigned char **) &mbc, byte_len, PAGE_DATA_SZ, &state); if (char_len < 0) GPF_T1 ("bad UTF8 data in wide blob page"); chars_on_page = char_len - from_char; @@ -407,7 +407,7 @@ bh_string_list_w (/* this was before 3.0: index_space_t * isp,*/ lock_trx_t * lt byte_len = LONG_REF (buf->bd_buffer + DP_BLOB_LEN); mbc = buf->bd_buffer + DP_DATA; - char_len = (long) virt_mbsnrtowcs (wpage, &mbc, byte_len, PAGE_DATA_SZ, &state); + char_len = (long) virt_mbsnrtowcs (wpage, (const unsigned char **) &mbc, byte_len, PAGE_DATA_SZ, &state); if (char_len < 0) GPF_T1 ("bad UTF8 data in wide blob page"); chars_on_page = MIN (char_len - from_char, get_chars); @@ -873,7 +873,7 @@ box_utf8_string_as_narrow (ccaddr_t _str, caddr_t narrow, long max_len, wcharset charset = default_charset; memset (&state, 0, sizeof (virt_mbstate_t)); - len = (long) virt_mbsnrtowcs (NULL, (unsigned char **) &src, box_length (str), 0, &state); + len = (long) virt_mbsnrtowcs (NULL, (const unsigned char **) &src, box_length (str), 0, &state); if (max_len > 0 && len > max_len) len = max_len; if (len < 0) /* there was <= 0 - bug */ @@ -916,7 +916,7 @@ t_box_utf8_string_as_narrow (ccaddr_t _str, caddr_t narrow, long max_len, wchars charset = default_charset; memset (&state, 0, sizeof (virt_mbstate_t)); - len = (long) virt_mbsnrtowcs (NULL, (unsigned char **) &src, strlen ((char *) str), 0, &state); + len = (long) virt_mbsnrtowcs (NULL, (const unsigned char **) &src, strlen ((char *) str), 0, &state); if (max_len > 0 && len > max_len) len = max_len; if (len < 0) /* there was <= 0 - bug */ @@ -975,7 +975,7 @@ t_box_utf8_as_wide_char (ccaddr_t _utf8, caddr_t _wide_dest, size_t utf8_len, si utf8work = utf8; memset (&state, 0, sizeof (virt_mbstate_t)); - wide_len = virt_mbsnrtowcs (NULL, &utf8work, utf8_len, 0, &state); + wide_len = virt_mbsnrtowcs (NULL, (const unsigned char **) &utf8work, utf8_len, 0, &state); if (((long) wide_len) < 0) return _wide_dest ? ((caddr_t) wide_len) : NULL; if (max_wide_len && max_wide_len < wide_len) @@ -987,7 +987,7 @@ t_box_utf8_as_wide_char (ccaddr_t _utf8, caddr_t _wide_dest, size_t utf8_len, si utf8work = utf8; memset (&state, 0, sizeof (virt_mbstate_t)); - if (wide_len != virt_mbsnrtowcs ((wchar_t *) dest, &utf8work, utf8_len, wide_len, &state)) + if (wide_len != virt_mbsnrtowcs ((wchar_t *) dest, (const unsigned char **) &utf8work, utf8_len, wide_len, &state)) GPF_T1("non consistent multi-byte to wide char translation of a buffer"); ((wchar_t *)dest)[wide_len] = L'\0'; From 9f9f5c9fa309f853bc2313b113053e835f7a9f0c Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 23 Aug 2024 10:57:42 +0000 Subject: [PATCH 56/94] Fixed missing server_func cast This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Dk/Dkernel.c | 4 ++-- libsrc/Wi/pldebug.c | 2 +- libsrc/Wi/sqlsrv.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsrc/Dk/Dkernel.c b/libsrc/Dk/Dkernel.c index 68464983b1..976f6c2706 100644 --- a/libsrc/Dk/Dkernel.c +++ b/libsrc/Dk/Dkernel.c @@ -2039,7 +2039,7 @@ sf_inprocess_ep (void) static server_func sf_inprocess_ep_wrapper (caddr_t args[]) { - return sf_inprocess_ep(); + return (server_func) sf_inprocess_ep(); } @@ -3647,7 +3647,7 @@ sf_caller_identification (char *name) static server_func sf_caller_identification_wrapper (caddr_t args[]) { - return sf_caller_identification ((char *)args[0]); + return (server_func) sf_caller_identification ((char *)args[0]); } #endif /* NO_THREAD */ diff --git a/libsrc/Wi/pldebug.c b/libsrc/Wi/pldebug.c index a7ee6a5cbf..e108eed686 100644 --- a/libsrc/Wi/pldebug.c +++ b/libsrc/Wi/pldebug.c @@ -1475,7 +1475,7 @@ sf_pl_debug (caddr_t name, caddr_t digest) static server_func sf_pl_debug_wrapper (caddr_t args[]) { - return sf_pl_debug (args[0], args[1]); + return (server_func) sf_pl_debug (args[0], args[1]); } /* source and line are from module's qr */ diff --git a/libsrc/Wi/sqlsrv.c b/libsrc/Wi/sqlsrv.c index 3801d715d9..5296b8df8d 100644 --- a/libsrc/Wi/sqlsrv.c +++ b/libsrc/Wi/sqlsrv.c @@ -3981,7 +3981,7 @@ srv_global_init_plugin_actions (dk_set_t *set_ptr, char *mode) static server_func sf_sql_connect_wrapper (caddr_t args[]) { - return sf_sql_connect (args[0], args[1], args[2], (caddr_t *) args[3]); + return (server_func) sf_sql_connect (args[0], args[1], args[2], (caddr_t *) args[3]); } static server_func @@ -4015,7 +4015,7 @@ sf_sql_transact_wrapper (caddr_t args[]) static server_func sf_sql_free_stmt_wrapper (caddr_t args[]) { - return (caddr_t) sf_sql_free_stmt (args[0], (int)args[1]); + return (server_func) sf_sql_free_stmt (args[0], (int)args[1]); } static server_func @@ -4042,7 +4042,7 @@ sf_sql_extended_fetch_wrapper (caddr_t args[]) static server_func sf_sql_no_threads_reply_wrapper (caddr_t args[]) { - return sf_sql_no_threads_reply (); + return (server_func) sf_sql_no_threads_reply (); } static server_func From c65deffab46521131dcb57427c739a88eb6a9440 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 30 Sep 2024 11:04:38 +0000 Subject: [PATCH 57/94] Fixed casts on mp_alloc and mp_alloc_box This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/collock.c | 10 +++++----- libsrc/Wi/mtwrite.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsrc/Wi/collock.c b/libsrc/Wi/collock.c index 9ca7f98387..8293e67921 100644 --- a/libsrc/Wi/collock.c +++ b/libsrc/Wi/collock.c @@ -111,17 +111,17 @@ ceic_del_dbg_log_row (ce_ins_ctx_t * ceic, buffer_desc_t * buf) } if (!n_del) return; - itc->itc_matches = mp_alloc_box (ceic->ceic_mp, n_del * sizeof (row_no_t), DV_BIN); - log_rds = (row_delta_t **)mp_alloc_box (ceic->ceic_mp, sizeof (caddr_t) * n_del, DV_BIN); + itc->itc_matches = (row_no_t *) mp_alloc_box (ceic->ceic_mp, n_del * sizeof (row_no_t), DV_BIN); + log_rds = (row_delta_t **) mp_alloc_box (ceic->ceic_mp, sizeof (caddr_t) * n_del, DV_BIN); for (inx = 0; inx < itc->itc_range_fill; inx++) { if (COL_NO_ROW == itc->itc_ranges[inx].r_end) { - row_delta_t * rd = log_rds[fill] = mp_alloc (ceic->ceic_mp, sizeof (row_delta_t)); + row_delta_t * rd = log_rds[fill] = (row_delta_t *) mp_alloc (ceic->ceic_mp, sizeof (row_delta_t)); memzero (rd, sizeof (row_delta_t)); rd->rd_key = key; rd->rd_op = RD_DELETE; - rd->rd_values = mp_alloc_box (ceic->ceic_mp, sizeof (caddr_t) * key->key_n_significant, DV_ARRAY_OF_POINTER); + rd->rd_values = (caddr_t *) mp_alloc_box (ceic->ceic_mp, sizeof (caddr_t) * key->key_n_significant, DV_ARRAY_OF_POINTER); itc->itc_matches[fill++] = itc->itc_ranges[inx].r_first; } } @@ -131,7 +131,7 @@ ceic_del_dbg_log_row (ce_ins_ctx_t * ceic, buffer_desc_t * buf) memzero (&dc, sizeof (dc)); dc.dc_mp = ceic->ceic_mp; dc.dc_type = DCT_BOXES | DCT_FROM_POOL; - dc.dc_values = mp_alloc (ceic->ceic_mp, sizeof (caddr_t) * n_del); + dc.dc_values = (caddr_t *) mp_alloc (ceic->ceic_mp, sizeof (caddr_t) * n_del); dc.dc_sqt.sqt_dtp = DV_ARRAY_OF_POINTER; dc.dc_n_places = n_del; DO_SET (dbe_column_t *, col, &key->key_parts) diff --git a/libsrc/Wi/mtwrite.c b/libsrc/Wi/mtwrite.c index b5351e2363..5ff25cb6b1 100644 --- a/libsrc/Wi/mtwrite.c +++ b/libsrc/Wi/mtwrite.c @@ -1179,7 +1179,7 @@ dbs_sched_low_dirty (dbe_storage_t * dbs, dp_addr_t min_dp, int * n_sched) bufs[fill++] = buf; if (fill == BUFS_BATCH) { - bufs = mp_alloc_box (mp, sizeof (caddr_t) * BUFS_BATCH, DV_NON_BOX); + bufs = (buffer_desc_t **) mp_alloc_box (mp, sizeof (caddr_t) * BUFS_BATCH, DV_NON_BOX); mp_set_push (mp, &buf_list, (void*)bufs); fill = 0; } From 97c9595a8cf28f72e608be194552640cff6af2d1 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 30 Sep 2024 12:05:24 +0000 Subject: [PATCH 58/94] Fixed bad or missing casts This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- binsrc/hosting/shapefileio/shapefileio.c | 24 ++++++++++++------------ binsrc/tests/isql.c | 2 +- libsrc/Wi/CLIsql3.c | 2 +- libsrc/Wi/arith.c | 11 ++++++----- libsrc/Wi/bif_soap.c | 4 ++-- libsrc/Wi/bif_xml.c | 14 +++++++------- libsrc/Wi/collock.c | 2 +- libsrc/Wi/extent.c | 2 +- libsrc/Wi/http.c | 10 +++++----- libsrc/Wi/search.c | 2 +- libsrc/Wi/sql3.y | 4 ++-- libsrc/Wi/sqlbif.c | 8 ++++---- libsrc/Wi/sqlcost.c | 6 +++--- libsrc/Wi/sqldf.c | 2 +- libsrc/Wi/sqlgen.c | 6 +++--- libsrc/Wi/sqlhash.c | 2 +- libsrc/Wi/sqlintrp.c | 2 +- libsrc/Wi/sqljp.c | 2 +- libsrc/Wi/sqlprt.c | 2 +- libsrc/Wi/sqlsrv.c | 2 +- libsrc/Wi/sqlvec.c | 2 +- libsrc/Wi/sqlvrun.c | 2 +- libsrc/Wi/srvstat.c | 8 ++++---- libsrc/Wi/vecrdf.c | 2 +- libsrc/Wi/xmlenc.c | 14 +++++++------- libsrc/Xml.new/dtd.c | 2 +- 26 files changed, 70 insertions(+), 69 deletions(-) diff --git a/binsrc/hosting/shapefileio/shapefileio.c b/binsrc/hosting/shapefileio/shapefileio.c index b1f655f9e0..3b177dd1c9 100644 --- a/binsrc/hosting/shapefileio/shapefileio.c +++ b/binsrc/hosting/shapefileio/shapefileio.c @@ -362,7 +362,7 @@ shapefileio_read_dbf_fld_mdata (shapefileio_ctx_t *ctx, int fldctr) mdta[4] = (caddr_t)(ptrlong)1; mdta[5] = (caddr_t)(ptrlong)0; mdta[6] = (caddr_t)(ptrlong)0; - ctx->shpio_dbf_cbk_mdata [fldctr] = mdta; + ctx->shpio_dbf_cbk_mdata [fldctr] = (caddr_t) mdta; } caddr_t @@ -462,11 +462,11 @@ shapefileio_read_one_shape ( } boxed_entity_id = box_num (entity_id); params = NEW_LIST (5); - params[0] = &boxed_entity_id; - params[1] = &geo_obj; - params[2] = &(ctx->shpio_dbf_cbk_mdata); - params[3] = &boxed_attrs; - params[4] = app_env; + params[0] = (caddr_t) &boxed_entity_id; + params[1] = (caddr_t) &geo_obj; + params[2] = (caddr_t) &(ctx->shpio_dbf_cbk_mdata); + params[3] = (caddr_t) &boxed_attrs; + params[4] = (caddr_t) app_env; err_ret[0] = qr_exec (ctx->shpio_qi->qi_client, ctx->shpio_cbk_fn_plain, ctx->shpio_qi, NULL, NULL, NULL, params, NULL, 0); dk_free_box (boxed_entity_id); dk_free_box (geo_obj); @@ -534,9 +534,9 @@ shapefileio_read_all_shapes (caddr_t text_or_filename, int arg1_is_filename, cad if (NULL != ctx.shpio_cbk_fn_mdata) { caddr_t *params = NEW_LIST (3); - params[0] = &raw_metas; - params[1] = &(ctx.shpio_dbf_cbk_mdata); - params[2] = app_env; + params[0] = (caddr_t) &raw_metas; + params[1] = (caddr_t) &(ctx.shpio_dbf_cbk_mdata); + params[2] = (caddr_t) app_env; err = qr_exec (ctx.shpio_qi->qi_client, ctx.shpio_cbk_fn_mdata, ctx.shpio_qi, NULL, NULL, NULL, params, NULL, 0); dk_free_box (params); } @@ -544,9 +544,9 @@ shapefileio_read_all_shapes (caddr_t text_or_filename, int arg1_is_filename, cad else { caddr_t *params = NEW_LIST (3); - params[0] = &raw_metas; - params[1] = &cbk_metas; - params[2] = app_env; + params[0] = (caddr_t) &raw_metas; + params[1] = (caddr_t) &cbk_metas; + params[2] = (caddr_t) app_env; err = qr_exec (ctx.shpio_qi->qi_client, ctx.shpio_cbk_fn_mdata, ctx.shpio_qi, NULL, NULL, NULL, params, NULL, 0); dk_free_box (params); } diff --git a/binsrc/tests/isql.c b/binsrc/tests/isql.c index 196332bb65..6f9ad64a58 100644 --- a/binsrc/tests/isql.c +++ b/binsrc/tests/isql.c @@ -9372,7 +9372,7 @@ is_set_subcommand_aux (TCHAR *text, int show_instead_of_set, #endif if (is_macro_name (macro_name, _T("LOCALE"))) { - isql_locale = setlocale (LC_ALL, arg); + isql_locale = setlocale (LC_ALL, (const char *) arg); if (!isql_locale) { isql_fprintf (error_stream, _T("%") PCT_S _T(": Warning: setlocale \"%") PCT_S _T("\" failed.\n"), progname, arg); diff --git a/libsrc/Wi/CLIsql3.c b/libsrc/Wi/CLIsql3.c index 8982bcaffd..c308f8ca89 100644 --- a/libsrc/Wi/CLIsql3.c +++ b/libsrc/Wi/CLIsql3.c @@ -1041,7 +1041,7 @@ SQLConnect (SQLHDBC hdbc, #ifndef DSN_TRANSLATION ASSERT_HANDLE_TYPE (hdbc, SQL_HANDLE_DBC); - return internal_sql_connect (hdbc, szDSN, cbDSN, szUID, cbUID, szPWD, cbPWD); + return internal_sql_connect (hdbc, (SQLCHAR *) szDSN, cbDSN, (SQLCHAR *) szUID, cbUID, (SQLCHAR *) szPWD, cbPWD); #else CON (con, hdbc); diff --git a/libsrc/Wi/arith.c b/libsrc/Wi/arith.c index 6efa38da97..7d8175c5f3 100644 --- a/libsrc/Wi/arith.c +++ b/libsrc/Wi/arith.c @@ -1197,7 +1197,7 @@ dvc_num_double (numeric_t num1, double d2) if (d2 > MIN_INT_DOUBLE && d2 < MAX_INT_DOUBLE) { NUMERIC_VAR (num2); - numeric_from_double (num2, d2); + numeric_from_double ((numeric_t) num2, d2); return numeric_compare_dvc ((numeric_t) num1, (numeric_t) num2); } if (num1->n_len + num1->n_scale <= 15) @@ -1973,7 +1973,7 @@ vec_cmp_t dbl_cmp_ops[] = {NULL, (vec_cmp_t)cmp_vec_dbl_eq, (vec_cmp_t)cmp_vec_d #define CMP_VEC_OP(name, dtp, op) \ -void name (dtp * l, dtp * r, int n_sets, dtp_t * set_mask, dtp_t * res_bits, dtp_t cmp_op, char * mix_ret) \ +void name (dtp l, dtp r, int n_sets, dtp_t * set_mask, dtp_t * res_bits, dtp_t cmp_op, char * mix_ret) \ { \ int set; \ char mix = *mix_ret; \ @@ -2015,8 +2015,9 @@ dt_cmp_fl (db_buf_t dt1, db_buf_t dt2) } -CMP_VEC_OP (cmp_vec_dt, dtp_t *, cmp_op & dt_cmp_fl (((db_buf_t)l) + DT_LENGTH * set, ((db_buf_t)r) + DT_LENGTH * set)) -CMP_VEC_OP (cmp_vec_any, dtp_t **, cmp_op & dv_compare (((db_buf_t*)l)[set], ((db_buf_t*)r)[set], NULL, 0)) +CMP_VEC_OP (cmp_vec_dt, void *, cmp_op & dt_cmp_fl (((db_buf_t)l) + DT_LENGTH * set, ((db_buf_t)r) + DT_LENGTH * set)) +CMP_VEC_OP (cmp_vec_any, void *, cmp_op & dv_compare (((db_buf_t*)l)[set], ((db_buf_t*)r)[set], NULL, 0)) + #define SWAP(t, l, r) { t tmp; tmp = r; r = l; l = tmp;} #define CMP_REV(new_op) \ { cmp_op = new_op; SWAP (dtp_t, l_dtp, r_dtp); SWAP (state_slot_t *, l, r);} @@ -2085,7 +2086,7 @@ CMP_VEC_OP (cmp_vec_any, dtp_t **, cmp_op & dv_compare (((db_buf_t*)l)[set], ((d la = ssl_artm_param (inst, l, (int64 *) & vn_temp_1.i, DV_DATETIME, inx, n, NULL, NULL); if (!inx || (SSL_VEC == r->ssl_type || SSL_REF == r->ssl_type)) ra = ssl_artm_param (inst, r, (int64 *) & vn_temp_2.i, DV_DATETIME, inx, n, NULL, NULL); - cmp_vec_dt ((db_buf_t)la, (db_buf_t)ra, n, set_mask ? &set_mask[inx / 8] : NULL, &res_bits[inx / 8], cmp_op, &mix); + cmp_vec_dt (la, ra, n, set_mask ? &set_mask[inx / 8] : NULL, &res_bits[inx / 8], cmp_op, &mix); } return mix - 1; } diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c index 629b69104d..8d0e608706 100644 --- a/libsrc/Wi/bif_soap.c +++ b/libsrc/Wi/bif_soap.c @@ -761,7 +761,7 @@ xml_find_child (caddr_t *entity, const char *szSearchName, const char *szURI, in caddr_t * xml_find_one_child (caddr_t *entity, char *szSearchName, char **szURIs, int nth, int *start_inx) { - const char **urls = szURIs; + const char **urls = (const char **) szURIs; caddr_t * rc = NULL; for (; urls[0]; urls++) { @@ -11367,7 +11367,7 @@ ws_soap_qr_opt_check (ws_connection_t * ws, query_t * qr) return; BOX_AUTO_TYPED (caddr_t, item, tmp, 5, DV_STRING); strcpy_box_ck (item,"Http"); - inx = find_index_to_vector (item, qr->qr_proc_soap_opts, BOX_ELEMENTS(qr->qr_proc_soap_opts), DV_ARRAY_OF_POINTER, 0, 2, "http_rest"); + inx = find_index_to_vector (item, (caddr_t) qr->qr_proc_soap_opts, BOX_ELEMENTS(qr->qr_proc_soap_opts), DV_ARRAY_OF_POINTER, 0, 2, "http_rest"); if (!inx || !DV_STRINGP (qr->qr_proc_soap_opts[inx])) goto done; split_string (qr->qr_proc_soap_opts[inx], NULL, &set); diff --git a/libsrc/Wi/bif_xml.c b/libsrc/Wi/bif_xml.c index 9af27d97f4..54879b4268 100644 --- a/libsrc/Wi/bif_xml.c +++ b/libsrc/Wi/bif_xml.c @@ -4312,7 +4312,7 @@ bif_int_vectorbld_acc (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) int argcount; /* number of arguments in the call */ int arg_inx; /* index of current argument */ int new_filled_count; /* value of filled_count at the end of the procedure */ - int64 *acc = bif_array_arg (qst, args, 0, "int_vector_agg"); + int64 *acc = (int64 *) bif_array_arg (qst, args, 0, "int_vector_agg"); caddr_t *dst; qi_signal_if_trx_error ((query_instance_t *) qst); if (1 > BOX_ELEMENTS (args)) @@ -4322,7 +4322,7 @@ bif_int_vectorbld_acc (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) if (NULL == acc) { acc = (int64 *) dk_alloc_box_zero (sizeof (int64) * 15 /* 2^n - 1 */ , DV_ARRAY_OF_LONG); - qst_set (qst, args[0], acc); + qst_set (qst, args[0], (caddr_t) acc); } filled_count = acc[0]; acc_length = BOX_ELEMENTS (acc); @@ -4339,16 +4339,16 @@ bif_int_vectorbld_acc (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) sqlr_new_error ("22003", "SR346", "Out of memory allocation limits: the composed vector contains too many items"); if (acc_length != new_acc_length) { - caddr_t new_acc; - if (NULL == (new_acc = dk_try_alloc_box (sizeof (int64) * new_acc_length, DV_ARRAY_OF_LONG))) + int64 * new_acc; + if (NULL == (new_acc = (int64 *) dk_try_alloc_box (sizeof (int64) * new_acc_length, DV_ARRAY_OF_LONG))) qi_signal_if_trx_error ((query_instance_t *) qst); memset (new_acc, 0, sizeof (int64) * new_acc_length); memcpy (new_acc, acc, sizeof (int64) * acc_length); - qst_set (qst, args[0], new_acc); + qst_set (qst, args[0], (caddr_t) new_acc); acc = new_acc; acc_length = new_acc_length; } - dst = acc + filled_count + 1; + dst = (caddr_t *) (acc + filled_count + 1); for (arg_inx = 1; arg_inx < argcount; arg_inx++) { caddr_t arg = QST_GET (qst, args[arg_inx]); @@ -4372,7 +4372,7 @@ bif_int_vectorbld_final (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) int arg_ctr = BOX_ELEMENTS (args); if (1 > arg_ctr) sqlr_new_error ("22003", "SR444", "Too few arguments for vectorbld_final"); - qst_swap_or_get_copy (qst, args[0], (int64 *) (&acc)); + qst_swap_or_get_copy (qst, args[0], (caddr_t *) (&acc)); filled_size = sizeof (int64) * acc[0]; new_box = (caddr_t) dk_alloc_box (filled_size, DV_ARRAY_OF_LONG); memcpy (new_box, acc + 1, filled_size); diff --git a/libsrc/Wi/collock.c b/libsrc/Wi/collock.c index 8293e67921..8c40bb88d8 100644 --- a/libsrc/Wi/collock.c +++ b/libsrc/Wi/collock.c @@ -131,7 +131,7 @@ ceic_del_dbg_log_row (ce_ins_ctx_t * ceic, buffer_desc_t * buf) memzero (&dc, sizeof (dc)); dc.dc_mp = ceic->ceic_mp; dc.dc_type = DCT_BOXES | DCT_FROM_POOL; - dc.dc_values = (caddr_t *) mp_alloc (ceic->ceic_mp, sizeof (caddr_t) * n_del); + dc.dc_values = (db_buf_t) mp_alloc (ceic->ceic_mp, sizeof (caddr_t) * n_del); dc.dc_sqt.sqt_dtp = DV_ARRAY_OF_POINTER; dc.dc_n_places = n_del; DO_SET (dbe_column_t *, col, &key->key_parts) diff --git a/libsrc/Wi/extent.c b/libsrc/Wi/extent.c index d4ce5fbc03..a1f3085ce2 100644 --- a/libsrc/Wi/extent.c +++ b/libsrc/Wi/extent.c @@ -1517,7 +1517,7 @@ em_compact (extent_map_t * em, int free_em) IN_DBS (em->em_dbs); dbs_locate_incbackup_bit (em->em_dbs, dp, &array, &array_page, &inx, &bit); array[inx] = 0; - page_set_checksum_init (array); + page_set_checksum_init ((db_buf_t) array); if (EXT_INDEX == EXT_TYPE (ext)) { /* when dropping a column extent map in a drop index, cpt remaps are possible, so if any, drop them. The remap pagge is dropped anyway as part of the em */ diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index 519172f6a5..c915bef32a 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -8843,11 +8843,11 @@ http_map_fill_cors_allow_headers (caddr_t option_value) if (NULL == ht) ht = id_strcase_hash_create (7); if (h[0] != '!' || 0 == stricmp (h, "!ALL")) /* expilicitly added header, or all custom disabled */ - id_hash_set (ht, &h, (caddr_t) &one); + id_hash_set (ht, (caddr_t) &h, (caddr_t) &one); else /* explicitly denied header */ { caddr_t he = box_dv_short_string (h+1); - id_hash_set (ht, &he, (caddr_t) &two); + id_hash_set (ht, (caddr_t) &he, (caddr_t) &two); } } END_DO_SET(); @@ -8855,10 +8855,10 @@ http_map_fill_cors_allow_headers (caddr_t option_value) /* default allowed headers, except if denied explicitly, see above */ DO_SET (caddr_t, h, &http_default_allow_headers_list) { - ptrlong * flag = id_hash_get (ht, (caddr_t) &h); + ptrlong * flag = (ptrlong *) id_hash_get (ht, (caddr_t) &h); if (flag && 2 == flag[0]) continue; - id_hash_set (ht, &h, (caddr_t) &one); + id_hash_set (ht, (caddr_t) &h, (caddr_t) &one); } END_DO_SET(); @@ -11702,7 +11702,7 @@ bif_http_on_message (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) ses = (dk_session_t *) conn[0]; server_session = (ws && ses && ses == ws->ws_session); if (ses && DKSESSTAT_ISSET (ses, SST_OK)) - conn[0] = keep_conn_ref && !server_session ? ses : NULL; + conn[0] = keep_conn_ref && !server_session ? (caddr_t) ses : (caddr_t) NULL; else ses = NULL; mutex_enter (thread_mtx); diff --git a/libsrc/Wi/search.c b/libsrc/Wi/search.c index 14c2d26125..380ca6c84e 100644 --- a/libsrc/Wi/search.c +++ b/libsrc/Wi/search.c @@ -3447,7 +3447,7 @@ cs_new_page (dk_hash_t * cols) int64 * place; caddr_t * p_value; id_hash_iterator (&hit, cs->cs_distinct); - while (hit_next (&hit, &p_value, (caddr_t*)&place)) + while (hit_next (&hit, (caddr_t *) &p_value, (caddr_t*)&place)) { *place &= ~CS_IN_SAMPLE; } diff --git a/libsrc/Wi/sql3.y b/libsrc/Wi/sql3.y index 10fda1bad3..7c8629545f 100644 --- a/libsrc/Wi/sql3.y +++ b/libsrc/Wi/sql3.y @@ -2927,7 +2927,7 @@ aggregate_ref $$ = sqlp_make_user_aggregate_fun_ref ($2, arglist, 1); } /* | AMMSC '(' '*' ')' { FN_REF ($$, $1, 0, 0); }*/ -| AMMSC '(' DISTINCT scalar_exp opt_sql_opt ')' { FN_REF ($$, $1, 1, $4); $$->_.fn_ref.fn_arglist = $5; } + | AMMSC '(' DISTINCT scalar_exp opt_sql_opt ')' { FN_REF ($$, $1, 1, $4); $$->_.fn_ref.fn_arglist = (ST **) $5; } | AMMSC '(' ALL scalar_exp ')' { FN_REF ($$, $1, 0, $4) } | AMMSC '(' scalar_exp ')' { FN_REF ($$, $1, 0, $3) } ; @@ -2979,7 +2979,7 @@ tail_of_tag_of $$ = ((caddr_t *)$1)[0]; if (!IS_BLOB_DTP($$)) yyerror (scanner, "__TAG OF ... HANDLE is valid only for LONG datatypes"); - $$ = (caddr_t *)(ptrlong)DV_BLOB_HANDLE_DTP_FOR_BLOB_DTP($$); + $$ = (caddr_t)(ptrlong)DV_BLOB_HANDLE_DTP_FOR_BLOB_DTP($$); } | DICTIONARY_L REFERENCE_L { $$ = (caddr_t) DV_DICT_ITERATOR; } | STREAM_L { $$ = (caddr_t) DV_STRING_SESSION; } diff --git a/libsrc/Wi/sqlbif.c b/libsrc/Wi/sqlbif.c index 9412031093..8ff0719689 100644 --- a/libsrc/Wi/sqlbif.c +++ b/libsrc/Wi/sqlbif.c @@ -10044,7 +10044,7 @@ bif_tlsf_dump (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) int ht_mode = AB_ALLOCD; if (BOX_ELEMENTS (args) > 2) { - hit = bif_arg (qst, args, 2, "tlsf_dump"); + hit = (id_hash_iterator_t *) bif_arg (qst, args, 2, "tlsf_dump"); ht_mode = bif_long_arg (qst, args, 3, "tlsf_dump"); if (DV_DICT_ITERATOR == DV_TYPE_OF (hit)) ht = hit->hit_hash; @@ -11142,7 +11142,7 @@ bif_blob_dps (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) dtp_t dtp = DV_TYPE_OF (bh); if (dtp != DV_BLOB_HANDLE && dtp != DV_BLOB_WIDE_HANDLE) return NEW_DB_NULL; - l = bh_dp_list_n (qi->qi_trx, bh); + l = bh_dp_list_n (qi->qi_trx, (blob_handle_t *) bh); return list_to_array (l); } @@ -12535,7 +12535,7 @@ bif_deserialize (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) return NEW_DB_NULL; if (DV_STRING_SESSION == dtp) { - return read_object (xx); + return read_object ((dk_session_t *) xx); } if (!IS_BLOB_HANDLE_DTP(dtp)) sqlr_new_error ("22023", "SR581", "deserialize() requires a blob or NULL or string argument"); @@ -12581,7 +12581,7 @@ bif_serialize_to_string_session (caddr_t * qst, caddr_t * err_ret, state_slot_t dv_type_title (tag), (unsigned) tag); } END_WRITE_FAIL (out); - return out; + return (caddr_t) out; } static caddr_t diff --git a/libsrc/Wi/sqlcost.c b/libsrc/Wi/sqlcost.c index 5de0d3659c..094b0d7eeb 100644 --- a/libsrc/Wi/sqlcost.c +++ b/libsrc/Wi/sqlcost.c @@ -3471,7 +3471,7 @@ rq_sample_subp (df_elt_t * dfe, rq_cols_t * rq, index_choice_t * ic) ri_iterator_t * rit; int found; rdf_sub_t * sub_iri; - variable = &rq->rq_p.rqp_lower->_.bin.right->dfe_tree; + variable = (caddr_t *) &rq->rq_p.rqp_lower->_.bin.right->dfe_tree; save = *variable; sub = ric_iri_to_sub (ric, save, RI_SUBPROPERTY, 0); if (!sub || (!sub->rs_sub && !sub->rs_equiv)) @@ -3585,9 +3585,9 @@ dfe_init_p_stat (df_elt_t * dfe, df_elt_t * lower) rq.rq_p.rqp_lower = lower; ic.ic_set_sample_key = 1; ic.ic_key = tb_px_key (rq.rq_table, rq.rq_s_col); - dfe_p_card (dfe, &rq, &p_stat, &ic, SO_S); + dfe_p_card (dfe, &rq, p_stat, &ic, SO_S); ic.ic_key = tb_px_key (rq.rq_table, rq.rq_o_col); - dfe_p_card (dfe, &rq, &p_stat, &ic, SO_O); + dfe_p_card (dfe, &rq, p_stat, &ic, SO_O); return 1; } diff --git a/libsrc/Wi/sqldf.c b/libsrc/Wi/sqldf.c index f6342a3ce8..c5e1453975 100644 --- a/libsrc/Wi/sqldf.c +++ b/libsrc/Wi/sqldf.c @@ -264,7 +264,7 @@ sqlo_is_tautology (ST * tree) dtp_t l_dtp = DV_TYPE_OF (l); dtp_t r_dtp = DV_TYPE_OF (r); if (DV_LONG_INT == l_dtp && DV_LONG_INT == r_dtp) - return unbox (l) == unbox (r); + return unbox ((ccaddr_t) l) == unbox ((ccaddr_t) r); return 2; } return 2; diff --git a/libsrc/Wi/sqlgen.c b/libsrc/Wi/sqlgen.c index cf8e71887f..938e234b9d 100644 --- a/libsrc/Wi/sqlgen.c +++ b/libsrc/Wi/sqlgen.c @@ -679,9 +679,9 @@ sqlg_geo_index_table (dbe_key_t * text_key, ST ** geo_args) for (inx = 2; inx < n; inx++) { ST * arg = geo_args[inx]; - if (DV_STRINGP (arg) && !stricmp (arg, "index") && inx + 1 < n && DV_STRINGP (geo_args[inx + 1])) + if (DV_STRINGP (arg) && !stricmp ((const char *) arg, "index") && inx + 1 < n && DV_STRINGP (geo_args[inx + 1])) { - caddr_t inx_name = geo_args[inx + 1]; + caddr_t inx_name = (caddr_t) geo_args[inx + 1]; dbe_table_t * tb = sch_name_to_table (wi_inst.wi_schema, inx_name); if (!tb) sqlc_new_error (top_sc->sc_cc, "28008", "GEOTB", "No geo index table %s", inx_name); @@ -3350,7 +3350,7 @@ sqlg_may_parallelize (sql_comp_t * sc, data_source_t * qn) } if (IS_QN(ts, outer_seq_end_input)) { - outer_seq_end_node_t * ose = ts; + outer_seq_end_node_t * ose = (outer_seq_end_node_t *) ts; data_source_t * qn0 = qn; for (qn0 = qn; qn0; qn0 = qn_next(qn0)) { diff --git a/libsrc/Wi/sqlhash.c b/libsrc/Wi/sqlhash.c index de0d2341a7..c8934791e0 100644 --- a/libsrc/Wi/sqlhash.c +++ b/libsrc/Wi/sqlhash.c @@ -309,7 +309,7 @@ setp_after_deserialize (setp_node_t * setp) if (setp->setp_loc_ts) setp->setp_loc_ts->ts_order_ks->ks_key = ha->ha_key; if (setp->setp_ha && HA_ORDER == setp->setp_ha->ha_op) - setp->setp_org_slots = (state_slot_t **)box_concat (setp->setp_keys_box, setp->setp_dependent_box); + setp->setp_org_slots = (state_slot_t **) box_concat ((caddr_t) setp->setp_keys_box, (caddr_t) setp->setp_dependent_box); } diff --git a/libsrc/Wi/sqlintrp.c b/libsrc/Wi/sqlintrp.c index 0de978ad91..880b9037e1 100644 --- a/libsrc/Wi/sqlintrp.c +++ b/libsrc/Wi/sqlintrp.c @@ -882,7 +882,7 @@ ins_call_vec (instruction_t * ins, caddr_t * inst, code_vec_t code_vec, int firs rets[set] = qi->qi_proc_ret; } END_SET_LOOP; - qi->qi_proc_ret = rets; + qi->qi_proc_ret = (caddr_t) rets; } } diff --git a/libsrc/Wi/sqljp.c b/libsrc/Wi/sqljp.c index 138e1ffebc..fe8d4af80c 100644 --- a/libsrc/Wi/sqljp.c +++ b/libsrc/Wi/sqljp.c @@ -957,7 +957,7 @@ sqlo_hash_fill_join (sqlo_t * so, df_elt_t * hash_ref_tb, df_elt_t ** fill_ret, t_listst (3, TABLE_REF, t_listst (6, TABLE_DOTTED, tb_dfe->_.table.ot->ot_table->tb_name, tb_dfe->_.table.ot->ot_new_prefix, NULL, NULL, tb_dfe->_.table.ot->ot_opts), NULL); END_DO_BOX; - sel = t_box_copy_tree (sel); + sel = (ST *) t_box_copy_tree ((caddr_t) sel); sqlo_scope (so, &sel); fill_dfe = sqlo_df (so, sel); fill_dfe->dfe_super = hash_ref_tb; diff --git a/libsrc/Wi/sqlprt.c b/libsrc/Wi/sqlprt.c index 7b0e8d84b9..517dfa3f30 100644 --- a/libsrc/Wi/sqlprt.c +++ b/libsrc/Wi/sqlprt.c @@ -39,7 +39,7 @@ trset_start (caddr_t * qst) ctx = (trset_ctx_t *)dk_alloc_box (sizeof (trset_ctx_t), DV_CUSTOM); ctx->tc_tail = ctx->tc_buf = dk_alloc_box (TRSET_BUF_MAX + 1, DV_LONG_STRING); ctx->tc_buf[0] = '\0'; - ctx->tc_qst = qst; + ctx->tc_qst = (query_instance_t *) qst; ctx->tc_indent = 0; SET_THR_ATTR (THREAD_CURRENT_THREAD, TA_REPORT_CTX, ctx); diff --git a/libsrc/Wi/sqlsrv.c b/libsrc/Wi/sqlsrv.c index 5296b8df8d..8d9f632b2f 100644 --- a/libsrc/Wi/sqlsrv.c +++ b/libsrc/Wi/sqlsrv.c @@ -4008,7 +4008,7 @@ sf_sql_fetch_wrapper (caddr_t args[]) static server_func sf_sql_transact_wrapper (caddr_t args[]) { - sf_sql_transact ((long) args[0], args[1]); + sf_sql_transact ((long) args[0], (caddr_t *) args[1]); return NULL; /* void function */ } diff --git a/libsrc/Wi/sqlvec.c b/libsrc/Wi/sqlvec.c index 03b2a08c47..b42ba91da4 100644 --- a/libsrc/Wi/sqlvec.c +++ b/libsrc/Wi/sqlvec.c @@ -1597,7 +1597,7 @@ sqlg_vec_setp (sql_comp_t * sc, setp_node_t * setp, dk_hash_t * res) { sqlg_vec_ref_ssl_list (sc, setp->setp_keys); if (setp->setp_ha && HA_ORDER == setp->setp_ha->ha_op) - setp->setp_org_slots = (state_slot_t **)box_concat (setp->setp_keys_box, setp->setp_dependent_box); + setp->setp_org_slots = (state_slot_t **)box_concat ((caddr_t) setp->setp_keys_box, (caddr_t) setp->setp_dependent_box); if (setp->setp_loc_ts) sqlg_vec_setp_loc (sc, setp); if (setp->setp_ha && HA_GROUP == setp->setp_ha->ha_op && !setp->setp_set_no_in_key) diff --git a/libsrc/Wi/sqlvrun.c b/libsrc/Wi/sqlvrun.c index ff6e5dd254..5a3766543e 100644 --- a/libsrc/Wi/sqlvrun.c +++ b/libsrc/Wi/sqlvrun.c @@ -3995,7 +3995,7 @@ ts_aq_result (table_source_t * ts, caddr_t * inst) } if (prof_on || !ts->src_gen.src_query->qr_select_node) { - qi_add_stats ((QI*)inst, qst_get (inst, ts->ts_aq_qis), ts->src_gen.src_query); + qi_add_stats ((QI*)inst, (QI **) qst_get (inst, ts->ts_aq_qis), ts->src_gen.src_query); } if (!ts->ts_agg_node) return; diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index 80da3facc1..94f945251f 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -4741,7 +4741,7 @@ sc_data_to_ext (query_instance_t * qi, caddr_t dt) arr[inx] = sc_data_to_ext (qi, a); } END_DO_BOX; - return arr; + return (caddr_t) arr; } else return box_copy_tree (dt); @@ -4754,7 +4754,7 @@ sc_ext_to_data (query_instance_t * qi, caddr_t dt) dtp_t dtp = DV_TYPE_OF (dt); caddr_t err = NULL; if (DV_STRING == dtp && box_flags (dt)) - return iri_to_id (qi, dt, 1, &err); + return iri_to_id ((caddr_t *) qi, dt, 1, &err); else if (DV_ARRAY_OF_POINTER == dtp) { caddr_t * arr = (caddr_t*)dk_alloc_box (box_length (dt), DV_ARRAY_OF_POINTER); @@ -4763,7 +4763,7 @@ sc_ext_to_data (query_instance_t * qi, caddr_t dt) arr[inx] = sc_ext_to_data (qi, a); } END_DO_BOX; - return arr; + return (caddr_t) arr; } else return box_copy_tree (dt); @@ -4959,7 +4959,7 @@ bif_stat_import (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) smpl.smp_time = approx_msec_real_time (); smpl.smp_card = unbox_float (smp[1]); smpl.smp_inx_card = unbox_float (smp[2]); - id_hash_set (ric->ric_samples, (caddr_t)&k, (caddr_t*)&smpl); + id_hash_set (ric->ric_samples, (caddr_t)&k, (caddr_t)&smpl); } END_DO_BOX; } diff --git a/libsrc/Wi/vecrdf.c b/libsrc/Wi/vecrdf.c index 43e8a08556..43c5546d75 100644 --- a/libsrc/Wi/vecrdf.c +++ b/libsrc/Wi/vecrdf.c @@ -851,7 +851,7 @@ bif_str_vec (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args, state_slot_ rbs_string_range (&dv, &len, &is_string); if (!is_string) { - rdf_box_t *rb = box_deserialize_string (dv, INT32_MAX, 0); + rdf_box_t *rb = (rdf_box_t *) box_deserialize_string (dv, INT32_MAX, 0); if ((rb_type__xsd_boolean == rb->rb_type) && (DV_LONG_INT == DV_TYPE_OF (rb->rb_box))) { int save = dc->dc_n_values; diff --git a/libsrc/Wi/xmlenc.c b/libsrc/Wi/xmlenc.c index b5a4b4359e..4d971ebc70 100644 --- a/libsrc/Wi/xmlenc.c +++ b/libsrc/Wi/xmlenc.c @@ -2940,7 +2940,7 @@ xenc_id_t xenc_encode_by_key (xenc_key_t * key, dk_session_t * ses, long seslen, xenc_id_t id = xenc_next_id (); char id_str[200]; uuid_t id_stat; - uuid_unparse (id, id_str); + uuid_unparse ((const unsigned char *) id, id_str); memcpy (&id_stat, id, sizeof (uuid_t)); snprintf (buf, 1024, "lm_length = cached_text->lm_length; res_pos->line_num = res_pos->col_b_num = res_pos->col_c_num = 1; res_pos->origin_ent = NULL; - key_ptr = id_hash_get_key_by_place (parser->includes, cached_text_ptr); + key_ptr = id_hash_get_key_by_place (parser->includes, (caddr_t) cached_text_ptr); res_pos->origin_uri = ((caddr_t *)key_ptr)[0]; dk_free_box (path); return 1; From 25f0fa5bbfa841768b2582c2a627043be8f090e3 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 1 Oct 2024 11:11:08 +0000 Subject: [PATCH 59/94] Fixed issue with function prototype This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/bif_file.c | 5 ++--- libsrc/Wi/ddlrun.c | 4 ++-- libsrc/Wi/sqlcost.c | 2 +- libsrc/Wi/sqlo.h | 2 +- libsrc/Wi/xmlenc.c | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libsrc/Wi/bif_file.c b/libsrc/Wi/bif_file.c index 489075990f..8f87e7d7d9 100644 --- a/libsrc/Wi/bif_file.c +++ b/libsrc/Wi/bif_file.c @@ -4911,13 +4911,12 @@ gz_stream_free (void * s) return gz_s_free ((gz_stream *)s); } -int -do_flush_ses (gzFile file, int flush, dk_session_t *ses_out) +static int +do_flush_ses (gz_stream *s, int flush, dk_session_t *ses_out) { uInt len; int done = 0; char temp[20]; - gz_stream *s = (gz_stream *) file; s->stream.avail_in = 0; /* should be zero already anyway */ diff --git a/libsrc/Wi/ddlrun.c b/libsrc/Wi/ddlrun.c index b3053a690f..3da0715d66 100644 --- a/libsrc/Wi/ddlrun.c +++ b/libsrc/Wi/ddlrun.c @@ -2695,7 +2695,7 @@ ddl_modify_col (query_instance_t * qi, char *table, caddr_t * column) void -ddl_drop_col (query_instance_t * qi, char *table, caddr_t * col, int if_exists) +ddl_drop_col (query_instance_t * qi, char *table, caddr_t col, int if_exists) { static query_t *dc_qr; caddr_t err; @@ -4097,7 +4097,7 @@ sql_ddl_node_input_1 (ddl_node_t * ddl, caddr_t * inst, caddr_t * state) ddl_modify_col (qi, tree->_.op.arg_1, (caddr_t *) tree->_.op.arg_2); break; case DROP_COL: - ddl_drop_col (qi, tree->_.op.arg_1, (caddr_t *) tree->_.op.arg_2, (int)(ptrlong)tree->_.op.arg_3); + ddl_drop_col (qi, tree->_.op.arg_1, tree->_.op.arg_2, (int)(ptrlong)tree->_.op.arg_3); break; case TABLE_RENAME: ddl_rename_table (qi, tree->_.op.arg_1, tree->_.op.arg_2); diff --git a/libsrc/Wi/sqlcost.c b/libsrc/Wi/sqlcost.c index 094b0d7eeb..c18a7f58d8 100644 --- a/libsrc/Wi/sqlcost.c +++ b/libsrc/Wi/sqlcost.c @@ -3905,7 +3905,7 @@ col_dfe_list_size (dk_set_t * cols) float -sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t cols, float * size_ret) +sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t * cols, float * size_ret) { float mem_cost = sqlo_hash_mem_cost (card); if (dfe->_.table.is_unique && !cols) diff --git a/libsrc/Wi/sqlo.h b/libsrc/Wi/sqlo.h index f5891ce1e1..75d4933865 100644 --- a/libsrc/Wi/sqlo.h +++ b/libsrc/Wi/sqlo.h @@ -968,7 +968,7 @@ void dfe_unplace_fill_join (df_elt_t * fill_dt, df_elt_t * tb_dfe, dk_set_t org_ int st_is_call (ST * tree, char * f, int n_args); df_elt_t * dfe_container (sqlo_t * so, int type, df_elt_t * super); float dfe_hash_fill_cond_card (df_elt_t * tb_dfe); -float sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t cols, float * size_ret); +float sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t * cols, float * size_ret); float sqlo_hash_ref_cost (df_elt_t * dfe, float hash_card); #define SQK_MAX_CHARS 2000 diff --git a/libsrc/Wi/xmlenc.c b/libsrc/Wi/xmlenc.c index 4d971ebc70..bbb2c75931 100644 --- a/libsrc/Wi/xmlenc.c +++ b/libsrc/Wi/xmlenc.c @@ -6624,7 +6624,7 @@ int x509_add_binbox_ext (X509 *issuer, X509 *x, ccaddr_t ext, ccaddr_t v) } static void -x509_add_extensions_from_vector (X509 *issuer, X509 *x, caddr_t ** exts) +x509_add_extensions_from_vector (X509 *issuer, X509 *x, caddr_t * exts) { int i; for (i = 0; i < BOX_ELEMENTS (exts); i += 2) From 71a3faf7ead42fb9a1dfee64ede78e7a1e4d70b0 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 1 Oct 2024 13:04:01 +0000 Subject: [PATCH 60/94] Fixed bad cast using thr_get_error_code This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/obackup.c | 8 ++++---- libsrc/Wi/sqlsrv.c | 4 ++-- libsrc/Wi/turtle_l.l | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libsrc/Wi/obackup.c b/libsrc/Wi/obackup.c index 3643ca449c..636009c658 100644 --- a/libsrc/Wi/obackup.c +++ b/libsrc/Wi/obackup.c @@ -1252,17 +1252,17 @@ bif_backup_online (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) QR_RESET_CODE { du_thread_t *self = THREAD_CURRENT_THREAD; - caddr_t* err = (caddr_t*) thr_get_error_code (self); + caddr_t err = thr_get_error_code (self); POP_QR_RESET; if ((DV_TYPE_OF (err) == DV_ARRAY_OF_POINTER) && BOX_ELEMENTS (err) == 3) { backup_status.is_error = 1; - strncpy (backup_status.errcode, err[1], 100); - strncpy (backup_status.errstring, err[2], 1024); + strncpy (backup_status.errcode, ERR_STATE(err), 100); + strncpy (backup_status.errstring, ERR_MESSAGE(err), 1024); } - sqlr_resignal ((caddr_t)err); + sqlr_resignal (err); } END_QR_RESET; return box_num (res); diff --git a/libsrc/Wi/sqlsrv.c b/libsrc/Wi/sqlsrv.c index 8d9f632b2f..9e3aa11cde 100644 --- a/libsrc/Wi/sqlsrv.c +++ b/libsrc/Wi/sqlsrv.c @@ -4546,7 +4546,7 @@ srv_make_trx_error (int code, caddr_t detail) case LTE_SQL_ERROR: { du_thread_t *self = THREAD_CURRENT_THREAD; - caddr_t *probable_err = (caddr_t *)thr_get_error_code (self); + caddr_t probable_err = thr_get_error_code (self); if (DV_ARRAY_OF_POINTER != DV_TYPE_OF (probable_err)) probable_err = NULL; if (NULL == probable_err) @@ -4560,7 +4560,7 @@ srv_make_trx_error (int code, caddr_t detail) { err = srv_make_new_error ("4000X", "SR176", "Transaction rolled back due to previous SQL error %s (((\n%s\n)))%s%s", - probable_err[1], probable_err[2], detail ? " : " : "", detail ? detail : ""); + ERR_STATE(probable_err), ERR_MESSAGE(probable_err), detail ? " : " : "", detail ? detail : ""); break; } } diff --git a/libsrc/Wi/turtle_l.l b/libsrc/Wi/turtle_l.l index c18d6bc39e..24838b78fd 100644 --- a/libsrc/Wi/turtle_l.l +++ b/libsrc/Wi/turtle_l.l @@ -797,7 +797,7 @@ resume_sniffing: QR_RESET_CODE { du_thread_t *self = THREAD_CURRENT_THREAD; - caddr_t *err = (caddr_t *)thr_get_error_code (self); + caddr_t err = thr_get_error_code (self); #ifdef TTLYYDEBUG ttlyy_dbg_printf (("{ERROR %s %s}", ERR_STATE(err), ERR_MESSAGE(err))); #endif From 3255b2661691ea8332fa803170f108102781582b Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 1 Oct 2024 13:11:32 +0000 Subject: [PATCH 61/94] Fixed bad variable declaration This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- binsrc/virtuoso/viconfig.c | 4 ++-- libsrc/Wi/http.c | 4 ++-- libsrc/Wi/rdf_core.c | 2 +- libsrc/Wi/srvstat.c | 2 +- libsrc/Wi/wifn.h | 4 ++-- libsrc/Wi/xmlenc.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/binsrc/virtuoso/viconfig.c b/binsrc/virtuoso/viconfig.c index 7aff436c2e..297cd20944 100644 --- a/binsrc/virtuoso/viconfig.c +++ b/binsrc/virtuoso/viconfig.c @@ -91,7 +91,7 @@ extern int prefix_in_result_col_names; extern int disk_no_mt_write; extern long vd_param_batch; extern long vd_opt_arrayparams; -extern const char *www_root; +extern char *www_root; extern char *dav_root; extern long vsp_in_dav_enabled; extern long http_proxy_enabled; @@ -167,7 +167,7 @@ extern int32 http_max_keep_alives; extern int32 http_max_cached_proxy_connections; extern int32 http_proxy_connection_cache_timeout; extern char * http_server_id_string; -extern const char * http_client_id_string; +extern char * http_client_id_string; extern char * http_access_control_allow_default_headers; extern char * http_soap_client_id_string; extern long http_ses_trap; diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c index c915bef32a..901d04029f 100644 --- a/libsrc/Wi/http.c +++ b/libsrc/Wi/http.c @@ -1957,7 +1957,7 @@ ws_clear (ws_connection_t * ws, int error_cleanup) char http_server_id_string_buf [1024]; char *http_server_id_string = NULL; -const char *http_client_id_string = "Mozilla/4.0 (compatible; OpenLink Virtuoso)"; +char *http_client_id_string = "Mozilla/4.0 (compatible; OpenLink Virtuoso)"; uint32 http_default_client_req_timeout = 100; extern char * https_csp; @@ -2803,7 +2803,7 @@ static char *fmt1 = #define REPLY_SENT "reply sent" -const char *www_root = "."; +char *www_root = "."; static int diff --git a/libsrc/Wi/rdf_core.c b/libsrc/Wi/rdf_core.c index f07c1dd1e7..2f239d2af9 100644 --- a/libsrc/Wi/rdf_core.c +++ b/libsrc/Wi/rdf_core.c @@ -3348,7 +3348,7 @@ bif_rdf_handle_invalid_iri_id (caddr_t * qst, caddr_t * err_ret, state_slot_t ** if (8192 == iid) return uname_nodeID_ns_8192; if (debug_invalid_iri_id) { - caddr_t buf[100]; + char buf[1024]; caddr_t b; if (is_prefix) diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index 94f945251f..45d915f5c2 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -4775,7 +4775,7 @@ bif_stat_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) QNCAST (QI, qi, qst); int inx, inx2; dbe_schema_t * sc = wi_inst.wi_schema; - dk_set_t * cols = NULL, keys = NULL, rics = NULL; + dk_set_t cols = NULL, keys = NULL, rics = NULL; DO_HT (ptrlong, id, dbe_column_t *, col, sc->sc_id_to_col) { dk_set_push (&cols, list (6, box_string (col->col_defined_in->tb_name), box_string (col->col_name), diff --git a/libsrc/Wi/wifn.h b/libsrc/Wi/wifn.h index 16da495fdf..db4c4f0d4f 100644 --- a/libsrc/Wi/wifn.h +++ b/libsrc/Wi/wifn.h @@ -837,7 +837,7 @@ extern int enable_gzip; extern int isdts_mode; extern FILE *http_log; extern char * http_soap_client_id_string; -extern const char * http_client_id_string; +extern char * http_client_id_string; extern char * http_server_id_string; extern uint32 http_default_client_req_timeout; extern long http_ses_trap; @@ -867,7 +867,7 @@ extern char *denied_dirs; extern char *backup_dirs; extern char *safe_execs; extern char *dba_execs; -extern const char *www_root; +extern char *www_root; extern char *temp_dir; /* Externals from virtuoso */ diff --git a/libsrc/Wi/xmlenc.c b/libsrc/Wi/xmlenc.c index bbb2c75931..8f97ed552a 100644 --- a/libsrc/Wi/xmlenc.c +++ b/libsrc/Wi/xmlenc.c @@ -1630,7 +1630,7 @@ caddr_t bif_xenc_DH_get_params (caddr_t * qst, caddr_t * err_r, state_slot_t ** int n, len; caddr_t buf = NULL, ret, b64; DH *dh; - BIGNUM *num; + const BIGNUM *num; mutex_enter (xenc_keys_mtx); key = xenc_get_key_by_name (name, 0); From 948ab791bae818f2f6d638acf96509b7f84dbe9f Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 1 Oct 2024 13:11:55 +0000 Subject: [PATCH 62/94] Fixed bad pointer type This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/rdf_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/rdf_core.c b/libsrc/Wi/rdf_core.c index 2f239d2af9..38ceca9cca 100644 --- a/libsrc/Wi/rdf_core.c +++ b/libsrc/Wi/rdf_core.c @@ -932,7 +932,7 @@ ttlp_qname_prefix_is_explicit_and_valid (ttlp_t *ttlp_arg, caddr_t qname) char *lname = strchr (qname, ':'); caddr_t ns_pref; id_hash_t *ns_dict; - caddr_t **ns_uri_ptr; + caddr_t ns_uri_ptr; if (NULL == lname) return 0; if (qname == lname) @@ -942,12 +942,12 @@ ttlp_qname_prefix_is_explicit_and_valid (ttlp_t *ttlp_arg, caddr_t qname) if (ttlp_arg[0].ttlp_in_trig_graph) { ns_dict = ttlp_arg[0].ttlp_inner_namespaces_prefix2iri; - ns_uri_ptr = ((NULL == ns_dict) ? NULL : (caddr_t *) id_hash_get (ns_dict, (caddr_t)(&ns_pref))); + ns_uri_ptr = ((NULL == ns_dict) ? NULL : (caddr_t) id_hash_get (ns_dict, (caddr_t)(&ns_pref))); if (NULL != ns_uri_ptr) goto ns_found; /* see below */ } ns_dict = ttlp_arg[0].ttlp_namespaces_prefix2iri; - ns_uri_ptr = ((NULL == ns_dict) ? NULL : (caddr_t *) id_hash_get (ns_dict, (caddr_t)(&ns_pref))); + ns_uri_ptr = ((NULL == ns_dict) ? NULL : (caddr_t) id_hash_get (ns_dict, (caddr_t)(&ns_pref))); if (NULL != ns_uri_ptr) goto ns_found; /* see below */ if (!strcmp (ns_pref, "rdf:")) From 1e94b8b703d21f05efbff5a68ec1f0bf136c865e Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 1 Oct 2024 13:12:24 +0000 Subject: [PATCH 63/94] Fixed initialization of different pointers This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/util/ncfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsrc/util/ncfg.c b/libsrc/util/ncfg.c index 4c4ba0c27d..efcb4674a8 100644 --- a/libsrc/util/ncfg.c +++ b/libsrc/util/ncfg.c @@ -169,7 +169,8 @@ _cfg_freeimage (PCONFIG pconfig) * * Dont reset the fileName and mtx fields */ - pconfig->image = pconfig->entries = NULL; + pconfig->image = NULL; + pconfig->entries = NULL; pconfig->dirty = 0; pconfig->size = 0L; pconfig->mtime = 0L; From 860691352f63ad53025abd20cf38de3528cddaf7 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Tue, 1 Oct 2024 16:18:33 +0000 Subject: [PATCH 64/94] Fixed use separate macro for XT * data This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/bif_xper.c | 2 +- libsrc/Wi/xpath.c | 8 ++++---- libsrc/Wi/xpath.h | 2 ++ libsrc/Wi/xslt_opt.c | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libsrc/Wi/bif_xper.c b/libsrc/Wi/bif_xper.c index 9b434fea48..90a60a571c 100644 --- a/libsrc/Wi/bif_xper.c +++ b/libsrc/Wi/bif_xper.c @@ -3492,7 +3492,7 @@ DBG_NAME(xp_attribute) (DBG_PARAMS xml_entity_t * xe, int start, XT * node, cadd local = tptr; local_len = len; } - if (!have_ns && !ST_P (node, XP_NAME_EXACT) && (local_len >= 5) && !memcmp (local, "xmlns", 5)) + if (!have_ns && !XT_P (node, XP_NAME_EXACT) && (local_len >= 5) && !memcmp (local, "xmlns", 5)) nt_res = 0; else nt_res = xt_node_test_match_parts (node, (char *) local, local_len, ns); diff --git a/libsrc/Wi/xpath.c b/libsrc/Wi/xpath.c index 167dd0ee68..03389551c8 100644 --- a/libsrc/Wi/xpath.c +++ b/libsrc/Wi/xpath.c @@ -1641,7 +1641,7 @@ xp_sql (xpp_t *xpp, xp_ctx_t * start_ctx, XT * tree, xp_ret_t * xr, int mode) else xr->xr_tree = (ST *) t_full_box_copy_tree ((caddr_t) tree); } - else if (ST_P (tree, XP_STEP) && + else if (XT_P (tree, XP_STEP) && ((tree->_.step.axis == XP_ATTRIBUTE) || (tree->_.step.axis == XP_ATTRIBUTE_WR)) && !tree->_.step.input) { @@ -2551,7 +2551,7 @@ xv_top_exp (xpp_t *xpp, XT * tree, caddr_t * err_ret) { XT * end_step = xp_end_step (path); xp_ret_t xr; - if (ST_P (end_step, XP_STEP) && xp_is_join_step ((int) end_step->_.step.axis) + if (XT_P (end_step, XP_STEP) && xp_is_join_step ((int) end_step->_.step.axis) /*mapping schema 12.02.03* / && !xp_is_simple_subelement (end_step) / *end mapping schema*/ @@ -3690,7 +3690,7 @@ xpt_eq (XT * tree, XT * ctx_step) ptrlong xpt_range_flags_of_step (XT *tree, XT* ctx_node) { - if (! ST_P (tree, XP_STEP)) + if (! XT_P (tree, XP_STEP)) return 0; switch (tree->_.step.axis) { @@ -3741,7 +3741,7 @@ xpt_call (XT * tree) sqlr_new_error ("XP370", "XT014", "First attribute of text-contains cannot be value of attribute"); if (0 == range_type) return in; - if (! ST_P (args[1], XP_LITERAL)) + if (! XT_P (args[1], XP_LITERAL)) return in; /* literal expected as the second argument */ if (! DV_STRINGP (args[1]->_.literal.val)) return in; diff --git a/libsrc/Wi/xpath.h b/libsrc/Wi/xpath.h index 8f607d9d48..aa0413f641 100644 --- a/libsrc/Wi/xpath.h +++ b/libsrc/Wi/xpath.h @@ -199,6 +199,8 @@ typedef struct xp_ctx_s int xc_is_generated; } xp_ctx_t; +#define XT_P(s, tp) \ + (ARRAYP (s) && BOX_ELEMENTS (s) > 0 && ((XT *)(s))->type == tp) typedef ptrlong xqst_t; /* int size of caddr_t */ diff --git a/libsrc/Wi/xslt_opt.c b/libsrc/Wi/xslt_opt.c index f5e9ffb1e9..c19f994743 100644 --- a/libsrc/Wi/xslt_opt.c +++ b/libsrc/Wi/xslt_opt.c @@ -492,7 +492,7 @@ xst_rule_default_priority (xp_query_t * xqr) if (DV_XPATH_QUERY == DV_TYPE_OF (xqr)) { XT * tree = xqr->xqr_tree; - if (!ST_P (tree, XP_STEP)) + if (!XT_P (tree, XP_STEP)) return 0.5; switch (tree->_.step.axis) { @@ -537,7 +537,7 @@ xte_to_template_1 (caddr_t * xte, xp_query_t *match, caddr_t name) if (match) { XT * tree = match->xqr_tree; - if (ST_P (tree, XP_STEP)) + if (XT_P (tree, XP_STEP)) { if ((XP_ATTRIBUTE == tree->_.step.axis) || (XP_ATTRIBUTE_WR == tree->_.step.axis)) xst->xst_match_attributes = 1; From 96e11a4def67edc7f8624a552cbb2c56dbedae47 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Wed, 2 Oct 2024 10:47:51 +0000 Subject: [PATCH 65/94] Fixed use separate macro for UST * data This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/sqltype.c | 4 ++-- libsrc/Wi/sqltype_c.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libsrc/Wi/sqltype.c b/libsrc/Wi/sqltype.c index 6dba7e26f5..bb1e7a8bf0 100644 --- a/libsrc/Wi/sqltype.c +++ b/libsrc/Wi/sqltype.c @@ -307,7 +307,7 @@ udt_compile_class_methods (dbe_schema_t * sc, sql_class_t * udt, int inx2; DO_BOX (UST *, prop, inx2, mtd->_.method_def.props) { - if (ST_P (prop, UDT_EXT)) + if (UST_P (prop, UDT_EXT)) { if (prop->_.ext_def.name) { @@ -337,7 +337,7 @@ udt_compile_class_methods (dbe_schema_t * sc, sql_class_t * udt, udtm->scm_ext_type = box_dv_short_string (prop->_.ext_def.type); } } - else if (ST_P (prop, UDT_VAR_EXT)) + else if (UST_P (prop, UDT_VAR_EXT)) { if (udtm->scm_type != UDT_METHOD_STATIC) { diff --git a/libsrc/Wi/sqltype_c.h b/libsrc/Wi/sqltype_c.h index 0f62bf5a42..724ebb14a3 100644 --- a/libsrc/Wi/sqltype_c.h +++ b/libsrc/Wi/sqltype_c.h @@ -151,9 +151,12 @@ typedef struct udt_parse_tree_s } udt_parse_tree_t; +#define UST_P(s, tp) \ + (ARRAYP (s) && BOX_ELEMENTS (s) > 0 && ((UST *)(s))->type == tp) + #define IS_DISTINCT_TYPE(tree) \ ((tree)->_.type.representation && BOX_ELEMENTS ((tree)->_.type.representation) == 1 && \ - !ST_P (((UST **)(tree)->_.type.representation)[0], UDT_MEMBER)) + !UST_P (((UST **)(tree)->_.type.representation)[0], UDT_MEMBER)) void udt_exec_class_def (query_instance_t * qi, ST * tree); void udt_drop_class_def (query_instance_t * qi, ST * tree); From 1aef3612155eb103d1778f988365727f96d4acae Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 29 Oct 2024 16:28:54 +0000 Subject: [PATCH 66/94] Fixed issues with stat_desc_t data This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- binsrc/virtuoso/viconfig.c | 43 +- libsrc/Wi/rdfbox.c | 111 ++-- libsrc/Wi/srvstat.c | 1074 ++++++++++++++++++------------------ libsrc/Wi/wi.h | 21 +- 4 files changed, 648 insertions(+), 601 deletions(-) diff --git a/binsrc/virtuoso/viconfig.c b/binsrc/virtuoso/viconfig.c index 297cd20944..c59a9fb290 100644 --- a/binsrc/virtuoso/viconfig.c +++ b/binsrc/virtuoso/viconfig.c @@ -1340,26 +1340,33 @@ cfg_setup (void) int32 v32; while (sd->sd_name) { - v32 = INT32_MAX; - if (cfg_getsize (pconfig, section, sd->sd_name, &v) != -1 || - cfg_getlong (pconfig, section, sd->sd_name, &v32) != -1) /* this is for cases of negative flags or zero */ + v32 = INT32_MAX; + if (cfg_getsize (pconfig, section, sd->sd_name, &v) != -1 || + cfg_getlong (pconfig, section, sd->sd_name, &v32) != -1) /* this is for cases of negative flags or zero */ { - if (v32 != INT32_MAX) v = v32; - if ((ptrlong)SD_INT32 == (ptrlong) sd->sd_str_value) - { - if (v > INT32_MIN && v < INT32_MAX) - *((int32*)sd->sd_value) = (int32)v; - else - log_error ("Cannot set flag %s, value out of int32 range", sd->sd_name); - } - else if ((ptrlong)SD_INT64 == (ptrlong) sd->sd_str_value) - *((int64*)sd->sd_value) = v; - else if (sd->sd_value) - *(long *)(sd->sd_value) = (long) v; - else - log_error ("Cannot set flag %s", sd->sd_name); + if (v32 != INT32_MAX) + v = v32; + switch (sd->sd_type) + { + case SD_TYPE_INT32: + { + if (v > INT32_MIN && v < INT32_MAX) + *((int32 *) sd->sd_value) = (int32) v; + else + log_error ("Cannot set flag %s, value out of int32 range", sd->sd_name); + } + break; + case SD_TYPE_INT64: + *((int64 *) sd->sd_value) = v; + break; + case SD_TYPE_LONG: + *(long *) (sd->sd_value) = (long) v; + break; + default: + log_error ("Cannot set flag %s", sd->sd_name); + } } - sd++; + sd++; } } diff --git a/libsrc/Wi/rdfbox.c b/libsrc/Wi/rdfbox.c index b852a9d843..f7b0f763f8 100644 --- a/libsrc/Wi/rdfbox.c +++ b/libsrc/Wi/rdfbox.c @@ -90,63 +90,66 @@ int rb_type__xsd_unsignedLong; int rb_type__xsd_unsignedShort; int rb_type__xsd_yearMonthDuration; +/**INDENT-OFF**/ stat_desc_t rdf_preset_datatypes_descs [] = { - {"rb_type__rdf:XMLLiteral" , (long *)&rb_type__rdf_XMLLiteral , SD_INT32 }, - {"rb_type__rdf:langString" , (long *)&rb_type__rdf_langString , SD_INT32 }, - {"rb_type__xsd:ENTITY" , (long *)&rb_type__xsd_ENTITY , SD_INT32 }, - {"rb_type__xsd:ENTITIES" , (long *)&rb_type__xsd_ENTITIES , SD_INT32 }, - {"rb_type__xsd:ID" , (long *)&rb_type__xsd_ID , SD_INT32 }, - {"rb_type__xsd:IDREF" , (long *)&rb_type__xsd_IDREF , SD_INT32 }, - {"rb_type__xsd:IDREFS" , (long *)&rb_type__xsd_IDREFS , SD_INT32 }, - {"rb_type__xsd:NCName" , (long *)&rb_type__xsd_NCName , SD_INT32 }, - {"rb_type__xsd:Name" , (long *)&rb_type__xsd_Name , SD_INT32 }, - {"rb_type__xsd:NMTOKEN" , (long *)&rb_type__xsd_NMTOKEN , SD_INT32 }, - {"rb_type__xsd:NMTOKENS" , (long *)&rb_type__xsd_NMTOKENS , SD_INT32 }, - {"rb_type__xsd:NOTATION" , (long *)&rb_type__xsd_NOTATION , SD_INT32 }, - {"rb_type__xsd:QName" , (long *)&rb_type__xsd_QName , SD_INT32 }, - {"rb_type__xsd:any" , (long *)&rb_type__xsd_any , SD_INT32 }, - {"rb_type__xsd:anyAtomicType" , (long *)&rb_type__xsd_anyAtomicType , SD_INT32 }, - {"rb_type__xsd:anySimpleType" , (long *)&rb_type__xsd_anySimpleType , SD_INT32 }, - {"rb_type__xsd:anyType" , (long *)&rb_type__xsd_anyType , SD_INT32 }, - {"rb_type__xsd:anyURI" , (long *)&rb_type__xsd_anyURI , SD_INT32 }, - {"rb_type__xsd:base64Binary" , (long *)&rb_type__xsd_base64Binary , SD_INT32 }, - {"rb_type__xsd:boolean" , (long *)&rb_type__xsd_boolean , SD_INT32 }, - {"rb_type__xsd:byte" , (long *)&rb_type__xsd_byte , SD_INT32 }, - {"rb_type__xsd:date" , (long *)&rb_type__xsd_date , SD_INT32 }, - {"rb_type__xsd:dateTime" , (long *)&rb_type__xsd_dateTime , SD_INT32 }, - {"rb_type__xsd:dateTimeStamp" , (long *)&rb_type__xsd_dateTimeStamp , SD_INT32 }, - {"rb_type__xsd:dayTimeDuration" , (long *)&rb_type__xsd_dayTimeDuration , SD_INT32 }, - {"rb_type__xsd:decimal" , (long *)&rb_type__xsd_decimal , SD_INT32 }, - {"rb_type__xsd:double" , (long *)&rb_type__xsd_double , SD_INT32 }, - {"rb_type__xsd:duration" , (long *)&rb_type__xsd_duration , SD_INT32 }, - {"rb_type__xsd:float" , (long *)&rb_type__xsd_float , SD_INT32 }, - {"rb_type__xsd:gDay" , (long *)&rb_type__xsd_gDay , SD_INT32 }, - {"rb_type__xsd:gMonth" , (long *)&rb_type__xsd_gMonth , SD_INT32 }, - {"rb_type__xsd:gMonthDay" , (long *)&rb_type__xsd_gMonthDay , SD_INT32 }, - {"rb_type__xsd:gYear" , (long *)&rb_type__xsd_gYear , SD_INT32 }, - {"rb_type__xsd:gYearMonth" , (long *)&rb_type__xsd_gYearMonth , SD_INT32 }, - {"rb_type__xsd:hexBinary" , (long *)&rb_type__xsd_hexBinary , SD_INT32 }, - {"rb_type__xsd:int" , (long *)&rb_type__xsd_int , SD_INT32 }, - {"rb_type__xsd:integer" , (long *)&rb_type__xsd_integer , SD_INT32 }, - {"rb_type__xsd:language" , (long *)&rb_type__xsd_language , SD_INT32 }, - {"rb_type__xsd:long" , (long *)&rb_type__xsd_long , SD_INT32 }, - {"rb_type__xsd:negativeInteger" , (long *)&rb_type__xsd_negativeInteger , SD_INT32 }, - {"rb_type__xsd:nonNegativeInteger" , (long *)&rb_type__xsd_nonNegativeInteger , SD_INT32 }, - {"rb_type__xsd:nonPositiveInteger" , (long *)&rb_type__xsd_nonPositiveInteger , SD_INT32 }, - {"rb_type__xsd:normalizedString" , (long *)&rb_type__xsd_normalizedString , SD_INT32 }, - {"rb_type__xsd:positiveInteger" , (long *)&rb_type__xsd_positiveInteger , SD_INT32 }, - {"rb_type__xsd:short" , (long *)&rb_type__xsd_short , SD_INT32 }, - {"rb_type__xsd:string" , (long *)&rb_type__xsd_string , SD_INT32 }, - {"rb_type__xsd:time" , (long *)&rb_type__xsd_time , SD_INT32 }, - {"rb_type__xsd:token" , (long *)&rb_type__xsd_token , SD_INT32 }, - {"rb_type__xsd:unsignedByte" , (long *)&rb_type__xsd_unsignedByte , SD_INT32 }, - {"rb_type__xsd:unsignedInt" , (long *)&rb_type__xsd_unsignedInt , SD_INT32 }, - {"rb_type__xsd:unsignedLong" , (long *)&rb_type__xsd_unsignedLong , SD_INT32 }, - {"rb_type__xsd:unsignedShort" , (long *)&rb_type__xsd_unsignedShort , SD_INT32 }, - {"rb_type__xsd:yearMonthDuration" , (long *)&rb_type__xsd_yearMonthDuration , SD_INT32 }, - {NULL, NULL, NULL} + SD_DEF_I32 (rb_type__rdf_XMLLiteral, "rb_type__rdf:XMLLiteral"), + SD_DEF_I32 (rb_type__rdf_langString, "rb_type__rdf:langString"), + SD_DEF_I32 (rb_type__xsd_ENTITY, "rb_type__xsd:ENTITY"), + SD_DEF_I32 (rb_type__xsd_ENTITIES, "rb_type__xsd:ENTITIES"), + SD_DEF_I32 (rb_type__xsd_ID, "rb_type__xsd:ID"), + SD_DEF_I32 (rb_type__xsd_IDREF, "rb_type__xsd:IDREF"), + SD_DEF_I32 (rb_type__xsd_IDREFS, "rb_type__xsd:IDREFS"), + SD_DEF_I32 (rb_type__xsd_NCName, "rb_type__xsd:NCName"), + SD_DEF_I32 (rb_type__xsd_Name, "rb_type__xsd:Name"), + SD_DEF_I32 (rb_type__xsd_NMTOKEN, "rb_type__xsd:NMTOKEN"), + SD_DEF_I32 (rb_type__xsd_NMTOKENS, "rb_type__xsd:NMTOKENS"), + SD_DEF_I32 (rb_type__xsd_NOTATION, "rb_type__xsd:NOTATION"), + SD_DEF_I32 (rb_type__xsd_QName, "rb_type__xsd:QName"), + SD_DEF_I32 (rb_type__xsd_any, "rb_type__xsd:any"), + SD_DEF_I32 (rb_type__xsd_anyAtomicType, "rb_type__xsd:anyAtomicType"), + SD_DEF_I32 (rb_type__xsd_anySimpleType, "rb_type__xsd:anySimpleType"), + SD_DEF_I32 (rb_type__xsd_anyType, "rb_type__xsd:anyType"), + SD_DEF_I32 (rb_type__xsd_anyURI, "rb_type__xsd:anyURI"), + SD_DEF_I32 (rb_type__xsd_base64Binary, "rb_type__xsd:base64Binary"), + SD_DEF_I32 (rb_type__xsd_boolean, "rb_type__xsd:boolean"), + SD_DEF_I32 (rb_type__xsd_byte, "rb_type__xsd:byte"), + SD_DEF_I32 (rb_type__xsd_date, "rb_type__xsd:date"), + SD_DEF_I32 (rb_type__xsd_dateTime, "rb_type__xsd:dateTime"), + SD_DEF_I32 (rb_type__xsd_dateTimeStamp, "rb_type__xsd:dateTimeStamp"), + SD_DEF_I32 (rb_type__xsd_dayTimeDuration, "rb_type__xsd:dayTimeDuration"), + SD_DEF_I32 (rb_type__xsd_decimal, "rb_type__xsd:decimal"), + SD_DEF_I32 (rb_type__xsd_double, "rb_type__xsd:double"), + SD_DEF_I32 (rb_type__xsd_duration, "rb_type__xsd:duration"), + SD_DEF_I32 (rb_type__xsd_float, "rb_type__xsd:float"), + SD_DEF_I32 (rb_type__xsd_gDay, "rb_type__xsd:gDay"), + SD_DEF_I32 (rb_type__xsd_gMonth, "rb_type__xsd:gMonth"), + SD_DEF_I32 (rb_type__xsd_gMonthDay, "rb_type__xsd:gMonthDay"), + SD_DEF_I32 (rb_type__xsd_gYear, "rb_type__xsd:gYear"), + SD_DEF_I32 (rb_type__xsd_gYearMonth, "rb_type__xsd:gYearMonth"), + SD_DEF_I32 (rb_type__xsd_hexBinary, "rb_type__xsd:hexBinary"), + SD_DEF_I32 (rb_type__xsd_int, "rb_type__xsd:int"), + SD_DEF_I32 (rb_type__xsd_integer, "rb_type__xsd:integer"), + SD_DEF_I32 (rb_type__xsd_language, "rb_type__xsd:language"), + SD_DEF_I32 (rb_type__xsd_long, "rb_type__xsd:long"), + SD_DEF_I32 (rb_type__xsd_negativeInteger, "rb_type__xsd:negativeInteger"), + SD_DEF_I32 (rb_type__xsd_nonNegativeInteger, "rb_type__xsd:nonNegativeInteger"), + SD_DEF_I32 (rb_type__xsd_nonPositiveInteger, "rb_type__xsd:nonPositiveInteger"), + SD_DEF_I32 (rb_type__xsd_normalizedString, "rb_type__xsd:normalizedString"), + SD_DEF_I32 (rb_type__xsd_positiveInteger, "rb_type__xsd:positiveInteger"), + SD_DEF_I32 (rb_type__xsd_short, "rb_type__xsd:short"), + SD_DEF_I32 (rb_type__xsd_string, "rb_type__xsd:string"), + SD_DEF_I32 (rb_type__xsd_time, "rb_type__xsd:time"), + SD_DEF_I32 (rb_type__xsd_token, "rb_type__xsd:token"), + SD_DEF_I32 (rb_type__xsd_unsignedByte, "rb_type__xsd:unsignedByte"), + SD_DEF_I32 (rb_type__xsd_unsignedInt, "rb_type__xsd:unsignedInt"), + SD_DEF_I32 (rb_type__xsd_unsignedLong, "rb_type__xsd:unsignedLong"), + SD_DEF_I32 (rb_type__xsd_unsignedShort, "rb_type__xsd:unsignedShort"), + SD_DEF_I32 (rb_type__xsd_yearMonthDuration, "rb_type__xsd:yearMonthDuration"), + { 0 } }; +/**INDENT-ON**/ + caddr_t boxed_iid_of_virtrdf_ns_uri = NULL; caddr_t boxed_iid_of_virtrdf_ns_uri_rdf_repl_all = NULL; diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index 45d915f5c2..9b93597bd0 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -1497,360 +1497,532 @@ extern int32 enable_spar_logfile; extern int32 enable_sqlc_logfile; +/**INDENT-OFF**/ stat_desc_t stat_descs [] = { - {"main_bufs", (long *)&main_bufs, SD_INT32}, - {"st_has_vdb", &st_has_vdb, NULL}, - {"disk_reads", (long *)&disk_reads, NULL}, - {"disk_releases", &disk_releases, NULL}, - {"disk_writess", &disk_writes, NULL}, - {"read_cum_time", &read_cum_time, SD_INT64}, - {"write_cum_time", &write_cum_time, SD_INT64}, - {"lock_deadlocks", &lock_deadlocks, NULL}, - {"lock_2r1w_deadlocks", &lock_2r1w_deadlocks, NULL}, - {"lock_killed_by_force", &lock_killed_by_force, NULL}, - {"lock_waits", &lock_waits, NULL}, - {"lock_enters", &lock_enters, NULL}, - {"lock_leaves", &lock_leaves, NULL}, - {"tc_try_land_write", &tc_try_land_write, NULL}, - {"tc_dp_changed_while_waiting_mtx", &tc_dp_changed_while_waiting_mtx, NULL}, - {"tc_try_land_reset", &tc_try_land_reset, NULL}, - {"tc_up_transit_parent_change", &tc_up_transit_parent_change, NULL}, - {"tc_dive_split", &tc_dive_split, NULL}, - {"tc_dtrans_split", &tc_dtrans_split, NULL}, - {"tc_up_transit_wait", &tc_up_transit_wait, NULL}, - {"tc_double_deletes", &tc_double_deletes, NULL}, - {"tc_delete_parent_waits", &tc_delete_parent_waits, NULL}, - {"tc_wait_trx_self_kill", &tc_wait_trx_self_kill, NULL}, - {"tc_read_wait_while_ra_finding_buf", &tc_read_wait_while_ra_finding_buf, NULL}, - {"tc_split_while_committing", &tc_split_while_committing, NULL}, - {"tc_rb_code_non_unique", &tc_rb_code_non_unique, NULL}, - {"tc_set_by_pl_wait", &tc_set_by_pl_wait, NULL}, - {"tc_split_2nd_read", &tc_split_2nd_read, NULL}, - {"tc_read_wait_decoy", &tc_read_wait_decoy, NULL}, - {"tc_read_wait", &tc_read_wait, NULL}, - {"tc_write_wait", &tc_write_wait, NULL}, - {"tc_cl_deadlocks", &tc_cl_deadlocks, NULL}, - {"tc_cl_wait_queries", &tc_cl_wait_queries, NULL}, - {"tc_cl_keep_alives", &tc_cl_keep_alives, NULL}, - {"tc_cl_branch_wanted_queries", &tc_cl_branch_wanted_queries, NULL}, - {"tc_cl_consensus_rollback", &tc_cl_consensus_rollback, NULL}, - {"tc_cl_consensus_commit", &tc_cl_consensus_commit, NULL}, - {"tc_cl_consensus_deferred", &tc_cl_consensus_deferred, NULL}, - {"swap_guard_last_majflt", &swap_guard_last_majflt, NULL }, - - {"tc_cl_branch_missed_rb", &tc_cl_branch_missed_rb, NULL}, - {"tc_cl_keep_alive_timeouts", &tc_cl_keep_alive_timeouts, NULL}, - {"tc_cl_commit_resend", &tc_cl_commit_resend, NULL}, - {"tc_cl_disconnect", &tc_cl_disconnect, NULL}, - {"tc_cl_disconnect_in_clt", &tc_cl_disconnect_in_clt, NULL}, - {"tc_dfg_coord_pause", &tc_dfg_coord_pause, NULL}, - {"tc_dfg_more", &tc_dfg_more, NULL}, - - {"tc_cl_kill_1pc", &tc_cl_kill_1pc, NULL}, - {"tc_cl_kill_2pc", &tc_cl_kill_2pc, NULL}, - {"tc_atomic_wait_2pc", &tc_atomic_wait_2pc, NULL}, - {"tc_cl_alt_interface", &tc_cl_alt_interface, NULL}, - {"tc_anytime_early_flush", &tc_anytime_early_flush, NULL}, - {"read_block_usec", &read_block_usec, NULL}, - {"write_block_usec", &write_block_usec, NULL}, - {"tc_qp_thread", &tc_qp_thread, NULL}, - {"strses_file_reads", &strses_file_reads, NULL}, - {"strses_file_writes", &strses_file_writes, NULL}, - {"strses_file_seeks", &strses_file_seeks, NULL}, - {"strses_file_wait_msec", &strses_file_wait_msec, NULL}, - {"tc_dive_would_deadlock", &tc_dive_would_deadlock, NULL}, - {"tc_get_buffer_while_stat", &tc_get_buffer_while_stat, NULL}, - {"tc_bp_wait_flush", &tc_bp_wait_flush, NULL}, - {"tc_page_fill_hash_overflow", &tc_page_fill_hash_overflow, NULL}, - {"tc_autocompact_split", &tc_autocompact_split, NULL}, - {"tc_key_sample_reset", &tc_key_sample_reset, NULL}, - {"tc_part_hash_join", &tc_part_hash_join, NULL}, - {"tc_pl_moved_in_reentry", &tc_pl_moved_in_reentry, NULL}, - {"tc_enter_transiting_bm_inx", &tc_enter_transiting_bm_inx, NULL}, - {"tc_geo_delete_retry", &tc_geo_delete_retry, NULL}, - {"tc_geo_delete_missed", &tc_geo_delete_missed, NULL}, - {"tc_aio_seq_write", &tc_aio_seq_write, NULL}, - {"tc_aio_seq_read", &tc_aio_seq_read, NULL}, - {"tc_read_absent_while_finalize", &tc_read_absent_while_finalize, NULL}, - {"tc_fix_outdated_leaf_ptr", &tc_fix_outdated_leaf_ptr, NULL}, - {"tc_bm_split_left_separate_but_no_split", &tc_bm_split_left_separate_but_no_split, NULL}, - {"tc_aq_sleep", &tc_aq_sleep, NULL}, - {"tc_root_image_miss", &tc_root_image_miss, NULL}, - {"tc_root_image_ref_deleted", &tc_root_image_ref_deleted, NULL}, - {"tc_uncommit_cpt_page", &tc_uncommit_cpt_page, NULL}, - {"tc_root_write", &tc_root_write, NULL}, - {"tc_unregister_enter", &tc_unregister_enter, NULL}, - {"tc_root_cache_miss", &tc_root_cache_miss, NULL}, - - - {"tc_initial_while_closing", &tc_initial_while_closing , NULL}, - {"tc_initial_while_closing_died", &tc_initial_while_closing_died , NULL}, - {"tc_client_dropped_connection", &tc_client_dropped_connection , NULL}, - {"tc_no_client_in_tp_data", &tc_no_client_in_tp_data , NULL}, - {"tc_bp_get_buffer", &tc_bp_get_buffer , NULL}, - - {"tc_bp_get_buffer_loop", &tc_bp_get_buffer_loop , NULL}, - - {"tc_unused_read_aside", &tc_unused_read_aside, NULL}, - {"tc_adjust_batch_sz", &tc_adjust_batch_sz, NULL}, - {"tc_cum_batch_sz", &tc_cum_batch_sz, NULL}, - {"tc_no_mem_for_longer_batch", &tc_no_mem_for_longer_batch, NULL}, - {"tc_slow_temp_lookup", &tc_slow_temp_lookup, NULL}, - {"tc_slow_temp_insert", &tc_slow_temp_insert, NULL}, - {"tc_dc_max_alloc", &tc_dc_max_alloc, NULL}, - {"tc_dc_default_alloc", &tc_dc_default_alloc, NULL}, - {"tc_dc_alloc", &tc_dc_alloc, NULL}, - {"tc_dc_size", &tc_dc_size, NULL}, - {"tc_dc_extend", &tc_dc_extend, NULL}, - {"tc_dc_extend_values", &tc_dc_extend_values, NULL}, - {"mp_large_in_use", (long *)&mp_large_in_use, NULL}, - {"mp_max_large_in_use", (long *)&mp_max_large_in_use, NULL}, - {"mp_mmap_clocks", &mp_mmap_clocks, NULL}, - {"dict_max_mp_bytes_in_use", &dict_max_mp_bytes_in_use, SD_INT64}, - {"tc_read_aside", &tc_read_aside, NULL}, - {"tc_merge_reads", &tc_merge_reads, NULL}, - {"tc_merge_read_pages", &tc_merge_read_pages, NULL}, - {"ra_count", &ra_count, NULL}, - {"ra_pages", &ra_pages, NULL}, - {"tc_first_free_replace", &tc_first_free_replace , NULL}, - {"tc_hi_lock_new_lock", &tc_hi_lock_new_lock , NULL}, - {"tc_hi_lock_old_dp_no_lock", &tc_hi_lock_old_dp_no_lock , NULL}, - {"tc_hi_lock_old_dp_no_lock_deadlock", &tc_hi_lock_old_dp_no_lock_deadlock , NULL}, - {"tc_hi_lock_old_dp_no_lock_put_lock", &tc_hi_lock_old_dp_no_lock_put_lock , NULL}, - {"tc_hi_lock_lock", &tc_hi_lock_lock , NULL}, - {"tc_hi_lock_lock_deadlock", &tc_hi_lock_lock_deadlock , NULL}, - {"tc_write_cancel", &tc_write_cancel , NULL}, - {"tc_write_scrapped_buf", &tc_write_scrapped_buf , NULL}, - {"tc_serializable_land_reset", &tc_serializable_land_reset , NULL}, - {"tc_dive_cache_compares", &tc_dive_cache_compares , NULL}, - {"tc_desc_serial_reset", &tc_desc_serial_reset , NULL}, - {"tc_dp_set_parent_being_read", &tc_dp_set_parent_being_read , NULL}, - {"tc_reentry_split", &tc_reentry_split , NULL}, - {"tc_kill_closing", &tc_kill_closing , NULL}, - {"tc_get_buf_failed", &tc_get_buf_failed , NULL}, - {"tc_log_write_clocks", &tc_log_write_clocks, NULL}, - - {"tc_release_pl_on_deleted_dp", &tc_release_pl_on_deleted_dp, NULL}, - {"tc_release_pl_on_absent_dp", &tc_release_pl_on_absent_dp, NULL}, - {"tc_cpt_lt_start_wait", &tc_cpt_lt_start_wait, NULL}, - {"tc_cpt_rollback", &tc_cpt_rollback, NULL}, - {"tc_cpt_unremap_dirty", &tc_cpt_unremap_dirty, NULL}, - {"tc_cpt_restore_uncommitted", &tc_cpt_restore_uncommitted, NULL}, - {"tc_wait_for_closing_lt", &tc_wait_for_closing_lt, NULL}, - {"tc_pl_non_owner_wait_ref_deld", &tc_pl_non_owner_wait_ref_deld, NULL}, - {"tc_pl_split", &tc_pl_split, NULL}, - {"tc_pl_split_multi_owner_page", &tc_pl_split_multi_owner_page, NULL}, - {"tc_pl_split_while_wait", &tc_pl_split_while_wait, NULL}, - {"tc_insert_follow_wait", &tc_insert_follow_wait, NULL}, - {"tc_history_itc_delta_wait", &tc_history_itc_delta_wait, NULL}, - {"tc_page_wait_reset", &tc_page_wait_reset, NULL}, - - {"tc_posthumous_lock", &tc_posthumous_lock, NULL}, - {"tc_finalize_while_being_read", &tc_finalize_while_being_read, NULL}, - {"tc_rollback_cpt_page", &tc_rollback_cpt_page, NULL}, - {"tc_dive_cache_hits", &tc_dive_cache_hits, NULL}, - {"tc_deadlock_win_get_lock", &tc_deadlock_win_get_lock, NULL}, - {"tc_double_deadlock", &tc_double_deadlock, NULL}, - {"tc_update_wait_move", &tc_update_wait_move, NULL}, - - {"tc_blob_read", &tc_blob_read, NULL}, - {"tc_blob_write", &tc_blob_write, NULL}, - {"tc_blob_ra", &tc_blob_ra, NULL}, - {"tc_blob_ra_size", &tc_blob_ra_size, NULL}, - - {"tc_cpt_rollback_retry", &tc_cpt_rollback_retry, NULL}, - {"tc_repl_cycle", &tc_repl_cycle, NULL}, - {"tc_repl_connect_quick_reuse", &tc_repl_connect_quick_reuse, NULL}, - {"tc_no_thread_kill_idle", &tc_no_thread_kill_idle, NULL}, - {"tc_no_thread_kill_vdb", &tc_no_thread_kill_vdb, NULL}, - {"tc_no_thread_kill_running", &tc_no_thread_kill_running, NULL}, - {"tc_deld_row_rl_rb", &tc_deld_row_rl_rb, NULL}, - {"tc_pg_write_compact", &tc_pg_write_compact, NULL}, - {"tft_random_seek", &tft_random_seek, NULL}, - {"tft_seq_seek", &tft_seq_seek, NULL}, - - {"tws_connections", &tws_connections , NULL}, - {"tws_requests", &tws_requests , NULL}, - {"tws_1_1_requests", &tws_1_1_requests , NULL}, - {"tws_slow_keep_alives", &tws_slow_keep_alives , NULL}, - {"tws_immediate_reuse", &tws_immediate_reuse , NULL}, - {"tws_slow_reuse", &tws_slow_reuse , NULL}, - {"tws_accept_queued", &tws_accept_queued , NULL}, - {"tws_accept_requeued", &tws_accept_requeued , NULL}, - {"tws_keep_alive_ready_queued", &tws_keep_alive_ready_queued , NULL}, - {"tws_early_timeout", &tws_early_timeout, NULL}, - {"tws_disconnect_while_check_in", &tws_disconnect_while_check_in, NULL}, - {"tws_done_while_check_in", &tws_done_while_check_in, NULL}, - {"tws_cancel", &tws_cancel, NULL}, - - {"tws_cached_connections_in_use", &tws_cached_connections_in_use , NULL}, - {"tws_cached_connections", &tws_cached_connections , NULL}, - {"tws_cached_connection_hits", &tws_cached_connection_hits , NULL}, - {"tws_cached_connection_miss", &tws_cached_connection_miss , NULL}, - {"tws_bad_request", &tws_bad_request , NULL}, - {"tws_max_connects", &tws_max_connects , NULL}, - - {"vt_batch_size_limit", &vt_batch_size_limit, NULL}, - - {"prof_avg_exec", (long *) &prof_avg_exec, NULL}, - {"prof_n_exec", (long *) &prof_n_exec, NULL}, - {"prof_compile_time", &prof_compile_time, SD_INT64}, - - {"st_dbms_name", NULL, &st_dbms_name}, - {"st_dbms_ver", NULL, &st_dbms_ver}, - {"st_build_thread_model", NULL, &build_thread_model}, - {"st_build_opsys_id", NULL, &build_opsys_id}, - {"st_build_date", NULL, &build_date}, - - {"st_proc_served", &st_proc_served, NULL}, - {"st_proc_active", &st_proc_active, NULL}, - {"st_proc_running", &st_proc_running, NULL}, - {"st_proc_queued_req", &st_proc_queued_req, NULL}, - {"st_proc_brk", (long *)&st_proc_brk, NULL}, - - {"st_db_file_size", NULL, &st_db_file_size}, - {"st_db_pages", &st_db_pages, NULL}, - {"st_db_page_size", &st_db_page_size, NULL}, - {"st_db_page_data_size", &st_db_page_data_size, NULL}, - {"st_db_free_pages", &st_db_free_pages, NULL}, - {"st_db_buffers", &st_db_buffers, NULL}, - {"st_db_used_buffers", &st_db_used_buffers, NULL}, - {"st_db_read_aside_buffers", &st_db_read_aside_buffers, NULL}, - {"st_db_dirty_buffers", &st_db_dirty_buffers, NULL}, - {"st_db_wired_buffers", &st_db_wired_buffers, NULL}, - {"st_db_disk_read_avg", &st_db_disk_read_avg, NULL}, - {"st_db_disk_read_pct", &st_db_disk_read_pct, NULL}, - {"st_db_disk_read_last", &st_db_disk_read_last, NULL}, - {"st_db_disk_read_aheads", &st_db_disk_read_aheads, NULL}, - {"st_db_disk_read_ahead_batch", &st_db_disk_read_ahead_batch, NULL}, - {"st_db_disk_second_reads", &st_db_disk_second_reads, NULL}, - {"st_db_disk_in_while_read", &st_db_disk_in_while_read, NULL}, - {"st_db_disk_mt_write", NULL, &st_db_disk_mt_write}, - {"st_db_log_name", NULL, &st_db_log_name}, - {"st_db_log_length", NULL, &st_db_log_length}, - {"st_db_temp_pages", &st_db_temp_pages, NULL}, - {"st_db_temp_free_pages", &st_db_temp_free_pages, NULL}, - - {"st_cli_connects", &srv_connect_ctr, NULL}, - {"st_cli_max_connected", &srv_max_clients, NULL}, - {"st_cli_n_current_connections", &st_cli_n_current_connections, NULL}, - {"st_cli_n_http_threads", (long *)&http_threads, SD_INT32}, - - {"st_rpc_stat", NULL, &st_rpc_stat}, - {"st_inx_pages_changed", &isp_r_delta, NULL}, - {"st_inx_pages_new", &isp_r_new, NULL}, - - {"st_chkp_remap_pages", &st_chkp_remap_pages, NULL}, - {"st_chkp_mapback_pages", &st_chkp_mapback_pages, NULL}, - {"st_chkp_atomic_time", &st_chkp_atomic_time, NULL}, - {"st_chkp_autocheckpoint", (long *) &cfg_autocheckpoint, NULL}, - {"st_chkp_last_checkpointed", (long *) &checkpointed_last_time, SD_INT64}, - - {"st_started_since_year", &st_started_since_year, NULL}, - {"st_started_since_month", &st_started_since_month, NULL}, - {"st_started_since_day", &st_started_since_day, NULL}, - {"st_started_since_hour", &st_started_since_hour, NULL}, - {"st_started_since_minute", &st_started_since_minute, NULL}, - - {"st_sys_ram", &st_sys_ram, SD_INT64}, - - {"prof_on", &prof_on, NULL}, - {"prof_start_time", &prof_start_time, NULL}, - - {"fe_replication_support", &fe_replication_support, NULL}, - - {"vdb_attach_autocommit", &vdb_attach_autocommit, NULL}, - {"vdb_stat_refresh_disabled", &cfg_disable_vdb_stat_refresh, NULL}, - {"vsp_in_dav_enabled", &vsp_in_dav_enabled, NULL}, - - {"dbev_enable", &dbev_enable, NULL}, - {"sql_encryption_on_password", &cli_encryption_on_password, NULL}, - - {"blob_releases", &blob_releases, NULL}, - {"blob_releases_noread", &blob_releases_noread, NULL}, - {"blob_releases_dir", &blob_releases_dir, NULL}, + SD_DEF_I32 (main_bufs, "main_bufs"), + SD_DEF_L (st_has_vdb, "st_has_vdb"), + SD_DEF_L (disk_reads, "disk_reads"), + SD_DEF_L (disk_releases, "disk_releases"), + SD_DEF_L (disk_writes, "disk_writess"), + SD_DEF_I64 (read_cum_time, "read_cum_time"), + SD_DEF_I64 (write_cum_time, "write_cum_time"), + SD_DEF_L (lock_deadlocks, "lock_deadlocks"), + SD_DEF_L (lock_2r1w_deadlocks, "lock_2r1w_deadlocks"), + SD_DEF_L (lock_killed_by_force, "lock_killed_by_force"), + SD_DEF_L (lock_waits, "lock_waits"), + SD_DEF_L (lock_enters, "lock_enters"), + SD_DEF_L (lock_leaves, "lock_leaves"), + SD_DEF_L (tc_try_land_write, "tc_try_land_write"), + SD_DEF_L (tc_dp_changed_while_waiting_mtx, "tc_dp_changed_while_waiting_mtx"), + SD_DEF_L (tc_try_land_reset, "tc_try_land_reset"), + SD_DEF_L (tc_up_transit_parent_change, "tc_up_transit_parent_change"), + SD_DEF_L (tc_dive_split, "tc_dive_split"), + SD_DEF_L (tc_dtrans_split, "tc_dtrans_split"), + SD_DEF_L (tc_up_transit_wait, "tc_up_transit_wait"), + SD_DEF_L (tc_double_deletes, "tc_double_deletes"), + SD_DEF_L (tc_delete_parent_waits, "tc_delete_parent_waits"), + SD_DEF_L (tc_wait_trx_self_kill, "tc_wait_trx_self_kill"), + SD_DEF_L (tc_read_wait_while_ra_finding_buf, "tc_read_wait_while_ra_finding_buf"), + SD_DEF_L (tc_split_while_committing, "tc_split_while_committing"), + SD_DEF_L (tc_rb_code_non_unique, "tc_rb_code_non_unique"), + SD_DEF_L (tc_set_by_pl_wait, "tc_set_by_pl_wait"), + SD_DEF_L (tc_split_2nd_read, "tc_split_2nd_read"), + SD_DEF_L (tc_read_wait_decoy, "tc_read_wait_decoy"), + SD_DEF_L (tc_read_wait, "tc_read_wait"), + SD_DEF_L (tc_write_wait, "tc_write_wait"), + SD_DEF_L (tc_cl_deadlocks, "tc_cl_deadlocks"), + SD_DEF_L (tc_cl_wait_queries, "tc_cl_wait_queries"), + SD_DEF_L (tc_cl_keep_alives, "tc_cl_keep_alives"), + SD_DEF_L (tc_cl_branch_wanted_queries, "tc_cl_branch_wanted_queries"), + SD_DEF_L (tc_cl_consensus_rollback, "tc_cl_consensus_rollback"), + SD_DEF_L (tc_cl_consensus_commit, "tc_cl_consensus_commit"), + SD_DEF_L (tc_cl_consensus_deferred, "tc_cl_consensus_deferred"), + SD_DEF_L (swap_guard_last_majflt, "swap_guard_last_majflt"), + + SD_DEF_L (tc_cl_branch_missed_rb, "tc_cl_branch_missed_rb"), + SD_DEF_L (tc_cl_keep_alive_timeouts, "tc_cl_keep_alive_timeouts"), + SD_DEF_L (tc_cl_commit_resend, "tc_cl_commit_resend"), + SD_DEF_L (tc_cl_disconnect, "tc_cl_disconnect"), + SD_DEF_L (tc_cl_disconnect_in_clt, "tc_cl_disconnect_in_clt"), + SD_DEF_L (tc_dfg_coord_pause, "tc_dfg_coord_pause"), + SD_DEF_L (tc_dfg_more, "tc_dfg_more"), + + SD_DEF_L (tc_cl_kill_1pc, "tc_cl_kill_1pc"), + SD_DEF_L (tc_cl_kill_2pc, "tc_cl_kill_2pc"), + SD_DEF_L (tc_atomic_wait_2pc, "tc_atomic_wait_2pc"), + SD_DEF_L (tc_cl_alt_interface, "tc_cl_alt_interface"), + SD_DEF_L (tc_anytime_early_flush, "tc_anytime_early_flush"), + SD_DEF_L (read_block_usec, "read_block_usec"), + SD_DEF_L (write_block_usec, "write_block_usec"), + SD_DEF_L (tc_qp_thread, "tc_qp_thread"), + SD_DEF_L (strses_file_reads, "strses_file_reads"), + SD_DEF_L (strses_file_writes, "strses_file_writes"), + SD_DEF_L (strses_file_seeks, "strses_file_seeks"), + SD_DEF_L (strses_file_wait_msec, "strses_file_wait_msec"), + SD_DEF_L (tc_dive_would_deadlock, "tc_dive_would_deadlock"), + SD_DEF_L (tc_get_buffer_while_stat, "tc_get_buffer_while_stat"), + SD_DEF_L (tc_bp_wait_flush, "tc_bp_wait_flush"), + SD_DEF_L (tc_page_fill_hash_overflow, "tc_page_fill_hash_overflow"), + SD_DEF_L (tc_autocompact_split, "tc_autocompact_split"), + SD_DEF_L (tc_key_sample_reset, "tc_key_sample_reset"), + SD_DEF_L (tc_part_hash_join, "tc_part_hash_join"), + SD_DEF_L (tc_pl_moved_in_reentry, "tc_pl_moved_in_reentry"), + SD_DEF_L (tc_enter_transiting_bm_inx, "tc_enter_transiting_bm_inx"), + SD_DEF_L (tc_geo_delete_retry, "tc_geo_delete_retry"), + SD_DEF_L (tc_geo_delete_missed, "tc_geo_delete_missed"), + SD_DEF_L (tc_aio_seq_write, "tc_aio_seq_write"), + SD_DEF_L (tc_aio_seq_read, "tc_aio_seq_read"), + SD_DEF_L (tc_read_absent_while_finalize, "tc_read_absent_while_finalize"), + SD_DEF_L (tc_fix_outdated_leaf_ptr, "tc_fix_outdated_leaf_ptr"), + SD_DEF_L (tc_bm_split_left_separate_but_no_split, "tc_bm_split_left_separate_but_no_split"), + SD_DEF_L (tc_aq_sleep, "tc_aq_sleep"), + SD_DEF_L (tc_root_image_miss, "tc_root_image_miss"), + SD_DEF_L (tc_root_image_ref_deleted, "tc_root_image_ref_deleted"), + SD_DEF_L (tc_uncommit_cpt_page, "tc_uncommit_cpt_page"), + SD_DEF_L (tc_root_write, "tc_root_write"), + SD_DEF_L (tc_unregister_enter, "tc_unregister_enter"), + SD_DEF_L (tc_root_cache_miss, "tc_root_cache_miss"), + + + SD_DEF_L (tc_initial_while_closing , "tc_initial_while_closing"), + SD_DEF_L (tc_initial_while_closing_died , "tc_initial_while_closing_died"), + SD_DEF_L (tc_client_dropped_connection , "tc_client_dropped_connection"), + SD_DEF_L (tc_no_client_in_tp_data , "tc_no_client_in_tp_data"), + SD_DEF_L (tc_bp_get_buffer , "tc_bp_get_buffer"), + + SD_DEF_L (tc_bp_get_buffer_loop , "tc_bp_get_buffer_loop"), + + SD_DEF_L (tc_unused_read_aside, "tc_unused_read_aside"), + SD_DEF_L (tc_adjust_batch_sz, "tc_adjust_batch_sz"), + SD_DEF_L (tc_cum_batch_sz, "tc_cum_batch_sz"), + SD_DEF_L (tc_no_mem_for_longer_batch, "tc_no_mem_for_longer_batch"), + SD_DEF_L (tc_slow_temp_lookup, "tc_slow_temp_lookup"), + SD_DEF_L (tc_slow_temp_insert, "tc_slow_temp_insert"), + SD_DEF_L (tc_dc_max_alloc, "tc_dc_max_alloc"), + SD_DEF_L (tc_dc_default_alloc, "tc_dc_default_alloc"), + SD_DEF_L (tc_dc_alloc, "tc_dc_alloc"), + SD_DEF_L (tc_dc_size, "tc_dc_size"), + SD_DEF_L (tc_dc_extend, "tc_dc_extend"), + SD_DEF_L (tc_dc_extend_values, "tc_dc_extend_values"), + SD_DEF_L (mp_large_in_use, "mp_large_in_use"), + SD_DEF_L (mp_max_large_in_use, "mp_max_large_in_use"), + SD_DEF_I64 (mp_mmap_clocks, "mp_mmap_clocks"), + SD_DEF_I64 (dict_max_mp_bytes_in_use, "dict_max_mp_bytes_in_use"), + SD_DEF_L (tc_read_aside, "tc_read_aside"), + SD_DEF_L (tc_merge_reads, "tc_merge_reads"), + SD_DEF_L (tc_merge_read_pages, "tc_merge_read_pages"), + SD_DEF_L (ra_count, "ra_count"), + SD_DEF_L (ra_pages, "ra_pages"), + SD_DEF_L (tc_first_free_replace , "tc_first_free_replace"), + SD_DEF_L (tc_hi_lock_new_lock , "tc_hi_lock_new_lock"), + SD_DEF_L (tc_hi_lock_old_dp_no_lock , "tc_hi_lock_old_dp_no_lock"), + SD_DEF_L (tc_hi_lock_old_dp_no_lock_deadlock , "tc_hi_lock_old_dp_no_lock_deadlock"), + SD_DEF_L (tc_hi_lock_old_dp_no_lock_put_lock , "tc_hi_lock_old_dp_no_lock_put_lock"), + SD_DEF_L (tc_hi_lock_lock , "tc_hi_lock_lock"), + SD_DEF_L (tc_hi_lock_lock_deadlock , "tc_hi_lock_lock_deadlock"), + SD_DEF_L (tc_write_cancel , "tc_write_cancel"), + SD_DEF_L (tc_write_scrapped_buf , "tc_write_scrapped_buf"), + SD_DEF_L (tc_serializable_land_reset , "tc_serializable_land_reset"), + SD_DEF_L (tc_dive_cache_compares , "tc_dive_cache_compares"), + SD_DEF_L (tc_desc_serial_reset , "tc_desc_serial_reset"), + SD_DEF_L (tc_dp_set_parent_being_read , "tc_dp_set_parent_being_read"), + SD_DEF_L (tc_reentry_split , "tc_reentry_split"), + SD_DEF_L (tc_kill_closing , "tc_kill_closing"), + SD_DEF_L (tc_get_buf_failed , "tc_get_buf_failed"), + SD_DEF_L (tc_log_write_clocks, "tc_log_write_clocks"), + + SD_DEF_L (tc_release_pl_on_deleted_dp, "tc_release_pl_on_deleted_dp"), + SD_DEF_L (tc_release_pl_on_absent_dp, "tc_release_pl_on_absent_dp"), + SD_DEF_L (tc_cpt_lt_start_wait, "tc_cpt_lt_start_wait"), + SD_DEF_L (tc_cpt_rollback, "tc_cpt_rollback"), + SD_DEF_L (tc_cpt_unremap_dirty, "tc_cpt_unremap_dirty"), + SD_DEF_L (tc_cpt_restore_uncommitted, "tc_cpt_restore_uncommitted"), + SD_DEF_L (tc_wait_for_closing_lt, "tc_wait_for_closing_lt"), + SD_DEF_L (tc_pl_non_owner_wait_ref_deld, "tc_pl_non_owner_wait_ref_deld"), + SD_DEF_L (tc_pl_split, "tc_pl_split"), + SD_DEF_L (tc_pl_split_multi_owner_page, "tc_pl_split_multi_owner_page"), + SD_DEF_L (tc_pl_split_while_wait, "tc_pl_split_while_wait"), + SD_DEF_L (tc_insert_follow_wait, "tc_insert_follow_wait"), + SD_DEF_L (tc_history_itc_delta_wait, "tc_history_itc_delta_wait"), + SD_DEF_L (tc_page_wait_reset, "tc_page_wait_reset"), + + SD_DEF_L (tc_posthumous_lock, "tc_posthumous_lock"), + SD_DEF_L (tc_finalize_while_being_read, "tc_finalize_while_being_read"), + SD_DEF_L (tc_rollback_cpt_page, "tc_rollback_cpt_page"), + SD_DEF_L (tc_dive_cache_hits, "tc_dive_cache_hits"), + SD_DEF_L (tc_deadlock_win_get_lock, "tc_deadlock_win_get_lock"), + SD_DEF_L (tc_double_deadlock, "tc_double_deadlock"), + SD_DEF_L (tc_update_wait_move, "tc_update_wait_move"), + + SD_DEF_L (tc_blob_read, "tc_blob_read"), + SD_DEF_L (tc_blob_write, "tc_blob_write"), + SD_DEF_L (tc_blob_ra, "tc_blob_ra"), + SD_DEF_L (tc_blob_ra_size, "tc_blob_ra_size"), + + SD_DEF_L (tc_cpt_rollback_retry, "tc_cpt_rollback_retry"), + SD_DEF_L (tc_repl_cycle, "tc_repl_cycle"), + SD_DEF_L (tc_repl_connect_quick_reuse, "tc_repl_connect_quick_reuse"), + SD_DEF_L (tc_no_thread_kill_idle, "tc_no_thread_kill_idle"), + SD_DEF_L (tc_no_thread_kill_vdb, "tc_no_thread_kill_vdb"), + SD_DEF_L (tc_no_thread_kill_running, "tc_no_thread_kill_running"), + SD_DEF_L (tc_deld_row_rl_rb, "tc_deld_row_rl_rb"), + SD_DEF_L (tc_pg_write_compact, "tc_pg_write_compact"), + SD_DEF_L (tft_random_seek, "tft_random_seek"), + SD_DEF_L (tft_seq_seek, "tft_seq_seek"), + + SD_DEF_L (tws_connections , "tws_connections"), + SD_DEF_L (tws_requests , "tws_requests"), + SD_DEF_L (tws_1_1_requests , "tws_1_1_requests"), + SD_DEF_L (tws_slow_keep_alives , "tws_slow_keep_alives"), + SD_DEF_L (tws_immediate_reuse , "tws_immediate_reuse"), + SD_DEF_L (tws_slow_reuse , "tws_slow_reuse"), + SD_DEF_L (tws_accept_queued , "tws_accept_queued"), + SD_DEF_L (tws_accept_requeued , "tws_accept_requeued"), + SD_DEF_L (tws_keep_alive_ready_queued , "tws_keep_alive_ready_queued"), + SD_DEF_L (tws_early_timeout, "tws_early_timeout"), + SD_DEF_L (tws_disconnect_while_check_in, "tws_disconnect_while_check_in"), + SD_DEF_L (tws_done_while_check_in, "tws_done_while_check_in"), + SD_DEF_L (tws_cancel, "tws_cancel"), + + SD_DEF_L (tws_cached_connections_in_use , "tws_cached_connections_in_use"), + SD_DEF_L (tws_cached_connections , "tws_cached_connections"), + SD_DEF_L (tws_cached_connection_hits , "tws_cached_connection_hits"), + SD_DEF_L (tws_cached_connection_miss , "tws_cached_connection_miss"), + SD_DEF_L (tws_bad_request , "tws_bad_request"), + SD_DEF_L (tws_max_connects , "tws_max_connects"), + + SD_DEF_L (vt_batch_size_limit, "vt_batch_size_limit"), + + SD_DEF_L (prof_avg_exec, "prof_avg_exec"), + SD_DEF_L (prof_n_exec, "prof_n_exec"), + SD_DEF_I64 (prof_compile_time, "prof_compile_time"), + + SD_DEF_STR (st_dbms_name, "st_dbms_name"), + SD_DEF_STR (st_dbms_ver, "st_dbms_ver"), + SD_DEF_STR (build_thread_model, "st_build_thread_model"), + SD_DEF_STR (build_opsys_id, "st_build_opsys_id"), + SD_DEF_STR (build_date, "st_build_date"), + + SD_DEF_L (st_proc_served, "st_proc_served"), + SD_DEF_L (st_proc_active, "st_proc_active"), + SD_DEF_L (st_proc_running, "st_proc_running"), + SD_DEF_L (st_proc_queued_req, "st_proc_queued_req"), + SD_DEF_L (st_proc_brk, "st_proc_brk"), + + SD_DEF_STR (st_db_file_size, "st_db_file_size"), + SD_DEF_L (st_db_pages, "st_db_pages"), + SD_DEF_L (st_db_page_size, "st_db_page_size"), + SD_DEF_L (st_db_page_data_size, "st_db_page_data_size"), + SD_DEF_L (st_db_free_pages, "st_db_free_pages"), + SD_DEF_L (st_db_buffers, "st_db_buffers"), + SD_DEF_L (st_db_used_buffers, "st_db_used_buffers"), + SD_DEF_L (st_db_read_aside_buffers, "st_db_read_aside_buffers"), + SD_DEF_L (st_db_dirty_buffers, "st_db_dirty_buffers"), + SD_DEF_L (st_db_wired_buffers, "st_db_wired_buffers"), + SD_DEF_L (st_db_disk_read_avg, "st_db_disk_read_avg"), + SD_DEF_L (st_db_disk_read_pct, "st_db_disk_read_pct"), + SD_DEF_L (st_db_disk_read_last, "st_db_disk_read_last"), + SD_DEF_L (st_db_disk_read_aheads, "st_db_disk_read_aheads"), + SD_DEF_L (st_db_disk_read_ahead_batch, "st_db_disk_read_ahead_batch"), + SD_DEF_L (st_db_disk_second_reads, "st_db_disk_second_reads"), + SD_DEF_L (st_db_disk_in_while_read, "st_db_disk_in_while_read"), + SD_DEF_STR (st_db_disk_mt_write, "st_db_disk_mt_write"), + SD_DEF_STR (st_db_log_name, "st_db_log_name"), + SD_DEF_STR (st_db_log_length, "st_db_log_length"), + SD_DEF_L (st_db_temp_pages, "st_db_temp_pages"), + SD_DEF_L (st_db_temp_free_pages, "st_db_temp_free_pages"), + + SD_DEF_L (srv_connect_ctr, "st_cli_connects"), + SD_DEF_L (srv_max_clients, "st_cli_max_connected"), + SD_DEF_L (st_cli_n_current_connections, "st_cli_n_current_connections"), + SD_DEF_I32 (http_threads, "st_cli_n_http_threads"), + + SD_DEF_STR (st_rpc_stat, "st_rpc_stat"), + SD_DEF_L (isp_r_delta, "st_inx_pages_changed"), + SD_DEF_L (isp_r_new, "st_inx_pages_new"), + + SD_DEF_L (st_chkp_remap_pages, "st_chkp_remap_pages"), + SD_DEF_L (st_chkp_mapback_pages, "st_chkp_mapback_pages"), + SD_DEF_L (st_chkp_atomic_time, "st_chkp_atomic_time"), + SD_DEF_L (cfg_autocheckpoint, "st_chkp_autocheckpoint"), + SD_DEF_I64 (checkpointed_last_time, "st_chkp_last_checkpointed"), + + SD_DEF_L (st_started_since_year, "st_started_since_year"), + SD_DEF_L (st_started_since_month, "st_started_since_month"), + SD_DEF_L (st_started_since_day, "st_started_since_day"), + SD_DEF_L (st_started_since_hour, "st_started_since_hour"), + SD_DEF_L (st_started_since_minute, "st_started_since_minute"), + + SD_DEF_I64 (st_sys_ram, "st_sys_ram"), + + SD_DEF_L (prof_on, "prof_on"), + SD_DEF_L (prof_start_time, "prof_start_time"), + + SD_DEF_L (fe_replication_support, "fe_replication_support"), + + SD_DEF_L (vdb_attach_autocommit, "vdb_attach_autocommit"), + SD_DEF_L (cfg_disable_vdb_stat_refresh, "vdb_stat_refresh_disabled"), + SD_DEF_L (vsp_in_dav_enabled, "vsp_in_dav_enabled"), + + SD_DEF_L (dbev_enable, "dbev_enable"), + SD_DEF_L (cli_encryption_on_password, "sql_encryption_on_password"), + + SD_DEF_L (blob_releases, "blob_releases"), + SD_DEF_L (blob_releases_noread, "blob_releases_noread"), + SD_DEF_L (blob_releases_dir, "blob_releases_dir"), /* Threading values */ - {"thr_thread_num_total", &my_thread_num_total, NULL}, - {"thr_thread_num_wait", &my_thread_num_wait, NULL}, - {"thr_thread_num_dead", &my_thread_num_dead, NULL}, - {"thr_thread_sched_preempt", &my_thread_sched_preempt, NULL}, - - {"thr_cli_running", &thr_cli_running, NULL}, - {"thr_cli_waiting", &thr_cli_waiting, NULL}, - {"thr_cli_vdb", &thr_cli_vdb, NULL}, - - {"sqlc_add_views_qualifiers", &sqlc_add_views_qualifiers, NULL}, - - {"db_ver_string", NULL, &db_version_string}, - - {"git_head", NULL, &git_head}, - - {"db_max_col_bytes", &db_max_col_bytes, NULL}, - {"db_sizeof_wide_char", &db_sizeof_wide_char, NULL}, - - {"st_host_name", NULL, &dns_host_name}, - {"st_cpu_count", &srv_cpu_count, NULL}, - {"st_default_language", NULL, &server_default_language_name}, - - {"st_os_user_name", NULL, &_st_os_user_name}, - - {"__internal_first_id", &first_id, NULL}, - {"st_os_fd_setsize", &my_fd_setsize, NULL}, - {"st_case_mode", &my_case_mode, NULL}, - {"enable_qp", (long *)&enable_qp, SD_INT32}, - {"cl_run_local_only", (long *)&cl_run_local_only, SD_INT32}, - {"cluster_enable", (long *)&cluster_enable, SD_INT32}, - {"cl_master_host", (long *)&local_cll.cll_master_host, SD_INT32}, - {"cl_max_host", (long *)&local_cll.cll_max_host, SD_INT32}, - {"cl_stage", (long *)&cl_stage, SD_INT32}, - {"in_log_replay", (long *)&in_log_replay, SD_INT32}, - {"cl_log_from_sync", (long *)&cl_log_from_sync, SD_INT32}, - {"cl_this_host", (long *)&local_cll.cll_this_host, SD_INT32}, - {"cl_n_hosts", (long *)&cl_n_hosts, SD_INT32}, - {"cl_cum_messages", (long *)&cl_cum_messages, SD_INT64}, - {"cl_cum_bytes", (long *)&cl_cum_bytes, SD_INT64}, - {"cl_batch_bytes", (long *)&cl_batch_bytes, SD_INT32}, - {"iri_range_size", (long *)&iri_range_size, SD_INT32}, - {"cl_req_batch_size", (long *)&cl_req_batch_size, SD_INT32}, - {"db_exists", (long *)&db_exists, SD_INT32}, - {"st_lite_mode", &my_lite_mode, NULL}, - {"db_default_columnstore", (long *)&enable_col_by_default, SD_INT32}, - {"enable_col_by_default", (long *)&enable_col_by_default, SD_INT32}, - {"enable_mt_ft_inx", (long *)&enable_mt_ft_inx, SD_INT32}, - {"disable_rdf_init", (long *)&disable_rdf_init, SD_INT32}, + SD_DEF_L (my_thread_num_total, "thr_thread_num_total"), + SD_DEF_L (my_thread_num_wait, "thr_thread_num_wait"), + SD_DEF_L (my_thread_num_dead, "thr_thread_num_dead"), + SD_DEF_L (my_thread_sched_preempt, "thr_thread_sched_preempt"), + + SD_DEF_L (thr_cli_running, "thr_cli_running"), + SD_DEF_L (thr_cli_waiting, "thr_cli_waiting"), + SD_DEF_L (thr_cli_vdb, "thr_cli_vdb"), + + SD_DEF_L (sqlc_add_views_qualifiers, "sqlc_add_views_qualifiers"), + + SD_DEF_STR (db_version_string, "db_ver_string"), + + SD_DEF_STR (git_head, "git_head"), + + SD_DEF_L (db_max_col_bytes, "db_max_col_bytes"), + SD_DEF_L (db_sizeof_wide_char, "db_sizeof_wide_char"), + + SD_DEF_STR (dns_host_name, "st_host_name"), + SD_DEF_L (srv_cpu_count, "st_cpu_count"), + SD_DEF_STR (server_default_language_name, "st_default_language"), + + SD_DEF_STR (_st_os_user_name, "st_os_user_name"), + + SD_DEF_L (first_id, "__internal_first_id"), + SD_DEF_L (my_fd_setsize, "st_os_fd_setsize"), + SD_DEF_L (my_case_mode, "st_case_mode"), + SD_DEF_I32 (enable_qp, "enable_qp"), + SD_DEF_I32 (cl_run_local_only, "cl_run_local_only"), + SD_DEF_I32 (cluster_enable, "cluster_enable"), + SD_DEF_I32 (local_cll.cll_master_host, "cl_master_host"), + SD_DEF_I32 (local_cll.cll_max_host, "cl_max_host"), + SD_DEF_I32 (cl_stage, "cl_stage"), + SD_DEF_I32 (in_log_replay, "in_log_replay"), + SD_DEF_I32 (cl_log_from_sync, "cl_log_from_sync"), + SD_DEF_I32 (local_cll.cll_this_host, "cl_this_host"), + SD_DEF_I32 (cl_n_hosts, "cl_n_hosts"), + SD_DEF_I64 (cl_cum_messages, "cl_cum_messages"), + SD_DEF_I64 (cl_cum_bytes, "cl_cum_bytes"), + SD_DEF_I32 (cl_batch_bytes, "cl_batch_bytes"), + SD_DEF_I32 (iri_range_size, "iri_range_size"), + SD_DEF_I32 (cl_req_batch_size, "cl_req_batch_size"), + SD_DEF_I32 (db_exists, "db_exists"), + SD_DEF_L (my_lite_mode, "st_lite_mode"), + SD_DEF_I32 (enable_col_by_default, "db_default_columnstore"), + SD_DEF_I32 (enable_col_by_default, "enable_col_by_default"), + SD_DEF_I32 (enable_mt_ft_inx, "enable_mt_ft_inx"), + SD_DEF_I32 (disable_rdf_init, "disable_rdf_init"), /* backup vars */ - {"backup_prefix_name", NULL, &my_bp_prefix}, - {"backup_file_index", (long *)&bp_ctx.db_bp_num, NULL}, - {"backup_dir_index", (long *)&bp_ctx.db_bp_index, NULL}, - {"backup_dir_bytes", (long *)&bp_ctx.db_bp_wr_bytes, NULL}, - {"backup_processed_pages", (long *)&bp_ctx.db_bp_pages, NULL}, + SD_DEF_STR (my_bp_prefix, "backup_prefix_name"), + SD_DEF_L (bp_ctx.db_bp_num, "backup_file_index"), + SD_DEF_L (bp_ctx.db_bp_index, "backup_dir_index"), + SD_DEF_L (bp_ctx.db_bp_wr_bytes, "backup_dir_bytes"), + SD_DEF_L (bp_ctx.db_bp_pages, "backup_processed_pages"), /* sparql vars */ - {"sparql_result_set_max_rows", &sparql_result_set_max_rows, NULL}, - {"sparql_construct_max_triples", &sparql_construct_max_triples, SD_INT32}, - {"sparql_max_mem_in_use", &sparql_max_mem_in_use, SD_INT64}, - {"rdf_create_graph_keywords", &rdf_create_graph_keywords, SD_INT32}, - {"rdf_query_graph_keywords", &rdf_query_graph_keywords, SD_INT32}, - {"enable_vec", (long *)&enable_vec, SD_INT32}, - {"srv_init", (long *)&in_srv_global_init, SD_INT32}, - {"ac_real_time", (long *)&ac_real_time, SD_INT64}, - {"ac_cpu_time", (long *)&ac_cpu_time, SD_INT64}, - {"ac_n_times", (long *)&ac_n_times, SD_INT32}, - {"col_ac_last_duration", (long *)&col_ac_last_duration, SD_INT32}, - {"col_ins_error", (long *)&col_ins_error, SD_INT32}, - {"cl_rdf_inf_inited", (long *)&cl_rdf_inf_inited, SD_INT32}, - {"chash_mempool_size_max_used", (long *)&chash_mempool_size_max_used, SD_INT64}, - {NULL, NULL, NULL} + SD_DEF_L (sparql_result_set_max_rows, "sparql_result_set_max_rows"), + SD_DEF_I32 (sparql_construct_max_triples, "sparql_construct_max_triples"), + SD_DEF_L (sparql_max_mem_in_use, "sparql_max_mem_in_use"), + SD_DEF_I32 (rdf_create_graph_keywords, "rdf_create_graph_keywords"), + SD_DEF_I32 (rdf_query_graph_keywords, "rdf_query_graph_keywords"), + SD_DEF_I32 (enable_vec, "enable_vec"), + SD_DEF_I32 (in_srv_global_init, "srv_init"), + SD_DEF_I64 (ac_real_time, "ac_real_time"), + SD_DEF_I64 (ac_cpu_time, "ac_cpu_time"), + SD_DEF_I32 (ac_n_times, "ac_n_times"), + SD_DEF_I32 (col_ac_last_duration, "col_ac_last_duration"), + SD_DEF_I32 (col_ins_error, "col_ins_error"), + SD_DEF_I32 (cl_rdf_inf_inited, "cl_rdf_inf_inited"), + SD_DEF_I64 (chash_mempool_size_max_used, "chash_mempool_size_max_used"), + {0} }; +/**INDENT-ON**/ + + +/**INDENT-OFF**/ +stat_desc_t dbf_descs [] = +{ + SD_DEF_L (dbf_no_disk, "dbf_no_disk"), + SD_DEF_I64 (dbs_max_temp_db_pages, "dbs_max_temp_db_pages"), + SD_DEF_L (dbf_2pc_prepare_wait, "dbf_2pc_prepare_wait"), + SD_DEF_L (dbf_2pc_wait, "dbf_2pc_wait"), + SD_DEF_L (dbf_branch_transact_wait, "dbf_branch_transact_wait"), + SD_DEF_L (dbf_log_no_disk, "dbf_log_no_disk"), + SD_DEF_I32 (dbf_log_always, "dbf_log_always"), + SD_DEF_I32 (dbf_no_atomic, "dbf_no_atomic"), + SD_DEF_L (txn_after_image_limit, "txn_after_image_limit"), + SD_DEF_L (dbf_clop_enter_wait, "dbf_clop_enter_wait"), + SD_DEF_L (dbf_cl_skip_wait_notify, "dbf_cl_skip_wait_notify"), + SD_DEF_L (dbf_cpt_rb, "dbf_cpt_rb"), + SD_DEF_I32 (cl_no_auto_remove, "cl_no_auto_remove"), + SD_DEF_L (dbf_cl_blob_autosend_limit, "dbf_cl_blob_autosend_limit"), + SD_DEF_L (dbf_no_sample_timeout, "dbf_no_sample_timeout"), + SD_DEF_I32 (dbf_fast_cpt, "dbf_fast_cpt"), + SD_DEF_I32 (enable_flush_all, "enable_flush_all"), + SD_DEF_I32 (cl_req_batch_size, "cl_req_batch_size"), + SD_DEF_I32 (cl_dfg_batch_bytes, "cl_dfg_batch_bytes"), + SD_DEF_I32 (cl_res_buffer_bytes, "cl_res_buffer_bytes"), + SD_DEF_I32 (cl_batches_per_rpc, "cl_batches_per_rpc"), + SD_DEF_I32 (cl_rdf_inf_inited, "cl_rdf_inf_inited"), + SD_DEF_I32 (enable_g_inf_opt, "enable_g_inf_opt"), + SD_DEF_I32 (enable_mem_hash_join, "enable_mem_hash_join"), + SD_DEF_I32 (sqlo_max_layouts, "sqlo_max_layouts"), + SD_DEF_I64 (sqlo_max_mp_size, "sqlo_max_mp_size"), + SD_DEF_I32 (enable_initial_plan, "enable_initial_plan"), + SD_DEF_I32 (enable_dt_leaf, "enable_dt_leaf"), + SD_DEF_I32 (enable_rq_obvious, "enable_rq_obvious"), + SD_DEF_I32 (sqlo_n_layout_steps, "sqlo_n_layout_steps"), + SD_DEF_I32 (sqlo_n_best_layouts, "sqlo_n_best_layouts"), + SD_DEF_I32 (sqlo_n_full_layouts, "sqlo_n_full_layouts"), + SD_DEF_I32 (sqlo_compiler_exceeds_run_factor, "sqlo_compiler_exceeds_run_factor"), + SD_DEF_I32 (enable_n_best_plans, "enable_n_best_plans"), + SD_DEF_I32 (enable_hash_merge, "enable_hash_merge"), + SD_DEF_I32 (enable_hash_fill_join, "enable_hash_fill_join"), + SD_DEF_I32 (enable_subscore, "enable_subscore"), + + SD_DEF_I32 (setp_distinct_max_keys, "setp_distinct_max_keys"), + SD_DEF_I32 (enable_iri_nic_n, "enable_iri_nic_n"), + SD_DEF_I32 (enable_iri_prefix_nic_n, "enable_iri_prefix_nic_n"), + SD_DEF_I32 (enable_at_print, "enable_at_print"), + SD_DEF_I32 (enable_min_card, "enable_min_card"), + SD_DEF_I32 (enable_distinct_sas, "enable_distinct_sas"), + SD_DEF_I32 (enable_inline_sqs, "enable_inline_sqs"), + SD_DEF_I32 (hash_join_enable, "hash_join_enable"), + SD_DEF_I32 (enable_chash_join, "enable_chash_join"), + SD_DEF_I32 (enable_joins_only, "enable_joins_only"), + SD_DEF_I32 (enable_exact_p_stat, "enable_exact_p_stat"), + SD_DEF_I32 (em_ra_window, "em_ra_window"), + SD_DEF_I32 (em_ra_threshold, "em_ra_threshold"), + SD_DEF_I32 (em_ra_startup_threshold, "em_ra_startup_threshold"), + + SD_DEF_I32 (atomic_timeout.to_sec, "timeout_resolution_sec"), + SD_DEF_I32 (atomic_timeout.to_usec, "timeout_resolution_usec"), + SD_DEF_I32 (ha_rehash_pct, "ha_rehash_pct"), + SD_DEF_I32 (c_use_aio, "c_use_aio"), + SD_DEF_L (callstack_on_exception, "callstack_on_exception"), +#ifndef NDEBUG + SD_DEF_I32 (sql_warning_mode, "sql_warning_mode"), +#endif + SD_DEF_L (public_debug, "public_debug"), + SD_DEF_I32 (enable_vec, "enable_vec"), + SD_DEF_I32 (enable_qp, "enable_qp"), + SD_DEF_I32 (enable_mt_txn, "enable_mt_txn"), + SD_DEF_I32 (enable_mt_transact, "enable_mt_transact"), + SD_DEF_I32 (enable_qn_cache, "enable_qn_cache"), + SD_DEF_I32 (aq_max_threads, "aq_max_threads"), + SD_DEF_I32 (qp_thread_min_usec, "qp_thread_min_usec"), + SD_DEF_I32 (qp_range_split_min_rows, "qp_range_split_min_rows"), + SD_DEF_I32 (qp_even_if_lock, "qp_even_if_lock"), + SD_DEF_I32 (enable_ro_rc, "enable_ro_rc"), + SD_DEF_I32 (dc_batch_sz, "dc_batch_sz"), + SD_DEF_I32 (dc_max_batch_sz, "dc_max_batch_sz"), + SD_DEF_I32 (enable_dyn_batch_sz, "enable_dyn_batch_sz"), + SD_DEF_I32 (enable_vec_reuse, "enable_vec_reuse"), + SD_DEF_I32 (dc_adjust_batch_sz_min_anytime, "dc_adjust_batch_sz_min_anytime"), + SD_DEF_I32 (enable_split_range, "enable_split_range"), + SD_DEF_I32 (enable_split_sets, "enable_split_sets"), + SD_DEF_I32 (dbf_compress_mask, "dbf_compress_mask"), + SD_DEF_I32 (dbf_ce_insert_mask, "dbf_ce_insert_mask"), + SD_DEF_I32 (dbf_ce_del_mask, "dbf_ce_del_mask"), + SD_DEF_I32 (dbf_col_ins_dbg_log, "dbf_col_ins_dbg_log"), + SD_DEF_I32 (dbf_col_del_leaf, "dbf_col_del_leaf"), + SD_DEF_I32 (enable_pogs_check, "enable_pogs_check"), + SD_DEF_I32 (enable_sslr_check, "enable_sslr_check"), + SD_DEF_I64 (chash_space_avail, "chash_space_avail"), + SD_DEF_I32 (chash_per_query_pct, "chash_per_query_pct"), + SD_DEF_I32 (enable_chash_gb, "enable_chash_gb"), + SD_DEF_I64 (chash_mempool_size_limit, "chash_mempool_size_limit"), + SD_DEF_I32 (enable_ksp_fast, "enable_ksp_fast"), + SD_DEF_I32 (enable_ac, "enable_ac"), + SD_DEF_I32 (enable_col_ac, "enable_col_ac"), + SD_DEF_I32 (col_ins_error, "col_ins_error"), + SD_DEF_I32 (col_seg_max_bytes, "col_seg_max_bytes"), + SD_DEF_I32 (col_seg_max_rows, "col_seg_max_rows"), + SD_DEF_I32 (cl_ac_interval, "cl_ac_interval"), + SD_DEF_I32 (enable_buf_mprotect, "enable_buf_mprotect"), + SD_DEF_I32 (local_cll.cll_no_disable_of_unavailable, "cl_no_disable_of_unavailable"), + SD_DEF_I32 (dbf_log_fsync, "dbf_log_fsync"), + SD_DEF_I32 (cls_rollback_no_finish_if_thread, "cls_rollback_no_finish_if_thread"), + SD_DEF_I32 (sqlo_sample_dep_cols, "sqlo_sample_dep_cols"), + SD_DEF_I32 (default_txn_isolation, "default_txn_isolation"), + SD_DEF_L (tc_dc_max_alloc, "tc_dc_max_alloc"), + SD_DEF_L (tc_dc_default_alloc, "tc_dc_default_alloc"), + SD_DEF_L (tc_dc_alloc, "tc_dc_alloc"), + SD_DEF_L (tc_dc_size, "tc_dc_size"), + SD_DEF_L (tc_dc_extend, "tc_dc_extend"), + SD_DEF_L (tc_dc_extend_values, "tc_dc_extend_values"), + + SD_DEF_L (c_max_large_vec, "c_max_large_vec"), + SD_DEF_L (cha_max_gb_bytes, "cha_max_gb_bytes"), + SD_DEF_L (mp_large_reserved, "mp_large_reserved"), + SD_DEF_L (mp_max_large_reserved, "mp_max_large_reserved"), + SD_DEF_L (mp_large_reserve_limit, "mp_large_reserve_limit"), + SD_DEF_L (mp_large_soft_cap, "mp_large_soft_cap"), + SD_DEF_L (mp_large_hard_cap, "mp_large_hard_cap"), + SD_DEF_L (mp_sparql_cap, "mp_sparql_cap"), + + SD_DEF_I32 (iri_range_size, "iri_range_size"), + SD_DEF_I64 (tn_max_memory, "tn_max_memory"), + SD_DEF_I64 (tn_at_mem_cutoff, "tn_at_mem_cutoff"), + SD_DEF_I64 (tn_mem_cutoff, "tn_mem_cutoff"), + SD_DEF_I64 (tn_at_card_cutoff, "tn_at_card_cutoff"), + SD_DEF_I64 (tn_card_cutoff, "tn_card_cutoff"), + SD_DEF_I32 (dbf_max_itc_samples, "dbf_max_itc_samples"), + SD_DEF_I32 (enable_mt_ft_inx, "enable_mt_ft_inx"), + SD_DEF_I32 (disable_rdf_init, "disable_rdf_init"), + SD_DEF_I32 (enable_rdf_trig, "enable_rdf_trig"), + SD_DEF_I32 (enable_pg_card, "enable_pg_card"), + SD_DEF_I32 (enable_ce_ins_check, "enable_ce_ins_check"), + SD_DEF_I32 (dbf_ignore_uneven_col, "dbf_ignore_uneven_col"), + SD_DEF_I32 (c_no_dbg_print, "c_no_dbg_print"), + SD_DEF_I32 (dbf_explain_level, "dbf_explain_level"), + SD_DEF_I32 (mp_local_rc_sz, "mp_local_rc_sz"), + SD_DEF_L (dbf_user_1, "dbf_user_1"), + SD_DEF_L (dbf_user_2, "dbf_user_2"), + SD_DEF_I32 (dbs_stop_cp, "dbs_stop_cp"), +#ifdef CACHE_MALLOC + SD_DEF_I32 (enable_no_free, "enable_no_free"), +#endif + SD_DEF_I32 (enable_rdf_box_const, "enable_rdf_box_const"), + SD_DEF_I32 (rdf_rpid64_mode, "rdf_rpid64_mode"), + SD_DEF_I32 (rdf_geo_use_wkt, "rdf_geo_use_wkt"), + SD_DEF_I32 (simple_rdf_numbers, "simple_rdf_numbers"), + SD_DEF_I32 (c_pcre_match_limit, "pcre_match_limit"), + SD_DEF_I32 (c_pcre_match_limit_recursion, "pcre_match_limit_recursion"), + SD_DEF_I32 (pcre_max_cache_sz, "pcre_max_cache_sz"), + SD_DEF_I32 (shcompo_max_cache_sz, "shcompo_max_cache_sz"), + SD_DEF_I32 (debug_invalid_iri_id, "debug_invalid_iri_id"), + SD_DEF_I32 (enable_qr_comment, "enable_qr_comment"), + SD_DEF_I32 (timezoneless_datetimes, "timezoneless_datetimes"), + SD_DEF_I32 (lock_escalation_pct, "lock_escalation_pct"), + SD_DEF_I32 (enable_spar_logfile, "enable_spar_logfile"), + SD_DEF_I32 (enable_sqlc_logfile, "enable_sqlc_logfile"), + SD_DEF_I32 (http_connect_timeout, "http_connect_timeout"), + SD_DEF_I64 (users_cache_sz, "users_cache_sz"), + SD_DEF_I32 (enable_cpt_rb_ck, "enable_cpt_rb_ck"), + SD_DEF_I64 (swap_guard_threshold, "swap_guard_threshold"), + SD_DEF_I64 (max_proc_vm_size, "max_proc_vm_size"), + SD_DEF_I64 (vm_size_wd_threshold, "vm_size_wd_threshold"), +{0} +}; +/**INDENT-ON**/ + /* - the following are ptrs of protected system wide params, once are set to a value greater than zero - cannot be changed until server is running, also if they written in DB cfg page, - cannot be changed even after server restart. -*/ + * the following are ptrs of protected system wide params, once are set to a value greater than zero + * cannot be changed until server is running, also if they written in DB cfg page, + * cannot be changed even after server restart. + */ static void * dbf_protected_params[] = { &timezoneless_datetimes, @@ -1858,7 +2030,7 @@ dbf_protected_params[] = { NULL }; -int +static int dbf_protected_param (stat_desc_t * sd) { int inx; @@ -1867,180 +2039,21 @@ dbf_protected_param (stat_desc_t * sd) if (sd->sd_value == ptr) { int64 val = 0; - if (SD_INT32 == (char **) sd->sd_str_value) + switch (sd->sd_type) + { + case SD_TYPE_INT32: val = *((int32 *) sd->sd_value); - else if (SD_INT64 == (char **) sd->sd_str_value) + break; + case SD_TYPE_INT64: val = *((int64 *) sd->sd_value); + break; + } return (val != 0); } return 0; } -stat_desc_t dbf_descs [] = - { - {"dbf_no_disk", &dbf_no_disk, NULL}, - {"dbs_max_temp_db_pages", &dbs_max_temp_db_pages, SD_INT64}, - {"dbf_2pc_prepare_wait", &dbf_2pc_prepare_wait, NULL}, - {"dbf_2pc_wait", &dbf_2pc_wait, NULL}, - {"dbf_branch_transact_wait", &dbf_branch_transact_wait, NULL}, - {"dbf_log_no_disk", &dbf_log_no_disk, NULL}, - {"dbf_log_always", &dbf_log_always, SD_INT32}, - {"dbf_no_atomic", &dbf_no_atomic, SD_INT32}, - {"txn_after_image_limit", &txn_after_image_limit, NULL}, - {"dbf_clop_enter_wait", &dbf_clop_enter_wait, NULL}, - {"dbf_cl_skip_wait_notify", &dbf_cl_skip_wait_notify, NULL}, - {"dbf_cpt_rb", &dbf_cpt_rb, NULL}, - {"cl_no_auto_remove", (long *)&cl_no_auto_remove, SD_INT32}, - {"dbf_cl_blob_autosend_limit", &dbf_cl_blob_autosend_limit, NULL}, - {"dbf_no_sample_timeout", &dbf_no_sample_timeout, NULL}, - {"dbf_fast_cpt", (long *)&dbf_fast_cpt, SD_INT32}, - {"enable_flush_all", &enable_flush_all, SD_INT32}, - {"cl_req_batch_size", (long *)&cl_req_batch_size, SD_INT32}, - {"cl_dfg_batch_bytes", (long *)&cl_dfg_batch_bytes, SD_INT32}, - {"cl_res_buffer_bytes", (long *)&cl_res_buffer_bytes, SD_INT32}, - {"cl_batches_per_rpc", (long *)&cl_batches_per_rpc, SD_INT32}, - {"cl_rdf_inf_inited", (long *)&cl_rdf_inf_inited, SD_INT32}, - {"enable_g_inf_opt", (long *)&enable_g_inf_opt, SD_INT32}, - {"enable_mem_hash_join", (long *)& enable_mem_hash_join, SD_INT32}, - {"sqlo_max_layouts", &sqlo_max_layouts, SD_INT32}, - {"sqlo_max_mp_size", &sqlo_max_mp_size}, - {"enable_initial_plan", &enable_initial_plan, SD_INT32}, - {"enable_dt_leaf", &enable_dt_leaf, SD_INT32}, - {"enable_rq_obvious", &enable_rq_obvious, SD_INT32}, - {"sqlo_n_layout_steps", &sqlo_n_layout_steps, SD_INT32}, - {"sqlo_n_best_layouts", &sqlo_n_best_layouts, SD_INT32}, - {"sqlo_n_full_layouts", &sqlo_n_full_layouts, SD_INT32}, - {"sqlo_compiler_exceeds_run_factor", &sqlo_compiler_exceeds_run_factor, SD_INT32}, - {"enable_n_best_plans", &enable_n_best_plans, SD_INT32}, - {"enable_hash_merge", (long *)&enable_hash_merge, SD_INT32}, - {"enable_hash_fill_join", (long *)&enable_hash_fill_join, SD_INT32}, - {"enable_subscore", (long *)&enable_subscore, SD_INT32}, - {"setp_distinct_max_keys", (long *)&setp_distinct_max_keys, SD_INT32}, - {"enable_iri_nic_n", (long *)&enable_iri_nic_n, SD_INT32}, - {"enable_iri_prefix_nic_n", (long *) &enable_iri_prefix_nic_n, SD_INT32}, - {"enable_at_print", (long *)&enable_at_print, SD_INT32}, - {"enable_min_card", (long *)&enable_min_card}, - {"enable_distinct_sas", (long *)&enable_distinct_sas, SD_INT32}, - {"enable_inline_sqs", (long *)&enable_inline_sqs, SD_INT32}, - {"hash_join_enable", (long *)&hash_join_enable, SD_INT32}, - {"enable_chash_join", (long *)&enable_chash_join, SD_INT32}, - {"enable_joins_only", &enable_joins_only, SD_INT32}, - {"enable_exact_p_stat", &enable_exact_p_stat, SD_INT32}, - {"em_ra_window", (long *)&em_ra_window, SD_INT32}, - {"em_ra_threshold", (long *)&em_ra_threshold, SD_INT32}, - {"em_ra_startup_threshold", (long *)&em_ra_startup_threshold, SD_INT32}, - {"timeout_resolution_sec", (long *)&atomic_timeout.to_sec, SD_INT32}, - {"timeout_resolution_usec", (long *)&atomic_timeout.to_usec, SD_INT32}, - {"ha_rehash_pct", (long *)&ha_rehash_pct, SD_INT32}, - {"c_use_aio", (long *)&c_use_aio, SD_INT32}, - {"callstack_on_exception", &callstack_on_exception, NULL}, -#ifndef NDEBUG - {"sql_warning_mode", (long *)&sql_warning_mode, SD_INT32}, -#endif - {"public_debug", &public_debug, NULL}, - {"enable_vec", (long *)&enable_vec, SD_INT32}, - {"enable_qp", (long *)&enable_qp, SD_INT32}, - {"enable_mt_txn", (long *)&enable_mt_txn, SD_INT32}, - {"enable_mt_transact", (long *)&enable_mt_transact, SD_INT32}, - {"enable_qn_cache", (long *)&enable_qn_cache, SD_INT32}, - {"aq_max_threads", (long *)&aq_max_threads, SD_INT32}, - {"qp_thread_min_usec", (long *)&qp_thread_min_usec, SD_INT32}, - {"qp_range_split_min_rows", (long *)&qp_range_split_min_rows, SD_INT32}, - {"qp_even_if_lock", (long *)&qp_even_if_lock, SD_INT32}, - {"enable_ro_rc", (long *)&enable_ro_rc, SD_INT32}, - {"dc_batch_sz", (long *)&dc_batch_sz, SD_INT32}, - {"dc_max_batch_sz", (long *)&dc_max_batch_sz, SD_INT32}, - {"enable_dyn_batch_sz", (long *)&enable_dyn_batch_sz, SD_INT32}, - {"enable_vec_reuse", (long *)&enable_vec_reuse, SD_INT32}, - {"dc_adjust_batch_sz_min_anytime", (long *)&dc_adjust_batch_sz_min_anytime, SD_INT32}, - {"enable_split_range", (long *)&enable_split_range, SD_INT32}, - {"enable_split_sets", (long *)&enable_split_sets, SD_INT32}, - {"dbf_compress_mask", (long *)&dbf_compress_mask, SD_INT32}, - {"dbf_ce_insert_mask", (long *)&dbf_ce_insert_mask, SD_INT32}, - {"dbf_ce_del_mask", (long *)&dbf_ce_del_mask, SD_INT32}, - {"dbf_col_ins_dbg_log", (long *)&dbf_col_ins_dbg_log, SD_INT32}, - {"dbf_col_del_leaf", (long *)&dbf_col_del_leaf, SD_INT32}, - {"enable_pogs_check", (long *)&enable_pogs_check, SD_INT32}, - {"enable_sslr_check", (long *)&enable_sslr_check, SD_INT32}, - {"chash_space_avail", (long *)&chash_space_avail, SD_INT64}, - {"chash_per_query_pct", (long *)&chash_per_query_pct, SD_INT32}, - {"enable_chash_gb", (long *)&enable_chash_gb, SD_INT32}, - {"chash_mempool_size_limit", (long *)&chash_mempool_size_limit, SD_INT64}, - {"enable_ksp_fast", (long *)&enable_ksp_fast, SD_INT32}, - {"enable_ac", (long *)&enable_ac, SD_INT32}, - {"enable_col_ac", (long *)&enable_col_ac, SD_INT32}, - {"col_ins_error", (long *)&col_ins_error, SD_INT32}, - {"col_seg_max_bytes", (long *)&col_seg_max_bytes, SD_INT32}, - {"col_seg_max_rows", (long *)&col_seg_max_rows, SD_INT32}, - {"cl_ac_interval", (long *)&cl_ac_interval, SD_INT32}, - {"enable_buf_mprotect", (long *)&enable_buf_mprotect, SD_INT32}, - {"cl_no_disable_of_unavailable", (long *)&local_cll.cll_no_disable_of_unavailable, SD_INT32}, - {"dbf_log_fsync", (long *)&dbf_log_fsync, SD_INT32}, - { "cls_rollback_no_finish_if_thread", (long *)&cls_rollback_no_finish_if_thread, SD_INT32}, - {"sqlo_sample_dep_cols", (long *)&sqlo_sample_dep_cols}, - {"default_txn_isolation", (long *)&default_txn_isolation, SD_INT32}, - {"tc_dc_max_alloc", &tc_dc_max_alloc, NULL}, - {"tc_dc_default_alloc", &tc_dc_default_alloc, NULL}, - {"tc_dc_alloc", &tc_dc_alloc, NULL}, - {"tc_dc_size", &tc_dc_size, NULL}, - {"tc_dc_extend", &tc_dc_extend, NULL}, - {"tc_dc_extend_values", &tc_dc_extend_values, NULL}, - - {"c_max_large_vec", (long *)&c_max_large_vec, NULL}, - {"cha_max_gb_bytes", (long *)&cha_max_gb_bytes, NULL}, - {"mp_large_reserved", &mp_large_reserved}, - {"mp_max_large_reserved", &mp_max_large_reserved}, - {"mp_large_reserve_limit", &mp_large_reserve_limit}, - {"mp_large_soft_cap", &mp_large_soft_cap}, - {"mp_large_hard_cap", &mp_large_hard_cap}, - {"mp_sparql_cap", &mp_sparql_cap, NULL}, - {"sparql_max_mem_in_use", &sparql_max_mem_in_use, SD_INT64}, - {"iri_range_size", (long *)&iri_range_size, SD_INT32}, - {"tn_max_memory", (long *)&tn_max_memory, SD_INT64}, - {"tn_at_mem_cutoff", (long *)&tn_at_mem_cutoff, SD_INT64}, - {"tn_mem_cutoff", (long *)&tn_mem_cutoff, SD_INT64}, - {"tn_at_card_cutoff", (long *)&tn_at_card_cutoff, SD_INT64}, - {"tn_card_cutoff", (long *)&tn_card_cutoff, SD_INT64}, - {"dbf_max_itc_samples", (long *)&dbf_max_itc_samples, SD_INT32}, - {"enable_mt_ft_inx", (long *)&enable_mt_ft_inx, SD_INT32}, - {"disable_rdf_init", (long *)&disable_rdf_init, SD_INT32}, - {"enable_rdf_trig", (long *)&enable_rdf_trig, SD_INT32}, - {"enable_pg_card", (long *)&enable_pg_card, SD_INT32}, - {"enable_ce_ins_check", (long *)&enable_ce_ins_check, SD_INT32}, - {"dbf_ignore_uneven_col", (long *)&dbf_ignore_uneven_col, SD_INT32}, - {"c_no_dbg_print", (long *)&c_no_dbg_print, SD_INT32}, - {"dbf_explain_level", (long *)&dbf_explain_level, SD_INT32}, - {"mp_local_rc_sz", (long *)&mp_local_rc_sz, SD_INT32}, - {"dbf_user_1", &dbf_user_1}, - {"dbf_user_2", &dbf_user_2}, - {"dbs_stop_cp", &dbs_stop_cp, SD_INT32}, -#ifdef CACHE_MALLOC - {"enable_no_free", &enable_no_free, SD_INT32}, -#endif - {"enable_rdf_box_const", &enable_rdf_box_const, SD_INT32}, - {"simple_rdf_numbers", &simple_rdf_numbers, SD_INT32}, - {"rdf_rpid64_mode", (long *)&rdf_rpid64_mode, SD_INT32}, - {"rdf_geo_use_wkt", (long *)&rdf_geo_use_wkt, SD_INT32}, - {"pcre_match_limit", &c_pcre_match_limit, SD_INT32}, - {"pcre_match_limit_recursion", &c_pcre_match_limit_recursion, SD_INT32}, - {"pcre_max_cache_sz", &pcre_max_cache_sz, SD_INT32}, - {"shcompo_max_cache_sz", &shcompo_max_cache_sz, SD_INT32}, - {"debug_invalid_iri_id", &debug_invalid_iri_id, SD_INT32}, - {"enable_qr_comment", &enable_qr_comment, SD_INT32}, - {"timezoneless_datetimes", &timezoneless_datetimes, SD_INT32}, - {"lock_escalation_pct", &lock_escalation_pct, SD_INT32}, - {"enable_spar_logfile", (long *) &enable_spar_logfile, SD_INT32}, - {"enable_sqlc_logfile", (long *) &enable_sqlc_logfile, SD_INT32}, - {"http_connect_timeout", &http_connect_timeout, SD_INT32}, - {"users_cache_sz", &users_cache_sz, SD_INT64}, - {"enable_cpt_rb_ck", &enable_cpt_rb_ck, SD_INT32}, - {"swap_guard_threshold", (long *)&swap_guard_threshold, SD_INT64}, - {"max_proc_vm_size", (long *)&max_proc_vm_size, SD_INT64}, - {"vm_size_wd_threshold", (long *)&vm_size_wd_threshold, SD_INT64}, - {NULL, NULL, NULL} - }; - caddr_t dbs_list () { @@ -2140,14 +2153,17 @@ sys_stat_impl (const char *name) if (place) { stat_desc_t * sd = *place; - if (SD_INT32 == (char **) sd->sd_str_value) + switch (sd->sd_type) + { + case SD_TYPE_LONG: + return box_num_nonull (*(long *) (sd->sd_value)); + case SD_TYPE_INT32: return box_num_nonull (*(int32*)sd->sd_value); - if (SD_INT64 == (char **) sd->sd_str_value) + case SD_TYPE_INT64: return box_num_nonull (*(int64*)sd->sd_value); - else if (sd->sd_value) - return (box_num_nonull (*(sd->sd_value))); - else if (sd->sd_str_value) - return (box_dv_short_string (*(sd->sd_str_value))); + case SD_TYPE_STRING: + return box_dv_short_string (*(char **) sd->sd_value); + } } return NULL; } @@ -2174,24 +2190,34 @@ bif_dbf_set (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) if (!place) sqlr_new_error ("42000", "SR...", "__dbf_set, parameter does not exist"); - sd = *place; + if (dbf_protected_param (sd)) - sqlr_new_error ("42000", "SR...", "sys_stat parameter '%.300s' is already set and cannot be changed", name); - if (SD_INT32 == (char **) sd->sd_str_value) + sqlr_new_error ("42000", "SR...", "__dbf_set: parameter '%.300s' is already set and cannot be changed", name); + + switch (sd->sd_type) + { + case SD_TYPE_INT32: { int32 ov = *((int32*)sd->sd_value); *((int32*)sd->sd_value) = v; return (box_num (ov)); } - if (sd->sd_value) + case SD_TYPE_INT64: { - long ov = *(sd->sd_value); - *(sd->sd_value) = v; + int64 ov = *((int64 *) sd->sd_value); + *((int64 *) sd->sd_value) = v; return (box_num (ov)); } - else - sqlr_new_error ("42000", "SR...", "sys_stat_set, parameter not settable"); + case SD_TYPE_LONG: + { + long ov = *((long *) sd->sd_value); + *((long *) sd->sd_value) = v; + return (box_num (ov)); + } + } + + sqlr_new_error ("42000", "SR...", "__dbf_set: parameter '%.300s' not settable", name); return NULL; /*dummy*/ } diff --git a/libsrc/Wi/wi.h b/libsrc/Wi/wi.h index 8159e49e76..2b911e5740 100644 --- a/libsrc/Wi/wi.h +++ b/libsrc/Wi/wi.h @@ -2169,19 +2169,30 @@ extern int in_crash_dump; #define __builtin_prefetch(m) 0 #endif -#define SD_INT32 ((char **)-1) -#define SD_INT64 ((char **)-2) +typedef enum +{ + SD_TYPE_INT32, + SD_TYPE_INT64, + SD_TYPE_LONG, + SD_TYPE_STRING, +} stat_desc_type_t; typedef struct stat_desc_s { const char * sd_name; - long * sd_value; - char ** sd_str_value; + void *sd_value; + stat_desc_type_t sd_type; } stat_desc_t; extern stat_desc_t dbf_descs[]; extern stat_desc_t rdf_preset_datatypes_descs[]; -int dbf_protected_param(stat_desc_t *sd); + +#define SD_STRUCT_ITEM(a, b, c) { a, &b, c } + +#define SD_DEF_I32(v, a) SD_STRUCT_ITEM (a, v, SD_TYPE_INT32) +#define SD_DEF_I64(v, a) SD_STRUCT_ITEM (a, v, SD_TYPE_INT64) +#define SD_DEF_L(v, a) SD_STRUCT_ITEM (a, v, SD_TYPE_LONG) +#define SD_DEF_STR(v, a) SD_STRUCT_ITEM (a, v, SD_TYPE_STRING) typedef struct s_time_t { From 7f5e8a05b30e05cf8ce7625b7f20ae88d76af5c7 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Wed, 30 Oct 2024 00:30:17 +0200 Subject: [PATCH 67/94] Fixed qi_set_batch_sz() signature This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/sqlfn.h | 2 +- libsrc/Wi/sqlvrun.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libsrc/Wi/sqlfn.h b/libsrc/Wi/sqlfn.h index fdfae78727..0608f82e28 100644 --- a/libsrc/Wi/sqlfn.h +++ b/libsrc/Wi/sqlfn.h @@ -1767,7 +1767,7 @@ int dv_rdf_id_delta (int64 ro_id_1, int64 ro_id_2, int64 *delta_ret); blob_handle_t * cli_ready_dae (client_connection_t * cli, blob_handle_t * bh); void cli_free_dae (client_connection_t * cli); -void qi_set_batch_sz (caddr_t * inst, table_source_t * ts, int new_sz); +void qi_set_batch_sz (caddr_t * inst, data_source_t * ts, int new_sz); void dk_hash_copy (dk_hash_t * to, dk_hash_t * from); state_slot_t * upd_find_col_ssl (update_node_t * upd, oid_t col_id); void complete_proc_name (char * proc_name, char * complete, char * def_qual, char * def_owner); diff --git a/libsrc/Wi/sqlvrun.c b/libsrc/Wi/sqlvrun.c index 5a3766543e..99a3b1ad63 100644 --- a/libsrc/Wi/sqlvrun.c +++ b/libsrc/Wi/sqlvrun.c @@ -1857,9 +1857,9 @@ qn_is_cl (data_source_t * qn) int -ts_need_large_out_batch (table_source_t * ts) +ts_need_large_out_batch (data_source_t * ts) { - data_source_t * next = qn_next ((data_source_t *)ts); + data_source_t * next = qn_next (ts); if (!next) return 0; if (IS_QN (next, setp_node_input)) @@ -1896,7 +1896,7 @@ qi_batch_inc (caddr_t * inst, data_source_t * qn) } for (prev = qn; prev; prev = qn_next (prev)) { - if (ts_need_large_out_batch ((table_source_t *)prev)) + if (ts_need_large_out_batch (prev)) inc += qn_batch_inc (inst, prev); } return inc; @@ -1904,13 +1904,13 @@ qi_batch_inc (caddr_t * inst, data_source_t * qn) void -qi_set_batch_sz (caddr_t * inst, table_source_t * ts, int new_sz) +qi_set_batch_sz (caddr_t * inst, data_source_t * ts, int new_sz) { data_source_t *pred; int any_qf = 0; if (!ts_need_large_out_batch (ts)) - ts = (table_source_t*)ts->src_gen.src_prev; - for (pred = (data_source_t *) ts; pred; pred = pred->src_prev) + ts = ts->src_prev; + for (pred = ts; pred; pred = pred->src_prev) { if (SRC_IN_STATE (pred, inst)) goto found; @@ -1923,7 +1923,7 @@ qi_set_batch_sz (caddr_t * inst, table_source_t * ts, int new_sz) found: TC (tc_adjust_batch_sz); tc_cum_batch_sz += new_sz; - for (pred = (data_source_t *) ts; pred; pred = pred->src_prev) + for (pred = ts; pred; pred = pred->src_prev) { if (!any_qf) any_qf = qn_is_cl (pred); @@ -1934,7 +1934,7 @@ qi_set_batch_sz (caddr_t * inst, table_source_t * ts, int new_sz) if (IS_QN (pred, subq_node_input)) { QNCAST (subq_source_t, sqs, pred); - qi_set_batch_sz (inst, (table_source_t *) sqs->sqs_query->qr_select_node->src_gen.src_prev, new_sz); + qi_set_batch_sz (inst, sqs->sqs_query->qr_select_node->src_gen.src_prev, new_sz); } } else @@ -2116,7 +2116,7 @@ ts_check_batch_sz (table_source_t * ts, caddr_t * inst, it_cursor_t * itc) return; } } - qi_set_batch_sz (inst, ts, target_sz); + qi_set_batch_sz (inst, (data_source_t *)ts, target_sz); } } @@ -2176,7 +2176,7 @@ ins_check_batch_sz (insert_node_t * ins, caddr_t * inst, it_cursor_t * itc) return; } } - qi_set_batch_sz (inst, ins, target_sz); + qi_set_batch_sz (inst, (data_source_t *)ins, target_sz); } /* query parallelization */ From 11c8245fae327ca1f9279d2c2eb499aa7bdc4718 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Thu, 31 Oct 2024 12:06:04 +0000 Subject: [PATCH 68/94] Fixed compiler warnings for misleading indentation This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/bif_explain.c | 22 +++++++++++----------- libsrc/Wi/extent.c | 12 ++++++------ libsrc/Wi/sqlcost.c | 20 ++++++++++---------- libsrc/Wi/sqlexp.c | 12 ++++++------ libsrc/Wi/sqlgen.c | 22 +++++++++++----------- libsrc/Wi/sqlsrv.c | 8 ++++---- libsrc/Wi/sqlvec.c | 8 ++++---- libsrc/Wi/sqlvrun.c | 10 +++++----- 8 files changed, 57 insertions(+), 57 deletions(-) diff --git a/libsrc/Wi/bif_explain.c b/libsrc/Wi/bif_explain.c index bd2146c379..f6a7af80f4 100644 --- a/libsrc/Wi/bif_explain.c +++ b/libsrc/Wi/bif_explain.c @@ -588,17 +588,17 @@ code_vec_print (code_vec_t cv) stmt_printf (("declare handler end at %d", in->_.handler.label)); else stmt_printf (("declare DEFAULT handler ")); - { - int inx; - DO_BOX (caddr_t *, state, inx, in->_.handler.states) - { - if (IS_BOX_POINTER (state)) - stmt_printf ((" state %s, ", state[0])); - else - stmt_printf ((" NO DATA_FOUND, ")); - } - END_DO_BOX; - } + { + int inx; + DO_BOX (caddr_t *, state, inx, in->_.handler.states) + { + if (IS_BOX_POINTER (state)) + stmt_printf ((" state %s, ", state[0])); + else + stmt_printf ((" NO DATA_FOUND, ")); + } + END_DO_BOX; + } break; case INS_HANDLER_END: diff --git a/libsrc/Wi/extent.c b/libsrc/Wi/extent.c index a1f3085ce2..15a0778253 100644 --- a/libsrc/Wi/extent.c +++ b/libsrc/Wi/extent.c @@ -524,12 +524,12 @@ ext_get_dp (extent_t * ext, dp_addr_t near) { if (!DP_IN_EXTENT (near, ext)) GPF_T1 ("near outside of extent"); - word = (near - ext->ext_dp) / BITS_IN_LONG; - if (ext->ext_pages[word] != 0xffffffff) - { - bit = word_free_bit (ext->ext_pages[word]); - goto bit_found; - } + word = (near - ext->ext_dp) / BITS_IN_LONG; + if (ext->ext_pages[word] != 0xffffffff) + { + bit = word_free_bit (ext->ext_pages[word]); + goto bit_found; + } } for (word = 0; word < EXTENT_SZ / BITS_IN_LONG; word++) { diff --git a/libsrc/Wi/sqlcost.c b/libsrc/Wi/sqlcost.c index c18a7f58d8..4628643abf 100644 --- a/libsrc/Wi/sqlcost.c +++ b/libsrc/Wi/sqlcost.c @@ -2581,16 +2581,16 @@ sqlo_inx_sample_1 (df_elt_t * tb_dfe, dbe_key_t * key, df_elt_t ** lowers, df_el } if (sop) itc->itc_st.cols = sop->sop_cols; - { - res = itc_sample (itc); - row_sel = itc_row_selectivity (itc, res); - if (sop && (dk_hash_t*)-1 == itc->itc_st.cols) - { - /* the itc sample has set the p stat, so no p stat or cxol samples here */ - hash_table_free (sop->sop_cols); - sop->sop_cols = NULL; - } - } + { + res = itc_sample (itc); + row_sel = itc_row_selectivity (itc, res); + if (sop && (dk_hash_t*)-1 == itc->itc_st.cols) + { + /* the itc sample has set the p stat, so no p stat or cxol samples here */ + hash_table_free (sop->sop_cols); + sop->sop_cols = NULL; + } + } if (sop) sop->sop_n_sample_rows += itc->itc_st.n_sample_rows; itc->itc_st.cols = NULL; diff --git a/libsrc/Wi/sqlexp.c b/libsrc/Wi/sqlexp.c index 52c8148dc6..30436cc9de 100644 --- a/libsrc/Wi/sqlexp.c +++ b/libsrc/Wi/sqlexp.c @@ -2119,16 +2119,16 @@ cv_refd_slots (sql_comp_t * sc, code_vec_t cv, dk_hash_t * res, dk_hash_t * all_ break; case INS_SUBQ: { - state_slot_t ** out_save = sc->sc_sel_out; - if (non_cl_local) - *non_cl_local = 1; + state_slot_t **out_save = sc->sc_sel_out; + if (non_cl_local) + *non_cl_local = 1; sc->sc_sel_out = NULL; - if (res) - sqlg_qn_env (sc, ins->_.subq.query->qr_head_node, NULL, res); + if (res) + sqlg_qn_env (sc, ins->_.subq.query->qr_head_node, NULL, res); sc->sc_sel_out = out_save; if (ins->_.subq.query->qr_select_node) { - ASG_SSL (res, all_res, ins->_.subq.query->qr_select_node->sel_out_slots[0]); + ASG_SSL (res, all_res, ins->_.subq.query->qr_select_node->sel_out_slots[0]); ASG_SSL (res, all_res, ins->_.subq.query->qr_select_node->sel_scalar_ret); } break; diff --git a/libsrc/Wi/sqlgen.c b/libsrc/Wi/sqlgen.c index 938e234b9d..7907ce6fe6 100644 --- a/libsrc/Wi/sqlgen.c +++ b/libsrc/Wi/sqlgen.c @@ -1919,15 +1919,15 @@ sqlg_pop_sqs (sql_comp_t * sc, subq_source_t * sqs, data_source_t ** head, dk_se qn->src_continuations = NULL; if (qn != last) sql_node_append (head, qn); - if (IS_QN (qn, select_node_input_subq) && !((select_node_t*)qn)->sel_subq_inlined) - { - QNCAST (select_node_t, sel, qn); - sel->sel_set_ctr = sctr; - sel->sel_subq_inlined = 1; - sel->src_gen.src_after_test = sqs->sqs_after_join_test; - sqs->sqs_after_join_test = NULL; - break; - } + if (IS_QN (qn, select_node_input_subq) && !((select_node_t*)qn)->sel_subq_inlined) + { + QNCAST (select_node_t, sel, qn); + sel->sel_set_ctr = sctr; + sel->sel_subq_inlined = 1; + sel->src_gen.src_after_test = sqs->sqs_after_join_test; + sqs->sqs_after_join_test = NULL; + break; + } } END_DO_SET (); qr->qr_nodes = dk_set_conc (sqr->qr_nodes, qr->qr_nodes); @@ -5205,8 +5205,8 @@ sqlg_handle_select_list (sqlo_t *so, df_elt_t * dfe, data_source_t ** head, state_slot_t * target_ssl = sqlg_dfe_ssl (so, sqlo_df (so, target_names[inx])); if (sc->sc_trans) sqlg_trans_rename (sc, res[inx], target_ssl); - res[inx] = sqlg_alias_or_assign (so, target_ssl, res[inx], &code, sqlg_is_vector - && DFE_VALUE_SUBQ == dfe->dfe_type); + res[inx] = sqlg_alias_or_assign (so, target_ssl, res[inx], &code, sqlg_is_vector + && DFE_VALUE_SUBQ == dfe->dfe_type); } } } diff --git a/libsrc/Wi/sqlsrv.c b/libsrc/Wi/sqlsrv.c index 9e3aa11cde..d3281e09b1 100644 --- a/libsrc/Wi/sqlsrv.c +++ b/libsrc/Wi/sqlsrv.c @@ -4453,10 +4453,10 @@ DBG_NAME(srv_make_new_error) (DBG_PARAMS const char *code, const char *virt_code if (code[1] == 'Y') virtuoso_sleep (0, 10000); - if ('S' == code[0] || '4' == code[0]) - { - at_printf (("Host %d make err %s %s in %s\n", local_cll.cll_this_host, code, temp, cl_thr_stat ())); - } + if ('S' == code[0] || '4' == code[0]) + { + at_printf (("Host %d make err %s %s in %s\n", local_cll.cll_this_host, code, temp, cl_thr_stat ())); + } #ifdef SIGNAL_DEBUG ctx = THREAD_CURRENT_THREAD->thr_reset_ctx; for (ctx_ctr = 0, ctx_iter = ctx; NULL != ctx_iter; ctx_ctr++, ctx_iter = ctx_iter->j_parent) { /*do nothing*/; } diff --git a/libsrc/Wi/sqlvec.c b/libsrc/Wi/sqlvec.c index b42ba91da4..6fc80dd7e9 100644 --- a/libsrc/Wi/sqlvec.c +++ b/libsrc/Wi/sqlvec.c @@ -4472,10 +4472,10 @@ qr_set_vec_ssls (query_t * qr) { if (SSL_VEC == ssl->ssl_type && !ssl->ssl_alias_of) dk_set_push (&ssls, (void *) ssl); - if (DV_ANY == ssl->ssl_dc_dtp) - est += dc_default_var_len + sizeof (caddr_t); - else - est += sizeof (int64); + if (DV_ANY == ssl->ssl_dc_dtp) + est += dc_default_var_len + sizeof (caddr_t); + else + est += sizeof (int64); } END_DO_SET (); DO_SET (state_slot_t *, ssl, &qr->qr_temp_spaces) diff --git a/libsrc/Wi/sqlvrun.c b/libsrc/Wi/sqlvrun.c index 99a3b1ad63..36f2091dfc 100644 --- a/libsrc/Wi/sqlvrun.c +++ b/libsrc/Wi/sqlvrun.c @@ -3826,11 +3826,11 @@ vec_fref_group_result (fun_ref_node_t * fref, table_source_t * ts, caddr_t * ins hash_area_t *ha = setp->setp_ha; if (HA_GROUP != ha->ha_op) continue; - if (1 == n_sets && (tree = (index_tree_t*) (SSL_REF == ha->ha_tree->ssl_type || SSL_VEC == ha->ha_tree->ssl_type ? sslr_qst_get (inst, (state_slot_ref_t*)ha->ha_tree, 0) : qst_get (inst, ha->ha_tree)))) - { - if (tree->it_hi && tree->it_hi->hi_chash) - chash_to_memcache (inst, tree, ha); - } + if (1 == n_sets && (tree = (index_tree_t*) (SSL_REF == ha->ha_tree->ssl_type || SSL_VEC == ha->ha_tree->ssl_type ? sslr_qst_get (inst, (state_slot_ref_t*)ha->ha_tree, 0) : qst_get (inst, ha->ha_tree)))) + { + if (tree->it_hi && tree->it_hi->hi_chash) + chash_to_memcache (inst, tree, ha); + } } END_DO_SET (); if (fref->src_gen.src_continuations) From 78664e0421d2a0dad0dc20e6617c972cea42beb0 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 4 Nov 2024 19:27:16 +0000 Subject: [PATCH 69/94] Fixed bad pointer indirection This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Dk/Dksets.c | 2 +- libsrc/Wi/sqlcost.c | 4 ++-- libsrc/Wi/sqlgen.c | 4 ++-- libsrc/Wi/sqlo.h | 2 +- libsrc/Wi/sqloprt.c | 14 +++++++------- libsrc/Wi/sqlrun.c | 6 +++--- libsrc/Wi/srvstat.c | 8 ++++---- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libsrc/Dk/Dksets.c b/libsrc/Dk/Dksets.c index 438f5bf283..128ac0d134 100644 --- a/libsrc/Dk/Dksets.c +++ b/libsrc/Dk/Dksets.c @@ -144,7 +144,7 @@ DBG_NAME (dk_set_delete_nth) (DBG_PARAMS dk_set_t * set, int idx) uint32 -dk_set_length (s_node_t * set) +dk_set_length (dk_set_t set) { uint32 count; diff --git a/libsrc/Wi/sqlcost.c b/libsrc/Wi/sqlcost.c index 4628643abf..eb8e2f7ce0 100644 --- a/libsrc/Wi/sqlcost.c +++ b/libsrc/Wi/sqlcost.c @@ -3889,7 +3889,7 @@ arity_scale (float ar) } int -col_dfe_list_size (dk_set_t * cols) +col_dfe_list_size (dk_set_t cols) { int res = 0; DO_SET (df_elt_t *, dfe, &cols) @@ -3905,7 +3905,7 @@ col_dfe_list_size (dk_set_t * cols) float -sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t * cols, float * size_ret) +sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t cols, float * size_ret) { float mem_cost = sqlo_hash_mem_cost (card); if (dfe->_.table.is_unique && !cols) diff --git a/libsrc/Wi/sqlgen.c b/libsrc/Wi/sqlgen.c index 7907ce6fe6..095c17d3dd 100644 --- a/libsrc/Wi/sqlgen.c +++ b/libsrc/Wi/sqlgen.c @@ -3541,7 +3541,7 @@ sqlg_parallel_ts_seq (sql_comp_t * sc, df_elt_t * dt_dfe, table_source_t * ts, f #define CVC(c) c = cv_copy (c) -code_vec_t cv_copy (code_vec_t * cv); +code_vec_t cv_copy (code_vec_t cv); @@ -3627,7 +3627,7 @@ cv_is_copiable (code_vec_t cv) code_vec_t -cv_copy (code_vec_t * cv) +cv_copy (code_vec_t cv) { int len; code_vec_t copy; diff --git a/libsrc/Wi/sqlo.h b/libsrc/Wi/sqlo.h index 75d4933865..f5891ce1e1 100644 --- a/libsrc/Wi/sqlo.h +++ b/libsrc/Wi/sqlo.h @@ -968,7 +968,7 @@ void dfe_unplace_fill_join (df_elt_t * fill_dt, df_elt_t * tb_dfe, dk_set_t org_ int st_is_call (ST * tree, char * f, int n_args); df_elt_t * dfe_container (sqlo_t * so, int type, df_elt_t * super); float dfe_hash_fill_cond_card (df_elt_t * tb_dfe); -float sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t * cols, float * size_ret); +float sqlo_hash_ins_cost (df_elt_t * dfe, float card, dk_set_t cols, float * size_ret); float sqlo_hash_ref_cost (df_elt_t * dfe, float hash_card); #define SQK_MAX_CHARS 2000 diff --git a/libsrc/Wi/sqloprt.c b/libsrc/Wi/sqloprt.c index f6a4d5a909..def146e783 100644 --- a/libsrc/Wi/sqloprt.c +++ b/libsrc/Wi/sqloprt.c @@ -75,7 +75,7 @@ sqlo_index_path_print (df_elt_t * dfe) caddr_t dv_iri_short_name (caddr_t x); void -dbg_print_st (caddr_t * box, FILE * f) +dbg_print_st (caddr_t box, FILE * f) { ST * st = (ST*)box; dtp_t dtp = DV_TYPE_OF (box); @@ -190,26 +190,26 @@ sqlo_dfe_print (df_elt_t * dfe, int offset) { if (ST_P (dfe->dfe_tree, KWD_PARAM)) { - dbg_print_st ((caddr_t *) dfe->dfe_tree->_.bin_exp.left, stdout); + dbg_print_st ((caddr_t) dfe->dfe_tree->_.bin_exp.left, stdout); sqlo_print (("=> ")); - dbg_print_st ((caddr_t *) dfe->dfe_tree->_.bin_exp.right, stdout); + dbg_print_st ((caddr_t) dfe->dfe_tree->_.bin_exp.right, stdout); } else if (ST_P (dfe->dfe_tree, ASG_STMT)) { - dbg_print_st ((caddr_t *) dfe->_.bin.left->dfe_tree, stdout); + dbg_print_st ((caddr_t) dfe->_.bin.left->dfe_tree, stdout); sqlo_print ((":= ")); - dbg_print_st ((caddr_t *) dfe->_.bin.right->dfe_tree, stdout); + dbg_print_st ((caddr_t) dfe->_.bin.right->dfe_tree, stdout); } else { sqlo_print ((" ")); if (!dfe->_.bin.right) sqlo_print ((" %s ", bop_text (dfe->_.bin.op))); - dbg_print_st ((caddr_t *) dfe->_.bin.left->dfe_tree, stdout); + dbg_print_st ((caddr_t) dfe->_.bin.left->dfe_tree, stdout); if (dfe->_.bin.right) { sqlo_print ((" %s ", bop_text (dfe->_.bin.op))); - dbg_print_st ((caddr_t *) dfe->_.bin.right->dfe_tree, stdout); + dbg_print_st ((caddr_t) dfe->_.bin.right->dfe_tree, stdout); } } sqlo_print (("\n")); diff --git a/libsrc/Wi/sqlrun.c b/libsrc/Wi/sqlrun.c index f12991ac40..7441602f25 100644 --- a/libsrc/Wi/sqlrun.c +++ b/libsrc/Wi/sqlrun.c @@ -4380,9 +4380,9 @@ DBG_NAME(qr_exec) (DBG_PARAMS client_connection_t * cli, query_t * qr, if (ret && DV_ARRAY_OF_POINTER == DV_TYPE_OF (ret) && qr->qr_proc_vectored) { { - caddr_t * prev = ret; - ret = (caddr_t*)((caddr_t*)ret)[0]; - dk_free_box ((caddr_t)prev); + caddr_t prev = ret; + ret = (caddr_t)((caddr_t*)ret)[0]; + dk_free_box (prev); } } if (ret && DV_ARRAY_OF_POINTER == DV_TYPE_OF (ret) && caller == CALLER_CLIENT) diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index 9b93597bd0..fd5fea60c2 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -4838,12 +4838,12 @@ bif_stat_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) id_hash_iterator (&hit, ric->ric_samples); while (hit_next (&hit, (caddr_t*)&s_key, (caddr_t*)&smp)) { - caddr_t * ent = sc_data_to_ext (qi, *(caddr_t*)s_key); + caddr_t ent = sc_data_to_ext (qi, *(caddr_t*)s_key); dbe_key_t * key = sch_id_to_key (wi_inst.wi_schema, unbox (ent[0])); if (key) { - dk_free_box (ent[0]); - ent[0] = box_dv_short_string (key->key_name); + dk_free_box (ent); + ent = box_dv_short_string (key->key_name); } dk_set_push (&smps, list (3, ent, box_float (smp->smp_card), box_float (smp->smp_inx_card))); } @@ -4931,7 +4931,7 @@ bif_stat_import (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) DO_BOX (caddr_t *, ks, inx, stats[1]) { dbe_table_t * tb = sch_name_to_table (sc, ks[0]); - caddr_t * ps = ks[3]; + caddr_t ps = ks[3]; if (!tb) continue; key = tb_name_to_key (tb, ks[1], 0); From 56549ca178bf291a8ee1a5a0fa7a9ed51c3b79bb Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 4 Nov 2024 19:29:26 +0000 Subject: [PATCH 70/94] Fixed bad typedef This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/sqlo.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libsrc/Wi/sqlo.h b/libsrc/Wi/sqlo.h index f5891ce1e1..7f701010c1 100644 --- a/libsrc/Wi/sqlo.h +++ b/libsrc/Wi/sqlo.h @@ -32,9 +32,7 @@ typedef struct df_elt_s df_elt_t; typedef struct dfe_reuse_s dfe_reuse_t; typedef struct sqlo_s sqlo_t; typedef struct locus_s locus_t; -#ifdef __cplusplus typedef struct remote_ds_s remote_ds_t; -#endif typedef struct ot_virt_col_s @@ -49,11 +47,7 @@ typedef struct op_table_s caddr_t ot_prefix; caddr_t ot_new_prefix; dbe_table_t * ot_table; -#ifdef __cplusplus remote_ds_t * ot_rds; -#else - struct remote_ds_t * ot_rds; -#endif ST * ot_dt; ST * ot_left_sel; ST * ot_join_cond; From e0b111ee29bc6570300d9214c575cec73b858aad Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 5 Nov 2024 11:14:24 +0000 Subject: [PATCH 71/94] Fixed wrong datatype This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- binsrc/virtuoso/viconfig.c | 2 +- libsrc/Wi/sqljp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/binsrc/virtuoso/viconfig.c b/binsrc/virtuoso/viconfig.c index c59a9fb290..6634e25783 100644 --- a/binsrc/virtuoso/viconfig.c +++ b/binsrc/virtuoso/viconfig.c @@ -1336,7 +1336,7 @@ cfg_setup (void) section = "Flags"; { stat_desc_t *sd = &dbf_descs[0]; - int64 v; + size_t v; int32 v32; while (sd->sd_name) { diff --git a/libsrc/Wi/sqljp.c b/libsrc/Wi/sqljp.c index fe8d4af80c..b0ab161dbc 100644 --- a/libsrc/Wi/sqljp.c +++ b/libsrc/Wi/sqljp.c @@ -344,7 +344,7 @@ jp_fanout (join_plan_t * jp) { if (DFE_BOP_PRED == is_o->dfe_type && 1 == is_o->_.bin.is_in_list) { - ST ** in_list = sqlo_in_list (is_o, NULL, NULL); + df_elt_t **in_list = sqlo_in_list (is_o, NULL, NULL); misc_card *= BOX_ELEMENTS (in_list) - 1; } return jp->jp_fanout = (p_stat[0] / o_card) * misc_card; From bbb74ea2481ff3d487bd90fd0daf9fc489bf7534 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 5 Nov 2024 13:55:44 +0000 Subject: [PATCH 72/94] Fixed issues compiling isqlw This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- binsrc/tests/isql.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/binsrc/tests/isql.c b/binsrc/tests/isql.c index 6f9ad64a58..37dab33625 100644 --- a/binsrc/tests/isql.c +++ b/binsrc/tests/isql.c @@ -10465,10 +10465,10 @@ isql_main (int argc, { if (!isqlt_tcsncmp (argv[i], _T("-?"), 2) || !isqlt_tcsncmp (argv[i], _T("/?"), 2) || !isqlt_tcsncmp (argv[i], _T("--help"), 6)) { - isqlt_ftprintf (stdout, _T("%") PCT_S _T(" Interactive SQL ") ISQL_TYPE _T("\n"), PRODUCT_NAME); - isqlt_ftprintf (stdout, _T("Version %") PCT_S _T(" as of %s\n"), ISQL_VERSION, __DATE__); + isqlt_ftprintf (stdout, _T("%s Interactive SQL ") ISQL_TYPE _T("\n"), PRODUCT_NAME); + isqlt_ftprintf (stdout, _T("Version %s as of %s\n"), ISQL_VERSION, __DATE__); #ifndef ODBC_ONLY - isqlt_ftprintf (stdout, _T("Compiled for %") PCT_S _T(" (%") PCT_S _T(")\n"), build_opsys_id, build_host_id); + isqlt_ftprintf (stdout, _T("Compiled for %s (%s)\n"), build_opsys_id, build_host_id); #endif isqlt_ftprintf (stdout, _T("%s\n"), PRODUCT_COPYRIGHT); isqlt_ftprintf (stdout, @@ -10617,7 +10617,7 @@ isql_main (int argc, i++; connect_port = argv[i]; } - pserv = getservbyname (connect_port, _T("tcp")); + pserv = getservbyname ((const char *)connect_port, "tcp"); if (pserv) { isqlt_stprintf (port, _T("%d"), ntohs (pserv->s_port)); @@ -10763,9 +10763,9 @@ isql_main (int argc, if (verbose_mode && (NOT web_mode)) { - isql_printf (_T("%") PCT_S _T(" Interactive SQL ") ISQL_TYPE _T("\n"), PRODUCT_NAME); - isql_printf (_T("Version %") PCT_S _T(" as of %s\n"), ISQL_VERSION, __DATE__); - isql_printf ("Type HELP; for help and EXIT; to exit.\n"); + isql_printf (_T("%s Interactive SQL ") ISQL_TYPE _T("\n"), PRODUCT_NAME); + isql_printf (_T("Version %s as of %s\n"), ISQL_VERSION, __DATE__); + isql_printf (_T("Type HELP; for help and EXIT; to exit.\n")); } if (nth_non_option || shortcuts_used) /* Used in the traditional way, with datasource, @@ -10899,7 +10899,7 @@ get_list_of_datasources (int for_html, TCHAR *dest_buf, int dest_size) { isqlt_tcsncpy (dest_buf, _T("", dest_size); + my_strncat (dest_buf, _T("\">"), dest_size); } else { From 988d7938a8092bf8b24489858fe26d667074ad28 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Tue, 5 Nov 2024 13:57:50 +0000 Subject: [PATCH 73/94] Fixed issue with pointer dereference This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types --- libsrc/Wi/srvstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index fd5fea60c2..07889b40a5 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -4839,7 +4839,7 @@ bif_stat_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args) while (hit_next (&hit, (caddr_t*)&s_key, (caddr_t*)&smp)) { caddr_t ent = sc_data_to_ext (qi, *(caddr_t*)s_key); - dbe_key_t * key = sch_id_to_key (wi_inst.wi_schema, unbox (ent[0])); + dbe_key_t * key = sch_id_to_key (wi_inst.wi_schema, unbox (ent)); if (key) { dk_free_box (ent); From 7cb1f5d9ca2d52cdaaee4c9df863dc0ffdba058a Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Thu, 7 Nov 2024 13:19:06 +0000 Subject: [PATCH 74/94] Updated version to 7.2.14-rc2 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a7985d2ed4..8144221c79 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ AC_PREREQ(2.59) m4_define(vos_major, [7]) m4_define(vos_minor, [2]) m4_define(vos_patch, [14]) -m4_define(vos_devel, [-rc1]) +m4_define(vos_devel, [-rc2]) AC_INIT([Virtuoso Open Source Edition (Column Store)], vos_major.vos_minor.vos_patch[]vos_devel, From b8e82297ed65bfbb16c08640f47ab9d04defd87e Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 8 Nov 2024 10:03:35 +0000 Subject: [PATCH 75/94] Fixed issue generating short url on 404 --- binsrc/fct/rdfdesc/description.vsp | 15 ++++++++++++--- binsrc/fct/sql/description.sql | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/binsrc/fct/rdfdesc/description.vsp b/binsrc/fct/rdfdesc/description.vsp index 6e61e6c68c..f6e7c6e35d 100644 --- a/binsrc/fct/rdfdesc/description.vsp +++ b/binsrc/fct/rdfdesc/description.vsp @@ -69,6 +69,7 @@ declare auto_sponge_on_empty_graph int; declare q_txt any; declare safetolink integer; + declare triples_found integer; declare jsses any; set http_charset='utf-8'; @@ -379,7 +380,6 @@ again: -- dbg_obj_print (qry_str); b3s_dbg_out (dbg_out, 'qry: ' || qry_str); - exec (qry_str, null, null, vector (), 0, meta, data); _subject := b3s_label_get (data, langs); @@ -387,6 +387,11 @@ again: rdf_link := sprintf ('/sparql?query=%U', __box_flags_tweak (sprintf ('define sql:describe-mode "CBD" %s DESCRIBE <%s>', b3s_render_inf_clause(), _S), 2)); __box_flags_set (rdf_link, 2); + -- 404 ck + qry_str := sprintf ('sparql ask %s where { { <%s> ?p1 ?o1 } union { ?s ?p2 <%s> } }', _F, _S, _S); + exec (qry_str, null, null, vector (), 0, meta, data); + triples_found := case when isvector(data) and aref(aref(data,0),0) then 1 else 0 end; + declare __res_desc, qs, qv, best_variant, accept, protocol varchar; declare best_q, curr float; declare inx int; @@ -582,11 +587,11 @@ again: id="sp_link" rel="nofollow">Sponge   - + Distinct   - Permalink + Permalink @@ -670,6 +675,9 @@ if (_subject <> '') { '') { } else { + _404: http_request_status ('HTTP/1.1 404 Not Found'); http ('

No further information is available.

'); } diff --git a/binsrc/fct/sql/description.sql b/binsrc/fct/sql/description.sql index 63e5c360f9..c161ebd6d0 100644 --- a/binsrc/fct/sql/description.sql +++ b/binsrc/fct/sql/description.sql @@ -1225,14 +1225,14 @@ fct_make_selector (in subj any, in sid integer) } ; -create procedure fct_make_curie (in url varchar, in lines any) +create procedure fct_make_curie (in url varchar, in lines any, in triples_found int default 1) { declare curie, chost, dhost varchar; declare len integer; len := cast (registry_get('c_uri_min_url_len') as integer); if (len = 0) len := 255; - if (__proc_exists ('WS.CURI.curi_make_curi') is null OR length(url) < len) + if (__proc_exists ('WS.CURI.curi_make_curi') is null OR length(url) < len OR 0 = triples_found) return url; curie := WS.CURI.curi_make_curi (url); From 3c1435fa321b67de5515531ac72115b9d2e80e0d Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:10:13 +0000 Subject: [PATCH 76/94] Removed support for AddThis This service was terminated on May 31 2023 --- binsrc/fct/css/default.css | 4 --- binsrc/fct/rdfdesc/description.vsp | 41 ------------------------------ binsrc/fct/rdfdesc/usage.vsp | 39 ---------------------------- binsrc/fct/sql/facet_view.sql | 17 ------------- binsrc/fct/xslt/fct_vsp.xsl | 24 ++--------------- 5 files changed, 2 insertions(+), 123 deletions(-) diff --git a/binsrc/fct/css/default.css b/binsrc/fct/css/default.css index 5e6ed78bb9..039773f12b 100644 --- a/binsrc/fct/css/default.css +++ b/binsrc/fct/css/default.css @@ -608,10 +608,6 @@ a.desc_permalink { font-size: 9pt; font-weight: normal } #fct_form { margin-top: 1ex } -.addthis_toolbox { margin: 20px 10px auto; } - -#FT_share .addthis_toolbox { margin: 0 } - img.dicon { border-width:0; height:20px; vertical-align: middle; } div.content.embedded > iframe { resize: auto; } diff --git a/binsrc/fct/rdfdesc/description.vsp b/binsrc/fct/rdfdesc/description.vsp index f6e7c6e35d..8ce5365c4e 100644 --- a/binsrc/fct/rdfdesc/description.vsp +++ b/binsrc/fct/rdfdesc/description.vsp @@ -4,8 +4,6 @@ xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0" - xmlns:addthis="http://www.addthis.com/help/api-spec" - xmlns:fb="http://www.facebook.com/2008/fbml" > '') {
Faceted Search & Find service v as of

- '0') { ?> -
- -
- - - - -
- - - - -
-

Alternative Linked Data Documents: diff --git a/binsrc/fct/rdfdesc/usage.vsp b/binsrc/fct/rdfdesc/usage.vsp index 8962cd99c0..ede671411d 100644 --- a/binsrc/fct/rdfdesc/usage.vsp +++ b/binsrc/fct/rdfdesc/usage.vsp @@ -4,8 +4,6 @@ xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" - xmlns:addthis="http://www.addthis.com/help/api-spec" - xmlns:fb="http://www.facebook.com/2008/fbml" >
Faceted Search & Find service v

- '0') { ?> -
- -
- - - - -
- - - - -
-
Alternative Linked Data Documents: diff --git a/binsrc/fct/sql/facet_view.sql b/binsrc/fct/sql/facet_view.sql index 0eec6ed140..1b73bf85c0 100644 --- a/binsrc/fct/sql/facet_view.sql +++ b/binsrc/fct/sql/facet_view.sql @@ -1020,13 +1020,6 @@ fct_web (in tree any, in sid int) fct_dbg_msg (sprintf ('reply: %s', cast (r_ses as varchar))); - declare _addthis_key varchar; - _addthis_key := registry_get ('fct_addthis_key'); - if (not isstring(_addthis_key)) _addthis_key := null; - if ('1' = _addthis_key) _addthis_key := 'xa-4ce13e0065cdadc0'; - - --dbg_printf('addthis_key: %s', _addthis_key); - http_value (xslt (registry_get ('_fct_xslt_') || 'fct_vsp.xsl', reply, vector ('sid', @@ -1051,8 +1044,6 @@ fct_web (in tree any, in sid int) p_qry, 'p_xml', p_xml, - 'addthis_key', - _addthis_key, 'tree', tree, 'agg_res', @@ -2708,14 +2699,6 @@ create procedure fct_page_head ()
-
- - - - - - -
'); } ; diff --git a/binsrc/fct/xslt/fct_vsp.xsl b/binsrc/fct/xslt/fct_vsp.xsl index a5fbc4ee19..e131d97ffc 100644 --- a/binsrc/fct/xslt/fct_vsp.xsl +++ b/binsrc/fct/xslt/fct_vsp.xsl @@ -22,9 +22,8 @@ -- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -- --> - + + @@ -42,7 +41,6 @@ - @@ -206,7 +204,6 @@ plink_a.innerHTML = 'Facet permalink'; OAT.Dom.append (['sparql_a_ctr',sparql_a, plink_a]); - - - - - From bb0b4478884a43e9d40970c2af4f300fa91e4880 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:19:53 +0000 Subject: [PATCH 77/94] Changed DOCTYPE from XHTML to HTML5 --- binsrc/fct/bbc_demo_queries.vsp | 9 +++---- binsrc/fct/demo_queries.vsp | 9 +++---- binsrc/fct/facet.vsp | 9 +++---- binsrc/fct/facet_doc.html | 9 +++---- binsrc/fct/rdfdesc/description.vsp | 14 +++++----- binsrc/fct/rdfdesc/fct_no_view_perms.vsp | 9 ++++--- binsrc/fct/rdfdesc/settings.vsp | 9 ++++--- binsrc/fct/rdfdesc/usage.vsp | 12 ++++----- binsrc/fct/sparql.vsp | 34 +++++++++++++----------- binsrc/fct/urilbl_status.vsp | 8 ++++-- binsrc/fct/www/about.html | 6 +++-- binsrc/fct/www/dlistall.vsp | 6 +++-- binsrc/fct/www/listall.vsp | 6 +++-- binsrc/fct/www/nspref.vsp | 6 +++-- binsrc/fct/www/search.vsp | 6 +++-- 15 files changed, 84 insertions(+), 68 deletions(-) diff --git a/binsrc/fct/bbc_demo_queries.vsp b/binsrc/fct/bbc_demo_queries.vsp index a0be772c0d..c2d4509c17 100644 --- a/binsrc/fct/bbc_demo_queries.vsp +++ b/binsrc/fct/bbc_demo_queries.vsp @@ -1,9 +1,8 @@ - - - + + + + BBC demo queries diff --git a/binsrc/fct/demo_queries.vsp b/binsrc/fct/demo_queries.vsp index 135db84eec..4acf3a0a16 100644 --- a/binsrc/fct/demo_queries.vsp +++ b/binsrc/fct/demo_queries.vsp @@ -1,9 +1,8 @@ - - - + + + + BBC demo queries diff --git a/binsrc/fct/facet.vsp b/binsrc/fct/facet.vsp index 4ffde92b70..6d7add90b1 100644 --- a/binsrc/fct/facet.vsp +++ b/binsrc/fct/facet.vsp @@ -1,9 +1,8 @@ - - - + + + + Precision Search & Find + + - - + + Entity Search, Find, and Explore - Documentation - - @@ -934,5 +929,12 @@ if (_subject <> '') {

+
+ + + +
diff --git a/binsrc/fct/rdfdesc/settings.vsp b/binsrc/fct/rdfdesc/settings.vsp index 44605b2698..cafcf41a98 100644 --- a/binsrc/fct/rdfdesc/settings.vsp +++ b/binsrc/fct/rdfdesc/settings.vsp @@ -49,11 +49,6 @@ - - -
@@ -100,5 +95,12 @@
+
+ + + +
diff --git a/binsrc/fct/rdfdesc/usage.vsp b/binsrc/fct/rdfdesc/usage.vsp index 8e6f66fabf..c61c2570ce 100644 --- a/binsrc/fct/rdfdesc/usage.vsp +++ b/binsrc/fct/rdfdesc/usage.vsp @@ -149,11 +149,6 @@ - - - @@ -403,5 +398,12 @@ Copyright © 2009- OpenLink Software
+
+ + + +
From c2c2339670b3f6e4078b4f46f134a9531d9912ee Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:24:45 +0000 Subject: [PATCH 79/94] Removed link to W3C XHTML validator --- binsrc/fct/rdfdesc/description.vsp | 3 --- binsrc/fct/rdfdesc/usage.vsp | 3 --- 2 files changed, 6 deletions(-) diff --git a/binsrc/fct/rdfdesc/description.vsp b/binsrc/fct/rdfdesc/description.vsp index f33d37560c..a69c8eb231 100644 --- a/binsrc/fct/rdfdesc/description.vsp +++ b/binsrc/fct/rdfdesc/description.vsp @@ -902,9 +902,6 @@ if (_subject <> '') { - Valid XHTML + RDFa
diff --git a/binsrc/fct/rdfdesc/usage.vsp b/binsrc/fct/rdfdesc/usage.vsp index c61c2570ce..1ad06d72e7 100644 --- a/binsrc/fct/rdfdesc/usage.vsp +++ b/binsrc/fct/rdfdesc/usage.vsp @@ -386,9 +386,6 @@ - Valid XHTML + RDFa
From f0e6e5ab004b3f6dcb1c6f3cc71443f24ac830da Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:25:20 +0000 Subject: [PATCH 80/94] Fixed issue with page selector on mobile devices --- binsrc/fct/css/default.css | 4 ++++ binsrc/fct/rdfdesc/description.vsp | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/binsrc/fct/css/default.css b/binsrc/fct/css/default.css index 039773f12b..0042d43288 100644 --- a/binsrc/fct/css/default.css +++ b/binsrc/fct/css/default.css @@ -612,3 +612,7 @@ img.dicon { border-width:0; height:20px; vertical-align: middle; } div.content.embedded > iframe { resize: auto; } div.content.embedded { resize: auto; overflow: auto; } + +.text-nowrap { + white-space: nowrap; +} diff --git a/binsrc/fct/rdfdesc/description.vsp b/binsrc/fct/rdfdesc/description.vsp index a69c8eb231..67cf431670 100644 --- a/binsrc/fct/rdfdesc/description.vsp +++ b/binsrc/fct/rdfdesc/description.vsp @@ -827,6 +827,7 @@ if (_subject <> '') { } } ?> '' and _last > 0) { if (1 or page > 0) { ?> +   @@ -836,10 +837,14 @@ if (_subject <> '') {   -     - Page of     + + + Page of     + + />   +
From 56156003d875168e1c8eb9ee597c7f477d549b07 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:28:04 +0000 Subject: [PATCH 81/94] Removed deprecated charset on stylesheet links --- binsrc/fct/facet.vsp | 2 +- binsrc/fct/rdfdesc/description.vsp | 4 ++-- binsrc/fct/rdfdesc/settings.vsp | 4 ++-- binsrc/fct/rdfdesc/usage.vsp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/binsrc/fct/facet.vsp b/binsrc/fct/facet.vsp index 6d7add90b1..c97e591940 100644 --- a/binsrc/fct/facet.vsp +++ b/binsrc/fct/facet.vsp @@ -30,7 +30,7 @@ pageUrl := pageUrl || '?' || query_str; ?> - + - + - + diff --git a/binsrc/fct/rdfdesc/settings.vsp b/binsrc/fct/rdfdesc/settings.vsp index cafcf41a98..aebf75edf4 100644 --- a/binsrc/fct/rdfdesc/settings.vsp +++ b/binsrc/fct/rdfdesc/settings.vsp @@ -47,8 +47,8 @@ Settings - - + +
diff --git a/binsrc/fct/rdfdesc/usage.vsp b/binsrc/fct/rdfdesc/usage.vsp index 1ad06d72e7..666bea1c67 100644 --- a/binsrc/fct/rdfdesc/usage.vsp +++ b/binsrc/fct/rdfdesc/usage.vsp @@ -147,8 +147,8 @@ Metadata about: <?vsp http (sprintf ('%s', label)); ?> - - + + From e4a707eaab17086f1fb119b8fe13f5bed1493429 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:28:30 +0000 Subject: [PATCH 82/94] Fixed recommendations from Lighthouse accessibility check --- binsrc/fct/rdfdesc/description.vsp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/binsrc/fct/rdfdesc/description.vsp b/binsrc/fct/rdfdesc/description.vsp index 9e0d0e4443..e73f7a4616 100644 --- a/binsrc/fct/rdfdesc/description.vsp +++ b/binsrc/fct/rdfdesc/description.vsp @@ -548,8 +548,7 @@ again: http (b3s_uri_curie(page_resource_uri)); } ?> - -     +     0) { http(sprintf('Goto\n', @@ -828,22 +827,22 @@ if (_subject <> '') { '' and _last > 0) { if (1 or page > 0) { ?> - +   - +     - +   - + Page of     - />   - + />   +
From e656c97c7c1c1c78e9d8be20b518f8f7641907a7 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:29:35 +0000 Subject: [PATCH 83/94] Removed tag --- binsrc/fct/rdfdesc/description.vsp | 7 +++---- binsrc/fct/rdfdesc/settings.vsp | 5 ++--- binsrc/fct/rdfdesc/usage.vsp | 7 +++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/binsrc/fct/rdfdesc/description.vsp b/binsrc/fct/rdfdesc/description.vsp index e73f7a4616..ae43cc1d57 100644 --- a/binsrc/fct/rdfdesc/description.vsp +++ b/binsrc/fct/rdfdesc/description.vsp @@ -462,7 +462,6 @@ again: ?> - About: <?vsp if (length (label)) http_value (label); else http (b3s_uri_percent_decode(b3s_uri_curie (page_resource_uri)));?> @@ -505,9 +504,9 @@ again:
  • Description
  • - Metadata + Metadata
  • -
  • Settings +
  • Settings diff --git a/binsrc/fct/rdfdesc/usage.vsp b/binsrc/fct/rdfdesc/usage.vsp index 666bea1c67..abadd24a1e 100644 --- a/binsrc/fct/rdfdesc/usage.vsp +++ b/binsrc/fct/rdfdesc/usage.vsp @@ -142,7 +142,6 @@ - Metadata about: <?vsp http (sprintf ('%s', label)); ?> @@ -165,7 +164,7 @@
  • Metadata
  • -
  • Settings
  • +
  • Settings
  • @@ -195,7 +194,7 @@     Permalink\n', + http(sprintf('Permalink\n', case when page_resource_uri like 'nodeID://%' then b3s_http_url (page_resource_uri) else page_resource_uri end, tp, b3s_render_ses_params (0,0) @@ -231,7 +230,7 @@ href="?g=&tp=4">Implicit Coreferences -
    +
    From 1a7075237cdc91f072ccfc2510cc2cef49801cd2 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:37:40 +0000 Subject: [PATCH 84/94] Updated FCT vad version --- binsrc/fct/vad_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binsrc/fct/vad_version b/binsrc/fct/vad_version index cc1fbc7583..1d6ad1c72b 100644 --- a/binsrc/fct/vad_version +++ b/binsrc/fct/vad_version @@ -1 +1 @@ -1.16.119 +1.16.120 From 4991196f6af902ad1c8079ecd72f92a7c3c1f212 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 10:35:21 +0000 Subject: [PATCH 85/94] Fixed compiler errors from -Werror=logical-not-parentheses --- binsrc/tests/time.c | 2 +- libsrc/Wi/sqlbif2.c | 2 +- libsrc/Wi/sqlintrp.c | 2 +- libsrc/Wi/sqlocr.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binsrc/tests/time.c b/binsrc/tests/time.c index 08f955bb0e..07aef7c820 100644 --- a/binsrc/tests/time.c +++ b/binsrc/tests/time.c @@ -105,7 +105,7 @@ ta_add_sample (timer_account_t * ta, long this_time) void ta_print_out (FILE * out, timer_account_t * ta) { - if (!ta->ta_is_on == TA_ON) + if (ta->ta_is_on != TA_ON) return; if (ta->ta_n_samples > 0) { diff --git a/libsrc/Wi/sqlbif2.c b/libsrc/Wi/sqlbif2.c index d35ba8352d..4ee3e4c69f 100644 --- a/libsrc/Wi/sqlbif2.c +++ b/libsrc/Wi/sqlbif2.c @@ -279,7 +279,7 @@ tcpses_check_disk_error (dk_session_t *ses, caddr_t *qst, int throw_error) { query_instance_t *qi = (query_instance_t *) qst; - if (!ses || !ses->dks_session || !ses->dks_session->ses_class != SESCLASS_STRING + if (!ses || !ses->dks_session || ses->dks_session->ses_class != SESCLASS_STRING || !ses->dks_session->ses_file->ses_max_blocks_init) return 0; diff --git a/libsrc/Wi/sqlintrp.c b/libsrc/Wi/sqlintrp.c index 880b9037e1..9b99630697 100644 --- a/libsrc/Wi/sqlintrp.c +++ b/libsrc/Wi/sqlintrp.c @@ -425,7 +425,7 @@ ins_call (instruction_t * ins, caddr_t * qst, code_vec_t code_vec) sql_method_t *mtd = NULL; ptrlong mtd_inx = -1; if (BOX_ELEMENTS (proc_name) != 2 || !DV_STRINGP (proc_mtd_call[0]) || - !DV_LONG_INT == DV_TYPE_OF (proc_mtd_call[1])) + DV_LONG_INT != DV_TYPE_OF (proc_mtd_call[1])) { err = srv_make_new_error ("22023", "UD004", "Invalid proc_name array supplied"); goto report_error; diff --git a/libsrc/Wi/sqlocr.c b/libsrc/Wi/sqlocr.c index d347550bf4..ce7a3e6880 100644 --- a/libsrc/Wi/sqlocr.c +++ b/libsrc/Wi/sqlocr.c @@ -43,7 +43,7 @@ int sqlo_cr_is_identifiable (sqlo_t * so, ST * tree) { df_elt_t *dfe = so->so_copy_root; - if (!dfe || !dfe->dfe_type == DFE_DT) + if (!dfe || dfe->dfe_type != DFE_DT) return 0; if (!ST_P (tree, SELECT_STMT)) return 0; From 77343f0dd834feed4d67db66e292f7cb294fee60 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 8 Nov 2024 11:43:56 +0000 Subject: [PATCH 86/94] Added optional new algorithm to fix xte_sum64 collisions For now we continue to use the old algorithm. --- libsrc/Wi/disk.c | 3 +++ libsrc/Wi/srvstat.c | 2 ++ libsrc/Wi/widisk.h | 1 + libsrc/Wi/xmltree.c | 62 ++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/libsrc/Wi/disk.c b/libsrc/Wi/disk.c index 56b3b284de..7aed9aa21f 100644 --- a/libsrc/Wi/disk.c +++ b/libsrc/Wi/disk.c @@ -3905,6 +3905,7 @@ dbs_init_id (char * str) } extern int32 rdf_rpid64_mode; +extern int32 xte_use_mhash; void dbs_write_cfg_page (dbe_storage_t * dbs, int is_first) @@ -3958,6 +3959,7 @@ dbs_write_cfg_page (dbe_storage_t * dbs, int is_first) db.db_timezoneless_datetimes = timezoneless_datetimes; /* should we check it is set to true? */ db.db_rdf_id64 = rdf_rpid64_mode; + db.db_xte_hash_mode = xte_use_mhash; LSEEK (fd, 0, SEEK_SET); memcpy (zero, &db, sizeof (db)); rc = write (fd, zero, PAGE_SZ); @@ -4396,6 +4398,7 @@ dbs_read_cfg_page (dbe_storage_t * dbs, wi_database_t * cfg_page) timezoneless_datetimes = cfg_page->db_timezoneless_datetimes; } rdf_rpid64_mode = cfg_page->db_rdf_id64; + xte_use_mhash = cfg_page->db_xte_hash_mode; if (cfg_page->db_byte_order != DB_ORDER_UNKNOWN && cfg_page->db_byte_order != DB_SYS_BYTE_ORDER) { #ifdef BYTE_ORDER_REV_SUPPORT diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index 07889b40a5..ad76823d4c 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -232,6 +232,7 @@ extern int enable_no_free; extern int32 enable_rdf_box_const; extern int32 simple_rdf_numbers; extern int32 rdf_rpid64_mode; +extern int32 xte_use_mhash; extern int enable_subscore; extern int enable_dfg; extern int enable_feed_other_dfg; @@ -1995,6 +1996,7 @@ stat_desc_t dbf_descs [] = #endif SD_DEF_I32 (enable_rdf_box_const, "enable_rdf_box_const"), SD_DEF_I32 (rdf_rpid64_mode, "rdf_rpid64_mode"), + SD_DEF_I32 (xte_use_mhash, "xte_use_mhash"), SD_DEF_I32 (rdf_geo_use_wkt, "rdf_geo_use_wkt"), SD_DEF_I32 (simple_rdf_numbers, "simple_rdf_numbers"), SD_DEF_I32 (c_pcre_match_limit, "pcre_match_limit"), diff --git a/libsrc/Wi/widisk.h b/libsrc/Wi/widisk.h index 6ed9c27c60..9f7c2e9609 100644 --- a/libsrc/Wi/widisk.h +++ b/libsrc/Wi/widisk.h @@ -367,6 +367,7 @@ struct wi_database_s char db_id[16]; char db_timezoneless_datetimes; /* The values for timezoneless_datetimes global, overrides one in virtuoso.ini in case of conflict */ char db_rdf_id64; /*!< The size of RI_NAME header */ + char db_xte_hash_mode; }; #define DBS_INCOMPLETE 1 /*being copied or being created by split, can't open */ diff --git a/libsrc/Wi/xmltree.c b/libsrc/Wi/xmltree.c index ff57bb47bd..990eef2266 100644 --- a/libsrc/Wi/xmltree.c +++ b/libsrc/Wi/xmltree.c @@ -10062,10 +10062,69 @@ caddr_t bif_xtree_tridgell32 (caddr_t * qst, caddr_t * err_ret, state_slot_t ** } #endif +/* + * This setting controls whether a new database uses: + * + * 0 = old algorithm + * 2 = new murmur algorithm + */ +uint32 xte_use_mhash = 0; /* use old algorithm for now */ + +uint64 +murmur_hash_64a (const void * key, int len, uint64 seed) +{ + const uint64 m = 0xC6A4A7935BD1E995LLU; /* MURMURHASH 64A MAGIC */ + const int r = 47; + uint64 h = seed ^ (len * m); + const uint64 * data = (const uint64 *)key; + const uint64 * end = (len >> 3) + data; + const unsigned char * data2; + + while(data != end) + { + uint64 k = *data++; + + k *= m; + k ^= k >> r; + k *= m; + + h ^= k; + h *= m; + } + + data2 = (const unsigned char *)data; + + switch(len & 7) + { + case 7: h ^= (uint64)(data2[6]) << 48; + case 6: h ^= (uint64)(data2[5]) << 40; + case 5: h ^= (uint64)(data2[4]) << 32; + case 4: h ^= (uint64)(data2[3]) << 24; + case 3: h ^= (uint64)(data2[2]) << 16; + case 2: h ^= (uint64)(data2[1]) << 8; + case 1: h ^= (uint64)(data2[0]); + h *= m; + }; + + h ^= h >> r; + h *= m; + h ^= h >> r; + + return h; +} + #define SUM64(data,lo,med,hi) \ + if (xte_use_mhash) { \ + mhash = murmur_hash_64a(data, box_length_inline ((data)) - 1, 0); \ + hi ^= (uint32_t)((mhash >> 42) & 0x3FFFFF); \ + med ^= (uint32)((mhash >> 21) & 0x1FFFFF); \ + lo ^= (uint32)(mhash & 0x1FFFFF); \ + } else { \ end = (data) + box_length_inline ((data)) - 1; \ for (tail = (data); tail < end; tail++) \ - { lo += tail[0]; med += lo; hi += med; } + { lo += tail[0]; med += lo; hi += med; } \ + } + static void xte_sum64_iter (caddr_t *tree, unsigned *lo_ptr, unsigned *med_ptr, unsigned *hi_ptr) @@ -10073,6 +10132,7 @@ xte_sum64_iter (caddr_t *tree, unsigned *lo_ptr, unsigned *med_ptr, unsigned *hi unsigned lo = lo_ptr[0], med = med_ptr[0], hi = hi_ptr[0], loxor, medxor, hixor, lon, medn, hin; unsigned char *data; unsigned char *tail, *end; + uint64 mhash; if (DV_ARRAY_OF_POINTER == DV_TYPE_OF (tree)) { int attrctr, head_len, cctr, ccount = BOX_ELEMENTS_INT (tree); From b4cb619f0208a0cb7759055280e89baef4321434 Mon Sep 17 00:00:00 2001 From: Mitko Iliev Date: Fri, 8 Nov 2024 11:59:31 +0000 Subject: [PATCH 87/94] Fixed int32 overflow when dbs_file_length unknown --- libsrc/Wi/srvstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c index ad76823d4c..bc84726319 100644 --- a/libsrc/Wi/srvstat.c +++ b/libsrc/Wi/srvstat.c @@ -710,12 +710,12 @@ dbms_status_report (void) rep_printf ("\nDatabase Status:\n" " File size " OFF_T_PRINTF_FMT ", %ld pages, %ld free.\n" " %d buffers, %d used, %d dirty %d wired down, repl age %d %d w. io %d w/crsr.\n", - dbs->dbs_file_length ? (OFF_T_PRINTF_DTP) dbs->dbs_file_length : (dbs->dbs_n_pages * PAGE_SZ), dbs->dbs_n_pages, + dbs->dbs_file_length ? (OFF_T_PRINTF_DTP) dbs->dbs_file_length : ((OFF_T) dbs->dbs_n_pages * PAGE_SZ), dbs->dbs_n_pages, st_db_free_pages, n_buffers, n_used, n_dirty, n_wired, bp_replace_count ? (int) (bp_replace_age / bp_replace_count) : 0, n_io, n_crsr ); snprintf (st_db_file_size, sizeof (st_db_file_size_buffer), OFF_T_PRINTF_FMT, - (OFF_T_PRINTF_DTP) (dbs->dbs_n_pages * PAGE_SZ)); + (OFF_T_PRINTF_DTP) ((OFF_T) dbs->dbs_n_pages * PAGE_SZ)); st_db_pages = dbs->dbs_n_pages; st_db_buffers = n_buffers; st_db_used_buffers = n_used; From f40b011040922408d8a6c91b41b333b6757e6de2 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 14:24:55 +0000 Subject: [PATCH 88/94] Added notice to isqlw this application has been deprecated (fixes #1322) There is no use shipping a broken tool. We have decided to have it return a deprecation notice in case users upgrade an existing installation. --- binsrc/tests/isql.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/binsrc/tests/isql.c b/binsrc/tests/isql.c index 37dab33625..9cbe51cee1 100644 --- a/binsrc/tests/isql.c +++ b/binsrc/tests/isql.c @@ -10768,6 +10768,11 @@ isql_main (int argc, isql_printf (_T("Type HELP; for help and EXIT; to exit.\n")); } +#ifdef _UNICODE + wprintf (L"\nThe current isqlw application has been deprecated and will be removed in a future release\n\n"); + exit (1); +#endif + if (nth_non_option || shortcuts_used) /* Used in the traditional way, with datasource, and possibly username and password given from the command line? */ From 87395efbd78b0d62d75a6d0820dee29f5315a6cf Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Fri, 8 Nov 2024 14:31:28 +0000 Subject: [PATCH 89/94] Updated version to 7.2.14-rc3 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8144221c79..67f23e3207 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ AC_PREREQ(2.59) m4_define(vos_major, [7]) m4_define(vos_minor, [2]) m4_define(vos_patch, [14]) -m4_define(vos_devel, [-rc2]) +m4_define(vos_devel, [-rc3]) AC_INIT([Virtuoso Open Source Edition (Column Store)], vos_major.vos_minor.vos_patch[]vos_devel, From 6c4dc48b89d86f30c2f468519d7a775be8b3fdb0 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 11 Nov 2024 11:17:52 +0000 Subject: [PATCH 90/94] Fixed disable readline/editline for isqlw --- binsrc/tests/isql.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/binsrc/tests/isql.c b/binsrc/tests/isql.c index 9cbe51cee1..e4fb7499ef 100644 --- a/binsrc/tests/isql.c +++ b/binsrc/tests/isql.c @@ -48,6 +48,10 @@ #error It appears that your system does not support unicode console input/output. If you happend to be using glibc 2.1, please upgrade to more recent version #endif +#if defined (UNICODE) || defined (_UNICODE) +#undef WITH_READLINE +#undef WITH_EDITLINE +#endif #if defined (WITH_READLINE) #include From 4a381d5ba6b45913d2dd712fb1eff2ce71a736ac Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 11 Nov 2024 11:21:46 +0000 Subject: [PATCH 91/94] Updated NEWS.md --- NEWS.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/NEWS.md b/NEWS.md index cbc13106b1..d211d0c931 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,70 @@ # NEWS +## November 11, 2024, v7.2.14 + * Virtuoso Engine + - Added new MaxTempDBPages setting to virtuoso.ini + - Fixed issue when out of disk space on temp db + - Fixed int32 overflow when `dbs_file_length` is unknown + - Fixed memory leak in X509 cert chain + - Fixed compiler errors from -Werror=incompatible-pointer-types (fixes #1312) + - Fixed compiler errors from -Werror=logical-not-parentheses + - Fixed compiler errors from -Werror=multistatement-macros + - Fixed issue with user defined types (UDT) + - Fixed issue when there are no parts to split + - Fixed issue with GROUP BY/ORDER BY on LEFT OUTER JOIN + - Fixed issue calling concat(wide, utf8) (fixes #944) + - Fixed issue with lenght calculation in `rdf_encode_for_uri()` + + * SPARQL + - Added support for (a relatively small amount of) blank nodes in SPARQL INSERT DATA (fixes #126) + - Fixed missing `DB.DBA.SPARQL_BINDINGS_VIEW_C_0` for empty solution bindings + - Fixed arbitrary XML with CDATA having html tags has MIME re-placed with text/html + - Fixed issue when there are no more inits to skip + - Fixed key estimate on single only + - Fixed inc. estimate on transitive with unbound input + + * Web Server and DAV + - Added support to handle websocket 101 connection upgrade in `http_client` + - Added flag to see if connection session is server or client + - Added `WSOCK.DBA.WEBSOCKET_CONNECT()` for client operations + - Added PUT/DELETE HTTP methods + - Added support for custom `%T` and `%D` HTTP log format + - Added flag to encode if API used as websocket client + - Fixed issue with "Content-Encoding: gzip" (fixes #1308) + - Fixed issue DAV escape; href should escape apos + - Fixed order of checking SOAP options and parameters + - Fixed allow `soap_boolean` to accept null for nullable arguments + - Fixed check which options are handled by endpoint + - Fixed check defines on rest method for additional http methods allowed + - Fixed issue with JSON registered REST services + - Fixed memory leak and error when service sets error status code + - Fixed missing SOAP procedure should return 404 'Not Found' + - Fixed missing encode flag + + * Faceted Browser + - Added support for WKT rendition + - Changed DOCTYPE from XHTML to HTML5 + - Removed `` tag + - Removed deprecated charset on stylesheet links + - Removed link to W3C XHTML validator + - Removed support for AddThis + - Moved javascript to the end of the page + - Fixed recommendations from Lighthouse accessibility check + - Fixed issue with page selector on mobile devices + - Fixed make iframe content resizable + + * Conductor + - Fixed issue when filename starts with underscore + - Fixed typo in generation of Transient view urls + - Fixed issue with RSS menu not working on Firefox + - Fixed issue with SN DETs errors + + * R2RML + - Fixed issue with {col} + + * GraphQL + - Fixed issue with generated names longer than 100 characters + ## June 10, 2024, v7.2.13: * Virtuoso Engine - Added safe `logical_*` bif names From bc838ec69b19a4d6ce790851fcf1abdcb940c2d3 Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 11 Nov 2024 11:22:58 +0000 Subject: [PATCH 92/94] Updated ChangeLog --- ChangeLog | 422 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 422 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3ea271d3c8..2afd5d36f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,427 @@ +2024-11-11 Patrick van Kleef + + Updated NEWS.md + + Fixed disable readline/editline for isqlw + +2024-11-08 Patrick van Kleef + + Updated version to 7.2.14-rc3 + +2024-11-08 Patrick van Kleef + + Added notice to isqlw this application has been deprecated (fixes #1322) + + There is no use shipping a broken tool. We have decided to have it return + a deprecation notice in case users upgrade an existing installation. + +2024-11-08 Mitko Iliev + + Fixed int32 overflow when dbs_file_length unknown + +2024-11-08 Mitko Iliev + + Added optional new algorithm to fix xte_sum64 collisions + + For now we continue to use the old algorithm. + +2024-11-08 Patrick van Kleef + + Fixed compiler errors from -Werror=logical-not-parentheses + + Updated FCT vad version + + Removed tag + + Fixed recommendations from Lighthouse accessibility check + + Removed deprecated charset on stylesheet links + + Fixed issue with page selector on mobile devices + + Removed link to W3C XHTML validator + + Moved javascript to the end of the page + + Changed DOCTYPE from XHTML to HTML5 + +2024-11-08 Patrick van Kleef + + Removed support for AddThis + + This service was terminated on May 31 2023 + +2024-11-08 Mitko Iliev + + Fixed issue generating short url on 404 + +2024-11-07 Patrick van Kleef + + Updated version to 7.2.14-rc2 + +2024-11-07 Patrick van Kleef + + Merge branch 'feature/gcc14-fixes' into develop/7 + + Fixes #1312 + Closes #1324 + +2024-11-07 Patrick van Kleef + + Fixed issue with pointer dereference + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed issues compiling isqlw + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed wrong datatype + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed bad typedef + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed bad pointer indirection + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed compiler warnings for misleading indentation + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Mitko Iliev + + Fixed qi_set_batch_sz() signature + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed issues with stat_desc_t data + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Mitko Iliev + + Fixed use separate macro for UST * data + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Mitko Iliev + + Fixed use separate macro for XT * data + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed initialization of different pointers + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed bad pointer type + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed bad variable declaration + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed bad cast using thr_get_error_code + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed issue with function prototype + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed bad or missing casts + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed casts on mp_alloc and mp_alloc_box + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed missing server_func cast + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed bad argument cast in virt_mbsnrtowcs and virt_wcsnrtombs + + This fixes errors reported by gcc 14 -Derror=incompatible-pointer-types + +2024-11-07 Patrick van Kleef + + Fixed wrong ODBC datatype + +2024-11-07 Mitko Iliev + + Fixed missing DB.DBA.SPARQL_BINDINGS_VIEW_C_0 for empty solution bindings + +2024-11-07 Patrick van Kleef + + Fixed compiler warnings from -Wmultistatement-macros + + Renamed last_majflt to swap_guard_last_majflt + + Fixed memory leak in X509 cert chain + + Removed rbuf_test function + +2024-10-28 Mitko Iliev + + Fixed arbitrary XML with CDATA having html tags has MIME re-placed with text/html + +2024-10-28 Patrick van Kleef + + Updated Conductor VAD version + +2024-10-28 Mitko Iliev + + Fixed issue when filename starts with underscore + + An underscore is a valid start character for visible files + +2024-10-28 Patrick van Kleef + + Fixed typo in generation of Transient view urls + +2024-10-28 Mitko Iliev + + Fixed issue with RSS menu not working on Firefox + + Added support to handle 101 connection upgrade in http_client + + Added flag to see if connection session is server or client + + Fixed missing encode flag + + Added WSOCK.DBA.WEBSOCKET_CONNECT() for client operations + + Added flag to encode if API used as WSock client + +2024-10-28 Mitko Iliev + + Fixed order of checking options and parameters + + Options must be checked before parameters; params are for + execution only + +2024-10-28 Patrick van Kleef + + Fixed allow soap_boolean to accept null for nullable arguments + +2024-10-28 Mitko Iliev + + Fixed errror state + + A missing procedure should return 'not found' instead of 'internal error' + +2024-10-28 Mitko Iliev + + Fixed check which options are handled by endpoint + + Check defines on rest method for additional http methods allowed + +2024-10-28 Mitko Iliev + + Fixed issue with JSON registered REST services + + JSON services should return JSON formatted error, not HTML body + +2024-10-28 Mitko Iliev + + Fixed issue with generated names longer than 100 characters + + The GraphQL query generator may compose name over 100 chars, leading to + truncated and bad sql. Fixed by making part after 80 chars a sha256 sum. + +2024-09-23 Patrick van Kleef + + Updated version to 7.2.14-rc1 + +2024-09-23 Mitko Iliev + + Fixed DAV escape href should escape apos + + Fixed issue when there are no more inits to skip + +2024-09-04 Patrick van Kleef + + Merge branch 'feature/backport' into develop/7 + + Updated FCT vad version + +2024-09-04 Mitko Iliev + + Fixed make 'x_content > iframe' content resizable + + Added support for WKT rendition + +2024-09-04 Patrick van Kleef + + Added new MaxTempDBPages setting to virtuoso.ini + + This setting limits the maximum size of the TempDatabase file on disk to a + fixed amount of used pages. If the engine detects this limit has been + exceeded, the query that was filling up the TempDatabase will return an + error and its transaction is killed. + + [TempDatabase] + MaxTempDBPages = 50G ; Limit size of the TempDatabase to 50GB on disk + + Values ending in B, K, M, G will be converted to number of pages that + can fit into that size. Plain values are interpreted as number of pages. + + For example 50G = (50 * 1024 * 1024 * 1024) / 8192 = 6553600 pages + + The default value is 0 which means that the TempDatabase file can fill + up the whole disk partition it is located on. + +2024-09-04 Mitko Iliev + + Added support for restricting the size of the tempdb + +2024-09-04 Patrick van Kleef + + Added temp space usage in db activity + + Fixed distribution of vadpacker + +2024-09-03 Patrick van Kleef + + Fixed issue re-initializing the pconfig struct + +2024-09-03 Mitko Iliev + + Added put/delete http methods + + Fixed key estimate on single only + +2024-09-03 Patrick van Kleef + + Added support for custom %T and %D http log format + + The following format codes are added: + + %T time to serve the request in seconds + %D time to serve the request in microseconds + + %{s}T time to serve the request in seconds (same as %T) + %{ms}T time to serve the request in milliseconds + %{us}T time to serve the request in microseconds (same as %D) + %{rt}T time to serve the request using CPU timestamp counter + +2024-09-03 Patrick van Kleef + + Fixed use get_usec_real_time() for rate limiting + + Fixed use usec for cli_start_time for custom %T and %D http log format + + Added new function get_usec_real_time + +2024-08-30 Patrick van Kleef + + Updated Vadpacker to v1.10 + +2024-08-09 Mitko Iliev + + Fixed inc. estimate on transitive with unbound input + + Fixed memory leak and error when service sets error status code + + Fixed issue with user defined types (UDT) + + Fixed issue with SN DETs errors + +2024-08-09 Mitko Iliev + + Fixed issue with {col} + + When a single column is specified as IRI then do not escape, + e.g. {col} means an IRI string + +2024-08-08 Mitko Iliev + + Fixed issue with "Content-Encoding: gzip" (fixes #1308) + +2024-06-26 Mitko Iliev + + Fixed issue when there are no parts to split + + Fixed issue with GROUP BY/ORDER BY on LEFT OUTER JOIN + +2024-06-24 Patrick van Kleef + + Fixed tested building against openssl 3.3.x + +2024-06-21 Ivan Mikhailov + + Added support for (a relatively small amount of) blank nodes in SPARQL INSERT DATA + + Fixes #126 + +2024-06-18 Mitko Iliev + + Fixed issue calling concat(wide, utf8) (fixes 944) + + A missing check for box_flags caused the result to be a broken wide + string. + +2024-06-18 Mitko Iliev + + Fixed issue with lenght calculation in rdf_encode_for_uri() + +2024-06-18 Ted Thibodeau Jr + + Fixed NEWS.md + +2024-06-18 Patrick van Kleef + + Updated version to 7.2.14-dev to mark the start of a new development cycle + 2024-06-10 Patrick van Kleef + Merge tag 'v7.2.13' into develop/7 + + Tagged for release + +2024-06-10 Patrick van Kleef + + Merge branch 'release/7.2.13' into stable/7 + + Updated NEWS.md and Changelog + Updated version to 7.2.13 Merge branch 'feature/vos-fixes' into develop/7 From 36dcbdf3d0696524b4bb2d3349dd434be1e2d03d Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 11 Nov 2024 11:23:56 +0000 Subject: [PATCH 93/94] Updated version to 7.2.14 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 67f23e3207..9ff1c2b29f 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ AC_PREREQ(2.59) m4_define(vos_major, [7]) m4_define(vos_minor, [2]) m4_define(vos_patch, [14]) -m4_define(vos_devel, [-rc3]) +m4_define(vos_devel, []) AC_INIT([Virtuoso Open Source Edition (Column Store)], vos_major.vos_minor.vos_patch[]vos_devel, From 36b81d36dff8a150183cf81884fcaa73b7c9f6aa Mon Sep 17 00:00:00 2001 From: Patrick van Kleef Date: Mon, 11 Nov 2024 11:24:54 +0000 Subject: [PATCH 94/94] Updated ChangeLog --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2afd5d36f2..bb0ebd02aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2024-11-11 Patrick van Kleef + Updated version to 7.2.14 + + Updated ChangeLog + Updated NEWS.md Fixed disable readline/editline for isqlw