diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-06-19 17:28:08 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-06-19 17:28:08 +0300 |
commit | 1e3886ae80c44a39ec3e4061b4ea3131cdcef213 (patch) | |
tree | ce95518792d1432b669ba13a248928e74e81a9bb /storage/connect/array.cpp | |
parent | 0fe7d8a2a221196d977e5efe3f3dedb22806bb53 (diff) | |
parent | 3a7201ea922f6d3373924c413fdb4b108f6208c5 (diff) | |
download | mariadb-git-1e3886ae80c44a39ec3e4061b4ea3131cdcef213.tar.gz |
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'storage/connect/array.cpp')
-rw-r--r-- | storage/connect/array.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp index 1998ab890e9..6e0da312ca3 100644 --- a/storage/connect/array.cpp +++ b/storage/connect/array.cpp @@ -155,6 +155,7 @@ ARRAY::ARRAY(PGLOBAL g, int type, int size, int length, int prec) switch (type) { case TYPE_STRING: Len = length; + /* fall through */ case TYPE_SHORT: case TYPE_INT: case TYPE_DOUBLE: @@ -518,8 +519,8 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm) vp = valp; } else if (opc != OP_EXIST) { - sprintf(g->Message, MSG(MISSING_ARG), opc); - longjmp(g->jumper[g->jump_level], TYPE_ARRAY); + sprintf(g->Message, MSG(MISSING_ARG), opc); + throw TYPE_ARRAY; } else // OP_EXIST return Nval > 0; @@ -592,6 +593,7 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp) switch (Type) { case TYPE_DOUBLE: prec = 2; + /* fall through */ case TYPE_SHORT: case TYPE_INT: case TYPE_DATE: @@ -681,15 +683,15 @@ void ARRAY::SetPrecision(PGLOBAL g, int p) { if (Vblp == NULL) { strcpy(g->Message, MSG(PREC_VBLP_NULL)); - longjmp(g->jumper[g->jump_level], TYPE_ARRAY); + throw TYPE_ARRAY; } // endif Vblp bool was = Vblp->IsCi(); if (was && !p) { strcpy(g->Message, MSG(BAD_SET_CASE)); - longjmp(g->jumper[g->jump_level], TYPE_ARRAY); - } // endif Vblp + throw TYPE_ARRAY; + } // endif Vblp if (was || !p) return; @@ -699,7 +701,7 @@ void ARRAY::SetPrecision(PGLOBAL g, int p) if (!was && Type == TYPE_STRING) // Must be resorted to eliminate duplicate strings if (Sort(g)) - longjmp(g->jumper[g->jump_level], TYPE_ARRAY); + throw TYPE_ARRAY; } // end of SetPrecision @@ -977,14 +979,14 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) size_t z, len = 2; if (Type == TYPE_LIST) - return "(?" "?" "?)"; // To be implemented + return (PSZ)("(?" "?" "?)"); // To be implemented z = MY_MAX(24, GetTypeSize(Type, Len) + 4); tp = (char*)PlugSubAlloc(g, NULL, z); for (i = 0; i < Nval; i++) { Value->SetValue_pvblk(Vblp, i); - Value->Print(g, tp, z); + Value->Prints(g, tp, z); len += strlen(tp); } // enfor i @@ -996,7 +998,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) for (i = 0; i < Nval;) { Value->SetValue_pvblk(Vblp, i); - Value->Print(g, tp, z); + Value->Prints(g, tp, z); strcat(p, tp); strcat(p, (++i == Nval) ? ")" : ","); } // enfor i @@ -1010,7 +1012,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) /***********************************************************************/ /* Make file output of ARRAY contents. */ /***********************************************************************/ -void ARRAY::Print(PGLOBAL g, FILE *f, uint n) +void ARRAY::Printf(PGLOBAL g, FILE *f, uint n) { char m[64]; int lim = MY_MIN(Nval,10); @@ -1027,7 +1029,7 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n) if (Vblp) for (int i = 0; i < lim; i++) { Value->SetValue_pvblk(Vblp, i); - Value->Print(g, f, n+4); + Value->Printf(g, f, n+4); } // endfor i } else @@ -1038,7 +1040,7 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n) /***********************************************************************/ /* Make string output of ARRAY contents. */ /***********************************************************************/ -void ARRAY::Print(PGLOBAL, char *ps, uint z) +void ARRAY::Prints(PGLOBAL, char *ps, uint z) { if (z < 16) return; |