Commit bd481432 authored by Olivier Bertrand's avatar Olivier Bertrand

- Calculate next position in filamap without assuming ENDING option is true.

modified:
  storage/connect/filamap.cpp

- ftell error: indicate in the error msg that is can be due to wrong ENDING value.
  filamtxt.cpp (MDEV-7030)
modified:
  storage/connect/filamtxt.cpp

- Change STRING according to Alexander Barkov remarks.
  Suppress the wrong Strz function. The unconditional function strz is no more
  used for s->db and s->table_name because they are zero terminated.
modified:
  storage/connect/ha_connect.cc
  storage/connect/xobject.cpp

- Change version number
modified:
  storage/connect/filamap.cpp

- Change PATH_MAX to FN_REFLEN (MDEV-7036)
modified:
  storage/connect/os.h
  storage/connect/tabmul.cpp

- Fix bug by adding a void argument for OP_NOT in Makefilter.
modified:
  storage/connect/filter.cpp

- Begin implementing XMSG style
  Two new system variables are defined:
  msg_lang ENUM session
  errmsg_dir_path STR global readonly
  This is a work in progress.
modified:
  storage/connect/ha_connect.cc
  storage/connect/plgdbutl.cpp
  storage/connect/plugutil.c
  storage/connect/rcmsg.c
  storage/connect/resource.h
