Changeset: 0518b8f61ef8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0518b8f61ef8
Modified Files:
        common/stream/bs.c
        common/stream/stream.h
Branch: copybinary
Log Message:

Add set_prompting


diffs (52 lines):

diff --git a/common/stream/bs.c b/common/stream/bs.c
--- a/common/stream/bs.c
+++ b/common/stream/bs.c
@@ -443,30 +443,12 @@ block_stream(stream *s)
        return ns;
 }
 
-/* Like block_stream(), but enables prompting.
- * This means that on encountering a block boundary, a prompt is sent
- * on the prompt_stream and the read is retried. If this does not
- * yield another block boundary, the first block boundary is ignored.
- * This is used as part of the MAPI protocol.
- *
- * When the stream is destroyed, prompt is not freed and prompt_stream is
- * not destroyed or closed.
- */
-stream *
-prompting_block_stream(stream *s, const char *prompt, stream *prompt_stream)
+void
+set_prompting(stream *block_stream, const char *prompt, stream *prompt_stream)
 {
-       if (!s->readonly) {
-               mnstr_set_open_error(s->name, 0, "prompting_block_stream not 
implemented for write streams");
-               return NULL;
+       if (isa_block_stream(block_stream)) {
+               bs *bs = block_stream->stream_data.p;
+               bs->prompt = prompt;
+               bs->pstream = prompt_stream;
        }
-
-       stream *b = block_stream(s);
-       if (b == NULL)
-               return NULL;
-
-       bs *bs = b->stream_data.p;
-       bs->prompt = prompt;
-       bs->pstream = prompt_stream;
-
-       return b;
 }
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -227,7 +227,7 @@ stream_export buffer *mnstr_get_buffer(s
 stream_export stream *block_stream(stream *s); // mapi.c, mal_mapi.c, 
client.c, merovingian
 stream_export bool isa_block_stream(const stream *s); // mapi.c, mal_client.c, 
remote.c, sql_scenario.c/sqlReader, sql_scan.c
 stream_export stream *bs_stream(stream *s); // unused
-stream_export stream *prompting_block_stream(stream *s, const char *prompt, 
stream *prompt_stream);
+stream_export void set_prompting(stream *block_stream, const char *prompt, 
stream *prompt_stream);
 
 stream_export void joeri_role(const char *role);
 stream_export void joeri_log(const char *fmt, ...)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to