Commit b8d6f973 authored by Olivier Bertrand's avatar Olivier Bertrand

- Add the PROFILE_End function in inihandl. Called by connect_done_func

  to release the cache memory allocated by the PROFILE perocessing.
  (also add some break at the end of switch's to avoid warnings)

modified:
  storage/connect/filamvct.cpp
  storage/connect/ha_connect.cc
  storage/connect/inihandl.c
  storage/connect/inihandl.h
parent 9508e913
...@@ -1823,7 +1823,7 @@ bool VECFAM::OpenTableFile(PGLOBAL g) ...@@ -1823,7 +1823,7 @@ bool VECFAM::OpenTableFile(PGLOBAL g)
{ {
char opmode[4]; char opmode[4];
int i; int i;
bool b; bool b= false;
PCOLDEF cdp; PCOLDEF cdp;
PVCTCOL cp; PVCTCOL cp;
MODE mode = Tdbp->GetMode(); MODE mode = Tdbp->GetMode();
......
...@@ -360,6 +360,9 @@ static int connect_init_func(void *p) ...@@ -360,6 +360,9 @@ static int connect_init_func(void *p)
trace= xtrace; trace= xtrace;
} // endif xtrace } // endif xtrace
#if !defined(WIN32)
PROFILE_Close(connectini);
#endif // !WIN32
init_connect_psi_keys(); init_connect_psi_keys();
...@@ -395,7 +398,7 @@ static int connect_done_func(void *p) ...@@ -395,7 +398,7 @@ static int connect_done_func(void *p)
#endif // LIBXML2_SUPPORT #endif // LIBXML2_SUPPORT
#if !defined(WIN32) #if !defined(WIN32)
PROFILE_Close(connectini); PROFILE_End();
#endif // !WIN32 #endif // !WIN32
for (pc= user_connect::to_users; pc; pc= pn) { for (pc= user_connect::to_users; pc; pc= pn) {
...@@ -903,6 +906,7 @@ void *ha_connect::GetColumnOption(void *field, PCOLINFO pcf) ...@@ -903,6 +906,7 @@ void *ha_connect::GetColumnOption(void *field, PCOLINFO pcf)
case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VAR_STRING:
pcf->Flags |= U_VAR; pcf->Flags |= U_VAR;
/* no break */
case MYSQL_TYPE_STRING: case MYSQL_TYPE_STRING:
pcf->Type= TYPE_STRING; pcf->Type= TYPE_STRING;
...@@ -966,6 +970,7 @@ void *ha_connect::GetColumnOption(void *field, PCOLINFO pcf) ...@@ -966,6 +970,7 @@ void *ha_connect::GetColumnOption(void *field, PCOLINFO pcf)
break; break;
default: default:
pcf->Type=TYPE_ERROR; pcf->Type=TYPE_ERROR;
break;
} // endswitch type } // endswitch type
// This is used to skip null bit // This is used to skip null bit
...@@ -1327,6 +1332,7 @@ int ha_connect::MakeRecord(char *buf) ...@@ -1327,6 +1332,7 @@ int ha_connect::MakeRecord(char *buf)
break; break;
default: default:
fmt= "%Y-%m-%d %H:%M:%S"; fmt= "%Y-%m-%d %H:%M:%S";
break;
} // endswitch type } // endswitch type
// Get date in the format required by MySQL fields // Get date in the format required by MySQL fields
...@@ -1340,6 +1346,7 @@ int ha_connect::MakeRecord(char *buf) ...@@ -1340,6 +1346,7 @@ int ha_connect::MakeRecord(char *buf)
// Passthru // Passthru
default: default:
p= value->GetCharString(val); p= value->GetCharString(val);
break;
} // endswitch Type } // endswitch Type
if (p) { if (p) {
...@@ -1459,6 +1466,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf) ...@@ -1459,6 +1466,7 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf)
attribute.charset(), charset, &cnv_errors); attribute.charset(), charset, &cnv_errors);
value->SetValue_psz(data_charset_value.c_ptr_safe()); value->SetValue_psz(data_charset_value.c_ptr_safe());
} }
break;
} // endswitch Type } // endswitch Type
#ifdef NEWCHANGE #ifdef NEWCHANGE
...@@ -1566,6 +1574,7 @@ const char *ha_connect::GetValStr(OPVAL vop, bool neg) ...@@ -1566,6 +1574,7 @@ const char *ha_connect::GetValStr(OPVAL vop, bool neg)
break; break;
default: default:
val= " ? "; val= " ? ";
break;
} /* endswitch */ } /* endswitch */
return val; return val;
...@@ -2168,6 +2177,7 @@ int ha_connect::ReadIndexed(uchar *buf, OPVAL op, const uchar *key, uint key_len ...@@ -2168,6 +2177,7 @@ int ha_connect::ReadIndexed(uchar *buf, OPVAL op, const uchar *key, uint key_len
DBUG_PRINT("ReadIndexed", ("%s", xp->g->Message)); DBUG_PRINT("ReadIndexed", ("%s", xp->g->Message));
printf("ReadIndexed: %s\n", xp->g->Message); printf("ReadIndexed: %s\n", xp->g->Message);
rc= HA_ERR_INTERNAL_ERROR; rc= HA_ERR_INTERNAL_ERROR;
break;
} // endswitch RC } // endswitch RC
if (xtrace > 1) if (xtrace > 1)
...@@ -2210,7 +2220,7 @@ int ha_connect::index_read(uchar * buf, const uchar * key, uint key_len, ...@@ -2210,7 +2220,7 @@ int ha_connect::index_read(uchar * buf, const uchar * key, uint key_len,
case HA_READ_KEY_EXACT: op= OP_EQ; break; case HA_READ_KEY_EXACT: op= OP_EQ; break;
case HA_READ_AFTER_KEY: op= OP_GT; break; case HA_READ_AFTER_KEY: op= OP_GT; break;
case HA_READ_KEY_OR_NEXT: op= OP_GE; break; case HA_READ_KEY_OR_NEXT: op= OP_GE; break;
default: DBUG_RETURN(-1); default: DBUG_RETURN(-1); break;
} // endswitch find_flag } // endswitch find_flag
if (xtrace > 1) if (xtrace > 1)
...@@ -2833,6 +2843,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -2833,6 +2843,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
case F_UNLCK: case F_UNLCK:
default: default:
newmode= MODE_ANY; newmode= MODE_ANY;
break;
} // endswitch mode } // endswitch mode
if (newmode == MODE_ANY) { if (newmode == MODE_ANY) {
...@@ -2990,6 +3001,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -2990,6 +3001,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
printf("Unsupported sql_command=%d", thd_sql_command(thd)); printf("Unsupported sql_command=%d", thd_sql_command(thd));
sprintf(g->Message, "Unsupported sql_command=%d", thd_sql_command(thd)); sprintf(g->Message, "Unsupported sql_command=%d", thd_sql_command(thd));
DBUG_RETURN(HA_ERR_INTERNAL_ERROR); DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
break;
} // endswitch newmode } // endswitch newmode
} else if (newmode == MODE_READ) { } else if (newmode == MODE_READ) {
...@@ -3027,6 +3039,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -3027,6 +3039,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
printf("Unsupported sql_command=%d", thd_sql_command(thd)); printf("Unsupported sql_command=%d", thd_sql_command(thd));
sprintf(g->Message, "Unsupported sql_command=%d", thd_sql_command(thd)); sprintf(g->Message, "Unsupported sql_command=%d", thd_sql_command(thd));
DBUG_RETURN(HA_ERR_INTERNAL_ERROR); DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
break;
} // endswitch newmode } // endswitch newmode
} // endif's newmode } // endif's newmode
...@@ -3583,6 +3596,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -3583,6 +3596,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
break; break;
default: default:
sprintf(g->Message, "Cannot get column info for table type %s", topt->type); sprintf(g->Message, "Cannot get column info for table type %s", topt->type);
break;
} // endif ttp } // endif ttp
// Check for supported catalog function // Check for supported catalog function
...@@ -3643,6 +3657,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -3643,6 +3657,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
break; break;
default: default:
sprintf(g->Message, "invalid catfunc %s", fncn); sprintf(g->Message, "invalid catfunc %s", fncn);
break;
} // endswitch info } // endswitch info
break; break;
...@@ -3979,6 +3994,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -3979,6 +3994,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
} // endif tabname } // endif tabname
default: /* do nothing */; default: /* do nothing */;
break;
} // endswitch ttp } // endswitch ttp
if (type == TAB_XML) { if (type == TAB_XML) {
...@@ -4001,6 +4017,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -4001,6 +4017,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
break; break;
default: default:
dom= false; dom= false;
break;
} // endswitch xsup } // endswitch xsup
#if !defined(DOMDOC_SUPPORT) #if !defined(DOMDOC_SUPPORT)
...@@ -4086,6 +4103,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -4086,6 +4103,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
"Unsupported type for column '%s'", "Unsupported type for column '%s'",
MYF(0), fp->field_name); MYF(0), fp->field_name);
DBUG_RETURN(rc); DBUG_RETURN(rc);
break;
} // endswitch type } // endswitch type
if ((fp)->real_maybe_null() && !IsTypeNullable(type)) { if ((fp)->real_maybe_null() && !IsTypeNullable(type)) {
......
...@@ -608,6 +608,31 @@ void PROFILE_Close(LPCSTR filename) ...@@ -608,6 +608,31 @@ void PROFILE_Close(LPCSTR filename)
} // end of PROFILE_Close } // end of PROFILE_Close
/***********************************************************************
* PROFILE_End
*
* Terminate and release the cache.
***********************************************************************/
void PROFILE_End(void)
{
int i;
if (trace)
htrc("PROFILE_End: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
/* Close all opened files and free the cache structure */
for (i = 0; i < N_CACHED_PROFILES; i++) {
if (trace)
htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
CurProfile = MRUProfile[i];
PROFILE_ReleaseFile();
free(MRUProfile[i]);
} // endfor i
} // end of PROFILE_End
/*********************************************************************** /***********************************************************************
* PROFILE_DeleteSection * PROFILE_DeleteSection
* *
......
...@@ -8,6 +8,7 @@ extern "C" { ...@@ -8,6 +8,7 @@ extern "C" {
#endif #endif
void PROFILE_Close(LPCSTR filename); void PROFILE_Close(LPCSTR filename);
void PROFILE_End(void);
int GetPrivateProfileString( int GetPrivateProfileString(
LPCTSTR lpAppName, // section name LPCTSTR lpAppName, // section name
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment