mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 02:30:06 +01:00
- 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
This commit is contained in:
parent
fe3cbcdffa
commit
b1ae834165
4 changed files with 36 additions and 18 deletions
storage/connect
|
@ -194,6 +194,7 @@ static my_bool indx_map= 0;
|
|||
/* Utility functions. */
|
||||
/***********************************************************************/
|
||||
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 PGLOBAL GetPlug(THD *thd, PCONNECT& lxp);
|
||||
|
@ -302,18 +303,6 @@ ha_create_table_option connect_field_option_list[]=
|
|||
/***********************************************************************/
|
||||
/* 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)
|
||||
{
|
||||
PHC phc;
|
||||
|
@ -328,6 +317,18 @@ bool PushWarning(PGLOBAL g, PTDBASE tdbp, int level)
|
|||
return false;
|
||||
} // 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
|
||||
static PSI_mutex_key con_key_mutex_CONNECT_SHARE_mutex;
|
||||
|
||||
|
|
|
@ -173,15 +173,19 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength)
|
|||
// Fixme
|
||||
char *p;
|
||||
|
||||
if( *relPath == '\\' || *relPath == '/' ) {
|
||||
if ( *relPath == '\\' || *relPath == '/' ) {
|
||||
strncpy(absPath, relPath, maxLength);
|
||||
} else if(*relPath == '~') {
|
||||
} else if (*relPath == '~') {
|
||||
// get the path to the home directory
|
||||
struct passwd *pw = getpwuid_r(getuid());
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
|
||||
strcat(strcat(strncpy(absPath, homedir, maxLength), "/"), relPath);
|
||||
} else {
|
||||
if (homedir)
|
||||
strcat(strncpy(absPath, homedir, maxLength), relPath + 1);
|
||||
else
|
||||
strncpy(absPath, relPath, maxLength);
|
||||
|
||||
} else {
|
||||
char buff[2*_MAX_PATH];
|
||||
|
||||
p= getcwd(buff, _MAX_PATH);
|
||||
|
|
|
@ -255,7 +255,20 @@ LPCSTR PlugSetPath(LPSTR pBuff, LPCSTR prefix, LPCSTR FileName, LPCSTR defpath)
|
|||
strcpy(pBuff, FileName); // FileName includes absolute path
|
||||
return pBuff;
|
||||
} // 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))
|
||||
{
|
||||
char tmp[_MAX_PATH];
|
||||
|
|
|
@ -220,6 +220,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
|||
|
||||
crp = crp->Next; // Type_Name
|
||||
crp->Kdata->SetValue(GetTypeName(type), i);
|
||||
fmt = NULL;
|
||||
|
||||
if (type == TYPE_DATE) {
|
||||
// When creating tables we do need info about date columns
|
||||
|
@ -239,7 +240,6 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
|||
// prec = (prec(???) == NOT_FIXED_DEC) ? 0 : fp->field_length;
|
||||
|
||||
len = fp->char_length();
|
||||
fmt = NULL;
|
||||
} else
|
||||
prec = len = zconv;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue