Changeset: 1b8c0e0b3295 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1b8c0e0b3295
Modified Files:
clients/Tests/exports.stable.out
sql/backends/monet5/sql.c
Branch: sql_profiler
Log Message:
Merge with default
diffs (truncated from 1229 to 300 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1769,10 +1769,6 @@ int sql_trans_create_table(sql_table **t
# stream
stream *block_stream(stream *s);
-stream *block_stream2(stream *s, size_t bufsiz, compression_method comp);
-buffer bs2_buffer(stream *s);
-int bs2_resizebuf(stream *ss, size_t bufsiz);
-void bs2_setpos(stream *ss, size_t pos);
stream *bs_stream(stream *s);
bstream *bstream_create(stream *rs, size_t chunk_size);
void bstream_destroy(bstream *s);
@@ -1799,6 +1795,7 @@ stream *iconv_rstream(stream *restrict s
stream *iconv_wstream(stream *restrict ss, const char *restrict charset, const
char *restrict name);
bool isa_block_stream(const stream *s);
stream *lz4_stream(stream *inner, int preset);
+stream *mapi_request_upload(const char *filename, bool binary, bstream *rs,
stream *ws);
void mnstr_clearerr(stream *s);
void mnstr_close(stream *s);
void mnstr_destroy(stream *s);
@@ -1856,7 +1853,6 @@ stream *open_rstream(const char *filenam
stream *open_urlstream(const char *url);
stream *open_wastream(const char *filename);
stream *open_wstream(const char *filename);
-void set_prompting(stream *block_stream, const char *prompt, stream
*prompt_stream);
stream *socket_rstream(SOCKET socket, const char *name);
stream *socket_wstream(SOCKET socket, const char *name);
stream *stderr_wastream(void);
diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt
--- a/clients/mapilib/CMakeLists.txt
+++ b/clients/mapilib/CMakeLists.txt
@@ -17,7 +17,6 @@ add_library(mapi
target_sources(mapi
PRIVATE
mapi.c
- mapi_prompt.h
PUBLIC
$<BUILD_INTERFACE:$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/mapi.h>
$<BUILD_INTERFACE:$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/mapi_querytype.h>
diff --git a/clients/odbc/tests/ODBCStmtAttr.c
b/clients/odbc/tests/ODBCStmtAttr.c
--- a/clients/odbc/tests/ODBCStmtAttr.c
+++ b/clients/odbc/tests/ODBCStmtAttr.c
@@ -87,7 +87,7 @@ StmtAttribute2name(SQLINTEGER attribute)
case SQL_ATTR_QUERY_TIMEOUT:
return "SQL_ATTR_QUERY_TIMEOUT";
default:
- fprintf(stderr, "StmtAttribute2name: Unexpected value %d\n",
attribute);
+ fprintf(stderr, "StmtAttribute2name: Unexpected value %ld\n",
(long) attribute);
return "NOT YET IMPLEMENTED";
}
}
diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt
--- a/common/stream/CMakeLists.txt
+++ b/common/stream/CMakeLists.txt
@@ -21,7 +21,6 @@ target_sources(stream
rw.c
bstream.c
bs.c
- bs2.c
stdio_stream.c
winio.c
compressed.c
@@ -31,6 +30,7 @@ target_sources(stream
lz4_stream.c
url_stream.c
socket_stream.c
+ mapi_stream.c
memio.c
callback.c
blackhole.c
@@ -41,6 +41,7 @@ target_sources(stream
stream.h
stream_internal.h
stream_socket.h
+ mapi_prompt.h
pump.h
PUBLIC
${stream_public_headers})
diff --git a/common/stream/bs.c b/common/stream/bs.c
--- a/common/stream/bs.c
+++ b/common/stream/bs.c
@@ -17,8 +17,6 @@
* indicated by an empty block (i.e. just a count of 0).
*/
-static ssize_t bs_read_internal(stream *restrict ss, void *restrict buf,
size_t elmsize, size_t cnt);
-
static bs *
bs_create(void)
{
@@ -168,29 +166,6 @@ bs_flush(stream *ss, mnstr_flush_level f
ssize_t
bs_read(stream *restrict ss, void *restrict buf, size_t elmsize, size_t cnt)
{
- ssize_t ret = bs_read_internal(ss, buf, elmsize, cnt);
- if (ret != 0 || ss->eof)
- return ret;
-
- bs *b = (bs*) ss-> stream_data.p;
- if (b->prompt == NULL || b->pstream == NULL)
- return 0;
-
- // before returning the 0 we send the prompt and make another attempt.
- if (mnstr_write(b->pstream, b->prompt, strlen(b->prompt), 1) != 1)
- return -1;
- if (mnstr_flush(b->pstream, MNSTR_FLUSH_DATA) < 0)
- return -1;
-
- // if it succeeds, return that to the client.
- // if it's still a block boundary, return that to the client.
- // if there's an error, return that to the client.
- return bs_read_internal(ss, buf, elmsize, cnt);
-}
-
-static ssize_t
-bs_read_internal(stream *restrict ss, void *restrict buf, size_t elmsize,
size_t cnt)
-{
bs *s;
size_t todo = cnt * elmsize;
size_t n;
@@ -397,13 +372,3 @@ block_stream(stream *s)
return ns;
}
-
-void
-set_prompting(stream *block_stream, const char *prompt, stream *prompt_stream)
-{
- if (isa_block_stream(block_stream)) {
- bs *bs = block_stream->stream_data.p;
- bs->prompt = prompt;
- bs->pstream = prompt_stream;
- }
-}
diff --git a/common/stream/bs2.c b/common/stream/bs2.c
deleted file mode 100644
--- a/common/stream/bs2.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V.
- */
-
-#include "monetdb_config.h"
-#include "stream.h"
-#include "stream_internal.h"
-
-
-/* ------------------------------------------------------------------ */
-typedef struct bs2 {
- stream *s; /* underlying stream */
- size_t nr; /* how far we got in buf */
- size_t itotal; /* amount available in current read block */
- size_t bufsiz;
- size_t readpos;
- compression_method comp;
- char *compbuf;
- size_t compbufsiz;
- char *buf;
-} bs2;
-
-
-static ssize_t
-compress_stream_data(bs2 *s)
-{
- assert(s->comp != COMPRESSION_NONE);
- if (s->comp == COMPRESSION_SNAPPY) {
-#ifdef HAVE_SNAPPY
- size_t compressed_length = s->compbufsiz;
- snappy_status ret;
- if ((ret = snappy_compress(s->buf, s->nr, s->compbuf,
&compressed_length)) != SNAPPY_OK) {
- return -1;
- }
- return compressed_length;
-#else
- assert(0);
- return -1;
-#endif
- } else if (s->comp == COMPRESSION_LZ4) {
-#ifdef HAVE_LIBLZ4
- int compressed_length = (int) s->compbufsiz;
- assert(s->nr < INT_MAX);
- if ((compressed_length = LZ4_compress_fast(s->buf, s->compbuf,
(int)s->nr, compressed_length, 1)) == 0) {
- return -1;
- }
- return compressed_length;
-#else
- assert(0);
- return -1;
-#endif
- }
- return -1;
-}
-
-
-static ssize_t
-decompress_stream_data(bs2 *s)
-{
- assert(s->comp != COMPRESSION_NONE);
- if (s->comp == COMPRESSION_SNAPPY) {
-#ifdef HAVE_SNAPPY
- snappy_status ret;
- size_t uncompressed_length = s->bufsiz;
- if ((ret = snappy_uncompress(s->compbuf, s->itotal, s->buf,
&uncompressed_length)) != SNAPPY_OK) {
- return -1;
- }
- return (ssize_t) uncompressed_length;
-#else
- assert(0);
- return -1;
-#endif
- } else if (s->comp == COMPRESSION_LZ4) {
-#ifdef HAVE_LIBLZ4
- int uncompressed_length = (int) s->bufsiz;
- assert(s->itotal < INT_MAX);
- if ((uncompressed_length = LZ4_decompress_safe(s->compbuf,
s->buf, (int)s->itotal, uncompressed_length)) <= 0) {
- return -1;
- }
- return uncompressed_length;
-#else
- assert(0);
- return -1;
-#endif
- }
- return -1;
-}
-
-static ssize_t
-compression_size_bound(bs2 *s)
-{
- if (s->comp == COMPRESSION_NONE) {
- return 0;
- } else if (s->comp == COMPRESSION_SNAPPY) {
-#ifndef HAVE_SNAPPY
- return -1;
-#else
- return snappy_max_compressed_length(s->bufsiz);
-#endif
- } else if (s->comp == COMPRESSION_LZ4) {
-#ifndef HAVE_LIBLZ4
- return -1;
-#else
- assert(s->bufsiz < INT_MAX);
- return LZ4_compressBound((int)s->bufsiz);
-#endif
- }
- return -1;
-}
-
-static bs2 *
-bs2_create(stream *s, size_t bufsiz, compression_method comp)
-{
- /* should be a binary stream */
- bs2 *ns;
- ssize_t compress_bound = 0;
-
- if ((ns = malloc(sizeof(*ns))) == NULL)
- return NULL;
- *ns = (bs2) {
- .buf = malloc(bufsiz),
- .s = s,
- .bufsiz = bufsiz,
- .comp = comp,
- };
- if (ns->buf == NULL) {
- free(ns);
- return NULL;
- }
-
- compress_bound = compression_size_bound(ns);
- if (compress_bound > 0) {
- ns->compbufsiz = (size_t) compress_bound;
- ns->compbuf = malloc(ns->compbufsiz);
- if (!ns->compbuf) {
- free(ns->buf);
- free(ns);
- return NULL;
- }
- } else if (compress_bound < 0) {
- free(ns->buf);
- free(ns);
- return NULL;
- }
- return ns;
-}
-
-/* Collect data until the internal buffer is filled, then write the
- * filled buffer to the underlying stream.
- * Struct field usage:
- * s - the underlying stream;
- * buf - the buffer in which data is collected;
- * nr - how much of buf is already filled (if nr == sizeof(buf) the
- * data is written to the underlying stream, so upon entry nr <
- * sizeof(buf));
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]