Commit b1ae8341 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix using ~ in file name on Linux

modified:
  storage/connect/osutil.c
  storage/connect/plugutil.c
  
- Fix using fmt uninitialized in Tabcolumns
modified:
  storage/connect/tabutil.cpp

- Suppress gcc warning
modified:
  storage/connect/ha_connect.cc
parent fe3cbcdf
...@@ -194,6 +194,7 @@ static my_bool indx_map= 0; ...@@ -194,6 +194,7 @@ static my_bool indx_map= 0;
/* Utility functions. */ /* Utility functions. */
/***********************************************************************/ /***********************************************************************/
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
void PushWarning(PGLOBAL g, THD *thd, int level);
static PCONNECT GetUser(THD *thd, PCONNECT xp); static PCONNECT GetUser(THD *thd, PCONNECT xp);
static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp); static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp);
...@@ -302,18 +303,6 @@ ha_create_table_option connect_field_option_list[]= ...@@ -302,18 +303,6 @@ ha_create_table_option connect_field_option_list[]=
/***********************************************************************/ /***********************************************************************/
/* Push G->Message as a MySQL warning. */ /* Push G->Message as a MySQL warning. */
/***********************************************************************/ /***********************************************************************/
void PushWarning(PGLOBAL g, THD *thd, int level)
{
if (thd) {
Sql_condition::enum_warning_level wlvl;
wlvl= (Sql_condition::enum_warning_level)level;
push_warning(thd, wlvl, 0, g->Message);
} else
htrc("%s\n", g->Message);
} // end of PushWarning
bool PushWarning(PGLOBAL g, PTDBASE tdbp, int level) bool PushWarning(PGLOBAL g, PTDBASE tdbp, int level)
{ {
PHC phc; PHC phc;
...@@ -328,6 +317,18 @@ bool PushWarning(PGLOBAL g, PTDBASE tdbp, int level) ...@@ -328,6 +317,18 @@ bool PushWarning(PGLOBAL g, PTDBASE tdbp, int level)
return false; return false;
} // end of PushWarning } // end of PushWarning
void PushWarning(PGLOBAL g, THD *thd, int level)
{
if (thd) {
Sql_condition::enum_warning_level wlvl;
wlvl= (Sql_condition::enum_warning_level)level;
push_warning(thd, wlvl, 0, g->Message);
} else
htrc("%s\n", g->Message);
} // end of PushWarning
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key con_key_mutex_CONNECT_SHARE_mutex; static PSI_mutex_key con_key_mutex_CONNECT_SHARE_mutex;
......
...@@ -173,14 +173,18 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength) ...@@ -173,14 +173,18 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength)
// Fixme // Fixme
char *p; char *p;
if( *relPath == '\\' || *relPath == '/' ) { if ( *relPath == '\\' || *relPath == '/' ) {
strncpy(absPath, relPath, maxLength); strncpy(absPath, relPath, maxLength);
} else if(*relPath == '~') { } else if (*relPath == '~') {
// get the path to the home directory // get the path to the home directory
struct passwd *pw = getpwuid_r(getuid()); struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir; const char *homedir = pw->pw_dir;
strcat(strcat(strncpy(absPath, homedir, maxLength), "/"), relPath); if (homedir)
strcat(strncpy(absPath, homedir, maxLength), relPath + 1);
else
strncpy(absPath, relPath, maxLength);
} else { } else {
char buff[2*_MAX_PATH]; char buff[2*_MAX_PATH];
......
...@@ -256,6 +256,19 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath) ...@@ -256,6 +256,19 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
return pBuff; return pBuff;
} // endif } // endif
#if !defined(WIN32)
if (*FileName == '~') {
if (_fullpath(pBuff, FileName, _MAX_PATH)) {
if (trace > 1)
htrc("pbuff='%s'\n", pBuff);
return pBuff;
} else
return FileName; // Error, return unchanged name
} // endif FileName
#endif // !WIN32
if (strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath)) if (strcmp(prefix, ".") && !PlugIsAbsolutePath(defpath))
{ {
char tmp[_MAX_PATH]; char tmp[_MAX_PATH];
......
...@@ -220,6 +220,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, ...@@ -220,6 +220,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
crp = crp->Next; // Type_Name crp = crp->Next; // Type_Name
crp->Kdata->SetValue(GetTypeName(type), i); crp->Kdata->SetValue(GetTypeName(type), i);
fmt = NULL;
if (type == TYPE_DATE) { if (type == TYPE_DATE) {
// When creating tables we do need info about date columns // When creating tables we do need info about date columns
...@@ -239,7 +240,6 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, ...@@ -239,7 +240,6 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
// prec = (prec(???) == NOT_FIXED_DEC) ? 0 : fp->field_length; // prec = (prec(???) == NOT_FIXED_DEC) ? 0 : fp->field_length;
len = fp->char_length(); len = fp->char_length();
fmt = NULL;
} else } else
prec = len = zconv; prec = len = zconv;
......
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