Changeset: 0d462d006187 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0d462d006187
Modified Files:
clients/mapiclient/mclient.c
monetdb5/modules/mal/mal_mapi.c
sql/backends/monet5/sql_result.c
Branch: protocol
Log Message:
Limit varchar padding to 255 characters, and allow for smaller buffer sizes
(temporary: only to test small buffer sizes (<8KB) for benchmarking purposes).
diffs (100 lines):
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3329,6 +3329,8 @@ main(int argc, char **argv)
free(passwd);
passwd = NULL;
+
+
if (blocksize > 0) {
if (blocksize < BLOCK) {
fprintf(stderr, "invalid block size (needs to be bigger
than %d)\n", BLOCK);
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -195,7 +195,7 @@ doChallenge(void *data)
}
// FIXME: this leaks a block stream header
- if (buflen < BLOCK) {
+ if (buflen < 200) {
mnstr_printf(fdout, "!buffer size needs to be set and
bigger than %d\n", BLOCK);
close_stream(fdin);
close_stream(fdout);
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -1915,6 +1915,7 @@ static int mvc_export_resultset_prot10(r
int typelen = ATOMsize(mtype);
int nil_len = -1;
int retval = -1;
+ char *sqlname = c->type.type->sqlname;
iterators[i] = bat_iterator(BATdescriptor(c->b));
/*if (strcasecmp(c->type.type->sqlname, "decimal") == 0) {
@@ -1961,13 +1962,16 @@ static int mvc_export_resultset_prot10(r
if (ATOMvarsized(mtype)) {
// FIXME support other types than string
assert(mtype == TYPE_str);
- if (mtype == TYPE_str && c->type.digits > 0) {
+ if (mtype == TYPE_str && c->type.digits > 0 &&
c->type.digits < 255) {
// varchar with fixed max length
typelen = c->type.digits;
fixed_lengths += typelen;
nil_len = typelen;
} else {
// variable length strings
+ if (c->type.digits > 0) {
+ sqlname = strdup("clob");
+ }
typelen = -1;
varsized++;
nil_len = strlen(str_nil) + 1;
@@ -1976,9 +1980,10 @@ static int mvc_export_resultset_prot10(r
fixed_lengths += typelen;
nil_len = typelen;
}
+ //printf("%d: %zu\n", i, typelen);
if (!mnstr_writeLng(s, (lng)(strlen(c->tn) + strlen(c->name) +
strlen(c->type.type->sqlname) + sizeof(int) + 3)) ||
- !write_str_term(s, c->tn) || !write_str_term(s,
c->name) || !write_str_term(s, c->type.type->sqlname) ||
+ !write_str_term(s, c->tn) || !write_str_term(s,
c->name) || !write_str_term(s, sqlname) ||
!mnstr_writeInt(s, typelen)) {
fres = -1;
goto cleanup;
@@ -2037,7 +2042,7 @@ static int mvc_export_resultset_prot10(r
}
mnstr_flush(s);
- while (row < (size_t) count) {
+ while (row < (size_t) count) {
size_t crow = 0;
size_t bytes_left = bsize - sizeof(lng) - 1;
#ifdef CONTINUATION_MESSAGE
@@ -2046,6 +2051,7 @@ static int mvc_export_resultset_prot10(r
(void) c;
#endif
if (varsized == 0) {
+ //printf("Fixed Length: %zu, Bytes Left: %zu\n",
fixed_lengths, bytes_left);
// no varsized elements, so we can immediately compute
the amount of elements
row = srow + bytes_left / fixed_lengths;
row = row > (size_t) count ? (size_t) count : row;
@@ -2193,7 +2199,7 @@ static int mvc_export_resultset_prot10(r
// FIXME support other types than string
assert(mtype == TYPE_str);
assert((size_t) var_col_len[i] < bsize);
- if (c->type.digits > 0) {
+ if (c->type.digits > 0 && c->type.digits < 255)
{
// varchar
size_t buflen = c->type.digits * (row -
srow);
char *tmpbuf = GDKmalloc(buflen);
@@ -2210,7 +2216,7 @@ static int mvc_export_resultset_prot10(r
if (mnstr_write(s, tmpbuf, buflen, 1)
!= 1) {
GDKfree(tmpbuf);
fres = -1;
- fprintf(stderr,"Sending data
failed.\n");
+ fprintf(stderr,"Sending string
data failed, %zu.\n", buflen);
goto cleanup;
}
GDKfree(tmpbuf);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list