diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2021-04-06 12:52:44 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2021-04-06 12:52:44 +0200 |
commit | c030f4c625b90baa17cb8c73a018a327aa12b557 (patch) | |
tree | 25466f53c50fc7d92e0b17f04c206f3ccf59eb47 /storage/connect | |
parent | 28b76afceac1eb2c35e77439142daac53908cdc3 (diff) | |
parent | 6fe624b5acf51383d39eb0e547a03779d41cf4a8 (diff) | |
download | mariadb-git-c030f4c625b90baa17cb8c73a018a327aa12b557.tar.gz |
Commit last pull from origin
Diffstat (limited to 'storage/connect')
-rw-r--r-- | storage/connect/bson.cpp | 37 | ||||
-rw-r--r-- | storage/connect/bson.h | 16 | ||||
-rw-r--r-- | storage/connect/bsonudf.cpp | 11 | ||||
-rw-r--r-- | storage/connect/filamtxt.cpp | 2 | ||||
-rw-r--r-- | storage/connect/ha_connect.cc | 19 | ||||
-rw-r--r-- | storage/connect/jsonudf.cpp | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/xml.result | 3 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/t/xml.test | 1 | ||||
-rw-r--r-- | storage/connect/plugutil.cpp | 6 |
9 files changed, 51 insertions, 48 deletions
diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index 92f36a4cdf2..a0a421657bd 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -82,7 +82,7 @@ BDOC::BDOC(PGLOBAL G) : BJSON(G, NULL) /***********************************************************************/ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) { - int i; + size_t i; bool b = false, ptyp = (bool *)pty; PBVAL bvp = NULL; @@ -185,7 +185,7 @@ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) /***********************************************************************/ /* Parse several items as being in an array. */ /***********************************************************************/ -OFFSET BDOC::ParseAsArray(int& i) { +OFFSET BDOC::ParseAsArray(size_t& i) { if (pty[0] && (!pretty || pretty > 2)) { OFFSET jsp; @@ -202,7 +202,7 @@ OFFSET BDOC::ParseAsArray(int& i) { /***********************************************************************/ /* Parse a JSON Array. */ /***********************************************************************/ -OFFSET BDOC::ParseArray(int& i) +OFFSET BDOC::ParseArray(size_t& i) { int level = 0; bool b = (!i); @@ -214,7 +214,7 @@ OFFSET BDOC::ParseArray(int& i) switch (s[i]) { case ',': if (level < 2) { - sprintf(G->Message, "Unexpected ',' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS); throw 1; } else level = 1; @@ -222,7 +222,7 @@ OFFSET BDOC::ParseArray(int& i) break; case ']': if (level == 1) { - sprintf(G->Message, "Unexpected ',]' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ',]' near %.*s", (int) ARGS); throw 1; } // endif level @@ -236,7 +236,7 @@ OFFSET BDOC::ParseArray(int& i) break; default: if (level == 2) { - sprintf(G->Message, "Unexpected value near %.*s", ARGS); + sprintf(G->Message, "Unexpected value near %.*s", (int) ARGS); throw 1; } else if (lastvlp) { vlp = ParseValue(i, NewVal()); @@ -260,7 +260,7 @@ OFFSET BDOC::ParseArray(int& i) /***********************************************************************/ /* Parse a JSON Object. */ /***********************************************************************/ -OFFSET BDOC::ParseObject(int& i) +OFFSET BDOC::ParseObject(size_t& i) { OFFSET key; int level = 0; @@ -283,7 +283,7 @@ OFFSET BDOC::ParseObject(int& i) level = 2; } else { - sprintf(G->Message, "misplaced string near %.*s", ARGS); + sprintf(G->Message, "misplaced string near %.*s", (int) ARGS); throw 2; } // endif level @@ -293,14 +293,14 @@ OFFSET BDOC::ParseObject(int& i) ParseValue(++i, GetVlp(lastbpp)); level = 3; } else { - sprintf(G->Message, "Unexpected ':' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ':' near %.*s", (int) ARGS); throw 2; } // endif level break; case ',': if (level < 3) { - sprintf(G->Message, "Unexpected ',' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS); throw 2; } else level = 1; @@ -308,7 +308,7 @@ OFFSET BDOC::ParseObject(int& i) break; case '}': if (!(level == 0 || level == 3)) { - sprintf(G->Message, "Unexpected '}' near %.*s", ARGS); + sprintf(G->Message, "Unexpected '}' near %.*s", (int) ARGS); throw 2; } // endif level @@ -321,7 +321,7 @@ OFFSET BDOC::ParseObject(int& i) break; default: sprintf(G->Message, "Unexpected character '%c' near %.*s", - s[i], ARGS); + s[i], (int) ARGS); throw 2; }; // endswitch s[i] @@ -332,7 +332,7 @@ OFFSET BDOC::ParseObject(int& i) /***********************************************************************/ /* Parse a JSON Value. */ /***********************************************************************/ -PBVAL BDOC::ParseValue(int& i, PBVAL bvp) +PBVAL BDOC::ParseValue(size_t& i, PBVAL bvp) { for (; i < len; i++) switch (s[i]) { @@ -398,14 +398,14 @@ suite: return bvp; err: - sprintf(G->Message, "Unexpected character '%c' near %.*s", s[i], ARGS); + sprintf(G->Message, "Unexpected character '%c' near %.*s", s[i], (int) ARGS); throw 3; } // end of ParseValue /***********************************************************************/ /* Unescape and parse a JSON string. */ /***********************************************************************/ -OFFSET BDOC::ParseString(int& i) +OFFSET BDOC::ParseString(size_t& i) { uchar* p; int n = 0; @@ -492,7 +492,7 @@ throw("Unexpected EOF in String"); /***********************************************************************/ /* Parse a JSON numeric value. */ /***********************************************************************/ -void BDOC::ParseNumeric(int& i, PBVAL vlp) +void BDOC::ParseNumeric(size_t& i, PBVAL vlp) { char buf[50]; int n = 0; @@ -1203,15 +1203,14 @@ void BJSON::SetArrayValue(PBVAL bap, PBVAL nvp, int n) { CheckType(bap, TYPE_JAR); int i = 0; - PBVAL bvp = NULL, pvp = NULL; + PBVAL bvp = NULL; if (bap->To_Val) for (bvp = GetArray(bap); bvp; i++, bvp = GetNext(bvp)) if (i == n) { SetValueVal(bvp, nvp); return; - } else - pvp = bvp; + } if (!bvp) AddArrayValue(bap, MOF(nvp)); diff --git a/storage/connect/bson.h b/storage/connect/bson.h index 4da86aeac67..acc36e8e0ed 100644 --- a/storage/connect/bson.h +++ b/storage/connect/bson.h @@ -104,7 +104,7 @@ public: PSZ GetArrayText(PGLOBAL g, PBVAL bap, PSTRG text); void MergeArray(PBVAL bap1,PBVAL bap2); bool DeleteValue(PBVAL bap, int n); - void AddArrayValue(PBVAL bap, OFFSET nvp = NULL, int* x = NULL); + void AddArrayValue(PBVAL bap, OFFSET nvp = 0, int* x = NULL); inline void AddArrayValue(PBVAL bap, PBVAL nvp = NULL, int* x = NULL) {AddArrayValue(bap, MOF(nvp), x);} void SetArrayValue(PBVAL bap, PBVAL nvp, int n); @@ -184,12 +184,12 @@ public: PSZ Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty); protected: - OFFSET ParseArray(int& i); - OFFSET ParseObject(int& i); - PBVAL ParseValue(int& i, PBVAL bvp); - OFFSET ParseString(int& i); - void ParseNumeric(int& i, PBVAL bvp); - OFFSET ParseAsArray(int& i); + OFFSET ParseArray(size_t& i); + OFFSET ParseObject(size_t& i); + PBVAL ParseValue(size_t& i, PBVAL bvp); + OFFSET ParseString(size_t& i); + void ParseNumeric(size_t& i, PBVAL bvp); + OFFSET ParseAsArray(size_t& i); bool SerializeArray(OFFSET arp, bool b); bool SerializeObject(OFFSET obp); bool SerializeValue(PBVAL vp, bool b = false); @@ -197,7 +197,7 @@ protected: // Members used when parsing and serializing JOUT* jp; // Used with serialize char* s; // The Json string to parse - int len; // The Json string length + size_t len; // The Json string length int pretty; // The pretty style of the file to parse bool pty[3]; // Used to guess what pretty is bool comma; // True if Pretty = 1 diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index dcf072242c8..a56db4d731b 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -31,6 +31,9 @@ int JsonDefPrec = -1; int GetDefaultPrec(void); int IsArgJson(UDF_ARGS* args, uint i); void SetChanged(PBSON bsp); +int GetJsonDefPrec(void); + +static PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp); /* --------------------------------- JSON UDF ---------------------------------- */ @@ -59,7 +62,7 @@ inline void JsonFreeMem(PGLOBAL g) { /*********************************************************************************/ /* Allocate and initialize a BSON structure. */ /*********************************************************************************/ -PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp) +static PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp) { PBSON bsp = (PBSON)PlgDBSubAlloc(g, NULL, sizeof(BSON)); @@ -391,7 +394,7 @@ PSZ BJNX::MakeKey(UDF_ARGS *args, int i) } // endif *s if (n < 1) - return NewStr("Key"); + return NewStr((PSZ)"Key"); if (!b) { p = (PSZ)BsonSubAlloc(n + 1); @@ -405,7 +408,7 @@ PSZ BJNX::MakeKey(UDF_ARGS *args, int i) return NewStr((PSZ)s); } // endif count - return NewStr("Key"); + return NewStr((PSZ)"Key"); } // end of MakeKey /*********************************************************************************/ @@ -1635,7 +1638,7 @@ PBVAL BJNX::ParseJsonFile(PGLOBAL g, char *fn, int& pty, size_t& len) len = (size_t)mm.lenL; if (mm.lenH) - len += ((size_t)mm.lenH * 0x000000001LL); + len += mm.lenH; memory = (char *)mm.memory; diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index 3c2c49de8b7..30ce19a5d37 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -1734,7 +1734,7 @@ bool BINFAM::OpenTableFile(PGLOBAL g) { /*********************************************************************/ return AllocateBuffer(g); } // end of OpenTableFile -#endif 0 +#endif // 0 /***********************************************************************/ /* Allocate the line buffer. For mode Delete a bigger buffer has to */ diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 2686bb4338e..b3c0b0c69b2 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -2194,7 +2194,6 @@ int ha_connect::MakeRecord(char *buf) int rc= 0; Field* *field; Field *fp; - my_bitmap_map *org_bitmap; CHARSET_INFO *charset= tdbp->data_charset(); //MY_BITMAP readmap; MY_BITMAP *map; @@ -2209,7 +2208,7 @@ int ha_connect::MakeRecord(char *buf) *table->def_read_set.bitmap, *table->def_write_set.bitmap); // Avoid asserts in field::store() for columns that are not updated - org_bitmap= dbug_tmp_use_all_columns(table, table->write_set); + MY_BITMAP *org_bitmap= dbug_tmp_use_all_columns(table, &table->write_set); // This is for variable_length rows memset(buf, 0, table->s->null_bytes); @@ -2236,7 +2235,7 @@ int ha_connect::MakeRecord(char *buf) continue; htrc("Column %s not found\n", fp->field_name); - dbug_tmp_restore_column_map(table->write_set, org_bitmap); + dbug_tmp_restore_column_map(&table->write_set, org_bitmap); DBUG_RETURN(HA_ERR_WRONG_IN_RECORD); } // endif colp @@ -2319,7 +2318,7 @@ int ha_connect::MakeRecord(char *buf) memcpy(buf, table->record[0], table->s->stored_rec_length); // This is copied from ha_tina and is necessary to avoid asserts - dbug_tmp_restore_column_map(table->write_set, org_bitmap); + dbug_tmp_restore_column_map(&table->write_set, org_bitmap); DBUG_RETURN(rc); } // end of MakeRecord @@ -2339,7 +2338,7 @@ int ha_connect::ScanRecord(PGLOBAL g, const uchar *) //PTDBASE tp= (PTDBASE)tdbp; String attribute(attr_buffer, sizeof(attr_buffer), table->s->table_charset); - my_bitmap_map *bmap= dbug_tmp_use_all_columns(table, table->read_set); + MY_BITMAP *bmap= dbug_tmp_use_all_columns(table, &table->read_set); const CHARSET_INFO *charset= tdbp->data_charset(); String data_charset_value(data_buffer, sizeof(data_buffer), charset); @@ -2461,7 +2460,7 @@ int ha_connect::ScanRecord(PGLOBAL g, const uchar *) } // endfor field err: - dbug_tmp_restore_column_map(table->read_set, bmap); + dbug_tmp_restore_column_map(&table->read_set, bmap); return rc; } // end of ScanRecord @@ -2509,7 +2508,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q, OPVAL op; Field *fp; const key_range *ranges[2]; - my_bitmap_map *old_map; + MY_BITMAP *old_map; KEY *kfp; KEY_PART_INFO *kpart; @@ -2526,7 +2525,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q, both= ranges[0] && ranges[1]; kfp= &table->key_info[active_index]; - old_map= dbug_tmp_use_all_columns(table, table->write_set); + old_map= dbug_tmp_use_all_columns(table, &table->write_set); for (i= 0; i <= 1; i++) { if (ranges[i] == NULL) @@ -2621,11 +2620,11 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q, if ((oom= qry->IsTruncated())) strcpy(g->Message, "Out of memory"); - dbug_tmp_restore_column_map(table->write_set, old_map); + dbug_tmp_restore_column_map(&table->write_set, old_map); return oom; err: - dbug_tmp_restore_column_map(table->write_set, old_map); + dbug_tmp_restore_column_map(&table->write_set, old_map); return true; } // end of MakeKeyWhere diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index bf6c9991800..7db01af2f2b 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -34,6 +34,8 @@ static char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, static PJSON JsonNew(PGLOBAL g, JTYP type); static PJVAL JvalNew(PGLOBAL g, JTYP type, void *vp = NULL); static PJSNX JsnxNew(PGLOBAL g, PJSON jsp, int type, int len = 64); +uint GetJsonGroupSize(void); +static void SetChanged(PBSON bsp); uint JsonGrpSize = 10; @@ -1237,7 +1239,7 @@ PBSON JbinAlloc(PGLOBAL g, UDF_ARGS *args, ulong len, PJSON jsp) /*********************************************************************************/ /* Set the BSON chain as changed. */ /*********************************************************************************/ -void SetChanged(PBSON bsp) +static void SetChanged(PBSON bsp) { if (bsp->Bsp) SetChanged(bsp->Bsp); diff --git a/storage/connect/mysql-test/connect/r/xml.result b/storage/connect/mysql-test/connect/r/xml.result index 6a0c9db27b3..575c903bbbc 100644 --- a/storage/connect/mysql-test/connect/r/xml.result +++ b/storage/connect/mysql-test/connect/r/xml.result @@ -374,8 +374,7 @@ INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3); Warnings: Level Warning Code 1105 -Message Com error: Unable to save character to 'iso-8859-1' encoding.
- +Message warning about characters outside of iso-8859-1 INSERT INTO t1 VALUES ('&<>"\''); SELECT node, hex(node) FROM t1; node &<>"' diff --git a/storage/connect/mysql-test/connect/t/xml.test b/storage/connect/mysql-test/connect/t/xml.test index 0fdf8e90b6e..e837ec79604 100644 --- a/storage/connect/mysql-test/connect/t/xml.test +++ b/storage/connect/mysql-test/connect/t/xml.test @@ -300,6 +300,7 @@ CREATE TABLE t1 (node VARCHAR(50)) ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml' OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1'; INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3); +--replace_regex /.*iso-8859-1.*/warning about characters outside of iso-8859-1/ INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3); INSERT INTO t1 VALUES ('&<>"\''); SELECT node, hex(node) FROM t1; diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index 69d258d9fd3..9e1f006d605 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -377,9 +377,9 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m) if (atoi(buff) == mid) break; - if (sscanf(buff, " %*d %s \"%[^\"]", msgid, stmsg) < 2) { + if (sscanf(buff, " %*d %.31s \"%.255[^\"]", msgid, stmsg) < 2) { // Old message file - if (!sscanf(buff, " %*d \"%[^\"]", stmsg)) { + if (!sscanf(buff, " %*d \"%.255[^\"]", stmsg)) { sprintf(stmsg, "Bad message file for %d %s", mid, SVP(m)); goto fin; } else @@ -628,7 +628,7 @@ size_t MakeOff(void* memp, void* ptr) DoThrow(999); } // endif ptr #endif // _DEBUG || DEVELOPMENT - return (size_t)((char*)ptr - (size_t)memp); + return (size_t)(((char*)ptr) - ((char*)memp)); } else return 0; |