mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
1) Fix bug on strange sprintf
2) Fix bug on bad sprintf 3) Fix bug on cast from pointer to int 4) Begin implementing the "info" tables. Already existing were the ODBC sata source table and the WMI column info table. A common way to handle them will permit to develop many other such tables. Implemented: The ODBC column info table. Modified: ha_connect.cc (4) odbconn.cpp (4) tabodbc.h (4) tabodbc.cpp (4) tabsys.h (3) rcmsg.c (4) tabfmt.cpp (2) tabtbl.cpp (1) resource.h (4) mycat.h (4)
This commit is contained in:
@@ -39,11 +39,27 @@ add_definitions( -DHUGE_SUPPORT -DZIP_SUPPORT )
|
|||||||
#
|
#
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
if(WITH_WARNINGS)
|
if(WITH_WARNINGS)
|
||||||
add_definitions(-Wall -Wfatal-errors -Wextra)
|
add_definitions(-Wall -Wfatal-errors -Wextra -Wmissing-declarations)
|
||||||
message(STATUS "CONNECT: GCC: All warnings enabled")
|
message(STATUS "CONNECT: GCC: All warnings enabled")
|
||||||
else()
|
else()
|
||||||
add_definitions(--no-warnings)
|
add_definitions(-Wall -Wfatal-errors -Wmissing-declarations)
|
||||||
message(STATUS "CONNECT: GCC: All warnings disabled")
|
add_definitions(-Wno-write-strings)
|
||||||
|
add_definitions(-Wno-unused-variable)
|
||||||
|
add_definitions(-Wno-unused-but-set-variable)
|
||||||
|
add_definitions(-Wno-unused-value)
|
||||||
|
add_definitions(-Wno-unused-function)
|
||||||
|
add_definitions(-Wno-parentheses)
|
||||||
|
add_definitions(-Wno-missing-declarations)
|
||||||
|
add_definitions(-Wno-int-to-pointer-cast)
|
||||||
|
add_definitions(-Wno-narrowing)
|
||||||
|
|
||||||
|
# This switch is for pure C only:
|
||||||
|
# add_definitions(-Wno-implicit-function-declaration)
|
||||||
|
# These switches are for C++ only
|
||||||
|
# add_definitions(-Wno-reorder)
|
||||||
|
# add_definitions(-Wno-delete-non-virtual-dtor)
|
||||||
|
|
||||||
|
message(STATUS "CONNECT: GCC: Some warnings disabled")
|
||||||
endif(WITH_WARNINGS)
|
endif(WITH_WARNINGS)
|
||||||
|
|
||||||
add_definitions( -DUNIX -DLINUX -DUBUNTU )
|
add_definitions( -DUNIX -DLINUX -DUBUNTU )
|
||||||
|
@@ -16,30 +16,6 @@
|
|||||||
#define PLG_MAX_PATH 144 /* Must be the same across systems */
|
#define PLG_MAX_PATH 144 /* Must be the same across systems */
|
||||||
#define PLG_BUFF_LEN 100 /* Number of lines in binary file buffer */
|
#define PLG_BUFF_LEN 100 /* Number of lines in binary file buffer */
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
/**************************************************************************/
|
|
||||||
/* Defines specific to Windows and ODBC. */
|
|
||||||
/**************************************************************************/
|
|
||||||
#define SQL_CHAR 1
|
|
||||||
#define SQL_NUMERIC 2
|
|
||||||
#define SQL_DECIMAL 3
|
|
||||||
#define SQL_INTEGER 4
|
|
||||||
#define SQL_SMALLINT 5
|
|
||||||
#define SQL_FLOAT 6
|
|
||||||
#define SQL_REAL 7
|
|
||||||
#define SQL_DOUBLE 8
|
|
||||||
#define SQL_TIMESTAMP 11
|
|
||||||
#define SQL_VARCHAR 12
|
|
||||||
#define SQL_NULLABLE_UNKNOWN 2
|
|
||||||
#define SQL_ALL_EXCEPT_LIKE 2
|
|
||||||
#define SQL_SEARCHABLE 3
|
|
||||||
#define SQL_ALL_TYPES 0
|
|
||||||
#define SQL_TABLE_STAT 0
|
|
||||||
#define SQL_BEST_ROWID 1
|
|
||||||
#define SQL_PC_NOT_PSEUDO 1
|
|
||||||
#define SQL_PC_PSEUDO 2
|
|
||||||
#define SQL_SCOPE_CURROW 0
|
|
||||||
#endif // !WIN32
|
|
||||||
|
|
||||||
//typedef class INDEXDEF *PIXDEF;
|
//typedef class INDEXDEF *PIXDEF;
|
||||||
|
|
||||||
@@ -83,6 +59,7 @@ class DllExport CATALOG {
|
|||||||
friend class OEMDEF;
|
friend class OEMDEF;
|
||||||
public:
|
public:
|
||||||
CATALOG(void); // Constructor
|
CATALOG(void); // Constructor
|
||||||
|
virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
void *GetDescp(void) {return Descp;}
|
void *GetDescp(void) {return Descp;}
|
||||||
|
@@ -46,8 +46,6 @@
|
|||||||
#include "filamap.h"
|
#include "filamap.h"
|
||||||
#include "tabdos.h"
|
#include "tabdos.h"
|
||||||
|
|
||||||
bool PushWarning(PGLOBAL, PTDBASE);
|
|
||||||
|
|
||||||
/* --------------------------- Class MAPFAM -------------------------- */
|
/* --------------------------- Class MAPFAM -------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -166,7 +164,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
if (!(*g->Message))
|
if (!(*g->Message))
|
||||||
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
||||||
"map", rc, filename);
|
"map", (int) rc, filename);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
#ifdef DEBTRACE
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
@@ -70,7 +70,6 @@
|
|||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
PQRYRES PlgAllocResult(PGLOBAL, int, int, int, int *, int *,
|
PQRYRES PlgAllocResult(PGLOBAL, int, int, int, int *, int *,
|
||||||
unsigned int *, bool blank = true, bool nonull = false);
|
unsigned int *, bool blank = true, bool nonull = false);
|
||||||
bool PushWarning(PGLOBAL, PTDBASE);
|
|
||||||
|
|
||||||
extern "C" int trace; // The general trace value
|
extern "C" int trace; // The general trace value
|
||||||
|
|
||||||
@@ -732,7 +731,7 @@ bool DBFFAM::CopyHeader(PGLOBAL g)
|
|||||||
if (fseek(Stream, 0, SEEK_SET))
|
if (fseek(Stream, 0, SEEK_SET))
|
||||||
strcpy(g->Message, "Seek error in CopyHeader");
|
strcpy(g->Message, "Seek error in CopyHeader");
|
||||||
else if ((n = fread(hdr, 1, hlen, Stream)) != hlen)
|
else if ((n = fread(hdr, 1, hlen, Stream)) != hlen)
|
||||||
sprintf(g->Message, MSG(BAD_READ_NUMBER), n, To_File);
|
sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, To_File);
|
||||||
else if ((n = fwrite(hdr, 1, hlen, T_Stream)) != hlen)
|
else if ((n = fwrite(hdr, 1, hlen, T_Stream)) != hlen)
|
||||||
sprintf(g->Message, MSG(WRITE_STRERROR), To_Fbt->Fname
|
sprintf(g->Message, MSG(WRITE_STRERROR), To_Fbt->Fname
|
||||||
, strerror(errno));
|
, strerror(errno));
|
||||||
|
@@ -52,7 +52,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int num_read, num_there, num_eq[2]; // Statistics
|
extern int num_read, num_there, num_eq[2]; // Statistics
|
||||||
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
|
|
||||||
|
|
||||||
/* --------------------------- Class FIXFAM -------------------------- */
|
/* --------------------------- Class FIXFAM -------------------------- */
|
||||||
|
|
||||||
@@ -309,6 +308,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
} else { // Mode == MODE_UPDATE
|
} else { // Mode == MODE_UPDATE
|
||||||
// T_Stream is the temporary stream or the table file stream itself
|
// T_Stream is the temporary stream or the table file stream itself
|
||||||
if (!T_Stream)
|
if (!T_Stream)
|
||||||
|
{
|
||||||
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
|
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
|
||||||
if (OpenTempFile(g))
|
if (OpenTempFile(g))
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
@@ -318,7 +318,7 @@ int FIXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
T_Stream = Stream;
|
T_Stream = Stream;
|
||||||
|
}
|
||||||
Modif++; // Modified line in Update mode
|
Modif++; // Modified line in Update mode
|
||||||
} // endif Mode
|
} // endif Mode
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
|
sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
|
||||||
return true;
|
return true;
|
||||||
} // endif len
|
} // endif len
|
||||||
|
|
||||||
@@ -1136,13 +1136,14 @@ int BGXFAM::WriteBuffer(PGLOBAL g)
|
|||||||
} else { // Mode == MODE_UPDATE
|
} else { // Mode == MODE_UPDATE
|
||||||
// Tfile is the temporary file or the table file handle itself
|
// Tfile is the temporary file or the table file handle itself
|
||||||
if (Tfile == INVALID_HANDLE_VALUE)
|
if (Tfile == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
|
if (UseTemp /*&& Tdbp->GetMode() == MODE_UPDATE*/) {
|
||||||
if (OpenTempFile(g))
|
if (OpenTempFile(g))
|
||||||
return RC_FX;
|
return RC_FX;
|
||||||
|
|
||||||
} else
|
} else
|
||||||
Tfile = Hfile;
|
Tfile = Hfile;
|
||||||
|
}
|
||||||
Modif++; // Modified line in Update mode
|
Modif++; // Modified line in Update mode
|
||||||
} // endif Mode
|
} // endif Mode
|
||||||
|
|
||||||
|
@@ -58,8 +58,6 @@
|
|||||||
extern int num_read, num_there, num_eq[2]; // Statistics
|
extern int num_read, num_there, num_eq[2]; // Statistics
|
||||||
extern "C" int trace;
|
extern "C" int trace;
|
||||||
|
|
||||||
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
|
|
||||||
|
|
||||||
/* --------------------------- Class TXTFAM -------------------------- */
|
/* --------------------------- Class TXTFAM -------------------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -873,7 +871,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
htrc("after read req=%d len=%d\n", req, len);
|
htrc("after read req=%d len=%d\n", req, len);
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
|
sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
|
||||||
return true;
|
return true;
|
||||||
} // endif len
|
} // endif len
|
||||||
|
|
||||||
|
@@ -92,7 +92,6 @@ typedef struct _vecheader {
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
|
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
|
||||||
bool check = true, bool blank = true);
|
bool check = true, bool blank = true);
|
||||||
bool PushWarning(PGLOBAL, PTDBASE);
|
|
||||||
|
|
||||||
/* -------------------------- Class VCTFAM --------------------------- */
|
/* -------------------------- Class VCTFAM --------------------------- */
|
||||||
|
|
||||||
@@ -900,7 +899,7 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
|
sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
|
||||||
return true;
|
return true;
|
||||||
} // endif len
|
} // endif len
|
||||||
|
|
||||||
@@ -1180,7 +1179,7 @@ bool VCTFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
|
|
||||||
if (n != (size_t)Nrec) {
|
if (n != (size_t)Nrec) {
|
||||||
if (errno == NO_ERROR)
|
if (errno == NO_ERROR)
|
||||||
sprintf(g->Message, MSG(BAD_READ_NUMBER), n, To_File);
|
sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, To_File);
|
||||||
else
|
else
|
||||||
sprintf(g->Message, MSG(READ_ERROR),
|
sprintf(g->Message, MSG(READ_ERROR),
|
||||||
To_File, strerror(errno));
|
To_File, strerror(errno));
|
||||||
@@ -1363,7 +1362,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
|
|||||||
|
|
||||||
if (!(*g->Message))
|
if (!(*g->Message))
|
||||||
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
||||||
"map", rc, filename);
|
"map", (int) rc, filename);
|
||||||
|
|
||||||
#ifdef DEBTRACE
|
#ifdef DEBTRACE
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
@@ -2349,7 +2348,7 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (len != req) {
|
if (len != req) {
|
||||||
sprintf(g->Message, MSG(DEL_READ_ERROR), req, len);
|
sprintf(g->Message, MSG(DEL_READ_ERROR), (int) req, (int) len);
|
||||||
return true;
|
return true;
|
||||||
} // endif len
|
} // endif len
|
||||||
|
|
||||||
@@ -2534,7 +2533,7 @@ bool VECFAM::ReadBlock(PGLOBAL g, PVCTCOL colp)
|
|||||||
#else // !WIN32
|
#else // !WIN32
|
||||||
if (errno == NO_ERROR)
|
if (errno == NO_ERROR)
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
sprintf(g->Message, MSG(BAD_READ_NUMBER), n, fn);
|
sprintf(g->Message, MSG(BAD_READ_NUMBER), (int) n, fn);
|
||||||
else
|
else
|
||||||
sprintf(g->Message, MSG(READ_ERROR),
|
sprintf(g->Message, MSG(READ_ERROR),
|
||||||
fn, strerror(errno));
|
fn, strerror(errno));
|
||||||
@@ -2760,7 +2759,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
|
|||||||
|
|
||||||
if (!(*g->Message))
|
if (!(*g->Message))
|
||||||
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
|
||||||
"map", rc, filename);
|
"map", (int) rc, filename);
|
||||||
#ifdef DEBTRACE
|
#ifdef DEBTRACE
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -62,7 +62,6 @@
|
|||||||
/* DB static variables. */
|
/* DB static variables. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
extern int num_read, num_there, num_eq[]; // Statistics
|
extern int num_read, num_there, num_eq[]; // Statistics
|
||||||
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@@ -44,7 +44,6 @@
|
|||||||
#define CRLF 2
|
#define CRLF 2
|
||||||
#else // !WIN32
|
#else // !WIN32
|
||||||
#define CRLF 1
|
#define CRLF 1
|
||||||
#define BOOL my_bool
|
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@@ -157,13 +157,14 @@ void XmlCleanupParserLib(void);
|
|||||||
PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info);
|
PQRYRES DBFColumns(PGLOBAL g, char *fn, BOOL info);
|
||||||
PQRYRES CSVColumns(PGLOBAL g, char *fn, char sep, char q, int hdr, int mxr);
|
PQRYRES CSVColumns(PGLOBAL g, char *fn, char sep, char q, int hdr, int mxr);
|
||||||
#if defined(ODBC_SUPPORT)
|
#if defined(ODBC_SUPPORT)
|
||||||
|
PQRYRES ODBCDataSources(PGLOBAL g, bool info = true);
|
||||||
PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn, bool info);
|
PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn, bool info);
|
||||||
#endif // ODBC_SUPPORT
|
#endif // ODBC_SUPPORT
|
||||||
#if defined(MYSQL_SUPPORT)
|
#if defined(MYSQL_SUPPORT)
|
||||||
PQRYRES ODBCDataSources(PGLOBAL g, bool info = true);
|
|
||||||
PQRYRES MyColumns(PGLOBAL g, char *host, char *db, char *user, char *pwd,
|
PQRYRES MyColumns(PGLOBAL g, char *host, char *db, char *user, char *pwd,
|
||||||
char *table, char *colpat, int port, bool key);
|
char *table, char *colpat, int port, bool key);
|
||||||
#endif // MYSQL_SUPPORT
|
#endif // MYSQL_SUPPORT
|
||||||
|
|
||||||
enum enum_field_types PLGtoMYSQL(int type, bool gdf);
|
enum enum_field_types PLGtoMYSQL(int type, bool gdf);
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *classname, PWMIUT wp= NULL);
|
PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *classname, PWMIUT wp= NULL);
|
||||||
@@ -633,11 +634,13 @@ PGLOBAL ha_connect::GetPlug(THD *thd)
|
|||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Return the value of an option specified in the option list. */
|
/* Return the value of an option specified in the option list. */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
char *ha_connect::GetListOption(char *opname, const char *oplist, char *def)
|
char *ha_connect::GetListOption(const char *opname,
|
||||||
|
const char *oplist,
|
||||||
|
const char *def)
|
||||||
{
|
{
|
||||||
char key[16], val[256];
|
char key[16], val[256];
|
||||||
char *pk, *pv, *pn;
|
char *pk, *pv, *pn;
|
||||||
char *opval= def;
|
char *opval= (char *) def;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (pk= (char*)oplist; ; pk= ++pn) {
|
for (pk= (char*)oplist; ; pk= ++pn) {
|
||||||
@@ -1387,7 +1390,7 @@ int ha_connect::MakeRecord(char *buf)
|
|||||||
|
|
||||||
if (xtrace > 1)
|
if (xtrace > 1)
|
||||||
#if defined(MARIADB)
|
#if defined(MARIADB)
|
||||||
printf("Maps: read=%p write=%p vcol=%p defr=%p defw=%p\n",
|
printf("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n",
|
||||||
*table->read_set->bitmap, *table->write_set->bitmap,
|
*table->read_set->bitmap, *table->write_set->bitmap,
|
||||||
*table->vcol_set->bitmap,
|
*table->vcol_set->bitmap,
|
||||||
*table->def_read_set.bitmap, *table->def_write_set.bitmap);
|
*table->def_read_set.bitmap, *table->def_write_set.bitmap);
|
||||||
@@ -1582,9 +1585,9 @@ int ha_connect::CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Return the string representing an operator. */
|
/* Return the string representing an operator. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
char *ha_connect::GetValStr(OPVAL vop, bool neg)
|
const char *ha_connect::GetValStr(OPVAL vop, bool neg)
|
||||||
{
|
{
|
||||||
char *val;
|
const char *val;
|
||||||
|
|
||||||
switch (vop) {
|
switch (vop) {
|
||||||
case OP_EQ:
|
case OP_EQ:
|
||||||
@@ -2551,7 +2554,8 @@ int ha_connect::rnd_next(uchar *buf)
|
|||||||
ulonglong tb2= my_interval_timer();
|
ulonglong tb2= my_interval_timer();
|
||||||
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
|
double elapsed= (double) (tb2 - xp->tb1) / 1000000000ULL;
|
||||||
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
|
DBUG_PRINT("rnd_next", ("rc=%d nrd=%u fnd=%u nfd=%u sec=%.3lf\n",
|
||||||
rc, xp->nrd, xp->fnd, xp->nfd, elapsed));
|
rc, (uint)xp->nrd, (uint)xp->fnd,
|
||||||
|
(uint)xp->nfd, elapsed));
|
||||||
xp->tb1= tb2;
|
xp->tb1= tb2;
|
||||||
xp->fnd= xp->nfd= 0;
|
xp->fnd= xp->nfd= 0;
|
||||||
} // endif nrd
|
} // endif nrd
|
||||||
@@ -2891,7 +2895,8 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
|
|
||||||
if (xtrace) {
|
if (xtrace) {
|
||||||
printf("%p external_lock: cmdtype=%d\n", this, thd->lex->sql_command);
|
printf("%p external_lock: cmdtype=%d\n", this, thd->lex->sql_command);
|
||||||
printf("Cmd=%s\n", thd->query_string);
|
printf("Cmd=%.*s\n", (int) thd->query_string.length(),
|
||||||
|
thd->query_string.str());
|
||||||
} // endif xtrace
|
} // endif xtrace
|
||||||
|
|
||||||
// Next code is temporarily replaced until sql_command is set
|
// Next code is temporarily replaced until sql_command is set
|
||||||
@@ -3176,7 +3181,6 @@ bool ha_connect::add_fields(THD *thd, void *alt_info,
|
|||||||
engine_option_value *create_options)
|
engine_option_value *create_options)
|
||||||
{
|
{
|
||||||
register Create_field *new_field;
|
register Create_field *new_field;
|
||||||
LEX *lex= thd->lex;
|
|
||||||
Alter_info *alter_info= (Alter_info*)alt_info;
|
Alter_info *alter_info= (Alter_info*)alt_info;
|
||||||
Virtual_column_info *vcol_info= (Virtual_column_info *)vcolinfo;
|
Virtual_column_info *vcol_info= (Virtual_column_info *)vcolinfo;
|
||||||
|
|
||||||
@@ -3276,14 +3280,15 @@ bool ha_connect::add_fields(THD *thd, void *alt_info,
|
|||||||
*/
|
*/
|
||||||
bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
|
bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
|
||||||
{
|
{
|
||||||
char ttp= '?', spc= ',', qch= 0, *typn= "DOS";
|
char ttp= '?', spc= ',', qch= 0;
|
||||||
|
const char *typn= "DOS";
|
||||||
|
const char *user;
|
||||||
char *fn, *dsn, *tab, *db, *host, *user, *pwd, *prt, *sep, *inf;
|
char *fn, *dsn, *tab, *db, *host, *user, *pwd, *prt, *sep, *inf;
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
char *nsp= NULL, *cls= NULL;
|
char *nsp= NULL, *cls= NULL;
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
int port= MYSQL_PORT, hdr= 0, mxr= 0;
|
int port= MYSQL_PORT, hdr= 0, mxr= 0;
|
||||||
bool b= false, ok= false, info= false;
|
bool b= false, ok= false, info= false;
|
||||||
LEX *lex= thd->lex;
|
|
||||||
LEX_STRING *comment, *name;
|
LEX_STRING *comment, *name;
|
||||||
HA_CREATE_INFO *create_info= (HA_CREATE_INFO *)crt_info;
|
HA_CREATE_INFO *create_info= (HA_CREATE_INFO *)crt_info;
|
||||||
engine_option_value *pov;
|
engine_option_value *pov;
|
||||||
@@ -3291,7 +3296,8 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
|
|||||||
PCOLRES crp;
|
PCOLRES crp;
|
||||||
PGLOBAL g= GetPlug(thd);
|
PGLOBAL g= GetPlug(thd);
|
||||||
|
|
||||||
fn= dsn= tab= db= host= user= pwd= prt= sep= inf= NULL;
|
fn= dsn= tab= db= host= pwd= prt= sep= inf= NULL;
|
||||||
|
user= NULL;
|
||||||
|
|
||||||
if (g) {
|
if (g) {
|
||||||
// Set default values
|
// Set default values
|
||||||
@@ -3791,4 +3797,3 @@ void __attribute__((destructor)) fini()
|
|||||||
#endif // LIBXML2_SUPPORT
|
#endif // LIBXML2_SUPPORT
|
||||||
} // end of fini
|
} // end of fini
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
|
@@ -241,7 +241,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual const COND *cond_push(const COND *cond);
|
virtual const COND *cond_push(const COND *cond);
|
||||||
PFIL CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond);
|
PFIL CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond);
|
||||||
char *GetValStr(OPVAL vop, bool neg);
|
const char *GetValStr(OPVAL vop, bool neg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Number of rows in table. It will only be called if
|
Number of rows in table. It will only be called if
|
||||||
@@ -346,7 +346,7 @@ char *GetValStr(OPVAL vop, bool neg);
|
|||||||
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
|
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char *GetListOption(char *opname, const char *oplist, char *def= NULL);
|
char *GetListOption(const char *opname, const char *oplist, const char *def= NULL);
|
||||||
char *encode(PGLOBAL g, char *cnm);
|
char *encode(PGLOBAL g, char *cnm);
|
||||||
bool add_fields(THD *thd, void *alter_info,
|
bool add_fields(THD *thd, void *alter_info,
|
||||||
LEX_STRING *field_name,
|
LEX_STRING *field_name,
|
||||||
|
@@ -36,9 +36,6 @@
|
|||||||
// The types and variables used locally
|
// The types and variables used locally
|
||||||
//typedef int bool;
|
//typedef int bool;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
#define DWORD int
|
|
||||||
#define TRUE 1
|
|
||||||
#define FALSE 0
|
|
||||||
#define SVP(S) ((S) ? S : "<null>")
|
#define SVP(S) ((S) ? S : "<null>")
|
||||||
#define _strlwr(P) strlwr(P) //OB: changed this line
|
#define _strlwr(P) strlwr(P) //OB: changed this line
|
||||||
#define MAX_PATHNAME_LEN 256
|
#define MAX_PATHNAME_LEN 256
|
||||||
@@ -81,7 +78,7 @@ typedef struct tagPROFILESECTION {
|
|||||||
} PROFILESECTION;
|
} PROFILESECTION;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool changed;
|
BOOL changed;
|
||||||
PROFILESECTION *section;
|
PROFILESECTION *section;
|
||||||
//char *dos_name;
|
//char *dos_name;
|
||||||
//char *unix_name;
|
//char *unix_name;
|
||||||
@@ -116,7 +113,7 @@ static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = "";
|
|||||||
|
|
||||||
static const char hex[16] = "0123456789ABCDEF";
|
static const char hex[16] = "0123456789ABCDEF";
|
||||||
|
|
||||||
bool WritePrivateProfileString(LPCSTR section, LPCSTR entry,
|
BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
|
||||||
LPCSTR string, LPCSTR filename );
|
LPCSTR string, LPCSTR filename );
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* PROFILE_CopyEntry
|
* PROFILE_CopyEntry
|
||||||
@@ -350,7 +347,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
|||||||
*
|
*
|
||||||
* Flush the current profile to disk if changed.
|
* Flush the current profile to disk if changed.
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
static bool PROFILE_FlushFile(void)
|
static BOOL PROFILE_FlushFile(void)
|
||||||
{
|
{
|
||||||
//char *p, buffer[MAX_PATHNAME_LEN];
|
//char *p, buffer[MAX_PATHNAME_LEN];
|
||||||
//const char *unix_name;
|
//const char *unix_name;
|
||||||
@@ -436,7 +433,7 @@ static void PROFILE_ReleaseFile(void)
|
|||||||
*
|
*
|
||||||
* Open a profile file, checking the cached file first.
|
* Open a profile file, checking the cached file first.
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
static bool PROFILE_Open(LPCSTR filename)
|
static BOOL PROFILE_Open(LPCSTR filename)
|
||||||
{
|
{
|
||||||
//char buffer[MAX_PATHNAME_LEN];
|
//char buffer[MAX_PATHNAME_LEN];
|
||||||
//char *p;
|
//char *p;
|
||||||
@@ -565,7 +562,7 @@ static bool PROFILE_Open(LPCSTR filename)
|
|||||||
*
|
*
|
||||||
* Delete a section from a profile tree.
|
* Delete a section from a profile tree.
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
static bool PROFILE_DeleteSection(PROFILESECTION* *section, LPCSTR name)
|
static BOOL PROFILE_DeleteSection(PROFILESECTION* *section, LPCSTR name)
|
||||||
{
|
{
|
||||||
while (*section) {
|
while (*section) {
|
||||||
if ((*section)->name[0] && !stricmp((*section)->name, name)) {
|
if ((*section)->name[0] && !stricmp((*section)->name, name)) {
|
||||||
@@ -589,7 +586,7 @@ static bool PROFILE_DeleteSection(PROFILESECTION* *section, LPCSTR name)
|
|||||||
*
|
*
|
||||||
* Delete a key from a profile tree.
|
* Delete a key from a profile tree.
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
static bool PROFILE_DeleteKey(PROFILESECTION* *section,
|
static BOOL PROFILE_DeleteKey(PROFILESECTION* *section,
|
||||||
LPCSTR section_name, LPCSTR key_name)
|
LPCSTR section_name, LPCSTR key_name)
|
||||||
{
|
{
|
||||||
while (*section) {
|
while (*section) {
|
||||||
@@ -656,7 +653,7 @@ void PROFILE_DeleteAllKeys(LPCSTR section_name)
|
|||||||
static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
|
static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
|
||||||
const char *section_name,
|
const char *section_name,
|
||||||
const char *key_name,
|
const char *key_name,
|
||||||
bool create, bool create_always)
|
BOOL create, BOOL create_always)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
int seclen, keylen;
|
int seclen, keylen;
|
||||||
@@ -747,8 +744,8 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
|
|||||||
* If return_values is TRUE, also include the corresponding values.
|
* If return_values is TRUE, also include the corresponding values.
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
static int PROFILE_GetSection(PROFILESECTION *section, LPCSTR section_name,
|
static int PROFILE_GetSection(PROFILESECTION *section, LPCSTR section_name,
|
||||||
LPSTR buffer, uint len, bool handle_env,
|
LPSTR buffer, uint len,
|
||||||
bool return_values)
|
BOOL handle_env, BOOL return_values)
|
||||||
{
|
{
|
||||||
PROFILEKEY *key;
|
PROFILEKEY *key;
|
||||||
|
|
||||||
@@ -927,8 +924,8 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name,
|
|||||||
*
|
*
|
||||||
* Set a profile string.
|
* Set a profile string.
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
static bool PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
|
static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
|
||||||
LPCSTR value, bool create_always)
|
LPCSTR value, BOOL create_always)
|
||||||
{
|
{
|
||||||
if (!key_name) { /* Delete a whole section */
|
if (!key_name) { /* Delete a whole section */
|
||||||
if (trace > 1)
|
if (trace > 1)
|
||||||
@@ -1026,7 +1023,7 @@ char *PROFILE_GetStringItem(char* start)
|
|||||||
static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry,
|
static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry,
|
||||||
LPCSTR def_val, LPSTR buffer,
|
LPCSTR def_val, LPSTR buffer,
|
||||||
uint len, LPCSTR filename,
|
uint len, LPCSTR filename,
|
||||||
bool allow_section_name_copy)
|
BOOL allow_section_name_copy)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
LPSTR pDefVal = NULL;
|
LPSTR pDefVal = NULL;
|
||||||
@@ -1143,10 +1140,10 @@ int GetPrivateProfileSection(LPCSTR section, LPSTR buffer,
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* WritePrivateProfileStringA (KERNEL32.@)
|
* WritePrivateProfileStringA (KERNEL32.@)
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
bool WritePrivateProfileString(LPCSTR section, LPCSTR entry,
|
BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
|
||||||
LPCSTR string, LPCSTR filename)
|
LPCSTR string, LPCSTR filename)
|
||||||
{
|
{
|
||||||
bool ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
EnterCriticalSection( &PROFILE_CritSect );
|
EnterCriticalSection( &PROFILE_CritSect );
|
||||||
|
|
||||||
@@ -1176,10 +1173,10 @@ bool WritePrivateProfileString(LPCSTR section, LPCSTR entry,
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* WritePrivateProfileSectionA (KERNEL32.@)
|
* WritePrivateProfileSectionA (KERNEL32.@)
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
bool WritePrivateProfileSection(LPCSTR section,
|
BOOL WritePrivateProfileSection(LPCSTR section,
|
||||||
LPCSTR string, LPCSTR filename )
|
LPCSTR string, LPCSTR filename )
|
||||||
{
|
{
|
||||||
bool ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
LPSTR p ;
|
LPSTR p ;
|
||||||
|
|
||||||
EnterCriticalSection(&PROFILE_CritSect);
|
EnterCriticalSection(&PROFILE_CritSect);
|
||||||
|
@@ -182,7 +182,7 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
|
|||||||
/* Get a unique char identifier for types. The letter used are: */
|
/* Get a unique char identifier for types. The letter used are: */
|
||||||
/* ABCDEF..I.KLM.O..R.T.VWXY.. */
|
/* ABCDEF..I.KLM.O..R.T.VWXY.. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
char GetTypeID(char *type)
|
char GetTypeID(const char *type)
|
||||||
{
|
{
|
||||||
return (!type) ? 'D' // DOS (default)
|
return (!type) ? 'D' // DOS (default)
|
||||||
: (!stricmp(type, "FMT")) ? 'T' // CSV
|
: (!stricmp(type, "FMT")) ? 'T' // CSV
|
||||||
@@ -569,7 +569,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am)
|
|||||||
/* Get a unique char identifier for types. The letter used are: */
|
/* Get a unique char identifier for types. The letter used are: */
|
||||||
/* ABCDEF..IJKLM.OPQRSTUVWXYZ and Allocate table definition class */
|
/* ABCDEF..IJKLM.OPQRSTUVWXYZ and Allocate table definition class */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
tc= GetTypeID((char*)am);
|
tc= GetTypeID(am);
|
||||||
|
|
||||||
switch (tc) {
|
switch (tc) {
|
||||||
case 'F':
|
case 'F':
|
||||||
|
@@ -24,6 +24,8 @@
|
|||||||
#include "block.h"
|
#include "block.h"
|
||||||
#include "catalog.h"
|
#include "catalog.h"
|
||||||
|
|
||||||
|
char GetTypeID(const char *type);
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* MYCAT: class for managing the CONNECT plugin DB items. */
|
/* MYCAT: class for managing the CONNECT plugin DB items. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -61,4 +63,4 @@ class MYCAT : public CATALOG {
|
|||||||
ha_connect *Hc; // The Connect handler
|
ha_connect *Hc; // The Connect handler
|
||||||
}; // end of class MYCAT
|
}; // end of class MYCAT
|
||||||
|
|
||||||
#endif __MYCAT__H
|
#endif /* __MYCAT__H */
|
||||||
|
@@ -94,7 +94,9 @@ int MYSQLC::GetResultSize(PGLOBAL g, PSZ sql)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Open a MySQL (remote) connection. */
|
/* Open a MySQL (remote) connection. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MYSQLC::Open(PGLOBAL g, PSZ host, PSZ db, PSZ user, PSZ pwd, int pt)
|
int MYSQLC::Open(PGLOBAL g, const char *host, const char *db,
|
||||||
|
const char *user, const char *pwd,
|
||||||
|
int pt)
|
||||||
{
|
{
|
||||||
m_DB = mysql_init(NULL);
|
m_DB = mysql_init(NULL);
|
||||||
|
|
||||||
@@ -182,7 +184,7 @@ int MYSQLC::KillQuery(ulong id)
|
|||||||
{
|
{
|
||||||
char kill[20];
|
char kill[20];
|
||||||
|
|
||||||
sprintf(kill, "KILL QUERY %u", id);
|
sprintf(kill, "KILL QUERY %u", (unsigned int) id);
|
||||||
return (m_DB) ? mysql_query(m_DB, kill) : 1;
|
return (m_DB) ? mysql_query(m_DB, kill) : 1;
|
||||||
} // end of KillQuery
|
} // end of KillQuery
|
||||||
|
|
||||||
@@ -477,7 +479,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
|
|||||||
} // endif m_Row
|
} // endif m_Row
|
||||||
|
|
||||||
for (crp = qrp->Colresp; crp; crp = crp->Next) {
|
for (crp = qrp->Colresp; crp; crp = crp->Next) {
|
||||||
if (row = m_Row + (crp->Ncol - 1))
|
if ((row = m_Row + (crp->Ncol - 1))) {
|
||||||
if (*row)
|
if (*row)
|
||||||
crp->Kdata->SetValue((PSZ)*row, n);
|
crp->Kdata->SetValue((PSZ)*row, n);
|
||||||
else {
|
else {
|
||||||
@@ -486,6 +488,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
|
|||||||
|
|
||||||
crp->Kdata->Reset(n);
|
crp->Kdata->Reset(n);
|
||||||
} // endelse *row
|
} // endelse *row
|
||||||
|
}
|
||||||
|
|
||||||
} // endfor crp
|
} // endfor crp
|
||||||
|
|
||||||
|
@@ -59,8 +59,9 @@ class DllItem MYSQLC {
|
|||||||
// int GetCurPos(void) {return (m_Res) ? N : 0;}
|
// int GetCurPos(void) {return (m_Res) ? N : 0;}
|
||||||
// int GetProgCur(void) {return N;}
|
// int GetProgCur(void) {return N;}
|
||||||
int GetResultSize(PGLOBAL g, PSZ sql);
|
int GetResultSize(PGLOBAL g, PSZ sql);
|
||||||
int Open(PGLOBAL g, PSZ host, PSZ db, PSZ user = "root",
|
int Open(PGLOBAL g, const char *host, const char *db,
|
||||||
PSZ pwd = "*", int pt = 0);
|
const char *user= "root", const char *pwd= "*",
|
||||||
|
int pt= 0);
|
||||||
ulong GetThreadID(void);
|
ulong GetThreadID(void);
|
||||||
ulong ServerVersion(void);
|
ulong ServerVersion(void);
|
||||||
const char *ServerInfo(void);
|
const char *ServerInfo(void);
|
||||||
|
@@ -339,7 +339,6 @@ PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn, bool info)
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Close the local connection. */
|
/* Close the local connection. */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
if (ocp)
|
|
||||||
ocp->Close();
|
ocp->Close();
|
||||||
|
|
||||||
if (!qrp)
|
if (!qrp)
|
||||||
@@ -380,7 +379,7 @@ PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn, bool info)
|
|||||||
/* data sources available on the local host. */
|
/* data sources available on the local host. */
|
||||||
/* Called with info=true to have result column names. */
|
/* Called with info=true to have result column names. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
PQRYRES ODBCDataSources(PGLOBAL g, bool info)
|
PQRYRES ODBCDataSources(PGLOBAL g)
|
||||||
{
|
{
|
||||||
static int dbtype[] = {DB_CHAR, DB_CHAR};
|
static int dbtype[] = {DB_CHAR, DB_CHAR};
|
||||||
static int buftyp[] = {TYPE_STRING, TYPE_STRING};
|
static int buftyp[] = {TYPE_STRING, TYPE_STRING};
|
||||||
@@ -2041,4 +2040,3 @@ void RECSET::Close(SWORD option)
|
|||||||
#endif // 0
|
#endif // 0
|
||||||
} // end of Close
|
} // end of Close
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
|
@@ -90,9 +90,8 @@ class DBX : public BLOCK {
|
|||||||
|
|
||||||
// Implementation (use ThrowDBX to create)
|
// Implementation (use ThrowDBX to create)
|
||||||
RETCODE GetRC(void) {return m_RC;}
|
RETCODE GetRC(void) {return m_RC;}
|
||||||
PSZ GetErrorMessage(int i)
|
const char *GetErrorMessage(int i)
|
||||||
{return (i >=0 && i < MAX_NUM_OF_MSG) ? m_ErrMsg[i]
|
{ return (i >=0 && i < MAX_NUM_OF_MSG) ? m_ErrMsg[i] : "No ODBC error"; }
|
||||||
: "No ODBC error";}
|
|
||||||
protected:
|
protected:
|
||||||
void BuildErrorMessage(ODBConn* pdb, HSTMT hstmt = SQL_NULL_HSTMT);
|
void BuildErrorMessage(ODBConn* pdb, HSTMT hstmt = SQL_NULL_HSTMT);
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ typedef unsigned char BYTE;
|
|||||||
typedef char *LPSTR;
|
typedef char *LPSTR;
|
||||||
typedef char *LPTSTR;
|
typedef char *LPTSTR;
|
||||||
typedef char *PSZ;
|
typedef char *PSZ;
|
||||||
|
typedef long BOOL;
|
||||||
typedef int INT;
|
typedef int INT;
|
||||||
#if !defined(NODW)
|
#if !defined(NODW)
|
||||||
/*
|
/*
|
||||||
@@ -39,19 +40,15 @@ typedef unsigned long DWORD;
|
|||||||
#undef HANDLE
|
#undef HANDLE
|
||||||
typedef int HANDLE;
|
typedef int HANDLE;
|
||||||
|
|
||||||
/* TODO-BAR: remove this */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
typedef int bool;
|
|
||||||
#else
|
|
||||||
#define bool my_bool
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _MAX_PATH PATH_MAX
|
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#define _stricmp strcasecmp
|
#define _stricmp strcasecmp
|
||||||
#define strnicmp strncasecmp
|
#define strnicmp strncasecmp
|
||||||
#define _strnicmp strncasecmp
|
#define _strnicmp strncasecmp
|
||||||
|
#ifdef PATH_MAX
|
||||||
|
#define _MAX_PATH PATH_MAX
|
||||||
|
#else
|
||||||
#define _MAX_PATH 260
|
#define _MAX_PATH 260
|
||||||
|
#endif
|
||||||
#define _MAX_DRIVE 3
|
#define _MAX_DRIVE 3
|
||||||
#define _MAX_DIR 256
|
#define _MAX_DIR 256
|
||||||
#define _MAX_FNAME 256
|
#define _MAX_FNAME 256
|
||||||
|
@@ -14,10 +14,9 @@ my_bool CloseFileHandle(HANDLE h)
|
|||||||
/* code to handle Linux and Solaris */
|
/* code to handle Linux and Solaris */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
//#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#define DWORD int
|
|
||||||
extern FILE *debug;
|
extern FILE *debug;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -195,7 +194,7 @@ char *_fullpath(char *absPath, const char *relPath, size_t maxLength)
|
|||||||
return absPath;
|
return absPath;
|
||||||
} /* end of _fullpath */
|
} /* end of _fullpath */
|
||||||
|
|
||||||
bool MessageBeep(uint i)
|
BOOL MessageBeep(uint i)
|
||||||
{
|
{
|
||||||
// Fixme
|
// Fixme
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -224,7 +223,7 @@ DWORD FormatMessage(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId,
|
|||||||
//if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER)
|
//if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER)
|
||||||
// return 0; /* means error */
|
// return 0; /* means error */
|
||||||
|
|
||||||
n = sprintf(buff, "Error code: %d", dwMessageId);
|
n = sprintf(buff, "Error code: %d", (int) dwMessageId);
|
||||||
strncpy(lpBuffer, buff, nSize);
|
strncpy(lpBuffer, buff, nSize);
|
||||||
return min(n, nSize);
|
return min(n, nSize);
|
||||||
} /* end of FormatMessage */
|
} /* end of FormatMessage */
|
||||||
|
@@ -29,7 +29,7 @@ int GetLastError();
|
|||||||
void _splitpath(const char*, char*, char*, char*, char*);
|
void _splitpath(const char*, char*, char*, char*, char*);
|
||||||
void _makepath(char*, const char*, const char*, const char*, const char*);
|
void _makepath(char*, const char*, const char*, const char*, const char*);
|
||||||
char *_fullpath(char *absPath, const char *relPath, size_t maxLength);
|
char *_fullpath(char *absPath, const char *relPath, size_t maxLength);
|
||||||
bool MessageBeep(uint);
|
BOOL MessageBeep(uint);
|
||||||
unsigned long _filelength(int fd);
|
unsigned long _filelength(int fd);
|
||||||
|
|
||||||
int GetPrivateProfileString(
|
int GetPrivateProfileString(
|
||||||
@@ -48,7 +48,7 @@ uint GetPrivateProfileInt(
|
|||||||
LPCTSTR lpFileName // initialization file name
|
LPCTSTR lpFileName // initialization file name
|
||||||
);
|
);
|
||||||
|
|
||||||
bool WritePrivateProfileString(
|
BOOL WritePrivateProfileString(
|
||||||
LPCTSTR lpAppName, // section name
|
LPCTSTR lpAppName, // section name
|
||||||
LPCTSTR lpKeyName, // key name
|
LPCTSTR lpKeyName, // key name
|
||||||
LPCTSTR lpString, // string to add
|
LPCTSTR lpString, // string to add
|
||||||
@@ -62,7 +62,7 @@ int GetPrivateProfileSection(
|
|||||||
LPCTSTR lpFileName // initialization file name
|
LPCTSTR lpFileName // initialization file name
|
||||||
);
|
);
|
||||||
|
|
||||||
bool WritePrivateProfileSection(
|
BOOL WritePrivateProfileSection(
|
||||||
LPCTSTR lpAppName, // section name
|
LPCTSTR lpAppName, // section name
|
||||||
LPCTSTR lpString, // data
|
LPCTSTR lpString, // data
|
||||||
LPCTSTR lpFileName // file name
|
LPCTSTR lpFileName // file name
|
||||||
@@ -74,10 +74,6 @@ PSZ strlwr(PSZ s);
|
|||||||
typedef size_t FILEPOS;
|
typedef size_t FILEPOS;
|
||||||
//pedef int FILEHANDLE; // UNIX
|
//pedef int FILEHANDLE; // UNIX
|
||||||
|
|
||||||
#ifndef _MAX_PATH
|
|
||||||
#define MAX_PATH 256
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -521,3 +521,5 @@ DllExport void NewPointer(PTABS, void *, void *);
|
|||||||
FILE *global_fopen(GLOBAL *g, int msgid, const char *path, const char *mode);
|
FILE *global_fopen(GLOBAL *g, int msgid, const char *path, const char *mode);
|
||||||
int global_open(GLOBAL *g, int msgid, const char *filename, int flags);
|
int global_open(GLOBAL *g, int msgid, const char *filename, int flags);
|
||||||
int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode);
|
int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode);
|
||||||
|
|
||||||
|
bool PushWarning(PGLOBAL, PTDBASE);
|
||||||
|
@@ -164,7 +164,9 @@ global_open_error_msg(GLOBAL *g, int msgid, const char *path, const char *mode)
|
|||||||
|
|
||||||
case MSGID_OPEN_ERROR_AND_STRERROR:
|
case MSGID_OPEN_ERROR_AND_STRERROR:
|
||||||
len= snprintf(g->Message, sizeof(g->Message) - 1,
|
len= snprintf(g->Message, sizeof(g->Message) - 1,
|
||||||
MSG(OPEN_ERROR) "%s",// "Open error %d in mode %d on %s: %s"
|
//OPEN_ERROR does not work, as it wants mode %d (not %s)
|
||||||
|
//MSG(OPEN_ERROR) "%s",// "Open error %d in mode %d on %s: %s"
|
||||||
|
"Open error %d in mode %s on %s: %s",
|
||||||
errno, mode, path, strerror(errno));
|
errno, mode, path, strerror(errno));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1472,6 +1474,7 @@ DllExport void NewPointer(PTABS t, void *oldv, void *newv)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!t->P1 || t->P1->Num == 50)
|
if (!t->P1 || t->P1->Num == 50)
|
||||||
|
{
|
||||||
if (!(tp = new TABPTR)) {
|
if (!(tp = new TABPTR)) {
|
||||||
PGLOBAL g = t->G;
|
PGLOBAL g = t->G;
|
||||||
|
|
||||||
@@ -1482,6 +1485,7 @@ DllExport void NewPointer(PTABS t, void *oldv, void *newv)
|
|||||||
tp->Num = 0;
|
tp->Num = 0;
|
||||||
t->P1 = tp;
|
t->P1 = tp;
|
||||||
} /* endif tp */
|
} /* endif tp */
|
||||||
|
}
|
||||||
|
|
||||||
t->P1->Old[t->P1->Num] = oldv;
|
t->P1->Old[t->P1->Num] = oldv;
|
||||||
t->P1->New[t->P1->Num++] = newv;
|
t->P1->New[t->P1->Num++] = newv;
|
||||||
|
@@ -459,7 +459,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
|
|||||||
|
|
||||||
sprintf(g->Message,
|
sprintf(g->Message,
|
||||||
"Not enough memory in %s area for request of %u (used=%d free=%d)",
|
"Not enough memory in %s area for request of %u (used=%d free=%d)",
|
||||||
pname, size, pph->To_Free, pph->FreeBlk);
|
pname, (uint) size, pph->To_Free, pph->FreeBlk);
|
||||||
|
|
||||||
#if defined(DEBUG2) || defined(DEBUG3)
|
#if defined(DEBUG2) || defined(DEBUG3)
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/**************** RCMsg C Program Source Code File (.C) ****************/
|
/**************** RCMsg C Program Source Code File (.C) ****************/
|
||||||
/* PROGRAM NAME: RCMSG */
|
/* PROGRAM NAME: RCMSG */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.0 */
|
/* Version 1.1 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT */
|
/* COPYRIGHT */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND: 2005 */
|
/* (C) Copyright to the author Olivier BERTRAND: 2005 - 2013 */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES */
|
/* WHAT THIS PROGRAM DOES */
|
||||||
/* ----------------------- */
|
/* ----------------------- */
|
||||||
|
@@ -471,7 +471,7 @@ void BINCOL::WriteColumn(PGLOBAL g)
|
|||||||
break;
|
break;
|
||||||
case 'C': // Characters
|
case 'C': // Characters
|
||||||
if ((n = (signed)strlen(Value->GetCharString(Buf))) > Long) {
|
if ((n = (signed)strlen(Value->GetCharString(Buf))) > Long) {
|
||||||
sprintf(g->Message, MSG(BIN_F_TOO_LONG), Name, n, Long);
|
sprintf(g->Message, MSG(BIN_F_TOO_LONG), Name, (int) n, Long);
|
||||||
longjmp(g->jumper[g->jump_level], 31);
|
longjmp(g->jumper[g->jump_level], 31);
|
||||||
} // endif n
|
} // endif n
|
||||||
|
|
||||||
|
@@ -271,7 +271,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
|
|||||||
|
|
||||||
} // endif Mul
|
} // endif Mul
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
suite:
|
suite:
|
||||||
|
#endif
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
Filenames = (char**)PlugSubAlloc(g, NULL, n * sizeof(char*));
|
Filenames = (char**)PlugSubAlloc(g, NULL, n * sizeof(char*));
|
||||||
|
|
||||||
|
@@ -78,8 +78,10 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
|
|||||||
/* of a MySQL table that will be retrieved by GetData commands. */
|
/* of a MySQL table that will be retrieved by GetData commands. */
|
||||||
/* key = TRUE when called from Create Table to get key informations. */
|
/* key = TRUE when called from Create Table to get key informations. */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
PQRYRES MyColumns(PGLOBAL g, char *host, char *db, char *user, char *pwd,
|
PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
|
||||||
char *table, char *colpat, int port, bool key)
|
const char *user, const char *pwd,
|
||||||
|
const char *table, const char *colpat,
|
||||||
|
int port, bool key)
|
||||||
{
|
{
|
||||||
static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR, DB_INT,
|
static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR, DB_INT,
|
||||||
DB_INT, DB_SHORT, DB_CHAR, DB_CHAR};
|
DB_INT, DB_SHORT, DB_CHAR, DB_CHAR};
|
||||||
|
@@ -137,3 +137,7 @@ class MYSQLCOL : public COLBLK {
|
|||||||
int Rank; // Rank (position) number in the query
|
int Rank; // Rank (position) number in the query
|
||||||
}; // end of class MYSQLCOL
|
}; // end of class MYSQLCOL
|
||||||
|
|
||||||
|
|
||||||
|
PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
|
||||||
|
const char *user, const char *pwd,
|
||||||
|
const char *table, const char *colpat, int port, bool key);
|
||||||
|
@@ -74,7 +74,7 @@
|
|||||||
#include "sql_string.h"
|
#include "sql_string.h"
|
||||||
|
|
||||||
extern "C" char *GetMsgid(int id);
|
extern "C" char *GetMsgid(int id);
|
||||||
PQRYRES ODBCDataSources(PGLOBAL g, bool info = false);
|
PQRYRES ODBCDataSources(PGLOBAL g);
|
||||||
PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn, bool info);
|
PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn, bool info);
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -934,6 +934,8 @@ PCOL TDBOIF::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n)
|
|||||||
if (!stricmp(colp->Name, GetMsgid(ID + i)))
|
if (!stricmp(colp->Name, GetMsgid(ID + i)))
|
||||||
colp->Flag = i;
|
colp->Flag = i;
|
||||||
|
|
||||||
|
} // endif Flag
|
||||||
|
|
||||||
return colp;
|
return colp;
|
||||||
} // end of MakeCol
|
} // end of MakeCol
|
||||||
|
|
||||||
|
@@ -195,7 +195,7 @@ class TDBOIF : public TDBASE {
|
|||||||
bool InitCol(PGLOBAL g);
|
bool InitCol(PGLOBAL g);
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
PQRYRES Qrp; // Result set
|
PQRYRES Qrp;
|
||||||
int ID; // Base of Column names
|
int ID; // Base of Column names
|
||||||
int NC; // Number of valid flags
|
int NC; // Number of valid flags
|
||||||
int N; // Row number
|
int N; // Row number
|
||||||
@@ -257,4 +257,3 @@ class TDBOCL : public TDBOIF {
|
|||||||
char *Tabn; // Points to ODBC table name
|
char *Tabn; // Points to ODBC table name
|
||||||
}; // end of class TDBOCL
|
}; // end of class TDBOCL
|
||||||
#endif // !NODBC
|
#endif // !NODBC
|
||||||
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*************** TabSys H Declares Source Code File (.H) ***************/
|
/*************** TabSys H Declares Source Code File (.H) ***************/
|
||||||
/* Name: TABSYS.H Version 2.2 */
|
/* Name: TABSYS.H Version 2.2 */
|
||||||
/* */
|
/* */
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
/************* TabTbl C++ Program Source Code File (.CPP) **************/
|
/************* TabTbl C++ Program Source Code File (.CPP) **************/
|
||||||
/* PROGRAM NAME: TABTBL */
|
/* PROGRAM NAME: TABTBL */
|
||||||
/* ------------- */
|
/* ------------- */
|
||||||
/* Version 1.3 */
|
/* Version 1.4 */
|
||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to PlugDB Software Development 2008-2012 */
|
/* (C) Copyright to PlugDB Software Development 2008-2013 */
|
||||||
/* Author: Olivier BERTRAND */
|
/* Author: Olivier BERTRAND */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
|
@@ -59,8 +59,6 @@ extern int trace;
|
|||||||
#define XMLSUP "libxml2"
|
#define XMLSUP "libxml2"
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
|
|
||||||
|
|
||||||
/* -------------- Implementation of the XMLDEF class ---------------- */
|
/* -------------- Implementation of the XMLDEF class ---------------- */
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -1201,7 +1199,7 @@ void XMLCOL::ReadColumn(PGLOBAL g)
|
|||||||
if (ValNode) {
|
if (ValNode) {
|
||||||
if (ValNode->GetType() != XML_ELEMENT_NODE &&
|
if (ValNode->GetType() != XML_ELEMENT_NODE &&
|
||||||
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
|
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
|
||||||
sprintf(g->Message, MSG(BAD_VALNODE), Name, ValNode->GetType());
|
sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||||
} // endif type
|
} // endif type
|
||||||
|
|
||||||
@@ -1394,7 +1392,7 @@ void XMULCOL::ReadColumn(PGLOBAL g)
|
|||||||
|
|
||||||
if (ValNode->GetType() != XML_ELEMENT_NODE &&
|
if (ValNode->GetType() != XML_ELEMENT_NODE &&
|
||||||
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
|
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
|
||||||
sprintf(g->Message, MSG(BAD_VALNODE), Name, ValNode->GetType());
|
sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||||
} // endif type
|
} // endif type
|
||||||
|
|
||||||
|
@@ -144,7 +144,7 @@ bool user_connect::CheckCleanup(void)
|
|||||||
last_query_id= thdp->query_id;
|
last_query_id= thdp->query_id;
|
||||||
|
|
||||||
if (xtrace)
|
if (xtrace)
|
||||||
printf("=====> Begin new query %d\n", last_query_id);
|
printf("=====> Begin new query %llu\n", last_query_id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} // endif query_id
|
} // endif query_id
|
||||||
|
@@ -705,7 +705,7 @@ char *STRING::GetShortString(char *p, int n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
char *STRING::GetIntString(char *p, int n)
|
char *STRING::GetIntString(char *p, int n)
|
||||||
{
|
{
|
||||||
sprintf(p, "%*d", n, atol(Strp));
|
sprintf(p, "%*ld", n, atol(Strp));
|
||||||
return p;
|
return p;
|
||||||
} // end of GetIntString
|
} // end of GetIntString
|
||||||
|
|
||||||
@@ -4336,7 +4336,7 @@ char *DFVAL::GetShortString(char *p, int n)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
char *DFVAL::GetIntString(char *p, int n)
|
char *DFVAL::GetIntString(char *p, int n)
|
||||||
{
|
{
|
||||||
sprintf(p, "%*ld", n, (int)Fval);
|
sprintf(p, "%*ld", n, (long) Fval);
|
||||||
return p;
|
return p;
|
||||||
} // end of GetIntString
|
} // end of GetIntString
|
||||||
|
|
||||||
|
@@ -2109,7 +2109,7 @@ bool XFILE::Open(PGLOBAL g, char *filename, MODE mode)
|
|||||||
/* Position the cursor at end of file so ftell returns file size. */
|
/* Position the cursor at end of file so ftell returns file size. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
if (fseek(Xfile, 0, SEEK_END)) {
|
if (fseek(Xfile, 0, SEEK_END)) {
|
||||||
sprintf(g->Message, MSG(FUNC_ERRNO), "Xseek", errno);
|
sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek");
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -2140,7 +2140,7 @@ bool XFILE::Seek(PGLOBAL g, int low, int high, int origin)
|
|||||||
#endif // !_DEBUG
|
#endif // !_DEBUG
|
||||||
|
|
||||||
if (fseek(Xfile, low, origin)) {
|
if (fseek(Xfile, low, origin)) {
|
||||||
sprintf(g->Message, MSG(FUNC_ERRNO), "Xseek", errno);
|
sprintf(g->Message, MSG(FUNC_ERRNO), errno, "Xseek");
|
||||||
return true;
|
return true;
|
||||||
} // endif
|
} // endif
|
||||||
|
|
||||||
@@ -2830,7 +2830,7 @@ int XXROW::FastFind(int nk)
|
|||||||
/* KXYCOL public constructor. */
|
/* KXYCOL public constructor. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
KXYCOL::KXYCOL(PKXBASE kp) : To_Keys(Keys.Memp),
|
KXYCOL::KXYCOL(PKXBASE kp) : To_Keys(Keys.Memp),
|
||||||
Kof((CPINT&)Koff.Memp), To_Bkeys(Bkeys.Memp)
|
To_Bkeys(Bkeys.Memp), Kof((CPINT&)Koff.Memp)
|
||||||
{
|
{
|
||||||
Next = NULL;
|
Next = NULL;
|
||||||
Previous = NULL;
|
Previous = NULL;
|
||||||
|
Reference in New Issue
Block a user