parent 1f9259df
...@@ -358,7 +358,12 @@ int MAPFAM::ReadBuffer(PGLOBAL g) ...@@ -358,7 +358,12 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
while (*Mempos++ != '\n') ; // What about Unix ??? while (*Mempos++ != '\n') ; // What about Unix ???
// Set caller line buffer // Set caller line buffer
len = (Mempos - Fpos) - Ending; len = (Mempos - Fpos) - 1;
// Don't rely on ENDING setting
if (len > 0 && *(Mempos - 2) == '\r')
len--; // Line ends by CRLF
memcpy(Tdbp->GetLine(), Fpos, len); memcpy(Tdbp->GetLine(), Fpos, len);
Tdbp->GetLine()[len] = '\0'; Tdbp->GetLine()[len] = '\0';
return RC_OK; return RC_OK;
......
...@@ -683,6 +683,7 @@ bool DOSFAM::RecordPos(PGLOBAL g) ...@@ -683,6 +683,7 @@ bool DOSFAM::RecordPos(PGLOBAL g)
{ {
if ((Fpos = ftell(Stream)) < 0) { if ((Fpos = ftell(Stream)) < 0) {
sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno)); sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno));
strcat(g->Message, " (possible wrong ENDING option value)");
return true; return true;
} // endif Fpos } // endif Fpos
......
...@@ -101,7 +101,7 @@ PFIL MakeFilter(PGLOBAL g, PFIL fp1, OPVAL vop, PFIL fp2) ...@@ -101,7 +101,7 @@ PFIL MakeFilter(PGLOBAL g, PFIL fp1, OPVAL vop, PFIL fp2)
PFIL filp = new(g) FILTER(g, vop); PFIL filp = new(g) FILTER(g, vop);
filp->Arg(0) = fp1; filp->Arg(0) = fp1;
filp->Arg(1) = fp2; filp->Arg(1) = (fp2) ? fp2 : pXVOID;
if (filp->Convert(g, false)) if (filp->Convert(g, false))
return NULL; return NULL;
......
...@@ -170,8 +170,8 @@ ...@@ -170,8 +170,8 @@
#define SZWMIN 4194304 // Minimum work area size 4M #define SZWMIN 4194304 // Minimum work area size 4M
extern "C" { extern "C" {
char version[]= "Version 1.03.0004 October 13, 2014"; char version[]= "Version 1.03.0005 November 08, 2014";
char compver[]= "Version 1.03.0004 " __DATE__ " " __TIME__; char compver[]= "Version 1.03.0005 " __DATE__ " " __TIME__;
#if defined(WIN32) #if defined(WIN32)
char slash= '\\'; char slash= '\\';
...@@ -179,9 +179,6 @@ extern "C" { ...@@ -179,9 +179,6 @@ extern "C" {
char slash= '/'; char slash= '/';
#endif // !WIN32 #endif // !WIN32
#if defined(XMSG)
char msglang[]; // Default message language
#endif
// int trace= 0; // The general trace value // int trace= 0; // The general trace value
int xconv= 0; // The type conversion option int xconv= 0; // The type conversion option
int zconv= SZCONV; // The text conversion size int zconv= SZCONV; // The text conversion size
...@@ -202,6 +199,11 @@ static ulong type_conv= 0; ...@@ -202,6 +199,11 @@ static ulong type_conv= 0;
#if defined(XMAP) #if defined(XMAP)
static my_bool indx_map= 0; static my_bool indx_map= 0;
#endif // XMAP #endif // XMAP
#if defined(XMSG)
extern "C" {
char *msg_path;
} // extern "C"
#endif // XMSG
/***********************************************************************/ /***********************************************************************/
/* Utility functions. */ /* Utility functions. */
...@@ -278,12 +280,40 @@ static MYSQL_THDVAR_ENUM( ...@@ -278,12 +280,40 @@ static MYSQL_THDVAR_ENUM(
1, // def (AUTO) 1, // def (AUTO)
&usetemp_typelib); // typelib &usetemp_typelib); // typelib
#if defined(XMSG)
const char *language_names[]=
{
"default", "english", "french", NullS
};
TYPELIB language_typelib=
{
array_elements(language_names) - 1, "language_typelib",
language_names, NULL
};
static MYSQL_THDVAR_ENUM(
msg_lang, // name
PLUGIN_VAR_RQCMDARG, // opt
"Message language", // comment
NULL, // check
NULL, // update
1, // def (ENGLISH)
&language_typelib); // typelib
#endif // XMSG
/***********************************************************************/ /***********************************************************************/
/* Function to export session variable values to other source files. */ /* Function to export session variable values to other source files. */
/***********************************************************************/ /***********************************************************************/
extern "C" int GetTraceValue(void) {return THDVAR(current_thd, xtrace);} extern "C" int GetTraceValue(void) {return THDVAR(current_thd, xtrace);}
bool ExactInfo(void) {return THDVAR(current_thd, exact_info);} bool ExactInfo(void) {return THDVAR(current_thd, exact_info);}
USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);} USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);}
#if defined(XMSG)
extern "C" const char *msglang(void)
{
return language_names[THDVAR(current_thd, msg_lang)];
} // end of msglang
#endif // XMSG
/***********************************************************************/ /***********************************************************************/
/* Global variables update functions. */ /* Global variables update functions. */
...@@ -912,15 +942,6 @@ char *ha_connect::GetRealString(const char *s) ...@@ -912,15 +942,6 @@ char *ha_connect::GetRealString(const char *s)
return sv; return sv;
} // end of GetRealString } // end of GetRealString
inline char *ha_connect::Strz(LEX_STRING &ls)
{
if (unlikely(ls.str && ls.str[ls.length]))
return strz(xp->g, ls);
else
return ls.str;
} // end of Strz
/****************************************************************************/ /****************************************************************************/
/* Return the value of a string option or NULL if not specified. */ /* Return the value of a string option or NULL if not specified. */
/****************************************************************************/ /****************************************************************************/
...@@ -934,7 +955,7 @@ char *ha_connect::GetStringOption(char *opname, char *sdef) ...@@ -934,7 +955,7 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
: table->s->connect_string; : table->s->connect_string;
if (cnc.length) if (cnc.length)
opval= GetRealString(Strz(cnc)); opval= GetRealString(strz(xp->g, cnc));
} else if (!stricmp(opname, "Query_String")) } else if (!stricmp(opname, "Query_String"))
opval= thd_query_string(table->in_use)->str; opval= thd_query_string(table->in_use)->str;
...@@ -1274,13 +1295,9 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) ...@@ -1274,13 +1295,9 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
pcf->Key= 0; // Not used when called from MySQL pcf->Key= 0; // Not used when called from MySQL
// Get the comment if any // Get the comment if any
if (fp->comment.str && fp->comment.length) { if (fp->comment.str && fp->comment.length)
if ((pcf->Remark= (char*)PlgDBSubAlloc(g, NULL, fp->comment.length + 1))) { pcf->Remark= strz(g, fp->comment);
memcpy(pcf->Remark, fp->comment.str, fp->comment.length); else
pcf->Remark[fp->comment.length]= 0;
} // endif Remark
} else
pcf->Remark= NULL; pcf->Remark= NULL;
return fldp; return fldp;
...@@ -1309,7 +1326,7 @@ bool ha_connect::GetIndexOption(KEY *kp, char *opname) ...@@ -1309,7 +1326,7 @@ bool ha_connect::GetIndexOption(KEY *kp, char *opname)
opval= options->mapped; opval= options->mapped;
} else if (kp->comment.str && kp->comment.length) { } else if (kp->comment.str && kp->comment.length) {
char *pv, *oplist= Strz(kp->comment); char *pv, *oplist= strz(xp->g, kp->comment);
if ((pv= GetListOption(xp->g, opname, oplist))) if ((pv= GetListOption(xp->g, opname, oplist)))
opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0); opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0);
...@@ -1455,12 +1472,12 @@ bool ha_connect::IsPartitioned(void) ...@@ -1455,12 +1472,12 @@ bool ha_connect::IsPartitioned(void)
const char *ha_connect::GetDBName(const char* name) const char *ha_connect::GetDBName(const char* name)
{ {
return (name) ? name : Strz(table->s->db); return (name) ? name : table->s->db.str;
} // end of GetDBName } // end of GetDBName
const char *ha_connect::GetTableName(void) const char *ha_connect::GetTableName(void)
{ {
return Strz(tshp ? tshp->table_name : table_share->table_name); return tshp ? tshp->table_name.str : table_share->table_name.str;
} // end of GetTableName } // end of GetTableName
char *ha_connect::GetPartName(void) char *ha_connect::GetPartName(void)
...@@ -3575,7 +3592,7 @@ int ha_connect::info(uint flag) ...@@ -3575,7 +3592,7 @@ int ha_connect::info(uint flag)
// This is necessary for getting file length // This is necessary for getting file length
if (table) if (table)
SetDataPath(g, Strz(table->s->db)); SetDataPath(g, table->s->db.str);
else else
DBUG_RETURN(HA_ERR_INTERNAL_ERROR); // Should never happen DBUG_RETURN(HA_ERR_INTERNAL_ERROR); // Should never happen
...@@ -4140,7 +4157,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) ...@@ -4140,7 +4157,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
DBUG_ASSERT(table && table->s); DBUG_ASSERT(table && table->s);
if (check_privileges(thd, options, Strz(table->s->db))) { if (check_privileges(thd, options, table->s->db.str)) {
strcpy(g->Message, "This operation requires the FILE privilege"); strcpy(g->Message, "This operation requires the FILE privilege");
htrc("%s\n", g->Message); htrc("%s\n", g->Message);
DBUG_RETURN(HA_ERR_INTERNAL_ERROR); DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
...@@ -4675,15 +4692,6 @@ static int init_table_share(THD* thd, ...@@ -4675,15 +4692,6 @@ static int init_table_share(THD* thd,
sql->ptr(), sql->length()); sql->ptr(), sql->length());
} // end of init_table_share } // end of init_table_share
static inline char *Strz(PGLOBAL g, LEX_STRING &ls)
{
if (unlikely(ls.str && ls.str[ls.length]))
return strz(g, ls);
else
return ls.str;
} // end of Strz
// Used to check whether a MYSQL table is created on itself // Used to check whether a MYSQL table is created on itself
bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
const char *db, char *tab, const char *src, int port) const char *db, char *tab, const char *src, int port)
...@@ -4692,9 +4700,9 @@ bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, ...@@ -4692,9 +4700,9 @@ bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
return false; return false;
else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1")) else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1"))
return false; return false;
else if (db && stricmp(db, Strz(g, s->db))) else if (db && stricmp(db, s->db.str))
return false; return false;
else if (tab && stricmp(tab, Strz(g, s->table_name))) else if (tab && stricmp(tab, s->table_name.str))
return false; return false;
else if (port && port != (signed)GetDefaultPort()) else if (port && port != (signed)GetDefaultPort())
return false; return false;
...@@ -4799,7 +4807,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -4799,7 +4807,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
} // endif option_list } // endif option_list
if (!(shm= (char*)db)) if (!(shm= (char*)db))
db= Strz(g, table_s->db); // Default value db= table_s->db.str; // Default value
// Check table type // Check table type
if (ttp == TAB_UNDEF) { if (ttp == TAB_UNDEF) {
...@@ -4849,7 +4857,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -4849,7 +4857,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
} // endif p } // endif p
} else if (ttp != TAB_ODBC || !(fnc & (FNC_TABLE | FNC_COL))) } else if (ttp != TAB_ODBC || !(fnc & (FNC_TABLE | FNC_COL)))
tab= Strz(g, table_s->table_name); // Default value tab= table_s->table_name.str; // Default value
#if defined(NEW_WAY) #if defined(NEW_WAY)
// add_option(thd, create_info, "tabname", tab); // add_option(thd, create_info, "tabname", tab);
...@@ -4859,7 +4867,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -4859,7 +4867,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
switch (ttp) { switch (ttp) {
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
case TAB_ODBC: case TAB_ODBC:
dsn= Strz(g, create_info->connect_string); dsn= strz(g, create_info->connect_string);
if (fnc & (FNC_DSN | FNC_DRIVER)) { if (fnc & (FNC_DSN | FNC_DRIVER)) {
ok= true; ok= true;
...@@ -4894,13 +4902,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -4894,13 +4902,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
case TAB_MYSQL: case TAB_MYSQL:
ok= true; ok= true;
if (create_info->connect_string.str) { if (create_info->connect_string.str &&
int len= create_info->connect_string.length; create_info->connect_string.length) {
PMYDEF mydef= new(g) MYSQLDEF(); PMYDEF mydef= new(g) MYSQLDEF();
dsn= (char*)PlugSubAlloc(g, NULL, len + 1); dsn= strz(g, create_info->connect_string);
strncpy(dsn, create_info->connect_string.str, len);
dsn[len]= 0;
mydef->SetName(create_info->alias); mydef->SetName(create_info->alias);
if (!mydef->ParseURL(g, dsn, false)) { if (!mydef->ParseURL(g, dsn, false)) {
...@@ -4945,7 +4951,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -4945,7 +4951,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
case TAB_XCL: case TAB_XCL:
case TAB_OCCUR: case TAB_OCCUR:
if (!src && !stricmp(tab, create_info->alias) && if (!src && !stricmp(tab, create_info->alias) &&
(!db || !stricmp(db, Strz(g, table_s->db)))) (!db || !stricmp(db, table_s->db.str)))
sprintf(g->Message, "A %s table cannot refer to itself", topt->type); sprintf(g->Message, "A %s table cannot refer to itself", topt->type);
else else
ok= true; ok= true;
...@@ -4983,11 +4989,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -4983,11 +4989,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
int i, len, prec, dec, typ, flg; int i, len, prec, dec, typ, flg;
// if (cat) // if (cat)
// cat->SetDataPath(g, Strz(g, table_s->db)); // cat->SetDataPath(g, table_s->db.str);
// else // else
// return HA_ERR_INTERNAL_ERROR; // Should never happen // return HA_ERR_INTERNAL_ERROR; // Should never happen
dpath= SetPath(g, Strz(g, table_s->db)); dpath= SetPath(g, table_s->db.str);
if (src && ttp != TAB_PIVOT && ttp != TAB_ODBC) { if (src && ttp != TAB_PIVOT && ttp != TAB_ODBC) {
qrp= SrcColumns(g, host, db, user, pwd, src, port); qrp= SrcColumns(g, host, db, user, pwd, src, port);
...@@ -5380,7 +5386,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -5380,7 +5386,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
} else if (options->tabname) { } else if (options->tabname) {
if (!stricmp(options->tabname, create_info->alias) && if (!stricmp(options->tabname, create_info->alias) &&
(!options->dbname || (!options->dbname ||
!stricmp(options->dbname, Strz(table_arg->s->db)))) { !stricmp(options->dbname, table_arg->s->db.str))) {
sprintf(g->Message, "A %s table cannot refer to itself", sprintf(g->Message, "A %s table cannot refer to itself",
options->type); options->type);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
...@@ -5405,14 +5411,11 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -5405,14 +5411,11 @@ int ha_connect::create(const char *name, TABLE *table_arg,
db= GetStringOption("database", NULL); db= GetStringOption("database", NULL);
port= atoi(GetListOption(g, "port", options->oplist, "0")); port= atoi(GetListOption(g, "port", options->oplist, "0"));
if (create_info->connect_string.str) { if (create_info->connect_string.str &&
char *dsn; create_info->connect_string.length) {
int len= create_info->connect_string.length; char *dsn= strz(g, create_info->connect_string);
PMYDEF mydef= new(g) MYSQLDEF(); PMYDEF mydef= new(g) MYSQLDEF();
dsn= (char*)PlugSubAlloc(g, NULL, len + 1);
strncpy(dsn, create_info->connect_string.str, len);
dsn[len]= 0;
mydef->SetName(create_info->alias); mydef->SetName(create_info->alias);
if (!mydef->ParseURL(g, dsn, false)) { if (!mydef->ParseURL(g, dsn, false)) {
...@@ -5650,7 +5653,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -5650,7 +5653,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
if (sqlcom == SQLCOM_CREATE_TABLE) if (sqlcom == SQLCOM_CREATE_TABLE)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
strcat(strcat(strcpy(dbpath, "./"), Strz(table->s->db)), "/"); strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
#if defined(WITH_PARTITION_STORAGE_ENGINE) #if defined(WITH_PARTITION_STORAGE_ENGINE)
} // endif part_info } // endif part_info
#endif // WITH_PARTITION_STORAGE_ENGINE #endif // WITH_PARTITION_STORAGE_ENGINE
...@@ -5724,10 +5727,10 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -5724,10 +5727,10 @@ int ha_connect::create(const char *name, TABLE *table_arg,
PDBUSER dup= PlgGetUser(g); PDBUSER dup= PlgGetUser(g);
PCATLG cat= (dup) ? dup->Catalog : NULL; PCATLG cat= (dup) ? dup->Catalog : NULL;
SetDataPath(g, Strz(table_arg->s->db)); SetDataPath(g, table_arg->s->db.str);
if (cat) { if (cat) {
// cat->SetDataPath(g, Strz(table_arg->s->db)); // cat->SetDataPath(g, table_arg->s->db.str);
#if defined(WITH_PARTITION_STORAGE_ENGINE) #if defined(WITH_PARTITION_STORAGE_ENGINE)
if (part_info) if (part_info)
...@@ -5807,7 +5810,7 @@ bool ha_connect::FileExists(const char *fn, bool bf) ...@@ -5807,7 +5810,7 @@ bool ha_connect::FileExists(const char *fn, bool bf)
} else } else
strcpy(tfn, fn); strcpy(tfn, fn);
strcat(strcat(strcat(strcpy(path, "."), s), Strz(table->s->db)), s); strcat(strcat(strcat(strcpy(path, "."), s), table->s->db.str), s);
PlugSetPath(filename, tfn, path); PlugSetPath(filename, tfn, path);
n= stat(filename, &info); n= stat(filename, &info);
...@@ -6291,6 +6294,13 @@ static MYSQL_SYSVAR_BOOL(indx_map, indx_map, PLUGIN_VAR_RQCMDARG, ...@@ -6291,6 +6294,13 @@ static MYSQL_SYSVAR_BOOL(indx_map, indx_map, PLUGIN_VAR_RQCMDARG,
NULL, update_connect_xmap, 0); NULL, update_connect_xmap, 0);
#endif // XMAP #endif // XMAP
#if defined(XMSG)
static MYSQL_SYSVAR_STR(errmsg_dir_path, msg_path,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to the directory where are the message files",
NULL, NULL, "");
#endif // XMSG
// Size used for g->Sarea_Size // Size used for g->Sarea_Size
static MYSQL_SYSVAR_UINT(work_size, work_size, static MYSQL_SYSVAR_UINT(work_size, work_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
...@@ -6307,6 +6317,10 @@ static struct st_mysql_sys_var* connect_system_variables[]= { ...@@ -6307,6 +6317,10 @@ static struct st_mysql_sys_var* connect_system_variables[]= {
MYSQL_SYSVAR(work_size), MYSQL_SYSVAR(work_size),
MYSQL_SYSVAR(use_tempfile), MYSQL_SYSVAR(use_tempfile),
MYSQL_SYSVAR(exact_info), MYSQL_SYSVAR(exact_info),
#if defined(XMSG)
MYSQL_SYSVAR(msg_lang),
MYSQL_SYSVAR(errmsg_dir_path),
#endif // XMSG
NULL NULL
}; };
...@@ -6323,7 +6337,7 @@ maria_declare_plugin(connect) ...@@ -6323,7 +6337,7 @@ maria_declare_plugin(connect)
0x0103, /* version number (1.03) */ 0x0103, /* version number (1.03) */
NULL, /* status variables */ NULL, /* status variables */
connect_system_variables, /* system variables */ connect_system_variables, /* system variables */
"1.03", /* string version */ "1.03.0005", /* string version */
MariaDB_PLUGIN_MATURITY_BETA /* maturity */ MariaDB_PLUGIN_MATURITY_BETA /* maturity */
} }
maria_declare_plugin_end; maria_declare_plugin_end;
...@@ -53,12 +53,12 @@ typedef int HANDLE; ...@@ -53,12 +53,12 @@ typedef int HANDLE;
#ifdef PATH_MAX #ifdef PATH_MAX
#define _MAX_PATH PATH_MAX #define _MAX_PATH PATH_MAX
#else #else
#define _MAX_PATH 260 #define _MAX_PATH FN_REFLEN
#endif #endif
#define _MAX_DRIVE 3 #define _MAX_DRIVE 3
#define _MAX_DIR 256 #define _MAX_DIR FN_REFLEN
#define _MAX_FNAME 256 #define _MAX_FNAME FN_HEADLEN
#define _MAX_EXT 256 #define _MAX_EXT FN_EXTLEN
#define INVALID_HANDLE_VALUE (-1) #define INVALID_HANDLE_VALUE (-1)
#define __stdcall #define __stdcall
#endif /* !WIN32 */ #endif /* !WIN32 */
......
...@@ -87,9 +87,6 @@ bool Initdone = false; ...@@ -87,9 +87,6 @@ bool Initdone = false;
bool plugin = false; // True when called by the XDB plugin handler bool plugin = false; // True when called by the XDB plugin handler
extern "C" { extern "C" {
#if defined(XMSG)
char msglang[16] = "ENGLISH"; // Default language
#endif
extern char version[]; extern char version[];
} // extern "C" } // extern "C"
...@@ -136,10 +133,12 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode) ...@@ -136,10 +133,12 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode)
break; break;
case MSGID_OPEN_MODE_STRERROR: case MSGID_OPEN_MODE_STRERROR:
{char fmt[256];
strcat(strcpy(fmt, MSG(OPEN_MODE_ERROR)), ": %s");
len= snprintf(g->Message, sizeof(g->Message) - 1, len= snprintf(g->Message, sizeof(g->Message) - 1,
MSG(OPEN_MODE_ERROR) ": %s", // Open(%s) error %d on %s: %s fmt, // Open(%s) error %d on %s: %s
mode, (int) errno, path, strerror(errno)); mode, (int) errno, path, strerror(errno));
break; }break;
case MSGID_OPEN_STRERROR: case MSGID_OPEN_STRERROR:
len= snprintf(g->Message, sizeof(g->Message) - 1, len= snprintf(g->Message, sizeof(g->Message) - 1,
......
...@@ -82,7 +82,8 @@ extern HINSTANCE s_hModule; /* Saved module handle */ ...@@ -82,7 +82,8 @@ extern HINSTANCE s_hModule; /* Saved module handle */
#endif // WIN32 #endif // WIN32
#if defined(XMSG) #if defined(XMSG)
extern char msglang[]; extern char *msg_path;
char *msglang(void);
#endif // XMSG #endif // XMSG
/***********************************************************************/ /***********************************************************************/
...@@ -326,8 +327,9 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m) ...@@ -326,8 +327,9 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m)
char *msg; char *msg;
FILE *mfile = NULL; FILE *mfile = NULL;
GetPrivateProfileString("Message", msglang, "Message\\english.msg", //GetPrivateProfileString("Message", msglang, "Message\\english.msg",
msgfile, _MAX_PATH, plgini); // msgfile, _MAX_PATH, plgini);
strcat(strcat(strcpy(msgfile, msg_path), msglang()), ".msg");
if (!(mfile = fopen(msgfile, "rt"))) { if (!(mfile = fopen(msgfile, "rt"))) {
sprintf(stmsg, "Fail to open message file %s for %s", msgfile, msglang); sprintf(stmsg, "Fail to open message file %s for %s", msgfile, msglang);
......
...@@ -21,7 +21,7 @@ char *GetMsgid(int id) ...@@ -21,7 +21,7 @@ char *GetMsgid(int id)
char *p = NULL; char *p = NULL;
switch (id) { switch (id) {
case IDS_00: p = "%s"; break; // case IDS_00: p = "%s"; break;
#if defined(FRENCH) #if defined(FRENCH)
case IDS_01: p = "%s: erreur d'allocation du buffer de communication de %d octets"; break; case IDS_01: p = "%s: erreur d'allocation du buffer de communication de %d octets"; break;
case IDS_02: p = "%s: erreur d'allocation mmoire tampon pour %d colonnes"; break; case IDS_02: p = "%s: erreur d'allocation mmoire tampon pour %d colonnes"; break;
...@@ -115,6 +115,7 @@ char *GetMsgid(int id) ...@@ -115,6 +115,7 @@ char *GetMsgid(int id)
case IDS_DSC_01: p = "Nom"; break; case IDS_DSC_01: p = "Nom"; break;
case IDS_DSC_02: p = "Description"; break; case IDS_DSC_02: p = "Description"; break;
#else // English #else // English
#if 0
case IDS_01: p = "%s: error allocating communication buffer of %d bytes"; break; case IDS_01: p = "%s: error allocating communication buffer of %d bytes"; break;
case IDS_02: p = "%s: error allocating parser memory for %d columns"; break; case IDS_02: p = "%s: error allocating parser memory for %d columns"; break;
case IDS_03: p = "%s: Invalid special command"; break; case IDS_03: p = "%s: Invalid special command"; break;
...@@ -130,6 +131,7 @@ char *GetMsgid(int id) ...@@ -130,6 +131,7 @@ char *GetMsgid(int id)
case IDS_13: p = "%s: invalid connection key value %d"; break; case IDS_13: p = "%s: invalid connection key value %d"; break;
case IDS_14: p = "SafeDB: %s rc=%d"; break; case IDS_14: p = "SafeDB: %s rc=%d"; break;
case IDS_15: p = "Wrong communication Dll called for engine %s"; break; case IDS_15: p = "Wrong communication Dll called for engine %s"; break;
#endif // 0
case IDS_TAB_01: p = "Table_Cat"; break; case IDS_TAB_01: p = "Table_Cat"; break;
case IDS_TAB_02: p = "Table_Schema"; break; case IDS_TAB_02: p = "Table_Schema"; break;
case IDS_TAB_03: p = "Table_Name"; break; case IDS_TAB_03: p = "Table_Name"; break;
...@@ -147,6 +149,7 @@ char *GetMsgid(int id) ...@@ -147,6 +149,7 @@ char *GetMsgid(int id)
case IDS_COL_10: p = "Radix"; break; case IDS_COL_10: p = "Radix"; break;
case IDS_COL_11: p = "Nullable"; break; case IDS_COL_11: p = "Nullable"; break;
case IDS_COL_12: p = "Remarks"; break; case IDS_COL_12: p = "Remarks"; break;
#if 0
case IDS_INF_01: p = "Type_Name"; break; case IDS_INF_01: p = "Type_Name"; break;
case IDS_INF_02: p = "Data_Type"; break; case IDS_INF_02: p = "Data_Type"; break;
case IDS_INF_03: p = "Precision"; break; case IDS_INF_03: p = "Precision"; break;
...@@ -162,12 +165,14 @@ char *GetMsgid(int id) ...@@ -162,12 +165,14 @@ char *GetMsgid(int id)
case IDS_INF_13: p = "Local_Type_Name"; break; case IDS_INF_13: p = "Local_Type_Name"; break;
case IDS_INF_14: p = "Minimum_Scale"; break; case IDS_INF_14: p = "Minimum_Scale"; break;
case IDS_INF_15: p = "Maximum_Scale"; break; case IDS_INF_15: p = "Maximum_Scale"; break;
#endif // 0
case IDS_PKY_01: p = "Table_Catalog"; break; case IDS_PKY_01: p = "Table_Catalog"; break;
case IDS_PKY_02: p = "Table_Schema"; break; case IDS_PKY_02: p = "Table_Schema"; break;
case IDS_PKY_03: p = "Table_Name"; break; case IDS_PKY_03: p = "Table_Name"; break;
case IDS_PKY_04: p = "Column_Name"; break; case IDS_PKY_04: p = "Column_Name"; break;
case IDS_PKY_05: p = "Key_Seq"; break; case IDS_PKY_05: p = "Key_Seq"; break;
case IDS_PKY_06: p = "Pk_Name"; break; case IDS_PKY_06: p = "Pk_Name"; break;
#if 0
case IDS_FKY_01: p = "PKTable_Catalog"; break; case IDS_FKY_01: p = "PKTable_Catalog"; break;
case IDS_FKY_02: p = "PKTable_Schema"; break; case IDS_FKY_02: p = "PKTable_Schema"; break;
case IDS_FKY_03: p = "PKTable_Name"; break; case IDS_FKY_03: p = "PKTable_Name"; break;
...@@ -181,6 +186,7 @@ char *GetMsgid(int id) ...@@ -181,6 +186,7 @@ char *GetMsgid(int id)
case IDS_FKY_11: p = "Delete_Rule"; break; case IDS_FKY_11: p = "Delete_Rule"; break;
case IDS_FKY_12: p = "FK_Name"; break; case IDS_FKY_12: p = "FK_Name"; break;
case IDS_FKY_13: p = "PK_Name"; break; case IDS_FKY_13: p = "PK_Name"; break;
#endif // 0
case IDS_STA_01: p = "Table_Catalog"; break; case IDS_STA_01: p = "Table_Catalog"; break;
case IDS_STA_02: p = "Table_Schema"; break; case IDS_STA_02: p = "Table_Schema"; break;
case IDS_STA_03: p = "Table_Name"; break; case IDS_STA_03: p = "Table_Name"; break;
...@@ -194,6 +200,7 @@ char *GetMsgid(int id) ...@@ -194,6 +200,7 @@ char *GetMsgid(int id)
case IDS_STA_11: p = "Cardinality"; break; case IDS_STA_11: p = "Cardinality"; break;
case IDS_STA_12: p = "Pages"; break; case IDS_STA_12: p = "Pages"; break;
case IDS_STA_13: p = "Filter_Condition"; break; case IDS_STA_13: p = "Filter_Condition"; break;
#if 0
case IDS_SPC_01: p = "Scope"; break; case IDS_SPC_01: p = "Scope"; break;
case IDS_SPC_02: p = "Column_Name"; break; case IDS_SPC_02: p = "Column_Name"; break;
case IDS_SPC_03: p = "Data_Type"; break; case IDS_SPC_03: p = "Data_Type"; break;
...@@ -202,6 +209,7 @@ char *GetMsgid(int id) ...@@ -202,6 +209,7 @@ char *GetMsgid(int id)
case IDS_SPC_06: p = "Length"; break; case IDS_SPC_06: p = "Length"; break;
case IDS_SPC_07: p = "Scale"; break; case IDS_SPC_07: p = "Scale"; break;
case IDS_SPC_08: p = "Pseudo_Column"; break; case IDS_SPC_08: p = "Pseudo_Column"; break;
#endif // 0
case IDS_DRV_01: p = "Description"; break; case IDS_DRV_01: p = "Description"; break;
case IDS_DRV_02: p = "Attributes"; break; case IDS_DRV_02: p = "Attributes"; break;
case IDS_DSC_01: p = "Name"; break; case IDS_DSC_01: p = "Name"; break;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by PlgSock.rc // Used by PlgSock.rc
// //
#if 0
#define IDS_00 115 #define IDS_00 115
#define IDS_01 116 #define IDS_01 116
#define IDS_02 117 #define IDS_02 117
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
#define IDS_19 134 #define IDS_19 134
#define IDS_20 135 #define IDS_20 135
#define IDS_21 136 #define IDS_21 136
#endif // 0
#define IDS_TABLES 143 #define IDS_TABLES 143
#define IDS_TAB_01 144 #define IDS_TAB_01 144
#define IDS_TAB_02 145 #define IDS_TAB_02 145
...@@ -43,6 +45,7 @@ ...@@ -43,6 +45,7 @@
#define IDS_COL_10 169 #define IDS_COL_10 169
#define IDS_COL_11 170 #define IDS_COL_11 170
#define IDS_COL_12 171 #define IDS_COL_12 171
#if 0
#define IDS_INFO 175 #define IDS_INFO 175
#define IDS_INF_01 176 #define IDS_INF_01 176
#define IDS_INF_02 177 #define IDS_INF_02 177
...@@ -59,6 +62,7 @@ ...@@ -59,6 +62,7 @@
#define IDS_INF_13 188 #define IDS_INF_13 188
#define IDS_INF_14 189 #define IDS_INF_14 189
#define IDS_INF_15 190 #define IDS_INF_15 190
#endif // 0
#define IDS_PKEY 191 #define IDS_PKEY 191
#define IDS_PKY_01 192 #define IDS_PKY_01 192
#define IDS_PKY_02 193 #define IDS_PKY_02 193
...@@ -66,6 +70,7 @@ ...@@ -66,6 +70,7 @@
#define IDS_PKY_04 195 #define IDS_PKY_04 195
#define IDS_PKY_05 196 #define IDS_PKY_05 196
#define IDS_PKY_06 197 #define IDS_PKY_06 197
#if 0
#define IDS_FKEY 207 #define IDS_FKEY 207
#define IDS_FKY_01 208 #define IDS_FKY_01 208
#define IDS_FKY_02 209 #define IDS_FKY_02 209
...@@ -80,6 +85,7 @@ ...@@ -80,6 +85,7 @@
#define IDS_FKY_11 218 #define IDS_FKY_11 218
#define IDS_FKY_12 219 #define IDS_FKY_12 219
#define IDS_FKY_13 220 #define IDS_FKY_13 220
#endif // 0
#define IDS_STAT 223 #define IDS_STAT 223
#define IDS_STA_01 224 #define IDS_STA_01 224
#define IDS_STA_02 225 #define IDS_STA_02 225
...@@ -94,6 +100,7 @@ ...@@ -94,6 +100,7 @@
#define IDS_STA_11 234 #define IDS_STA_11 234
#define IDS_STA_12 235 #define IDS_STA_12 235
#define IDS_STA_13 236 #define IDS_STA_13 236
#if 0
#define IDS_SPCOLS 1247 #define IDS_SPCOLS 1247
#define IDS_SPC_01 1248 #define IDS_SPC_01 1248
#define IDS_SPC_02 1249 #define IDS_SPC_02 1249
...@@ -118,6 +125,7 @@ ...@@ -118,6 +125,7 @@
#define IDS_PLG_07 1286 #define IDS_PLG_07 1286
#define IDS_PLG_08 1287 #define IDS_PLG_08 1287
#define IDS_PLG_09 1288 #define IDS_PLG_09 1288
#endif // 0
#define IDS_DRIVER 1290 #define IDS_DRIVER 1290
#define IDS_DRV_01 1291 #define IDS_DRV_01 1291
#define IDS_DRV_02 1292 #define IDS_DRV_02 1292
......
...@@ -197,7 +197,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g) ...@@ -197,7 +197,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
#else // !WIN32 #else // !WIN32
struct stat fileinfo; struct stat fileinfo;
char fn[PATH_MAX], direc[PATH_MAX], pattern[256], ftype[8]; char fn[FN_REFLEN], direc[C], pattern[256], ftype[8];
DIR *dir; DIR *dir;
struct dirent *entry; struct dirent *entry;
......
...@@ -272,7 +272,7 @@ bool STRING::Set(char *s, uint n) ...@@ -272,7 +272,7 @@ bool STRING::Set(char *s, uint n)
if (!s) if (!s)
return false; return false;
uint len = MY_MIN(strlen(s), n) + 1; uint len = strnlen(s, n) + 1;
if (len > Size) { if (len > Size) {
char *p = Realloc(len); char *p = Realloc(len);
......
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