Changeset: 27fae883f781 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=27fae883f781
Modified Files:
sql/backends/monet5/sql.c
sql/storage/bat/bat_table.c
sql/storage/store.c
Branch: default
Log Message:
Merge with Jul2017 branch.
diffs (truncated from 1094 to 300 lines):
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -670,16 +670,16 @@ mvc_next_value(Client cntxt, MalBlkPtr m
str msg;
sql_schema *s;
lng *res = getArgReference_lng(stk, pci, 0);
- str *sname = getArgReference_str(stk, pci, 1);
- str *seqname = getArgReference_str(stk, pci, 2);
+ str sname = *getArgReference_str(stk, pci, 1);
+ str seqname = *getArgReference_str(stk, pci, 2);
if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
return msg;
if ((msg = checkSQLContext(cntxt)) != NULL)
return msg;
- s = mvc_bind_schema(m, *sname);
+ s = mvc_bind_schema(m, sname);
if (s) {
- sql_sequence *seq = find_sql_sequence(s, *seqname);
+ sql_sequence *seq = find_sql_sequence(s, seqname);
if (seq && seq_next_value(seq, res)) {
m->last_id = *res;
@@ -703,15 +703,15 @@ mvc_bat_next_value(Client cntxt, MalBlkP
seqbulk *sb = NULL;
BATiter bi;
bat *res = getArgReference_bat(stk, pci, 0);
- bat *sid = getArgReference_bat(stk, pci, 1);
- str *seqname = getArgReference_str(stk, pci, 2);
+ bat sid = *getArgReference_bat(stk, pci, 1);
+ str seqname = *getArgReference_str(stk, pci, 2);
if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
return msg;
if ((msg = checkSQLContext(cntxt)) != NULL)
return msg;
- if ((b = BATdescriptor(*sid)) == NULL)
+ if ((b = BATdescriptor(sid)) == NULL)
throw(SQL, "sql.next_value", SQLSTATE(HY005) "Cannot access
column descriptor");
r = COLnew(b->hseqbase, TYPE_lng, BATcount(b), TRANSIENT);
@@ -737,17 +737,17 @@ mvc_bat_next_value(Client cntxt, MalBlkP
seqbulk_destroy(sb);
s = mvc_bind_schema(m, sname);
seq = NULL;
- if (!s || (seq = find_sql_sequence(s, *seqname)) ==
NULL || !(sb = seqbulk_create(seq, BATcount(b)))) {
+ if (!s || (seq = find_sql_sequence(s, seqname)) == NULL
|| !(sb = seqbulk_create(seq, BATcount(b)))) {
BBPunfix(b->batCacheid);
BBPunfix(r->batCacheid);
- throw(SQL, "sql.next_value", SQLSTATE(HY050)
"Cannot find the sequence %s.%s", sname,*seqname);
+ throw(SQL, "sql.next_value", SQLSTATE(HY050)
"Cannot find the sequence %s.%s", sname,seqname);
}
}
if (!seqbulk_next_value(sb, &l)) {
BBPunfix(b->batCacheid);
BBPunfix(r->batCacheid);
seqbulk_destroy(sb);
- throw(SQL, "sql.next_value", SQLSTATE(HY050) "Cannot
generate next seuqnce value %s.%s", sname, *seqname);
+ throw(SQL, "sql.next_value", SQLSTATE(HY050) "Cannot
generate next seuqnce value %s.%s", sname, seqname);
}
if (BUNappend(r, &l, FALSE) != GDK_SUCCEED) {
BBPunfix(b->batCacheid);
@@ -772,21 +772,21 @@ mvc_get_value(Client cntxt, MalBlkPtr mb
str msg;
sql_schema *s;
lng *res = getArgReference_lng(stk, pci, 0);
- str *sname = getArgReference_str(stk, pci, 1);
- str *seqname = getArgReference_str(stk, pci, 2);
+ str sname = *getArgReference_str(stk, pci, 1);
+ str seqname = *getArgReference_str(stk, pci, 2);
if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
return msg;
if ((msg = checkSQLContext(cntxt)) != NULL)
return msg;
- s = mvc_bind_schema(m, *sname);
+ s = mvc_bind_schema(m, sname);
if (s) {
- sql_sequence *seq = find_sql_sequence(s, *seqname);
+ sql_sequence *seq = find_sql_sequence(s, seqname);
if (seq && seq_get_value(seq, res))
return MAL_SUCCEED;
}
- throw(SQL, "sql.get_value", SQLSTATE(HY050) "Failed to fetch sequence
%s.%s", *sname, *seqname);
+ throw(SQL, "sql.get_value", SQLSTATE(HY050) "Failed to fetch sequence
%s.%s", sname, seqname);
}
str
@@ -814,26 +814,26 @@ mvc_restart_seq(Client cntxt, MalBlkPtr
str msg;
sql_schema *s;
lng *res = getArgReference_lng(stk, pci, 0);
- str *sname = getArgReference_str(stk, pci, 1);
- str *seqname = getArgReference_str(stk, pci, 2);
- lng *start = getArgReference_lng(stk, pci, 3);
+ str sname = *getArgReference_str(stk, pci, 1);
+ str seqname = *getArgReference_str(stk, pci, 2);
+ lng start = *getArgReference_lng(stk, pci, 3);
if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
return msg;
if ((msg = checkSQLContext(cntxt)) != NULL)
return msg;
- if (*start == lng_nil)
- throw(SQL, "sql.restart", SQLSTATE(HY050) "Cannot (re)start
sequence %s.%s with NULL",*sname,*seqname);
- s = mvc_bind_schema(m, *sname);
+ if (start == lng_nil)
+ throw(SQL, "sql.restart", SQLSTATE(HY050) "Cannot (re)start
sequence %s.%s with NULL",sname,seqname);
+ s = mvc_bind_schema(m, sname);
if (s) {
- sql_sequence *seq = find_sql_sequence(s, *seqname);
+ sql_sequence *seq = find_sql_sequence(s, seqname);
if (seq) {
- *res = sql_trans_sequence_restart(m->session->tr, seq,
*start);
+ *res = sql_trans_sequence_restart(m->session->tr, seq,
start);
return MAL_SUCCEED;
}
}
- throw(SQL, "sql.restart", SQLSTATE(HY050) "Sequence %s.%s not found",
*sname, *seqname);
+ throw(SQL, "sql.restart", SQLSTATE(HY050) "Sequence %s.%s not found",
sname, seqname);
}
static BAT *
@@ -885,16 +885,16 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
int coltype = getBatType(getArgType(mb, pci, 0));
mvc *m = NULL;
str msg;
- str *sname = getArgReference_str(stk, pci, 2 + upd);
- str *tname = getArgReference_str(stk, pci, 3 + upd);
- str *cname = getArgReference_str(stk, pci, 4 + upd);
- int *access = getArgReference_int(stk, pci, 5 + upd);
+ str sname = *getArgReference_str(stk, pci, 2 + upd);
+ str tname = *getArgReference_str(stk, pci, 3 + upd);
+ str cname = *getArgReference_str(stk, pci, 4 + upd);
+ int access = *getArgReference_int(stk, pci, 5 + upd);
if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
return msg;
if ((msg = checkSQLContext(cntxt)) != NULL)
return msg;
- b = mvc_bind(m, *sname, *tname, *cname, *access);
+ b = mvc_bind(m, sname, tname, cname, access);
if (b && b->ttype != coltype)
throw(SQL,"sql.bind",SQLSTATE(42000) "Column type mismatch");
if (b) {
@@ -904,17 +904,17 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
int part_nr = *getArgReference_int(stk, pci, 6 + upd);
int nr_parts = *getArgReference_int(stk, pci, 7 + upd);
- if (*access == 0) {
+ if (access == 0) {
psz = cnt ? (cnt / nr_parts) : 0;
bn = BATslice(b, part_nr * psz, (part_nr + 1 ==
nr_parts) ? cnt : ((part_nr + 1) * psz));
BAThseqbase(bn, part_nr * psz);
} else {
/* BAT b holds the UPD_ID bat */
oid l, h;
- BAT *c = mvc_bind(m, *sname, *tname, *cname, 0);
+ BAT *c = mvc_bind(m, sname, tname, cname, 0);
if (c == NULL)
throw(SQL,"sql.bind",SQLSTATE(HY005)
"Cannot access the update column %s.%s.%s",
- *sname,*tname,*cname);
+ sname,tname,cname);
cnt = BATcount(c);
psz = cnt ? (cnt / nr_parts) : 0;
@@ -927,12 +927,12 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
BBPunfix(b->batCacheid);
b = bn;
} else if (upd) {
- BAT *uv = mvc_bind(m, *sname, *tname, *cname,
RD_UPD_VAL);
+ BAT *uv = mvc_bind(m, sname, tname, cname, RD_UPD_VAL);
bat *uvl = getArgReference_bat(stk, pci, 1);
if (uv == NULL)
throw(SQL,"sql.bind",SQLSTATE(HY005) "Cannot
access the update column %s.%s.%s",
- *sname,*tname,*cname);
+ sname,tname,cname);
BBPkeepref(*bid = b->batCacheid);
BBPkeepref(*uvl = uv->batCacheid);
return MAL_SUCCEED;
@@ -941,16 +941,16 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
bat *uvl = getArgReference_bat(stk, pci, 1);
if (BATcount(b)) {
- BAT *uv = mvc_bind(m, *sname, *tname, *cname,
RD_UPD_VAL);
- BAT *ui = mvc_bind(m, *sname, *tname, *cname,
RD_UPD_ID);
+ BAT *uv = mvc_bind(m, sname, tname, cname,
RD_UPD_VAL);
+ BAT *ui = mvc_bind(m, sname, tname, cname,
RD_UPD_ID);
BAT *id;
BAT *vl;
if (ui == NULL)
throw(SQL,"sql.bind",SQLSTATE(HY005)
"Cannot access the insert column %s.%s.%s",
- *sname, *tname, *cname);
+ sname, tname, cname);
if (uv == NULL)
throw(SQL,"sql.bind",SQLSTATE(HY005)
"Cannot access the update column %s.%s.%s",
- *sname, *tname, *cname);
+ sname, tname, cname);
id = BATproject(b, ui);
vl = BATproject(b, uv);
bat_destroy(ui);
@@ -964,9 +964,9 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
BBPkeepref(*bid = id->batCacheid);
BBPkeepref(*uvl = vl->batCacheid);
} else {
- sql_schema *s = mvc_bind_schema(m, *sname);
- sql_table *t = mvc_bind_table(m, s, *tname);
- sql_column *c = mvc_bind_column(m, t, *cname);
+ sql_schema *s = mvc_bind_schema(m, sname);
+ sql_table *t = mvc_bind_table(m, s, tname);
+ sql_column *c = mvc_bind_column(m, t, cname);
*bid = e_bat(TYPE_oid);
*uvl = e_bat(c->type.type->localtype);
@@ -977,9 +977,9 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
}
return MAL_SUCCEED;
}
- if (*sname && strcmp(*sname, str_nil) != 0)
- throw(SQL, "sql.bind", SQLSTATE(42000) "unable to find
%s.%s(%s)", *sname, *tname, *cname);
- throw(SQL, "sql.bind", SQLSTATE(42000) "unable to find %s(%s)", *tname,
*cname);
+ if (sname && strcmp(sname, str_nil) != 0)
+ throw(SQL, "sql.bind", SQLSTATE(42000) "unable to find
%s.%s(%s)", sname, tname, cname);
+ throw(SQL, "sql.bind", SQLSTATE(42000) "unable to find %s(%s)", tname,
cname);
}
/* str mvc_bind_idxbat_wrap(int *bid, str *sname, str *tname, str *iname, int
*access); */
@@ -992,18 +992,18 @@ mvc_bind_idxbat_wrap(Client cntxt, MalBl
int coltype = getBatType(getArgType(mb, pci, 0));
mvc *m = NULL;
str msg;
- str *sname = getArgReference_str(stk, pci, 2 + upd);
- str *tname = getArgReference_str(stk, pci, 3 + upd);
- str *iname = getArgReference_str(stk, pci, 4 + upd);
- int *access = getArgReference_int(stk, pci, 5 + upd);
+ str sname = *getArgReference_str(stk, pci, 2 + upd);
+ str tname = *getArgReference_str(stk, pci, 3 + upd);
+ str iname = *getArgReference_str(stk, pci, 4 + upd);
+ int access = *getArgReference_int(stk, pci, 5 + upd);
if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
return msg;
if ((msg = checkSQLContext(cntxt)) != NULL)
return msg;
- b = mvc_bind_idxbat(m, *sname, *tname, *iname, *access);
+ b = mvc_bind_idxbat(m, sname, tname, iname, access);
if (b && b->ttype != coltype)
- throw(SQL,"sql.bind",SQLSTATE(42000) "Column type mismatch
%s.%s.%s",*sname,*tname,*iname);
+ throw(SQL,"sql.bind",SQLSTATE(42000) "Column type mismatch
%s.%s.%s",sname,tname,iname);
if (b) {
if (pci->argc == (8 + upd) && getArgType(mb, pci, 6 + upd) ==
TYPE_int) {
BUN cnt = BATcount(b), psz;
@@ -1011,16 +1011,16 @@ mvc_bind_idxbat_wrap(Client cntxt, MalBl
int part_nr = *getArgReference_int(stk, pci, 6 + upd);
int nr_parts = *getArgReference_int(stk, pci, 7 + upd);
- if (*access == 0) {
+ if (access == 0) {
psz = cnt ? (cnt / nr_parts) : 0;
bn = BATslice(b, part_nr * psz, (part_nr + 1 ==
nr_parts) ? cnt : ((part_nr + 1) * psz));
BAThseqbase(bn, part_nr * psz);
} else {
/* BAT b holds the UPD_ID bat */
oid l, h;
- BAT *c = mvc_bind_idxbat(m, *sname, *tname,
*iname, 0);
+ BAT *c = mvc_bind_idxbat(m, sname, tname,
iname, 0);
if ( c == NULL)
- throw(SQL,"sql.bindidx",SQLSTATE(42000)
"Cannot access index column %s.%s.%s",*sname,*tname,*iname);
+ throw(SQL,"sql.bindidx",SQLSTATE(42000)
"Cannot access index column %s.%s.%s",sname,tname,iname);
cnt = BATcount(c);
psz = cnt ? (cnt / nr_parts) : 0;
l = part_nr * psz;
@@ -1032,10 +1032,10 @@ mvc_bind_idxbat_wrap(Client cntxt, MalBl
BBPunfix(b->batCacheid);
b = bn;
} else if (upd) {
- BAT *uv = mvc_bind_idxbat(m, *sname, *tname, *iname,
RD_UPD_VAL);
+ BAT *uv = mvc_bind_idxbat(m, sname, tname, iname,
RD_UPD_VAL);
bat *uvl = getArgReference_bat(stk, pci, 1);
if ( uv == NULL)
- throw(SQL,"sql.bindidx",SQLSTATE(42000) "Cannot
access index column %s.%s.%s",*sname,*tname,*iname);
+ throw(SQL,"sql.bindidx",SQLSTATE(42000) "Cannot
access index column %s.%s.%s",sname,tname,iname);
BBPkeepref(*bid = b->batCacheid);
BBPkeepref(*uvl = uv->batCacheid);
return MAL_SUCCEED;
@@ -1044,13 +1044,13 @@ mvc_bind_idxbat_wrap(Client cntxt, MalBl
bat *uvl = getArgReference_bat(stk, pci, 1);
if (BATcount(b)) {
- BAT *uv = mvc_bind_idxbat(m, *sname, *tname,
*iname, RD_UPD_VAL);
- BAT *ui = mvc_bind_idxbat(m, *sname, *tname,
*iname, RD_UPD_ID);
+ BAT *uv = mvc_bind_idxbat(m, sname, tname,
iname, RD_UPD_VAL);
+ BAT *ui = mvc_bind_idxbat(m, sname, tname,
iname, RD_UPD_ID);
BAT *id, *vl;
if ( ui == NULL)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list