diff options
Diffstat (limited to 'storage/connect')
46 files changed, 490 insertions, 383 deletions
diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h index 03a467e9230..c9712f516b5 100644 --- a/storage/connect/colblk.h +++ b/storage/connect/colblk.h @@ -63,7 +63,7 @@ class DllExport COLBLK : public XOBJECT { bool IsVirtual(void) {return Cdp->IsVirtual();} bool IsNullable(void) {return Nullable;} void SetNullable(bool b) {Nullable = b;} - + void SetName(PSZ name_var) { Name= name_var; } // Methods virtual void Reset(void); virtual bool Compare(PXOB xp); diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index 9b9a9d5acb8..41bce530aeb 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -294,9 +294,16 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, /* its column blocks in mode write (required by XML tables). */ /*******************************************************************/ if (mode == MODE_UPDATE) { - PTDBASE utp; - - if (!(utp = (PTDBASE)tdbp->Duplicate(g))) { + PTDB utp; + + if (!(utp = tdbp->Duplicate(g))) { + /* If table type is of type virtual retrieve global parameter as it was.*/ + if (tdbp->GetAmType() == TYPE_AM_VIR) { + if (tdbp->OpenDB(g)) { + printf("%s\n", g->Message); + throw 7; + } + } snprintf(g->Message, sizeof(g->Message), MSG(INV_UPDT_TABLE), tdbp->GetName()); throw 4; } // endif tp @@ -592,7 +599,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) if (!tdbp->IsRemote()) { // Make all the eventual indexes - PTDBDOS tbxp = (PTDBDOS)tdbp; + PTDBASE tbxp = (PTDBASE)tdbp; tbxp->ResetKindex(g, NULL); tbxp->SetKey_Col(NULL); rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1); @@ -645,6 +652,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) // return 0; if (tdbp->GetKindex()) + { if (((XXBASE*)tdbp->GetKindex())->GetID() == id) { tdbp->GetKindex()->Reset(); // Same index return (tdbp->GetKindex()->IsMul()) ? 2 : 1; @@ -652,6 +660,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) tdbp->GetKindex()->Close(); tdbp->SetKindex(NULL); } // endif colp + } for (xdp= dfp->GetIndx(); xdp; xdp= xdp->GetNext()) if (xdp->GetID() == id) diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp index 1715cf7a204..1b38ab2ee57 100644 --- a/storage/connect/filamap.cpp +++ b/storage/connect/filamap.cpp @@ -354,7 +354,8 @@ int MAPFAM::ReadBuffer(PGLOBAL g) if ((rc = GetNext(g)) != RC_OK) return rc; - case RC_NF: + /* falls through */ + case RC_NF: // Skip this record if ((rc = SkipRecord(g, false)) != RC_OK) return rc; diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index 4c3ec10062b..b6c2bd3bdaa 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -936,6 +936,7 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc) if (irc == RC_OK) { // T_Stream is the temporary stream or the table file stream itself if (!T_Stream) + { if (UseTemp) { if (OpenTempFile(g)) return RC_FX; @@ -945,7 +946,7 @@ int DBFFAM::DeleteRecords(PGLOBAL g, int irc) } else T_Stream = Stream; - + } *Tdbp->GetLine() = '*'; Modif++; // Modified line in Delete mode } // endif irc diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp index 1df247bd951..1964e752eb6 100644 --- a/storage/connect/filamfix.cpp +++ b/storage/connect/filamfix.cpp @@ -135,7 +135,7 @@ bool FIXFAM::AllocateBuffer(PGLOBAL g) // The buffer must be prepared depending on column types int n = 0; bool b = false; - PDOSDEF defp = (PDOSDEF)Tdbp->GetDef(); + PDOSDEF defp __attribute__((unused))= (PDOSDEF)Tdbp->GetDef(); // PCOLDEF cdp; PBINCOL colp; diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp index 7e9597d6b75..34575c22e71 100644 --- a/storage/connect/filamgz.cpp +++ b/storage/connect/filamgz.cpp @@ -647,7 +647,7 @@ int ZBKFAM::WriteBuffer(PGLOBAL g) int ZBKFAM::DeleteRecords(PGLOBAL g, int irc) { if (irc == RC_EF) { - LPCSTR name = Tdbp->GetName(); + LPCSTR name __attribute__((unused)) = Tdbp->GetName(); PDOSDEF defp = (PDOSDEF)Tdbp->GetDef(); defp->SetBlock(0); @@ -673,7 +673,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool) int rc = RC_OK; if (Tdbp->GetMode() == MODE_INSERT) { - LPCSTR name = Tdbp->GetName(); + LPCSTR name __attribute__((unused))= Tdbp->GetName(); PDOSDEF defp = (PDOSDEF)Tdbp->GetDef(); if (CurNum && !Closing) { @@ -1021,6 +1021,7 @@ bool ZLBFAM::AllocateBuffer(PGLOBAL g) #else snprintf(g->Message, sizeof(g->Message), MSG(READ_ERROR), To_File, _strerror(NULL)); #endif + /* falls through */ case RC_NF: return TRUE; } // endswitch @@ -1355,7 +1356,7 @@ void ZLBFAM::CloseTableFile(PGLOBAL g, bool) int rc = RC_OK; if (Tdbp->GetMode() == MODE_INSERT) { - LPCSTR name = Tdbp->GetName(); + LPCSTR name __attribute__((unused))= Tdbp->GetName(); PDOSDEF defp = (PDOSDEF)Tdbp->GetDef(); // Closing is True if last Write was in error diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index 9ecc2293c48..7a5d16accb2 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -1548,13 +1548,14 @@ int BLKFAM::WriteBuffer(PGLOBAL g) // T_Stream is the temporary stream or the table file stream itself if (!T_Stream) + { if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) { if (OpenTempFile(g)) return RC_FX; } else T_Stream = Stream; - + } if (UseTemp) { /*****************************************************************/ /* We are using a temporary file. Before writing the updated */ diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp index f3e31895324..df889e9ab72 100644 --- a/storage/connect/filamvct.cpp +++ b/storage/connect/filamvct.cpp @@ -306,6 +306,7 @@ int VCTFAM::Cardinality(PGLOBAL g) return 1; if (Block < 0) + { if (Split) { // Separate column files and no pre setting of Block and Last // This allows to see a table modified externally, but Block @@ -351,7 +352,7 @@ int VCTFAM::Cardinality(PGLOBAL g) return -1; // Error } // endif split - + } return (Block) ? ((Block - 1) * Nrec + Last) : 0; } // end of Cardinality @@ -1168,7 +1169,7 @@ bool VCTFAM::ResetTableSize(PGLOBAL g, int block, int last) if (!Header) { // Update catalog values for Block and Last PVCTDEF defp = (PVCTDEF)Tdbp->GetDef(); - LPCSTR name = Tdbp->GetName(); + LPCSTR name __attribute__((unused))= Tdbp->GetName(); defp->SetBlock(Block); defp->SetLast(Last); @@ -4131,7 +4132,8 @@ bool BGVFAM::CleanUnusedSpace(PGLOBAL g) } else { int req; - memset(To_Buf, 0, Buflen); + if (To_Buf) + memset(To_Buf, 0, Buflen); for (n = Fpos - Tpos; n > 0; n -= req) { /*****************************************************************/ diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp index bebfe276b3f..a3f75304a47 100644 --- a/storage/connect/filter.cpp +++ b/storage/connect/filter.cpp @@ -1220,15 +1220,19 @@ bool FILTER::Eval(PGLOBAL g) int i; // n = 0; //PSUBQ subp = NULL; PARRAY ap = NULL; - PDBUSER dup = PlgGetUser(g); + PDBUSER dup __attribute__((unused)) = PlgGetUser(g); if (Opc <= OP_XX) + { for (i = 0; i < 2; i++) + { // Evaluate the object and eventually convert it. if (Arg(i)->Eval(g)) return TRUE; else if (Test[i].Conv) Val(i)->SetValue_pval(Arg(i)->GetValue()); + } + } if (trace(1)) htrc(" Filter: op=%d type=%d %d B_T=%d %d val=%p %p\n", diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c index 1fb2b3fee65..1bca2d4ec18 100644 --- a/storage/connect/fmdlex.c +++ b/storage/connect/fmdlex.c @@ -240,12 +240,11 @@ YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +#ifdef NOT_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; -static void yy_push_state YY_PROTO(( int new_state )); -static void yy_pop_state YY_PROTO(( void )); -static int yy_top_state YY_PROTO(( void )); +#endif static void *yy_flex_alloc YY_PROTO(( unsigned int )); static void *yy_flex_realloc YY_PROTO(( void *, unsigned int )); @@ -267,11 +266,13 @@ extern char *yytext; static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); #endif +#ifdef NOT_USED #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif +#endif static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); @@ -1060,6 +1061,8 @@ register char *yy_bp; } +#ifdef NOT_USED + #ifdef __cplusplus static int yyinput() #else @@ -1126,7 +1129,7 @@ static int input() return c; } - +#endif /* NOT_USED */ #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -1266,6 +1269,7 @@ FILE *file; } +#ifdef NOT_USED #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else @@ -1297,7 +1301,6 @@ int new_state; BEGIN(new_state); } - static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) @@ -1311,6 +1314,7 @@ static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } +#endif /* NOT_USED */ #ifdef YY_USE_PROTOS diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 5af952afcd4..8526d985af0 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -849,7 +849,7 @@ static int connect_init_func(void *p) @brief Plugin clean up */ -static int connect_done_func(void *) +int connect_done_func(void *) { int error= 0; PCONNECT pc, pn; @@ -1774,10 +1774,7 @@ bool ha_connect::GetIndexOption(KEY *kp, PCSZ opname) /****************************************************************************/ bool ha_connect::IsUnique(uint n) { - TABLE_SHARE *s= (table) ? table->s : NULL; - KEY kp= s->key_info[n]; - - return (kp.flags & 1) != 0; + return (table->key_info[n].flags & HA_NOSAME) != 0; } // end of IsUnique /****************************************************************************/ @@ -2047,7 +2044,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del) k1= k2= 0; n1= n2= 1; // 1 is space for final null character - for (field= table->field; fp= *field; field++) { + for (field= table->field; (fp= *field); field++) { if (bitmap_is_set(map, fp->field_index)) { n1+= (fp->field_name.length + 1); k1++; @@ -2063,7 +2060,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del) if (k1) { p= c1= (char*)PlugSubAlloc(g, NULL, n1); - for (field= table->field; fp= *field; field++) + for (field= table->field; (fp= *field); field++) if (bitmap_is_set(map, fp->field_index)) { strcpy(p, fp->field_name.str); p+= (fp->field_name.length + 1); @@ -2075,7 +2072,7 @@ int ha_connect::OpenTable(PGLOBAL g, bool del) if (k2) { p= c2= (char*)PlugSubAlloc(g, NULL, n2); - for (field= table->field; fp= *field; field++) + for (field= table->field; (fp= *field); field++) if (bitmap_is_set(ump, fp->field_index)) { strcpy(p, fp->field_name.str); @@ -2102,11 +2099,13 @@ int ha_connect::OpenTable(PGLOBAL g, bool del) istable= true; // strmake(tname, table_name, sizeof(tname)-1); +#ifdef NOT_USED_VARIABLE // We may be in a create index query if (xmod == MODE_ANY && *tdbp->GetName() != '#') { // The current indexes PIXDEF oldpix= GetIndexInfo(); } // endif xmod +#endif } else htrc("OpenTable: %s\n", g->Message); @@ -2133,7 +2132,7 @@ bool ha_connect::CheckColumnList(PGLOBAL g) MY_BITMAP *map= table->read_set; try { - for (field= table->field; fp= *field; field++) + for (field= table->field; (fp= *field); field++) if (bitmap_is_set(map, fp->field_index)) { if (!(colp= tdbp->ColDB(g, (PSZ)fp->field_name.str, 0))) { snprintf(g->Message, sizeof(g->Message), "Column %s not found in %s", @@ -2205,9 +2204,8 @@ int ha_connect::MakeRecord(char *buf) DBUG_ENTER("ha_connect::MakeRecord"); if (trace(2)) - htrc("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n", + htrc("Maps: read=%08X write=%08X defr=%08X defw=%08X\n", *table->read_set->bitmap, *table->write_set->bitmap, - (table->vcol_set) ? *table->vcol_set->bitmap : 0, *table->def_read_set.bitmap, *table->def_write_set.bitmap); // Avoid asserts in field::store() for columns that are not updated @@ -2840,44 +2838,49 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond) } else { char buff[256]; String *res, tmp(buff, sizeof(buff), &my_charset_bin); - Item_basic_constant *pval= (Item_basic_constant *)args[i]; PPARM pp= (PPARM)PlugSubAlloc(g, NULL, sizeof(PARM)); // IN and BETWEEN clauses should be col VOP list if (!i && (ismul)) return NULL; - switch (args[i]->real_type()) { - case COND::STRING_ITEM: - res= pval->val_str(&tmp); - pp->Value= PlugSubAllocStr(g, NULL, res->ptr(), res->length()); - pp->Type= (pp->Value) ? TYPE_STRING : TYPE_ERROR; - break; - case COND::INT_ITEM: - pp->Type= TYPE_INT; - pp->Value= PlugSubAlloc(g, NULL, sizeof(int)); - *((int*)pp->Value)= (int)pval->val_int(); - break; - case COND::DATE_ITEM: - pp->Type= TYPE_DATE; - pp->Value= PlugSubAlloc(g, NULL, sizeof(int)); - *((int*)pp->Value)= (int)pval->val_int_from_date(); - break; - case COND::REAL_ITEM: - pp->Type= TYPE_DOUBLE; - pp->Value= PlugSubAlloc(g, NULL, sizeof(double)); - *((double*)pp->Value)= pval->val_real(); - break; - case COND::DECIMAL_ITEM: - pp->Type= TYPE_DOUBLE; - pp->Value= PlugSubAlloc(g, NULL, sizeof(double)); - *((double*)pp->Value)= pval->val_real_from_decimal(); - break; + switch (args[i]->real_type()) { + case COND::CONST_ITEM: + { + Item *pval= (Item *)args[i]; + switch (args[i]->cmp_type()) { + case STRING_RESULT: + res= pval->val_str(&tmp); + pp->Value= PlugSubAllocStr(g, NULL, res->ptr(), res->length()); + pp->Type= (pp->Value) ? TYPE_STRING : TYPE_ERROR; + break; + case INT_RESULT: + pp->Type= TYPE_INT; + pp->Value= PlugSubAlloc(g, NULL, sizeof(int)); + *((int*)pp->Value)= (int)pval->val_int(); + break; + case TIME_RESULT: + pp->Type= TYPE_DATE; + pp->Value= PlugSubAlloc(g, NULL, sizeof(int)); + *((int*)pp->Value)= (int) Temporal_hybrid(pval).to_longlong(); + break; + case REAL_RESULT: + case DECIMAL_RESULT: + pp->Type= TYPE_DOUBLE; + pp->Value= PlugSubAlloc(g, NULL, sizeof(double)); + *((double*)pp->Value)= pval->val_real(); + break; + case ROW_RESULT: + DBUG_ASSERT(0); + return NULL; + } + } + break; case COND::CACHE_ITEM: // Possible ??? case COND::NULL_ITEM: // TODO: handle this default: return NULL; - } // endswitch type + } // endswitch type if (trace(1)) htrc("Value type=%hd\n", pp->Type); @@ -3137,16 +3140,12 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) } else { char buff[256]; String *res, tmp(buff, sizeof(buff), &my_charset_bin); - Item_basic_constant *pval= (Item_basic_constant *)args[i]; + Item *pval= (Item *)args[i]; Item::Type type= args[i]->real_type(); switch (type) { - case COND::STRING_ITEM: - case COND::INT_ITEM: - case COND::REAL_ITEM: + case COND::CONST_ITEM: case COND::NULL_ITEM: - case COND::DECIMAL_ITEM: - case COND::DATE_ITEM: case COND::CACHE_ITEM: break; default: @@ -3182,14 +3181,14 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) strcat(s, "'}"); break; } // endif ODBC - - // fall through + // fall through case MYSQL_TYPE_DATE: if (tty == TYPE_AM_ODBC) { strcat(s, "{d '"); strcat(strncat(s, res->ptr(), res->length()), "'}"); break; } // endif ODBC + // fall through case MYSQL_TYPE_TIME: if (tty == TYPE_AM_ODBC) { @@ -3197,6 +3196,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) strcat(strncat(s, res->ptr(), res->length()), "'}"); break; } // endif ODBC + // fall through case MYSQL_TYPE_VARCHAR: if (tty == TYPE_AM_ODBC && i) { @@ -3686,7 +3686,7 @@ int ha_connect::close(void) item_sum.cc, item_sum.cc, sql_acl.cc, sql_insert.cc, sql_insert.cc, sql_select.cc, sql_table.cc, sql_udf.cc and sql_update.cc */ -int ha_connect::write_row(uchar *buf) +int ha_connect::write_row(const uchar *buf) { int rc= 0; PGLOBAL& g= xp->g; @@ -4385,7 +4385,6 @@ int ha_connect::info(uint flag) // tdbp must be available to get updated info if (xp->CheckQuery(valid_query_id) || !tdbp) { - PDBUSER dup= PlgGetUser(g); if (xmod == MODE_ANY || xmod == MODE_ALTER) { // Pure info, not a query @@ -4680,12 +4679,14 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, // break; case SQLCOM_DELETE_MULTI: *cras= true; + // fall through case SQLCOM_DELETE: case SQLCOM_TRUNCATE: newmode= MODE_DELETE; break; case SQLCOM_UPDATE_MULTI: *cras= true; + // fall through case SQLCOM_UPDATE: newmode= MODE_UPDATE; break; @@ -4695,6 +4696,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, break; case SQLCOM_FLUSH: locked= 0; + // fall through case SQLCOM_DROP_TABLE: case SQLCOM_RENAME_TABLE: newmode= MODE_ANY; @@ -5624,7 +5626,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, PCSZ nsp= NULL, cls= NULL; #endif // _WIN32 //int hdr, mxe; - int port= 0, mxr= 0, rc= 0, mul= 0; + int port= 0, mxr __attribute__((unused)) = 0, rc= 0, mul= 0; //PCSZ tabtyp= NULL; #if defined(ODBC_SUPPORT) POPARM sop= NULL; @@ -5922,6 +5924,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, #endif // _WIN32 case TAB_PIVOT: supfnc= FNC_NO; + // fall through case TAB_PRX: case TAB_TBL: case TAB_XCL: @@ -6171,7 +6174,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, } // endfor crp } else { - char *schem= NULL; + char *schem __attribute__((unused)) = NULL; char *tn= NULL; // Not a catalog table @@ -7204,7 +7207,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table, ALTER_DROP_PK_INDEX; alter_table_operations inplace_offline_operations= - ALTER_COLUMN_EQUAL_PACK_LENGTH | + ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE | ALTER_COLUMN_NAME | ALTER_COLUMN_DEFAULT | ALTER_CHANGE_CREATE_OPTION | @@ -7303,7 +7306,7 @@ ha_connect::check_if_supported_inplace_alter(TABLE *altered_table, #if 0 uint table_changes= (ha_alter_info->handler_flags & - ALTER_COLUMN_EQUAL_PACK_LENGTH) ? + ALTER_COLUMN_TYPE_CHANGE_BY_ENGINE) ? IS_EQUAL_PACK_LENGTH : IS_EQUAL_YES; if (table->file->check_if_incompatible_data(create_info, table_changes) diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 846f289a40c..ec03fe6de4b 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -390,7 +390,7 @@ virtual int check(THD* thd, HA_CHECK_OPT* check_opt); We implement this in ha_connect.cc. It's not an obligatory method; skip it and and MySQL will treat it as not implemented. */ - int write_row(uchar *buf); + int write_row(const uchar *buf); /** @brief We implement this in ha_connect.cc. It's not an obligatory method; @@ -552,6 +552,9 @@ public: bool enable_activate_all_index; // Inherited from MyISAM }; // end of ha_connect class definition +#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT) +bool MongoEnabled(void); +#endif // JAVA_SUPPORT || CMGO_SUPPORT /* This is a hack for ASAN * Libraries such as libxml2 and libodbc do not like being unloaded before @@ -574,4 +577,3 @@ inline int dummy(void) return d; } #endif - diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp index 7d8741ebfa3..de04fa91883 100644 --- a/storage/connect/inihandl.cpp +++ b/storage/connect/inihandl.cpp @@ -193,7 +193,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section ) secno++; } - for (key= section->key; key; key= key->next) { + for (key = section->key; key; key = key->next) { if (key->name[0]) { fprintf(file, "%s", SVP(key->name)); @@ -1340,6 +1340,7 @@ BOOL WritePrivateProfileSection(LPCSTR section, * Note that when the buffer is big enough then the return value may be any * value between 1 and len-1 (or len in Win95), including len-2. */ +#ifdef NOT_USED static DWORD GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename) { @@ -1356,7 +1357,7 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename) LeaveCriticalSection(&PROFILE_CritSect); return ret; } // end of GetPrivateProfileSectionNames - +#endif /************************************************************************ * Program to test the above diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index 0786c3139e1..c37c4955607 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -218,7 +218,7 @@ PJSON ParseJson(PGLOBAL g, char* s, size_t len, int* ptyp, bool* comma) b = false; break; } // endif b - + /* falls through */ default: if (jsp) jsp = jdp->ParseAsArray(g, i, pretty, ptyp); diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 1b5ff9ae0c4..91bd42a4f3e 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -211,7 +211,7 @@ my_bool JSNX::ParseJpath(PGLOBAL g) { char *p, *p1 = NULL, *p2 = NULL, *pbuf = NULL; int i; - my_bool a, mul = false; + my_bool a; if (Parsed) return false; // Already done @@ -335,6 +335,7 @@ void JSNX::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val) break; case TYPE_NULL: vp->SetNull(true); + /* falls through */ default: vp->Reset(); } // endswitch Type @@ -425,7 +426,6 @@ PVAL JSNX::GetColumnValue(PGLOBAL g, PJSON row, int i) /*********************************************************************************/ PJVAL JSNX::GetRowValue(PGLOBAL g, PJSON row, int i, my_bool b) { - my_bool expd = false; PJAR arp; PJVAL val = NULL; @@ -846,7 +846,7 @@ my_bool JSNX::WriteValue(PGLOBAL g, PJVAL jvalp) PSZ JSNX::Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k) { PSZ str = NULL; - my_bool b = false, err = true; + my_bool err = true; g->Message[0] = 0; @@ -968,7 +968,7 @@ my_bool JSNX::LocateValue(PGLOBAL g, PJVAL jvp) PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx) { PSZ str = NULL; - my_bool b = false, err = true; + my_bool err = true; PJPN jnp; if (!jsp) { @@ -1473,7 +1473,7 @@ static PBSON MakeBinResult(PGLOBAL g, UDF_ARGS *args, PJSON top, ulong len, int bsnp->Pretty = pretty; - if (bsnp->Filename = (char*)args->args[0]) { + if ((bsnp->Filename = (char*)args->args[0])) { bsnp->Filename = MakePSZ(g, args, 0); strncpy(bsnp->Msg, bsnp->Filename, BMX); } else @@ -1906,7 +1906,7 @@ char *GetJsonFile(PGLOBAL g, char *fn) #endif if (h == -1) { - snprintf(g->Message, sizeof(g->Message), "Error %d opening %s", errno, fn); + snprintf(g->Message, sizeof(g->Message), "Error %d opening %-.1024s", errno, fn); return NULL; } // endif h @@ -1918,7 +1918,7 @@ char *GetJsonFile(PGLOBAL g, char *fn) if ((str = (char*)PlgDBSubAlloc(g, NULL, len + 1))) { if ((n = read(h, str, len)) < 0) { - snprintf(g->Message, sizeof(g->Message), "Error %d reading %d bytes from %s", errno, len, fn); + snprintf(g->Message, sizeof(g->Message), "Error %d reading %d bytes from %-.1024s", errno, len, fn); return NULL; } // endif n @@ -3615,7 +3615,7 @@ char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, } catch (int n) { if (trace(1)) - htrc("Exception %d: %s\n", n, g->Message); + htrc("Exception %d: %-.256s\n", n, g->Message); PUSH_WARNING(g->Message); str = NULL; @@ -3890,12 +3890,13 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message) strcpy(message, "Third argument is not an integer (rank)"); return true; } else if (args->arg_count > 3) + { if (args->arg_type[3] != INT_RESULT) { strcpy(message, "Fourth argument is not an integer (memory)"); return true; } else more += (ulong)*(longlong*)args->args[2]; - + } CalcLen(args, false, reslen, memlen); // TODO: calculate this @@ -3973,7 +3974,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result, } catch (int n) { if (trace(1)) - htrc("Exception %d: %s\n", n, g->Message); + htrc("Exception %d: %-.256s\n", n, g->Message); PUSH_WARNING(g->Message); *error = 1; @@ -4017,12 +4018,13 @@ my_bool json_locate_all_init(UDF_INIT *initid, UDF_ARGS *args, char *message) strcpy(message, "Third argument is not an integer (Depth)"); return true; } else if (args->arg_count > 3) + { if (args->arg_type[3] != INT_RESULT) { strcpy(message, "Fourth argument is not an integer (memory)"); return true; } else more += (ulong)*(longlong*)args->args[2]; - + } CalcLen(args, false, reslen, memlen); // TODO: calculate this @@ -4098,7 +4100,7 @@ char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result, } catch (int n) { if (trace(1)) - htrc("Exception %d: %s\n", n, g->Message); + htrc("Exception %d: %-.256s\n", n, g->Message); PUSH_WARNING(g->Message); *error = 1; @@ -4372,7 +4374,7 @@ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, } catch (int n) { if (trace(1)) - htrc("Exception %d: %s\n", n, g->Message); + htrc("Exception %d: %-.256s\n", n, g->Message); PUSH_WARNING(g->Message); str = NULL; @@ -5311,7 +5313,7 @@ char *jbin_object_delete(UDF_INIT *initid, UDF_ARGS *args, char *result, PCSZ key; PJOB jobp; PJVAL jvp = MakeValue(g, args, 0, &top); - PJSON jsp = jvp->GetJson(); + PJSON jsp __attribute__((unused)) = jvp->GetJson(); if (CheckPath(g, args, top, jvp, 2)) PUSH_WARNING(g->Message); @@ -6633,7 +6635,7 @@ long long countin(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *) memcpy(str2, args->args[1], lg); str2[lg] = 0; - while (s = strstr(s, str2)) { + while ((s = strstr(s, str2))) { n++; s += lg; } // endwhile diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp index 54715da4ddc..e414aa88355 100644 --- a/storage/connect/libdoc.cpp +++ b/storage/connect/libdoc.cpp @@ -211,7 +211,7 @@ static xmlStrdupFunc Strdup; void xmlMyFree(void *mem) { if (trace(1)) { - htrc("%.4d Freeing at %p %s\n", ++m, mem, s); + htrc("%.4d Freeing at %p %-.256s\n", ++m, mem, s); *s = 0; } // endif trace Free(mem); @@ -221,7 +221,7 @@ void *xmlMyMalloc(size_t size) { void *p = Malloc(size); if (trace(1)) { - htrc("%.4d Allocating %.5d at %p %s\n", ++m, size, p, s); + htrc("%.4d Allocating %.5d at %p %-.256s\n", ++m, size, p, s); *s = 0; } // endif trace return p; @@ -231,7 +231,7 @@ void *xmlMyMallocAtomic(size_t size) { void *p = MallocA(size); if (trace(1)) { - htrc("%.4d Atom alloc %.5d at %p %s\n", ++m, size, p, s); + htrc("%.4d Atom alloc %.5d at %p %-.256s\n", ++m, size, p, s); *s = 0; } // endif trace return p; @@ -241,7 +241,7 @@ void *xmlMyRealloc(void *mem, size_t size) { void *p = Realloc(mem, size); if (trace(1)) { - htrc("%.4d ReAlloc %.5d to %p from %p %s\n", ++m, size, p, mem, s); + htrc("%.4d ReAlloc %.5d to %p from %p %-.256s\n", ++m, size, p, mem, s); *s = 0; } // endif trace return p; @@ -251,7 +251,7 @@ char *xmlMyStrdup(const char *str) { char *p = Strdup(str); if (trace(1)) { - htrc("%.4d Duplicating to %p from %p %s %s\n", ++m, p, str, str, s); + htrc("%.4d Duplicating to %p from %p %-.256s %-.256s\n", ++m, p, str, str, s); *s = 0; } // endif trace return p; @@ -410,7 +410,7 @@ bool LIBXMLDOC::NewDoc(PGLOBAL g, PCSZ ver) void LIBXMLDOC::AddComment(PGLOBAL g, char *txtp) { if (trace(1)) - htrc("AddComment: %s\n", txtp); + htrc("AddComment: %-.256s\n", txtp); xmlNodePtr cp = xmlNewDocComment(Docp, BAD_CAST txtp); xmlAddChild((xmlNodePtr)Docp, cp); @@ -438,7 +438,7 @@ PXNODE LIBXMLDOC::GetRoot(PGLOBAL g) PXNODE LIBXMLDOC::NewRoot(PGLOBAL g, char *name) { if (trace(1)) - htrc("NewRoot: %s\n", name); + htrc("NewRoot: %-.256s\n", name); xmlNodePtr root = xmlNewDocNode(Docp, NULL, BAD_CAST name, NULL); @@ -456,7 +456,7 @@ PXNODE LIBXMLDOC::NewRoot(PGLOBAL g, char *name) PXNODE LIBXMLDOC::NewPnode(PGLOBAL g, char *name) { if (trace(1)) - htrc("NewNode: %s\n", name); + htrc("NewNode: %-.256s\n", name); xmlNodePtr nop; @@ -497,7 +497,7 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn) FILE *of; if (trace(1)) - htrc("DumpDoc: %s\n", ofn); + htrc("DumpDoc: %-.256s\n", ofn); if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w"))) return -1; @@ -516,8 +516,8 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn) xmlNodePtr Rootp; // Save the modified document - fprintf(of, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", Encoding); - fprintf(of, "<!-- Created by CONNECT %s -->\n", version); + fprintf(of, "<?xml version=\"1.0\" encoding=\"%-.256s\"?>\n", Encoding); + fprintf(of, "<!-- Created by CONNECT %-.256s -->\n", version); if (!(Rootp = xmlDocGetRootElement(Docp))) return 1; @@ -593,7 +593,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) xmlNodeSetPtr nl; if (trace(1)) - htrc("GetNodeList: %s np=%p\n", xp, np); + htrc("GetNodeList: %-.256s np=%p\n", xp, np); if (!Ctxp) { // Init Xpath @@ -610,7 +610,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) strcpy(g->Message, MSG(XPATH_CNTX_ERR)); if (trace(1)) - htrc("Context error: %s\n", g->Message); + htrc("Context error: %-.256s\n", g->Message); return NULL; } // endif xpathCtx @@ -618,7 +618,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) // Register namespaces from list (if any) for (PNS nsp = Namespaces; nsp; nsp = nsp->Next) { if (trace(1)) - htrc("Calling xmlXPathRegisterNs Prefix=%s Uri=%s\n", + htrc("Calling xmlXPathRegisterNs Prefix=%-.256s Uri=%-.512s\n", nsp->Prefix, nsp->Uri); if (xmlXPathRegisterNs(Ctxp, BAD_CAST nsp->Prefix, @@ -626,7 +626,7 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) snprintf(g->Message, sizeof(g->Message), MSG(REGISTER_ERR), nsp->Prefix, nsp->Uri); if (trace(1)) - htrc("Ns error: %s\n", g->Message); + htrc("Ns error: %-.256s\n", g->Message); return NULL; } // endif Registering @@ -661,14 +661,14 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp) Ctxp->node = np; if (trace(1)) - htrc("Calling xmlXPathEval %s Ctxp=%p\n", xp, Ctxp); + htrc("Calling xmlXPathEval %-.256s Ctxp=%p\n", xp, Ctxp); // Evaluate table xpath if (!(Xop = xmlXPathEval(BAD_CAST xp, Ctxp))) { snprintf(g->Message, sizeof(g->Message), MSG(XPATH_EVAL_ERR), xp); if (trace(1)) - htrc("Path error: %s\n", g->Message); + htrc("Path error: %-.256s\n", g->Message); return NULL; } else @@ -844,14 +844,14 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len) } // endif p1 } else { - snprintf(g->Message, sizeof(g->Message), "Truncated %s content", Nodep->name); + snprintf(g->Message, sizeof(g->Message), "Truncated %-.256s content", Nodep->name); rc = RC_INFO; } // endif len *p2 = 0; if (trace(1)) - htrc("GetText buf='%s' len=%d\n", buf, len); + htrc("GetText buf='%-.256s' len=%d\n", buf, len); xmlFree(Content); Content = NULL; @@ -859,7 +859,7 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len) *buf = '\0'; if (trace(1)) - htrc("GetContent: %s\n", buf); + htrc("GetContent: %-.256s\n", buf); return rc; } // end of GetContent @@ -870,12 +870,12 @@ RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len) bool XML2NODE::SetContent(PGLOBAL g, char *txtp, int len) { if (trace(1)) - htrc("SetContent: %s\n", txtp); + htrc("SetContent: %-.256s\n", txtp); xmlChar *buf = xmlEncodeEntitiesReentrant(Docp, BAD_CAST txtp); if (trace(1)) - htrc("SetContent: %s -> %s\n", txtp, buf); + htrc("SetContent: %-.256s -> %-.256s\n", txtp, buf); xmlNodeSetContent(Nodep, buf); xmlFree(buf); @@ -904,7 +904,7 @@ PXNODE XML2NODE::Clone(PGLOBAL g, PXNODE np) PXLIST XML2NODE::GetChildElements(PGLOBAL g, char *xp, PXLIST lp) { if (trace(1)) - htrc("GetChildElements: %s\n", xp); + htrc("GetChildElements: %-.256s\n", xp); return SelectNodes(g, (xp) ? xp : (char*)"*", lp); } // end of GetChildElements @@ -915,7 +915,7 @@ PXLIST XML2NODE::GetChildElements(PGLOBAL g, char *xp, PXLIST lp) PXLIST XML2NODE::SelectNodes(PGLOBAL g, char *xp, PXLIST lp) { if (trace(1)) - htrc("SelectNodes: %s\n", xp); + htrc("SelectNodes: %-.256s\n", xp); xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp); @@ -933,7 +933,7 @@ PXLIST XML2NODE::SelectNodes(PGLOBAL g, char *xp, PXLIST lp) PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np) { if (trace(1)) - htrc("SelectSingleNode: %s\n", xp); + htrc("SelectSingleNode: %-.256s\n", xp); xmlNodeSetPtr nl = ((PXDOC2)Doc)->GetNodeList(g, Nodep, xp); @@ -957,7 +957,7 @@ PXATTR XML2NODE::GetAttribute(PGLOBAL g, char *name, PXATTR ap) xmlAttrPtr atp; if (trace(1)) - htrc("GetAttribute: %s\n", SVP(name)); + htrc("GetAttribute: %-.256s\n", SVP(name)); if (name) atp = xmlHasProp(Nodep, BAD_CAST name); @@ -986,7 +986,7 @@ PXNODE XML2NODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np) char *p, *pn, *pf = NULL, *nmp = PlugDup(g, name); if (trace(1)) - htrc("AddChildNode: %s\n", name); + htrc("AddChildNode: %-.256s\n", name); // Is a prefix specified if ((pn = strchr(nmp, ':'))) { @@ -1037,7 +1037,7 @@ PXNODE XML2NODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np) PXATTR XML2NODE::AddProperty(PGLOBAL g, char *name, PXATTR ap) { if (trace(1)) - htrc("AddProperty: %s\n", name); + htrc("AddProperty: %-.256s\n", name); xmlAttrPtr atp = xmlNewProp(Nodep, BAD_CAST name, NULL); @@ -1060,7 +1060,7 @@ PXATTR XML2NODE::AddProperty(PGLOBAL g, char *name, PXATTR ap) void XML2NODE::AddText(PGLOBAL g, PCSZ txtp) { if (trace(1)) - htrc("AddText: %s\n", txtp); + htrc("AddText: %-.256s\n", txtp); // This is to avoid a blank line when inserting a new line xmlNodePtr np = xmlGetLastChild(Nodep); @@ -1120,7 +1120,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp) err: if (trace(1)) - htrc("DeleteChild: errmsg=%s\n", xerr->message); + htrc("DeleteChild: errmsg=%-.256s\n", xerr->message); xmlResetError(xerr); } // end of DeleteChild @@ -1222,7 +1222,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len) if (strlen((char*)txt) >= (unsigned)len) { memcpy(buf, txt, len - 1); buf[len - 1] = 0; - snprintf(g->Message, sizeof(g->Message), "Truncated %s content", Atrp->name); + snprintf(g->Message, sizeof(g->Message), "Truncated %-.256s content", Atrp->name); rc = RC_INFO; } else strcpy(buf, (const char*)txt); @@ -1232,7 +1232,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len) *buf = '\0'; if (trace(1)) - htrc("GetText: %s\n", buf); + htrc("GetText: %-.256s\n", buf); return rc; } // end of GetText @@ -1243,7 +1243,7 @@ RCODE XML2ATTR::GetText(PGLOBAL g, char *buf, int len) bool XML2ATTR::SetText(PGLOBAL g, char *txtp, int len) { if (trace(1)) - htrc("SetText: %s %d\n", txtp, len); + htrc("SetText: %-.256s %d\n", txtp, len); xmlSetProp(Parent, Atrp->name, BAD_CAST txtp); return false; diff --git a/storage/connect/maputil.cpp b/storage/connect/maputil.cpp index a03ac6cb36e..043a37f13d0 100644 --- a/storage/connect/maputil.cpp +++ b/storage/connect/maputil.cpp @@ -190,7 +190,7 @@ bool CloseMemMap(void *memory, size_t dwSize) { if (memory) { // All this must be redesigned - int rc = msync((char*)memory, dwSize, MS_SYNC); + int rc __attribute__((unused))= msync((char*)memory, dwSize, MS_SYNC); return (munmap((char*)memory, dwSize) < 0) ? true : false; } else return false; diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index e5ea1ac52ae..e0e69c61183 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -140,7 +140,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, PCSZ fmt; char *fld, *colname, *chset, v, buf[128], uns[16], zero[16]; int i, n, nf = 0, ncol = sizeof(buftyp) / sizeof(int); - int len, type, prec, rc, k = 0; + int len, type, prec, rc; bool b; PQRYRES qrp; PCOLRES crp; diff --git a/storage/connect/mysql-test/connect/r/general.result b/storage/connect/mysql-test/connect/r/general.result index ed2c903145d..ef023b7c8d9 100644 --- a/storage/connect/mysql-test/connect/r/general.result +++ b/storage/connect/mysql-test/connect/r/general.result @@ -16,3 +16,17 @@ SELECT * FROM t1; a 10 DROP TABLE t1; +# +# MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE +# +CREATE TABLE numbers +ENGINE=CONNECT, +TABLE_TYPE=VIR, +BLOCK_SIZE=3; +TRUNCATE TABLE numbers; +ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT +DELETE FROM numbers WHERE n = 1; +ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT +UPDATE numbers SET n = 10 WHERE n = 1; +ERROR HY000: Got error 174 'Virtual tables are read only' from CONNECT +DROP TABLE numbers; diff --git a/storage/connect/mysql-test/connect/r/mysql_index.result b/storage/connect/mysql-test/connect/r/mysql_index.result index dd1864529ca..e81caf671a4 100644 --- a/storage/connect/mysql-test/connect/r/mysql_index.result +++ b/storage/connect/mysql-test/connect/r/mysql_index.result @@ -45,10 +45,9 @@ id msg SELECT * FROM t2 WHERE id IN (2,4) AND msg = 'Two'; id msg 2 Two -SELECT * FROM t2 WHERE id > 3; +SELECT * FROM t2 WHERE id > 4; id msg 5 Cinq -4 Four 6 Six SELECT * FROM t2 WHERE id >= 3; id msg @@ -60,10 +59,9 @@ SELECT * FROM t2 WHERE id < 3; id msg 1 Un 2 Two -SELECT * FROM t2 WHERE id < 3 OR id > 4; +SELECT * FROM t2 WHERE id < 2 OR id > 4; id msg 1 Un -2 Two 5 Cinq 6 Six SELECT * FROM t2 WHERE id <= 3; @@ -173,6 +171,9 @@ matricule nom prenom 5765 FOCH ROBERT 4080 FOCH SERGE 3368 MOGADOR ALAIN +explain SELECT matricule, nom, prenom FROM t2 WHERE nom IN ('FOCH','MOGADOR'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range NP NP 18 NULL 4 Using where SELECT matricule, nom, prenom FROM t2 WHERE nom = 'FOCH' OR nom = 'MOGADOR'; matricule nom prenom 1977 FOCH BERNADETTE @@ -184,252 +185,252 @@ matricule nom prenom 3368 MOGADOR ALAIN SELECT matricule, nom, prenom FROM t2 WHERE nom < 'ADDAX'; matricule nom prenom -4552 ABBADIE MONIQUE +1122 ACACIAS SERGE +115 ACHILLE JACQUES +1340 ABBE MICHELE +1644 ACARDIE BEATE +2728 ABOUT CATHERINE MARIE +2945 ABBEVILLE PASCAL 307 ABBAYE ANNICK +3395 ADAM JEAN CLAUDE +398 ABREUVOIR JEAN LUC +4038 ADAM JANICK +4552 ABBADIE MONIQUE +6124 ABELIAS DELIA +6314 ABERDEN EVELYNE +6399 ABEILLES RENE 6627 ABBAYE GERALD 7961 ABBE KATIA -1340 ABBE MICHELE -9270 ABBE SOPHIE -2945 ABBEVILLE PASCAL 8596 ABEBERRY PATRICK -6399 ABEILLES RENE 8673 ABEL JEAN PIERRE -6124 ABELIAS DELIA -6314 ABERDEN EVELYNE 895 ABORD CHANTAL -2728 ABOUT CATHERINE MARIE -398 ABREUVOIR JEAN LUC -1122 ACACIAS SERGE -1644 ACARDIE BEATE -115 ACHILLE JACQUES -4038 ADAM JANICK -3395 ADAM JEAN CLAUDE +9270 ABBE SOPHIE SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL'; matricule nom prenom -4552 ABBADIE MONIQUE +1340 ABBE MICHELE +2945 ABBEVILLE PASCAL 307 ABBAYE ANNICK +4552 ABBADIE MONIQUE +6399 ABEILLES RENE 6627 ABBAYE GERALD 7961 ABBE KATIA -1340 ABBE MICHELE -9270 ABBE SOPHIE -2945 ABBEVILLE PASCAL 8596 ABEBERRY PATRICK -6399 ABEILLES RENE 8673 ABEL JEAN PIERRE +9270 ABBE SOPHIE SELECT matricule, nom, prenom FROM t2 WHERE nom > 'YVON'; matricule nom prenom -9742 YZENGREMER MICHEL -8738 ZILINA JEAN LOUIS -5357 ZOLA BERNARD -5441 ZOLA BRIGITTE 1325 ZOLA CHRISTINE -4859 ZORI CATHERINE 4102 ZOUAVES ALAIN -SELECT matricule, nom, prenom FROM t2 WHERE nom >= 'YVON'; -matricule nom prenom -5389 YVON CAROLE -9742 YZENGREMER MICHEL -8738 ZILINA JEAN LOUIS +4859 ZORI CATHERINE 5357 ZOLA BERNARD 5441 ZOLA BRIGITTE +8738 ZILINA JEAN LOUIS +9742 YZENGREMER MICHEL +SELECT matricule, nom, prenom FROM t2 WHERE nom >= 'YVON'; +matricule nom prenom 1325 ZOLA CHRISTINE -4859 ZORI CATHERINE 4102 ZOUAVES ALAIN +4859 ZORI CATHERINE +5357 ZOLA BERNARD +5389 YVON CAROLE +5441 ZOLA BRIGITTE +8738 ZILINA JEAN LOUIS +9742 YZENGREMER MICHEL SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL' OR nom > 'YVON'; matricule nom prenom -4552 ABBADIE MONIQUE +1325 ZOLA CHRISTINE +1340 ABBE MICHELE +2945 ABBEVILLE PASCAL 307 ABBAYE ANNICK +4102 ZOUAVES ALAIN +4552 ABBADIE MONIQUE +4859 ZORI CATHERINE +5357 ZOLA BERNARD +5441 ZOLA BRIGITTE +6399 ABEILLES RENE 6627 ABBAYE GERALD 7961 ABBE KATIA -1340 ABBE MICHELE -9270 ABBE SOPHIE -2945 ABBEVILLE PASCAL 8596 ABEBERRY PATRICK -6399 ABEILLES RENE 8673 ABEL JEAN PIERRE -9742 YZENGREMER MICHEL 8738 ZILINA JEAN LOUIS -5357 ZOLA BERNARD -5441 ZOLA BRIGITTE -1325 ZOLA CHRISTINE -4859 ZORI CATHERINE -4102 ZOUAVES ALAIN +9270 ABBE SOPHIE +9742 YZENGREMER MICHEL SELECT matricule, nom, prenom FROM t2 WHERE nom > 'HELEN' AND nom < 'HEROS'; matricule nom prenom -9096 HELENA PHILIPPE +1291 HERMITAGE XAVIER +2085 HEOL GUY PAUL +2579 HERANDIERE PIERRE +2673 HENNER LILIANE 3309 HELENE ISABELLE -8365 HELIOTROPES LISE +403 HERMITTE PHILIPPE +4050 HERBILLON FRANCOIS +4254 HENIN SERGE 4666 HELLEN PIERRE 5781 HELSINKI DANIELLE -7626 HENIN PHILIPPE -4254 HENIN SERGE -2673 HENNER LILIANE -9716 HENRI JACQUES -2085 HEOL GUY PAUL -2579 HERANDIERE PIERRE +6185 HERMITTE FRANCOIS 7093 HERAULTS DANIEL -4050 HERBILLON FRANCOIS +7626 HENIN PHILIPPE +8365 HELIOTROPES LISE +9096 HELENA PHILIPPE 9231 HERBILLON MADELEINE -1291 HERMITAGE XAVIER -6185 HERMITTE FRANCOIS -403 HERMITTE PHILIPPE +9716 HENRI JACQUES 9749 HEROLD ISABELLE SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS'; matricule nom prenom -6199 HELEN MARTIAL -9096 HELENA PHILIPPE +1291 HERMITAGE XAVIER +2085 HEOL GUY PAUL +2579 HERANDIERE PIERRE +2673 HENNER LILIANE 3309 HELENE ISABELLE -8365 HELIOTROPES LISE +403 HERMITTE PHILIPPE +4050 HERBILLON FRANCOIS +4254 HENIN SERGE 4666 HELLEN PIERRE 5781 HELSINKI DANIELLE -7626 HENIN PHILIPPE -4254 HENIN SERGE -2673 HENNER LILIANE -9716 HENRI JACQUES -2085 HEOL GUY PAUL -2579 HERANDIERE PIERRE +6185 HERMITTE FRANCOIS +6199 HELEN MARTIAL 7093 HERAULTS DANIEL -4050 HERBILLON FRANCOIS +7626 HENIN PHILIPPE +8365 HELIOTROPES LISE +8445 HEROS SYLVIE +9096 HELENA PHILIPPE 9231 HERBILLON MADELEINE -1291 HERMITAGE XAVIER -6185 HERMITTE FRANCOIS -403 HERMITTE PHILIPPE +9716 HENRI JACQUES 9749 HEROLD ISABELLE -8445 HEROS SYLVIE SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS' AND prenom = 'PHILIPPE'; matricule nom prenom -9096 HELENA PHILIPPE -7626 HENIN PHILIPPE 403 HERMITTE PHILIPPE +7626 HENIN PHILIPPE +9096 HELENA PHILIPPE SELECT matricule, nom, prenom FROM t2 ORDER BY nom LIMIT 10; matricule nom prenom +1340 ABBE MICHELE +2945 ABBEVILLE PASCAL +307 ABBAYE ANNICK 4552 ABBADIE MONIQUE +6399 ABEILLES RENE 6627 ABBAYE GERALD -307 ABBAYE ANNICK 7961 ABBE KATIA -1340 ABBE MICHELE -9270 ABBE SOPHIE -2945 ABBEVILLE PASCAL 8596 ABEBERRY PATRICK -6399 ABEILLES RENE 8673 ABEL JEAN PIERRE +9270 ABBE SOPHIE SELECT a.nom, a.prenom, b.nom FROM t1 a STRAIGHT_JOIN t2 b ON a.prenom = b.prenom WHERE a.nom = 'FOCH' AND a.nom != b.nom; nom prenom nom -FOCH SERGE ACACIAS -FOCH ROBERT AGRIANT -FOCH JOCELYNE ALEXIS +FOCH BERNADETTE BERTIN +FOCH BERNADETTE BOISSY +FOCH BERNADETTE HUNTZIGER +FOCH BERNADETTE LATECOERE +FOCH BERNADETTE LEGER +FOCH BERNADETTE MONTJUSTIN +FOCH BERNADETTE ONZE +FOCH BERNADETTE PALMAROLE +FOCH BERNADETTE PLOUHARNEL FOCH DENIS AMBOISE -FOCH SERGE ANDALUCIA -FOCH ROBERT ANNECY -FOCH SERGE ARCACHON -FOCH JOCELYNE AUGUSTE -FOCH JOCELYNE BASSE -FOCH SERGE BEACH -FOCH FRANCK BEARN -FOCH SERGE BELLES FOCH DENIS BERARD FOCH DENIS BERIN -FOCH BERNADETTE BERTIN FOCH DENIS BILLEHOU FOCH DENIS BOILEAU -FOCH BERNADETTE BOISSY -FOCH ROBERT BONVIN -FOCH SERGE BOUTON -FOCH SERGE BREUIL -FOCH SERGE CARREFOUR -FOCH JOCELYNE CARRERE -FOCH JOCELYNE CHAPELLE -FOCH SERGE CHATEAU -FOCH ROBERT CHENIER -FOCH SERGE COLLETTE FOCH DENIS CONNE -FOCH SERGE COOLE FOCH DENIS COULOUBRIER FOCH DENIS COUTURIER -FOCH ROBERT CURAT -FOCH ROBERT DAUDET -FOCH SERGE ECLUSE -FOCH SERGE EGUILLON FOCH DENIS EPINETTES FOCH DENIS FIGOURNAS -FOCH JOCELYNE FLEMING -FOCH JOCELYNE GAMBADES -FOCH ROBERT GIOTERAIE -FOCH SERGE GOAS -FOCH ROBERT GRAFFIANE -FOCH SERGE GREFFIER -FOCH ROBERT GUILLOTIERE -FOCH SERGE HENIN -FOCH BERNADETTE HUNTZIGER -FOCH FRANCK ILLIERS FOCH DENIS ISTANBUL FOCH DENIS ITALIE -FOCH SERGE JARDIN +FOCH DENIS LACATE +FOCH DENIS MAROLLES +FOCH DENIS MONTELIER +FOCH DENIS MONTILS +FOCH DENIS POINTE +FOCH DENIS PORTO +FOCH DENIS REINOTS +FOCH DENIS REMPART +FOCH DENIS ROUSSIER +FOCH DENIS TORTE +FOCH DENIS TOULON +FOCH DENIS VALMANTE +FOCH FRANCK BEARN +FOCH FRANCK ILLIERS FOCH FRANCK JEANPIERRE -FOCH JOCELYNE KENNEDY FOCH FRANCK LABBE -FOCH DENIS LACATE FOCH FRANCK LACOMBE -FOCH ROBERT LAMOTHE -FOCH BERNADETTE LATECOERE -FOCH BERNADETTE LEGER -FOCH SERGE LEONIE FOCH FRANCK LEROY -FOCH SERGE LOZERE -FOCH DENIS MAROLLES -FOCH ROBERT MARRONIERS -FOCH SERGE MARSAT -FOCH SERGE MONTAGNE FOCH FRANCK MONTALEIGNE -FOCH DENIS MONTELIER -FOCH DENIS MONTILS -FOCH BERNADETTE MONTJUSTIN -FOCH SERGE MORIZET -FOCH ROBERT NIMES -FOCH ROBERT NORD -FOCH SERGE NOVEMBRE -FOCH BERNADETTE ONZE -FOCH SERGE ORANGERIE FOCH FRANCK ORVEAU -FOCH BERNADETTE PALMAROLE +FOCH FRANCK PURPAN +FOCH FRANCK ROCQUENCOURT +FOCH FRANCK RUSSIE +FOCH JOCELYNE ALEXIS +FOCH JOCELYNE AUGUSTE +FOCH JOCELYNE BASSE +FOCH JOCELYNE CARRERE +FOCH JOCELYNE CHAPELLE +FOCH JOCELYNE FLEMING +FOCH JOCELYNE GAMBADES +FOCH JOCELYNE KENNEDY FOCH JOCELYNE PEYBERT +FOCH JOCELYNE PIED +FOCH JOCELYNE PONTAROUX +FOCH ROBERT AGRIANT +FOCH ROBERT ANNECY +FOCH ROBERT BONVIN +FOCH ROBERT CHENIER +FOCH ROBERT CURAT +FOCH ROBERT DAUDET +FOCH ROBERT GIOTERAIE +FOCH ROBERT GRAFFIANE +FOCH ROBERT GUILLOTIERE +FOCH ROBERT LAMOTHE +FOCH ROBERT MARRONIERS +FOCH ROBERT NIMES +FOCH ROBERT NORD FOCH ROBERT PEYNIBLOU FOCH ROBERT PIECE -FOCH JOCELYNE PIED FOCH ROBERT PLAGNE -FOCH SERGE PLAISANCE -FOCH BERNADETTE PLOUHARNEL -FOCH DENIS POINTE FOCH ROBERT POMMERY -FOCH JOCELYNE PONTAROUX -FOCH DENIS PORTO FOCH ROBERT PRESIDENT FOCH ROBERT PUJADE -FOCH FRANCK PURPAN FOCH ROBERT QUILICHINI -FOCH DENIS REINOTS -FOCH DENIS REMPART -FOCH SERGE RESISTANCE -FOCH SERGE RESTANQUES FOCH ROBERT RIOU -FOCH FRANCK ROCQUENCOURT FOCH ROBERT ROLL FOCH ROBERT ROSSA -FOCH SERGE ROSSAYS -FOCH DENIS ROUSSIER -FOCH FRANCK RUSSIE FOCH ROBERT SABLONS -FOCH SERGE SARTRE -FOCH SERGE SAVIGNAC -FOCH SERGE SEGUR FOCH ROBERT STRASBOURG FOCH ROBERT TIRE -FOCH DENIS TORTE -FOCH DENIS TOULON FOCH ROBERT TUBY -FOCH DENIS VALMANTE -FOCH SERGE VANOEL FOCH ROBERT VIARMES +FOCH SERGE ACACIAS +FOCH SERGE ANDALUCIA +FOCH SERGE ARCACHON +FOCH SERGE BEACH +FOCH SERGE BELLES +FOCH SERGE BOUTON +FOCH SERGE BREUIL +FOCH SERGE CARREFOUR +FOCH SERGE CHATEAU +FOCH SERGE COLLETTE +FOCH SERGE COOLE +FOCH SERGE ECLUSE +FOCH SERGE EGUILLON +FOCH SERGE GOAS +FOCH SERGE GREFFIER +FOCH SERGE HENIN +FOCH SERGE JARDIN +FOCH SERGE LEONIE +FOCH SERGE LOZERE +FOCH SERGE MARSAT +FOCH SERGE MONTAGNE +FOCH SERGE MORIZET +FOCH SERGE NOVEMBRE +FOCH SERGE ORANGERIE +FOCH SERGE PLAISANCE +FOCH SERGE RESISTANCE +FOCH SERGE RESTANQUES +FOCH SERGE ROSSAYS +FOCH SERGE SARTRE +FOCH SERGE SAVIGNAC +FOCH SERGE SEGUR +FOCH SERGE VANOEL FOCH SERGE WILSON DROP TABLE t2; DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/part_file.result b/storage/connect/mysql-test/connect/r/part_file.result index c679ed95062..3dabd946b50 100644 --- a/storage/connect/mysql-test/connect/r/part_file.result +++ b/storage/connect/mysql-test/connect/r/part_file.result @@ -145,14 +145,11 @@ id select_type table partitions type possible_keys key key_len ref rows Extra SELECT * FROM t1 WHERE id = 10; rwid rnum prtn tbn fid id msg 1 1 2 t1 part2 10 ten -EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 40; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 2,3 range PRIMARY PRIMARY 4 NULL 7 Using where -SELECT * FROM t1 WHERE id >= 10; +1 SIMPLE t1 2,3 range PRIMARY PRIMARY 4 NULL 4 Using where +SELECT * FROM t1 WHERE id >= 40; rwid rnum prtn tbn fid id msg -1 1 2 t1 part2 10 ten -3 3 2 t1 part2 20 twenty -4 4 2 t1 part2 35 thirty five 2 2 2 t1 part2 40 forty 1 1 3 t1 part3 60 sixty 3 3 3 t1 part3 72 seventy two diff --git a/storage/connect/mysql-test/connect/r/xml2_mult.result b/storage/connect/mysql-test/connect/r/xml2_mult.result index ac4cdea4e7f..0146baa89c0 100644 --- a/storage/connect/mysql-test/connect/r/xml2_mult.result +++ b/storage/connect/mysql-test/connect/r/xml2_mult.result @@ -74,6 +74,8 @@ Warnings: Warning 1105 Truncated author content # increase author size ALTER TABLE bookstore MODIFY `author` VARCHAR(128) NOT NULL; +Warnings: +Warning 1105 This is an outward table, table data were not modified. SELECT * FROM bookstore; category title lang author year price COOKING Everyday Italian en Giada De Laurentiis 2005 30.00 diff --git a/storage/connect/mysql-test/connect/r/xml_mult.result b/storage/connect/mysql-test/connect/r/xml_mult.result index 427adf94313..9cdc36dea6b 100644 --- a/storage/connect/mysql-test/connect/r/xml_mult.result +++ b/storage/connect/mysql-test/connect/r/xml_mult.result @@ -72,6 +72,8 @@ Warnings: Warning 1105 Truncated author content # increase author size ALTER TABLE bookstore MODIFY `author` VARCHAR(128) NOT NULL; +Warnings: +Warning 1105 This is an outward table, table data were not modified. SELECT * FROM bookstore; category title lang author year price COOKING Everyday Italian en Giada De Laurentiis 2005 30.00 diff --git a/storage/connect/mysql-test/connect/t/general.test b/storage/connect/mysql-test/connect/t/general.test index 34e5d4c7b6d..e2f228738cf 100644 --- a/storage/connect/mysql-test/connect/t/general.test +++ b/storage/connect/mysql-test/connect/t/general.test @@ -14,3 +14,20 @@ SELECT * FROM t1; ALTER TABLE t1 TABLE_TYPE=NON_EXISTING; SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-23626: CONNECT VIR tables return inconsistent error for UPDATE +--echo # + +CREATE TABLE numbers +ENGINE=CONNECT, +TABLE_TYPE=VIR, +BLOCK_SIZE=3; + +--error ER_GET_ERRMSG +TRUNCATE TABLE numbers; +--error ER_GET_ERRMSG +DELETE FROM numbers WHERE n = 1; +--error ER_GET_ERRMSG +UPDATE numbers SET n = 10 WHERE n = 1; +DROP TABLE numbers; diff --git a/storage/connect/mysql-test/connect/t/mysql_index.test b/storage/connect/mysql-test/connect/t/mysql_index.test index 81fdcad9330..ebc4965e8e1 100644 --- a/storage/connect/mysql-test/connect/t/mysql_index.test +++ b/storage/connect/mysql-test/connect/t/mysql_index.test @@ -49,10 +49,10 @@ SELECT * FROM t2; SELECT * FROM t2 WHERE id = 3; SELECT * FROM t2 WHERE id IN (2,4); SELECT * FROM t2 WHERE id IN (2,4) AND msg = 'Two'; -SELECT * FROM t2 WHERE id > 3; +SELECT * FROM t2 WHERE id > 4; SELECT * FROM t2 WHERE id >= 3; SELECT * FROM t2 WHERE id < 3; -SELECT * FROM t2 WHERE id < 3 OR id > 4; +SELECT * FROM t2 WHERE id < 2 OR id > 4; SELECT * FROM t2 WHERE id <= 3; SELECT * FROM t2 WHERE id BETWEEN 3 AND 5; SELECT * FROM t2 WHERE id > 2 AND id < 6; @@ -111,16 +111,28 @@ CREATE TABLE t2 ) ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTIOn='mysql://root@localhost/test/t1'; SELECT * FROM t2 limit 10; SELECT matricule, nom, prenom FROM t2 WHERE nom IN ('FOCH','MOGADOR'); +--sorted_result +explain SELECT matricule, nom, prenom FROM t2 WHERE nom IN ('FOCH','MOGADOR'); SELECT matricule, nom, prenom FROM t2 WHERE nom = 'FOCH' OR nom = 'MOGADOR'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom < 'ADDAX'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom > 'YVON'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom >= 'YVON'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL' OR nom > 'YVON'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom > 'HELEN' AND nom < 'HEROS'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS'; +--sorted_result SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS' AND prenom = 'PHILIPPE'; +--sorted_result SELECT matricule, nom, prenom FROM t2 ORDER BY nom LIMIT 10; +--sorted_result SELECT a.nom, a.prenom, b.nom FROM t1 a STRAIGHT_JOIN t2 b ON a.prenom = b.prenom WHERE a.nom = 'FOCH' AND a.nom != b.nom; DROP TABLE t2; diff --git a/storage/connect/mysql-test/connect/t/part_file.test b/storage/connect/mysql-test/connect/t/part_file.test index 8ee43a917ec..2e5127f03e5 100644 --- a/storage/connect/mysql-test/connect/t/part_file.test +++ b/storage/connect/mysql-test/connect/t/part_file.test @@ -82,8 +82,8 @@ SELECT * FROM t1; SELECT * FROM t1 order by id; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10; SELECT * FROM t1 WHERE id = 10; -EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10; -SELECT * FROM t1 WHERE id >= 10; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 40; +SELECT * FROM t1 WHERE id >= 40; SELECT count(*) FROM t1 WHERE id < 10; SELECT case when id < 10 then 1 when id < 50 then 2 else 3 end as pn, count(*) FROM t1 group by pn; SELECT prtn, count(*) FROM t1 group by prtn; diff --git a/storage/connect/myutil.cpp b/storage/connect/myutil.cpp index 1c73ded5e05..c49db48bfb3 100644 --- a/storage/connect/myutil.cpp +++ b/storage/connect/myutil.cpp @@ -66,6 +66,7 @@ int MYSQLtoPLG(char *typname, char *var) break; case TPC_SKIP: *var = 'K'; + /* falls through */ default: // TPC_NO type = TYPE_ERROR; } // endswitch xconv @@ -236,13 +237,14 @@ int MYSQLtoPLG(int mytype, char *var) break; case TPC_SKIP: *var = 'K'; // Skip + /* falls through */ default: // TPC_NO type = TYPE_ERROR; } // endswitch xconv return type; } // endif var - + /* falls through */ default: type = TYPE_ERROR; } // endswitch mytype diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index 9f2a39c0379..c1534eb6c2a 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -430,6 +430,7 @@ char *ExtractFromPath(PGLOBAL g, char *pBuff, char *FileName, OPVAL op) /* Because this function is only used for catalog name checking, */ /* it must be case insensitive. */ /***********************************************************************/ +#ifdef NOT_USED static bool PlugCheckPattern(PGLOBAL g, LPCSTR string, LPCSTR pat) { if (pat && strlen(pat)) { @@ -443,6 +444,7 @@ static bool PlugCheckPattern(PGLOBAL g, LPCSTR string, LPCSTR pat) return true; } // end of PlugCheckPattern +#endif /***********************************************************************/ /* PlugEvalLike: evaluates a LIKE clause. */ diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index be79d10eeb7..6fb40c92a1b 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -147,7 +147,7 @@ PGLOBAL PlugInit(LPCSTR Language, size_t worksize) PGLOBAL g; if (trace(2)) - htrc("PlugInit: Language='%s'\n", + htrc("PlugInit: Language='%-.256s'\n", ((!Language) ? "Null" : (char*)Language)); try { @@ -217,15 +217,15 @@ LPSTR PlugRemoveType(LPSTR pBuff, LPCSTR FileName) _splitpath(FileName, drive, direc, fname, ftype); if (trace(2)) { - htrc("after _splitpath: FileName=%s\n", FileName); - htrc("drive=%s dir=%s fname=%s ext=%s\n", + htrc("after _splitpath: FileName=%-.256s\n", FileName); + htrc("drive=%-.256s dir=%-.256s fname=%-.256s ext=%-.256s\n", SVP(drive), direc, fname, ftype); } // endif trace _makepath(pBuff, drive, direc, fname, ""); if (trace(2)) - htrc("buff='%s'\n", pBuff); + htrc("buff='%-.256s'\n", pBuff); return pBuff; } // end of PlugRemoveType @@ -257,7 +257,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) #endif if (trace(2)) - htrc("prefix=%s fn=%s path=%s\n", prefix, FileName, defpath); + htrc("prefix=%-.256s fn=%-.256s path=%-.256s\n", prefix, FileName, defpath); if (strlen(FileName) >= _MAX_PATH) { @@ -280,7 +280,7 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) if (*FileName == '~') { if (_fullpath(pBuff, FileName, _MAX_PATH)) { if (trace(2)) - htrc("pbuff='%s'\n", pBuff); + htrc("pbuff='%-.256s'\n", pBuff); return pBuff; } else @@ -315,12 +315,12 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) _splitpath(tmpdir, defdrv, defdir, NULL, NULL); if (trace(2)) { - htrc("after _splitpath: FileName=%s\n", FileName); + htrc("after _splitpath: FileName=%-.256s\n", FileName); #if defined(_WIN32) - htrc("drive=%s dir=%s fname=%s ext=%s\n", drive, direc, fname, ftype); - htrc("defdrv=%s defdir=%s\n", defdrv, defdir); + htrc("drive=%-.256s dir=%-.256s fname=%-.256s ext=%-.256s\n", drive, direc, fname, ftype); + htrc("defdrv=%-.256s defdir=%-.256s\n", defdrv, defdir); #else - htrc("dir=%s fname=%s ext=%s\n", direc, fname, ftype); + htrc("dir=%-.256s fname=%-.256s ext=%-.256s\n", direc, fname, ftype); #endif } // endif trace @@ -342,11 +342,11 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) _makepath(newname, drive, direc, fname, ftype); if (trace(2)) - htrc("newname='%s'\n", newname); + htrc("newname='%-.256s'\n", newname); if (_fullpath(pBuff, newname, _MAX_PATH)) { if (trace(2)) - htrc("pbuff='%s'\n", pBuff); + htrc("pbuff='%-.256s'\n", pBuff); return pBuff; } else @@ -494,7 +494,7 @@ bool AllocSarea(PGLOBAL g, size_t size) if (g->Sarea) { htrc("Work area of %zd allocated at %p\n", size, g->Sarea); } else - htrc("SareaAlloc: %s\n", g->Message); + htrc("SareaAlloc: %-.256s\n", g->Message); } // endif trace @@ -576,11 +576,11 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size) PCSZ pname = "Work"; snprintf(g->Message, sizeof(g->Message), - "Not enough memory in %s area for request of %zd (used=%zd free=%zd)", + "Not enough memory in %-.256s area for request of %zu (used=%zu free=%zu)", pname, size, pph->To_Free, pph->FreeBlk); if (trace(1)) - htrc("PlugSubAlloc: %s\n", g->Message); + htrc("PlugSubAlloc: %-.256s\n", g->Message); DoThrow(1234); } /* endif size OS32 code */ diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index ce3e5696eb7..144d31735d6 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -354,8 +354,6 @@ RECFM TABDEF::GetTableFormat(const char* type) bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR schema, LPCSTR am) { - int poff = 0; - Hc = ((MYCAT*)cat)->GetHandler(); Name = (PSZ)name; Schema = (PSZ)Hc->GetDBName(schema); @@ -434,6 +432,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g) case RECFM_CSV: case RECFM_FMT: nlg+= nof; + /* falls through */ case RECFM_DIR: case RECFM_XML: poff= loff + (pcf->Flags & U_VIRTUAL ? 0 : 1); @@ -476,6 +475,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g) switch (trf ) { case RECFM_VCT: cdp->SetOffset(0); // Not to have shift + /* falls through */ case RECFM_BIN: // BIN/VEC are packed by default if (nof) { diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index c721e30ce47..797b988b309 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -577,8 +577,6 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox) MaxSize = -1; // Size must be recalculated Cardinal = -1; // as well as Cardinality - PTXF xp = Txfp; - To_Filter = NULL; // Disable filtering //To_BlkIdx = NULL; // and index filtering To_BlkFil = NULL; // and block filtering @@ -650,7 +648,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g) PDOSDEF defp = (PDOSDEF)To_Def; PDOSCOL colp = NULL; PDBUSER dup = PlgGetUser(g); - PCATLG cat = defp->GetCat(); + PCATLG cat __attribute__((unused))= defp->GetCat(); //void *memp = cat->GetDescp(); if ((nrec = defp->GetElemt()) < 2) { @@ -1013,14 +1011,14 @@ bool TDBDOS::GetBlockValues(PGLOBAL g) { char filename[_MAX_PATH]; int i, lg, n[NZ]; - int nrec, block = 0, last = 0, allocblk = 0; + int nrec, block = 0, last = 0; int len; bool newblk = false; size_t ndv, nbm, nbk, blk; FILE *opfile; PCOLDEF cdp; PDOSDEF defp = (PDOSDEF)To_Def; - PCATLG cat = defp->GetCat(); + PCATLG cat __attribute__((unused))= defp->GetCat(); PDBUSER dup = PlgGetUser(g); #if 0 @@ -1302,7 +1300,7 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp) } // endif blk - int i, op = filp->GetOpc(), opm = filp->GetOpm(), n = 0; + int i, op = filp->GetOpc(), opm = filp->GetOpm(); bool cnv[2]; PCOL colp; PXOB arg[2] = {NULL,NULL}; @@ -1345,13 +1343,14 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp) bfp = new(g) BLKSPCIN(g, this, op, opm, arg, Txfp->Nrec); } else if (blk && Txfp->Nrec > 1 && colp->IsClustered()) + { // Clustered column and constant array if (colp->GetClustered() == 2) bfp = new(g) BLKFILIN2(g, this, op, opm, arg); else bfp = new(g) BLKFILIN(g, this, op, opm, arg); - - } // endif this + } + } // endif this #if 0 } else if (filp->GetArgType(0) == TYPE_SCALF && @@ -1427,12 +1426,10 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv) //bool conv = false, xdb2 = false, ok = false, b[2]; //PXOB *xarg1, *xarg2 = NULL, xp[2]; int i, n = 0, type[2] = {0,0}; - bool conv = false, xdb2 = false, ok = false; - PXOB *xarg2 = NULL, xp[2]; + bool conv = false, xdb2 = false; + PXOB xp[2]; PCOL colp; -//LSTVAL *vlp = NULL; -//SFROW *sfr[2]; - PBF *fp = NULL, bfp = NULL; + PBF bfp = NULL; for (i = 0; i < 2; i++) { switch (arg[i]->GetType()) { @@ -1663,7 +1660,7 @@ int TDBDOS::TestBlock(PGLOBAL g) int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add) { int k, n, rc = RC_OK; - bool fixed, doit, sep, b = (pxdf != NULL); + bool fixed, doit, sep; PCOL *keycols, colp; PIXDEF xdp, sxp = NULL; PKPDEF kdp; @@ -2855,6 +2852,7 @@ bool DOSCOL::SetBitMap(PGLOBAL g) bool DOSCOL::CheckSorted(PGLOBAL g) { if (Sorted) + { if (OldVal) { // Verify whether this column is sorted all right if (OldVal->CompareValue(Value) > 0) { @@ -2867,7 +2865,7 @@ bool DOSCOL::CheckSorted(PGLOBAL g) } else OldVal = AllocateValue(g, Value); - + } return false; } // end of CheckSorted diff --git a/storage/connect/tabext.cpp b/storage/connect/tabext.cpp index c408cf60c66..2e222201d1f 100644 --- a/storage/connect/tabext.cpp +++ b/storage/connect/tabext.cpp @@ -388,7 +388,6 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt) char *catp = NULL, buf[NAM_LEN * 3]; int len; bool first = true; - PTABLE tablep = To_Table; PCOL colp; if (Srcdef) @@ -501,6 +500,7 @@ void TDBEXT::RemoveConst(PGLOBAL g, char *stmt) int n, nc; while ((p = strstr(stmt, "NAME_CONST"))) + { if ((n = sscanf(p, "%*[^,],%1024[^)])%n", val, &nc))) { if (trace(33)) htrc("p=%s\nn=%d val=%s nc=%d\n", p, n, val, nc); @@ -524,8 +524,8 @@ void TDBEXT::RemoveConst(PGLOBAL g, char *stmt) } else break; - - return; + } + return; } // end of RemoveConst /***********************************************************************/ diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 56d3cc05547..6eb28f84bd0 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -1142,6 +1142,7 @@ int TDBCSV::CheckWrite(PGLOBAL g) n += (Quoted > 2 ? 2 : 0); else if (strchr(Field[i], Sep) || (Qot && *Field[i] == Qot) || Quoted > 1 || (Quoted == 1 && !Fldtyp[i])) + { if (!Qot) { snprintf(g->Message, sizeof(g->Message), MSG(SEP_IN_FIELD), i + 1); return -1; @@ -1154,7 +1155,7 @@ int TDBCSV::CheckWrite(PGLOBAL g) n += 2; // Outside quotes } // endif - + } if ((nlen += n) > maxlen) { strcpy(g->Message, MSG(LINE_TOO_LONG)); return -1; diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index e3ad2f742d1..67eb5bbede0 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -260,14 +260,14 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetArrayValue(0) : NULL; } else { - if (!((tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))) { - if (!mgo && !tdp->Uri) { - snprintf(g->Message, sizeof(g->Message), "LRECL must be specified for pretty=%d", tdp->Pretty); - return 0; + if (!(tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0))) + { + if (!mgo && !tdp->Uri) { + snprintf(g->Message, sizeof(g->Message), "LRECL must be specified for pretty=%d", tdp->Pretty); + return 0; } else tdp->Lrecl = 8192; // Should be enough - - } // endif Lrecl + } tdp->Ending = GetIntegerTableOption(g, topt, "Ending", CRLF); @@ -1613,6 +1613,7 @@ PSZ JSONCOL::GetJpath(PGLOBAL g, bool proj) } // endif for (p1 = p2 = mgopath; *p1; p1++) + { if (i) { // Inside [] if (isdigit(*p1)) { if (!proj) @@ -1651,11 +1652,12 @@ PSZ JSONCOL::GetJpath(PGLOBAL g, bool proj) Sgfy = true; break; } // endif p2 - + /* falls through */ default: *p2++ = *p1; break; } // endswitch p1; + } if (*(p2 - 1) == '.') p2--; @@ -2444,16 +2446,15 @@ int TDBJSON::Cardinality(PGLOBAL g) { if (!g) return (Xcol || Multiple) ? 0 : 1; - else if (Cardinal < 0) { - if (!Multiple) { - if (MakeDocument(g) == RC_OK) - Cardinal = Doc->size(); - - } else - return 10; - - } // endif Cardinal + else if (Cardinal < 0) + { + if (!Multiple) { + if (MakeDocument(g) == RC_OK) + Cardinal = Doc->size(); + } else + return 10; + } return Cardinal; } // end of Cardinality diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp index f3a8cf57bfc..fe68e12bc77 100644 --- a/storage/connect/tabmul.cpp +++ b/storage/connect/tabmul.cpp @@ -671,8 +671,8 @@ TDBDIR::TDBDIR(PSZ fpat) : TDBASE((PTABDEF)NULL) /***********************************************************************/ char* TDBDIR::Path(PGLOBAL g) { - PCATLG cat = PlgGetCatalog(g); - PTABDEF defp = (PTABDEF)To_Def; + PCATLG cat __attribute__((unused))= PlgGetCatalog(g); + PTABDEF defp = (PTABDEF)To_Def; #if defined(_WIN32) if (!*Drive) { @@ -708,8 +708,9 @@ PCOL TDBDIR::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) int TDBDIR::GetMaxSize(PGLOBAL g) { if (MaxSize < 0) { - int rc, n = -1; + int n = -1; #if defined(_WIN32) + int rc; // Start searching files in the target directory. hSearch = FindFirstFile(Path(g), &FileData); @@ -1041,12 +1042,13 @@ int TDBSDR::GetMaxSize(PGLOBAL g) /***********************************************************************/ int TDBSDR::FindInDir(PGLOBAL g) { - int rc, n = 0; + int n = 0; size_t m = strlen(Direc); // Start searching files in the target directory. #if defined(_WIN32) HANDLE h; + int rc; #if defined(PATHMATCHSPEC) if (!*Drive) diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 9331e0e6faf..26381e347ae 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -1258,7 +1258,7 @@ MYSQLCOL::MYSQLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am) MYSQLCOL::MYSQLCOL(MYSQL_FIELD *fld, PTDB tdbp, int i, PCSZ am) : COLBLK(NULL, tdbp, i) { - const char *chset = get_charset_name(fld->charsetnr); +//const char *chset = get_charset_name(fld->charsetnr); //char v = (!strcmp(chset, "binary")) ? 'B' : 0; char v = 0; @@ -1399,6 +1399,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g) /* If physical fetching of the line was deferred, do it now. */ /*********************************************************************/ if (!tdbp->Fetched) + { if ((rc = tdbp->Myc.Fetch(g, tdbp->N)) != RC_OK) { if (rc == RC_EF) snprintf(g->Message, sizeof(g->Message), MSG(INV_DEF_READ), rc); @@ -1406,7 +1407,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g) throw 11; } else tdbp->Fetched = true; - + } if ((buf = ((PTDBMY)To_Tdb)->Myc.GetCharField(Rank))) { if (trace(2)) htrc("MySQL ReadColumn: name=%s buf=%s\n", Name, buf); diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp index 2a41f1747a2..fe5e6c44fbd 100644 --- a/storage/connect/taboccur.cpp +++ b/storage/connect/taboccur.cpp @@ -204,7 +204,7 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col, /**********************************************************************/ /* Replace the columns of the colist by the rank and occur columns. */ /**********************************************************************/ - for (i = 0, pcrp = &qrp->Colresp; crp = *pcrp; ) { + for (i = 0, pcrp = &qrp->Colresp; (crp = *pcrp); ) { for (k = 0, pn = colist; k < m; k++, pn += (strlen(pn) + 1)) if (!stricmp(pn, crp->Name)) break; @@ -452,8 +452,8 @@ bool TDBOCCUR::OpenDB(PGLOBAL g) N = M = 0; RowFlag = 0; - if (Xcolp) - Xcolp->Xreset(); + if (Xcolp) + Xcolp->Xreset(); return Tdbp->OpenDB(g); } // endif use diff --git a/storage/connect/tabpivot.cpp b/storage/connect/tabpivot.cpp index 5d1d4d2f05b..d700cff0e41 100644 --- a/storage/connect/tabpivot.cpp +++ b/storage/connect/tabpivot.cpp @@ -187,7 +187,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g) } // endif picol // Prepare the column list - for (pcrp = &Qryp->Colresp; crp = *pcrp; ) + for (pcrp = &Qryp->Colresp; (crp = *pcrp); ) if (SkipColumn(crp, skc)) { // Ignore this column *pcrp = crp->Next; @@ -340,7 +340,7 @@ int PIVAID::Qcompare(int *i1, int *i2) bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) { char *p1, *p2; - PHC hc = ((MYCAT*)Cat)->GetHandler(); + PHC hc __attribute__((unused))= ((MYCAT*)Cat)->GetHandler(); if (PRXDEF::DefineAM(g, am, poff)) return TRUE; @@ -748,7 +748,9 @@ int TDBPIVOT::ReadDB(PGLOBAL g) colp->ReadColumn(g); for (colp = Columns; colp; colp = colp->GetNext()) + { if (colp->GetAmType() == TYPE_AM_SRC) + { if (FileStatus) { if (((PSRCCOL)colp)->CompareLast()) { newrow = (RowFlag) ? TRUE : FALSE; @@ -757,7 +759,8 @@ int TDBPIVOT::ReadDB(PGLOBAL g) } else ((PSRCCOL)colp)->SetColumn(); - + } + } FileStatus = 1; } // endif RowFlag diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index 6727c457d4a..d8885b7f49d 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -708,7 +708,7 @@ bool PRXCOL::Init(PGLOBAL g, PTDB tp) MODE mode = To_Tdb->GetMode(); // Needed for MYSQL subtables - ((XCOLBLK*)Colp)->Name = Decode(g, Colp->GetName()); + ((COLBLK*)Colp)->SetName(Decode(g, Colp->GetName())); // May not have been done elsewhere Colp->InitValue(g); diff --git a/storage/connect/tabxcl.cpp b/storage/connect/tabxcl.cpp index 87fa799d87e..5b1cf57cebb 100644 --- a/storage/connect/tabxcl.cpp +++ b/storage/connect/tabxcl.cpp @@ -274,7 +274,8 @@ void XCLCOL::ReadColumn(PGLOBAL g) PSZ p; // Trim left - for (p = Cp; *p == ' '; p++) ; + for (p = Cp; *p == ' '; p++) + ; if ((Cp = strchr(Cp, Sep))) // Separator is found diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index b66e6b62ac8..6bc3209da59 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -228,8 +228,10 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) while (true) { if (!vp->atp && - !(node = (vp->nl) ? vp->nl->GetItem(g, vp->k++, tdp->Usedom ? node : NULL) - : NULL)) + !(node = (vp->nl) ? vp->nl->GetItem(g, vp->k++, tdp->Usedom ? + node : NULL) + : NULL)) + { if (j) { vp = lvlp[--j]; @@ -244,7 +246,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) continue; } else break; - + } xcol->Name[vp->n] = 0; fmt[vp->m] = 0; @@ -258,6 +260,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) switch (vp->atp->GetText(g, buf, sizeof(buf))) { case RC_INFO: PushWarning(g, txmp); + /* falls through */ case RC_OK: strncat(fmt, "@", XLEN(fmt)); break; @@ -318,6 +321,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) switch (node->GetContent(g, buf, sizeof(buf))) { case RC_INFO: PushWarning(g, txmp); + /* falls through */ case RC_OK: xcol->Cbn = !strlen(buf); break; @@ -1284,6 +1288,7 @@ int TDBXML::ReadDB(PGLOBAL g) bool TDBXML::CheckRow(PGLOBAL g, bool b) { if (NewRow && Mode == MODE_INSERT) + { if (Rowname) { TabNode->AddText(g, "\n\t"); RowNode = TabNode->AddChildNode(g, Rowname, RowNode); @@ -1291,6 +1296,7 @@ bool TDBXML::CheckRow(PGLOBAL g, bool b) strcpy(g->Message, MSG(NO_ROW_NODE)); return true; } // endif Rowname + } if (Colname && (NewRow || b)) Clist = RowNode->SelectNodes(g, Colname, Clist); @@ -1542,11 +1548,13 @@ bool XMLCOL::ParseXpath(PGLOBAL g, bool mode) // Analyze the Xpath for this column for (i = 0, p = pbuf; (p2 = strchr(p, '/')); i++, p = p2 + 1) { if (Tdbp->Mulnode && !strncmp(p, Tdbp->Mulnode, p2 - p)) + { if (!Tdbp->Xpand && mode) { strcpy(g->Message, MSG(CONCAT_SUBNODE)); return true; } else Inod = i; // Index of multiple node + } if (mode) { // For Update or Insert the Xpath must be explicit @@ -1793,10 +1801,12 @@ void XMLCOL::WriteColumn(PGLOBAL g) break; if (ColNode) + { if (Type) ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp); else AttNode = ColNode->GetAttribute(g, Xname, Vxap); + } if (TopNode || ValNode || AttNode) break; // We found the good column @@ -1813,6 +1823,7 @@ void XMLCOL::WriteColumn(PGLOBAL g) /*********************************************************************/ if (ColNode == NULL) { if (TopNode == NULL) + { if (Tdbp->Clist) { Tdbp->RowNode->AddText(g, "\n\t\t"); ColNode = Tdbp->RowNode->AddChildNode(g, Tdbp->Colname); @@ -1820,7 +1831,7 @@ void XMLCOL::WriteColumn(PGLOBAL g) TopNode = ColNode; } else TopNode = Tdbp->RowNode; - + } for (; k < Nod && TopNode; k++) { if (!done) { TopNode->AddText(g, "\n\t\t"); @@ -2035,6 +2046,7 @@ void XMULCOL::WriteColumn(PGLOBAL g) } // endfor k if (ColNode) + { if (Inod == Nod) { /***************************************************************/ /* The node value can be multiple. */ @@ -2052,11 +2064,13 @@ void XMULCOL::WriteColumn(PGLOBAL g) ValNode = Nlx->GetItem(g, Tdbp->Nsub, Vxnp); } else // Inod != Nod + { if (Type) ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp); else AttNode = ColNode->GetAttribute(g, Xname, Vxap); - + } + } if (TopNode || ValNode || AttNode) break; // We found the good column else if (Tdbp->Clist) @@ -2069,6 +2083,7 @@ void XMULCOL::WriteColumn(PGLOBAL g) /*********************************************************************/ if (ColNode == NULL) { if (TopNode == NULL) + { if (Tdbp->Clist) { Tdbp->RowNode->AddText(g, "\n\t\t"); ColNode = Tdbp->RowNode->AddChildNode(g, Tdbp->Colname); @@ -2076,6 +2091,7 @@ void XMULCOL::WriteColumn(PGLOBAL g) TopNode = ColNode; } else TopNode = Tdbp->RowNode; + } for (; k < Nod && TopNode; k++) { if (!done) { diff --git a/storage/connect/user_connect.h b/storage/connect/user_connect.h index 2670c5bcebc..53064e620f2 100644 --- a/storage/connect/user_connect.h +++ b/storage/connect/user_connect.h @@ -35,7 +35,7 @@ //typedef struct _global *PGLOBAL; typedef class user_connect *PCONNECT; typedef class ha_connect *PHC; -static int connect_done_func(void *); +int connect_done_func(void *); /*****************************************************************************/ /* The CONNECT users. There should be one by connected users. */ diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp index c3e42945d70..528c4abf3db 100644 --- a/storage/connect/valblk.cpp +++ b/storage/connect/valblk.cpp @@ -1130,7 +1130,7 @@ void STRBLK::SetValues(PVBLK pv, int k, int n) CheckType(pv) PSZ *sp = ((STRBLK*)pv)->Strp; - for (register int i = k; i < n; i++) + for (int i = k; i < n; i++) Strp[i] = (!pv->IsNull(i)) ? sp[i] : NULL; } // end of SetValues diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index cc68c8694c7..9586f834b8f 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -2614,12 +2614,13 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval) // Pass g to have an error return or NULL to set invalid dates to 0 if (MakeTime(&datm)) + { if (g) { strcpy(g->Message, MSG(BAD_DATETIME)); rc = true; } else Tval = 0; - + } return rc; } // end of MakeDate diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 9892bf889ce..cef4d8a47b3 100644 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -559,12 +559,14 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) // Check whether the unique index is unique indeed if (!Mul) + { if (Ndif < Num_K) { strcpy(g->Message, MSG(INDEX_NOT_UNIQ)); brc = true; goto err; } else PlgDBfree(Offset); // Not used anymore + } // Restore kcp list To_LastCol->Next = addcolp; @@ -1209,7 +1211,7 @@ bool XINDEX::MapInit(PGLOBAL g) PCOL colp; PXCOL prev = NULL, kcp = NULL; PDOSDEF defp = (PDOSDEF)Tdbp->To_Def; - PDBUSER dup = PlgGetUser(g); + PDBUSER dup __attribute__((unused))= PlgGetUser(g); /*********************************************************************/ /* Get the estimated table size. */ @@ -2043,11 +2045,12 @@ int XINDXS::Range(PGLOBAL g, int limit, bool incl) k = FastFind(); if (k < Num_K || Op != OP_EQ) + { if (limit) n = (Mul) ? k : kp->Val_K; else n = (Mul) ? Pof[kp->Val_K + 1] - k : 1; - + } } else { strcpy(g->Message, MSG(RANGE_NO_JOIN)); n = -1; // Logical error diff --git a/storage/connect/zip.c b/storage/connect/zip.c index 4bbe31ab7dd..52d63e108e7 100644 --- a/storage/connect/zip.c +++ b/storage/connect/zip.c @@ -28,6 +28,7 @@ #include <time.h> #include "zlib.h" #include "zip.h" +#include "my_attribute.h" #ifdef STDC # include <stddef.h> @@ -518,16 +519,16 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) break; - for (i=(int)uReadSize-3; (i--)>0;) + for (i=(int)uReadSize-3; (i--)>0;) { if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) { uPosFound = uReadPos+i; break; } - - if (uPosFound!=0) - break; + } + if (uPosFound!=0) + break; } TRYFREE(buf); return uPosFound; @@ -1057,7 +1058,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const void* extrafield_global, uInt size_extrafield_global, const char* comment, int method, int level, int raw, int windowBits,int memLevel, int strategy, - const char* password, uLong crcForCrypting, + const char* password, uLong crcForCrypting __attribute__((unused)), uLong versionMadeBy, uLong flagBase, int zip64) { zip64_internal* zi; @@ -1066,11 +1067,10 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, uInt i; int err = ZIP_OK; -# ifdef NOCRYPT - (crcForCrypting); +#ifdef NOCRYPT if (password != NULL) return ZIP_PARAMERROR; -# endif +#endif if (file == NULL) return ZIP_PARAMERROR; |