Commit 78f11e8e authored by Alexander Barkov's avatar Alexander Barkov

Merge 10.0-connect -> 10.0

parents a0de0fd5 1b1ffe40
/*************** Colblk H Declares Source Code File (.H) ***************/ /*************** Colblk H Declares Source Code File (.H) ***************/
/* Name: COLBLK.H Version 1.6 */ /* Name: COLBLK.H Version 1.7 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */ /* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
/* */ /* */
/* This file contains the COLBLK and derived classes declares. */ /* This file contains the COLBLK and derived classes declares. */
/***********************************************************************/ /***********************************************************************/
...@@ -99,7 +99,7 @@ class DllExport COLBLK : public XOBJECT { ...@@ -99,7 +99,7 @@ class DllExport COLBLK : public XOBJECT {
/***********************************************************************/ /***********************************************************************/
/* Class SPCBLK: Base class for special column descriptors. */ /* Class SPCBLK: Base class for special column descriptors. */
/***********************************************************************/ /***********************************************************************/
class SPCBLK : public COLBLK { class DllExport SPCBLK : public COLBLK {
public: public:
// Constructor // Constructor
SPCBLK(PCOLUMN cp); SPCBLK(PCOLUMN cp);
...@@ -121,7 +121,7 @@ class SPCBLK : public COLBLK { ...@@ -121,7 +121,7 @@ class SPCBLK : public COLBLK {
/***********************************************************************/ /***********************************************************************/
/* Class RIDBLK: ROWID special column descriptor. */ /* Class RIDBLK: ROWID special column descriptor. */
/***********************************************************************/ /***********************************************************************/
class RIDBLK : public SPCBLK { class DllExport RIDBLK : public SPCBLK {
public: public:
// Constructor // Constructor
RIDBLK(PCOLUMN cp, bool rnm); RIDBLK(PCOLUMN cp, bool rnm);
...@@ -140,7 +140,7 @@ class RIDBLK : public SPCBLK { ...@@ -140,7 +140,7 @@ class RIDBLK : public SPCBLK {
/***********************************************************************/ /***********************************************************************/
/* Class FIDBLK: FILEID special column descriptor. */ /* Class FIDBLK: FILEID special column descriptor. */
/***********************************************************************/ /***********************************************************************/
class FIDBLK : public SPCBLK { class DllExport FIDBLK : public SPCBLK {
public: public:
// Constructor // Constructor
FIDBLK(PCOLUMN cp); FIDBLK(PCOLUMN cp);
...@@ -161,7 +161,7 @@ class FIDBLK : public SPCBLK { ...@@ -161,7 +161,7 @@ class FIDBLK : public SPCBLK {
/***********************************************************************/ /***********************************************************************/
/* Class TIDBLK: TABID special column descriptor. */ /* Class TIDBLK: TABID special column descriptor. */
/***********************************************************************/ /***********************************************************************/
class TIDBLK : public SPCBLK { class DllExport TIDBLK : public SPCBLK {
public: public:
// Constructor // Constructor
TIDBLK(PCOLUMN cp); TIDBLK(PCOLUMN cp);
...@@ -186,7 +186,7 @@ class TIDBLK : public SPCBLK { ...@@ -186,7 +186,7 @@ class TIDBLK : public SPCBLK {
/***********************************************************************/ /***********************************************************************/
/* Class SIDBLK: SERVID special column descriptor. */ /* Class SIDBLK: SERVID special column descriptor. */
/***********************************************************************/ /***********************************************************************/
class SIDBLK : public SPCBLK { class DllExport SIDBLK : public SPCBLK {
public: public:
// Constructor // Constructor
SIDBLK(PCOLUMN cp); SIDBLK(PCOLUMN cp);
......
...@@ -347,7 +347,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, ...@@ -347,7 +347,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
if (xtrace) if (xtrace)
printf("About to open the table: tdbp=%p\n", tdbp); printf("About to open the table: tdbp=%p\n", tdbp);
if (mode != MODE_ANY) { if (mode != MODE_ANY && mode != MODE_ALTER) {
if (tdbp->OpenDB(g)) { if (tdbp->OpenDB(g)) {
printf("%s\n", g->Message); printf("%s\n", g->Message);
return true; return true;
......
...@@ -535,7 +535,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -535,7 +535,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
if (!Stream) if (!Stream)
return RC_EF; return RC_EF;
if (trace) if (trace > 1)
htrc("ReadBuffer: Tdbp=%p To_Line=%p Placed=%d\n", htrc("ReadBuffer: Tdbp=%p To_Line=%p Placed=%d\n",
Tdbp, Tdbp->To_Line, Placed); Tdbp, Tdbp->To_Line, Placed);
...@@ -548,20 +548,20 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -548,20 +548,20 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
CurBlk = (int)Rows++; CurBlk = (int)Rows++;
if (trace) if (trace > 1)
htrc("ReadBuffer: CurBlk=%d\n", CurBlk); htrc("ReadBuffer: CurBlk=%d\n", CurBlk);
} else } else
Placed = false; Placed = false;
if (trace) if (trace > 1)
htrc(" About to read: stream=%p To_Buf=%p Buflen=%d\n", htrc(" About to read: stream=%p To_Buf=%p Buflen=%d\n",
Stream, To_Buf, Buflen); Stream, To_Buf, Buflen);
if (fgets(To_Buf, Buflen, Stream)) { if (fgets(To_Buf, Buflen, Stream)) {
p = To_Buf + strlen(To_Buf) - 1; p = To_Buf + strlen(To_Buf) - 1;
if (trace) if (trace > 1)
htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p); htrc(" Read: To_Buf=%p p=%c\n", To_Buf, To_Buf, p);
#if defined(UNIX) #if defined(UNIX)
...@@ -589,7 +589,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -589,7 +589,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
} else if (*p == '\n') } else if (*p == '\n')
*p = '\0'; // Eliminate ending new-line character *p = '\0'; // Eliminate ending new-line character
if (trace) if (trace > 1)
htrc(" To_Buf='%s'\n", To_Buf); htrc(" To_Buf='%s'\n", To_Buf);
strcpy(Tdbp->To_Line, To_Buf); strcpy(Tdbp->To_Line, To_Buf);
...@@ -610,7 +610,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g) ...@@ -610,7 +610,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
rc = RC_FX; rc = RC_FX;
} // endif's fgets } // endif's fgets
if (trace) if (trace > 1)
htrc("ReadBuffer: rc=%d\n", rc); htrc("ReadBuffer: rc=%d\n", rc);
IsRead = true; IsRead = true;
......
...@@ -219,9 +219,10 @@ typedef struct _global { /* Global structure */ ...@@ -219,9 +219,10 @@ typedef struct _global { /* Global structure */
uint Sarea_Size; /* Work area size */ uint Sarea_Size; /* Work area size */
PACTIVITY Activityp, ActivityStart; PACTIVITY Activityp, ActivityStart;
char Message[MAX_STR]; char Message[MAX_STR];
short Trace;
int Createas; /* To pass info to created table */ int Createas; /* To pass info to created table */
void *Xchk; /* indexes in create/alter */ void *Xchk; /* indexes in create/alter */
short Alchecked; /* Checked for ALTER */
short Trace;
int jump_level; int jump_level;
jmp_buf jumper[MAX_JUMP + 2]; jmp_buf jumper[MAX_JUMP + 2];
} GLOBAL; } GLOBAL;
......
This diff is collapsed.
...@@ -50,9 +50,20 @@ typedef struct _xinfo { ...@@ -50,9 +50,20 @@ typedef struct _xinfo {
class XCHK : public BLOCK { class XCHK : public BLOCK {
public: public:
XCHK(void) {oldsep= newsep= false; oldpix= newpix= NULL;} XCHK(void) {oldsep= newsep= false;
oldopn= newopn= NULL;
oldpix= newpix= NULL;}
inline char *SetName(PGLOBAL g, char *name) {
char *nm= NULL;
if (name) {nm= (char*)PlugSubAlloc(g, NULL, strlen(name) + 1);
strcpy(nm, name);}
return nm;}
bool oldsep; // Sepindex before create/alter bool oldsep; // Sepindex before create/alter
bool newsep; // Sepindex after create/alter bool newsep; // Sepindex after create/alter
char *oldopn; // Optname before create/alter
char *newopn; // Optname after create/alter
PIXDEF oldpix; // The indexes before create/alter PIXDEF oldpix; // The indexes before create/alter
PIXDEF newpix; // The indexes after create/alter PIXDEF newpix; // The indexes after create/alter
}; // end of class XCHK }; // end of class XCHK
...@@ -156,15 +167,20 @@ class ha_connect: public handler ...@@ -156,15 +167,20 @@ class ha_connect: public handler
// CONNECT Implementation // CONNECT Implementation
static bool connect_init(void); static bool connect_init(void);
static bool connect_end(void); static bool connect_end(void);
TABTYPE GetRealType(PTOS pos);
char *GetStringOption(char *opname, char *sdef= NULL); char *GetStringOption(char *opname, char *sdef= NULL);
PTOS GetTableOptionStruct(TABLE *table_arg); PTOS GetTableOptionStruct(TABLE *table_arg);
bool GetBooleanOption(char *opname, bool bdef); bool GetBooleanOption(char *opname, bool bdef);
bool SetBooleanOption(char *opname, bool b); bool SetBooleanOption(char *opname, bool b);
int GetIntegerOption(char *opname); int GetIntegerOption(char *opname);
bool SetIntegerOption(char *opname, int n); bool SetIntegerOption(char *opname, int n);
bool SameChar(TABLE *tab, char *opn);
bool SameInt(TABLE *tab, char *opn);
bool SameBool(TABLE *tab, char *opn);
bool FileExists(const char *fn);
PFOS GetFieldOptionStruct(Field *fp); PFOS GetFieldOptionStruct(Field *fp);
void *GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf); void *GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf);
PIXDEF GetIndexInfo(void); PIXDEF GetIndexInfo(TABLE_SHARE *s= NULL);
const char *GetDBName(const char *name); const char *GetDBName(const char *name);
const char *GetTableName(void); const char *GetTableName(void);
//int GetColNameLen(Field *fp); //int GetColNameLen(Field *fp);
...@@ -199,18 +215,19 @@ class ha_connect: public handler ...@@ -199,18 +215,19 @@ class ha_connect: public handler
*/ */
const char **bas_ext() const; const char **bas_ext() const;
/**
Check if a storage engine supports a particular alter table in-place
@note Called without holding thr_lock.c lock.
*/
virtual enum_alter_inplace_result
check_if_supported_inplace_alter(TABLE *altered_table,
Alter_inplace_info *ha_alter_info);
/** @brief /** @brief
This is a list of flags that indicate what functionality the storage engine This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h implements. The current table flags are documented in handler.h
*/ */
ulonglong table_flags() const ulonglong table_flags() const;
{
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_HAS_RECORDS |
HA_NO_AUTO_INCREMENT | HA_NO_PREFIX_CHAR_KEYS |
HA_NO_COPY_ON_ALTER | HA_CAN_VIRTUAL_COLUMNS |
HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
/*HA_NULL_IN_KEY |*/ HA_MUST_USE_TABLE_CONDITION_PUSHDOWN);
}
/** @brief /** @brief
This is a bitmap of flags that indicates how the storage engine This is a bitmap of flags that indicates how the storage engine
...@@ -464,6 +481,7 @@ const char *GetValStr(OPVAL vop, bool neg); ...@@ -464,6 +481,7 @@ const char *GetValStr(OPVAL vop, bool neg);
XINFO xinfo; // The table info structure XINFO xinfo; // The table info structure
bool valid_info; // True if xinfo is valid bool valid_info; // True if xinfo is valid
bool stop; // Used when creating index bool stop; // Used when creating index
bool alter; // True when converting to other engine
int indexing; // Type of indexing for CONNECT int indexing; // Type of indexing for CONNECT
int locked; // Table lock int locked; // Table lock
THR_LOCK_DATA lock_data; THR_LOCK_DATA lock_data;
......
...@@ -98,6 +98,8 @@ extern "C" HINSTANCE s_hModule; // Saved module handle ...@@ -98,6 +98,8 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
extern int xtrace; extern int xtrace;
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
/***********************************************************************/ /***********************************************************************/
/* Get a unique enum table type ID. */ /* Get a unique enum table type ID. */
/***********************************************************************/ /***********************************************************************/
...@@ -259,6 +261,89 @@ uint GetFuncID(const char *func) ...@@ -259,6 +261,89 @@ uint GetFuncID(const char *func)
return fnc; return fnc;
} // end of GetFuncID } // end of GetFuncID
/***********************************************************************/
/* OEMColumn: Get table column info for an OEM table. */
/***********************************************************************/
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info)
{
typedef PQRYRES (__stdcall *XCOLDEF) (PGLOBAL, void*, char*, char*, bool);
const char *module, *subtype;
char c, getname[40] = "Col";
#if defined(WIN32)
HANDLE hdll; /* Handle to the external DLL */
#else // !WIN32
void *hdll; /* Handle for the loaded shared library */
#endif // !WIN32
XCOLDEF coldef = NULL;
PQRYRES qrp = NULL;
module = topt->module;
subtype = topt->subtype;
if (!module || !subtype)
return NULL;
// The exported name is always in uppercase
for (int i = 0; ; i++) {
c = subtype[i];
getname[i + 3] = toupper(c);
if (!c) break;
} // endfor i
#if defined(WIN32)
// Load the Dll implementing the table
if (!(hdll = LoadLibrary(module))) {
char buf[256];
DWORD rc = GetLastError();
sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, module);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0,
(LPTSTR)buf, sizeof(buf), NULL);
strcat(strcat(g->Message, ": "), buf);
return NULL;
} // endif hDll
// Get the function returning an instance of the external DEF class
if (!(coldef = (XCOLDEF)GetProcAddress((HINSTANCE)hdll, getname))) {
sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname);
FreeLibrary((HMODULE)hdll);
return NULL;
} // endif coldef
#else // !WIN32
const char *error = NULL;
// Load the desired shared library
if (!(hdll = dlopen(module, RTLD_LAZY))) {
error = dlerror();
sprintf(g->Message, MSG(SHARED_LIB_ERR), module, SVP(error));
return NULL;
} // endif Hdll
// Get the function returning an instance of the external DEF class
if (!(coldef = (XCOLDEF)dlsym(hdll, getname))) {
error = dlerror();
sprintf(g->Message, MSG(GET_FUNC_ERR), getname, SVP(error));
dlclose(hdll);
return NULL;
} // endif coldef
#endif // !WIN32
// Just in case the external Get function does not set error messages
sprintf(g->Message, "Error getting column info from %s", subtype);
// Get the table column definition
qrp = coldef(g, topt, tab, db, info);
#if defined(WIN32)
FreeLibrary((HMODULE)hdll);
#else // !WIN32
dlclose(hdll);
#endif // !WIN32
return qrp;
} // end of OEMColumns
/* ------------------------- Class CATALOG --------------------------- */ /* ------------------------- Class CATALOG --------------------------- */
/***********************************************************************/ /***********************************************************************/
......
...@@ -50,8 +50,6 @@ dept INT(4) NOT NULL FIELD_FORMAT='S' ...@@ -50,8 +50,6 @@ dept INT(4) NOT NULL FIELD_FORMAT='S'
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ERROR HY000: Table 't1' is read only ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=NO; ALTER TABLE t1 READONLY=NO;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -71,8 +69,6 @@ fig name birth id salary dept ...@@ -71,8 +69,6 @@ fig name birth id salary dept
5555 RONALD 1980-02-26 3333 4444.44 555 5555 RONALD 1980-02-26 3333 4444.44 555
7777 BILL 1973-06-30 4444 5555.56 777 7777 BILL 1973-06-30 4444 5555.56 777
ALTER TABLE t1 READONLY=YES; ALTER TABLE t1 READONLY=YES;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -63,8 +63,6 @@ Archibald 2001-05-17 3 ...@@ -63,8 +63,6 @@ Archibald 2001-05-17 3
Nabucho 2003-08-12 2 Nabucho 2003-08-12 2
RONALD 1980-02-26 4 RONALD 1980-02-26 4
ALTER TABLE t1 READONLY=no; ALTER TABLE t1 READONLY=no;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -80,8 +78,6 @@ Nabucho 2003-08-12 2 ...@@ -80,8 +78,6 @@ Nabucho 2003-08-12 2
RONALD 1980-02-26 4 RONALD 1980-02-26 4
BILL 1973-06-30 5 BILL 1973-06-30 5
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -69,8 +69,6 @@ a ...@@ -69,8 +69,6 @@ a
10 10
20 20
ALTER TABLE t1 READONLY=Yes; ALTER TABLE t1 READONLY=Yes;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -85,8 +83,6 @@ ERROR HY000: Table 't1' is read only ...@@ -85,8 +83,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=NO; ALTER TABLE t1 READONLY=NO;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -508,12 +504,12 @@ DROP TABLE IF EXISTS t1; ...@@ -508,12 +504,12 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(10) NOT NULL a VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1c.dbf';
INSERT INTO t1 VALUES ('10'); INSERT INTO t1 VALUES ('10');
SELECT * FROM t1; SELECT * FROM t1;
a a
10 10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf'); CALL dbf_header('MYSQLD_DATADIR/test/t1c.dbf');
-------- -------- -------- --------
FileSize 77 FileSize 77
DBF_Version 03 DBF_Version 03
...@@ -532,17 +528,15 @@ Dec 0 ...@@ -532,17 +528,15 @@ Dec 0
Flags 00 Flags 00
-------- -------- -------- --------
ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL; ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(10) NOT NULL `a` varchar(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1c.dbf'
SELECT * FROM t1; SELECT * FROM t1;
a a
10 10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf'); CALL dbf_header('MYSQLD_DATADIR/test/t1c.dbf');
-------- -------- -------- --------
FileSize 77 FileSize 77
DBF_Version 03 DBF_Version 03
...@@ -561,15 +555,17 @@ Dec 0 ...@@ -561,15 +555,17 @@ Dec 0
Flags 00 Flags 00
-------- -------- -------- --------
ALTER TABLE t1 MODIFY a INT(10) NOT NULL; ALTER TABLE t1 MODIFY a INT(10) NOT NULL;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(10) NOT NULL `a` int(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1c.dbf'
SELECT * FROM t1; SELECT * FROM t1;
a a
10 10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf'); CALL dbf_header('MYSQLD_DATADIR/test/t1c.dbf');
-------- -------- -------- --------
FileSize 77 FileSize 77
DBF_Version 03 DBF_Version 03
......
...@@ -13,8 +13,6 @@ boys .txt 282 ...@@ -13,8 +13,6 @@ boys .txt 282
boys2 .txt 282 boys2 .txt 282
boyswin .txt 288 boyswin .txt 288
ALTER TABLE t1 OPTION_LIST='subdir=0'; ALTER TABLE t1 OPTION_LIST='subdir=0';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -22,8 +22,6 @@ SELECT * FROM t1; ...@@ -22,8 +22,6 @@ SELECT * FROM t1;
id id
10 10
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -38,8 +36,6 @@ ERROR HY000: Table 't1' is read only ...@@ -38,8 +36,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=0; ALTER TABLE t1 READONLY=0;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -37,8 +37,6 @@ SUM(brut) ...@@ -37,8 +37,6 @@ SUM(brut)
# Testing file mapping # Testing file mapping
# #
ALTER TABLE t1 MAPPED=yes; ALTER TABLE t1 MAPPED=yes;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM t1 LIMIT 10; SELECT * FROM t1 LIMIT 10;
matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat formation
5745 ESCOURCHE BENEDICTE 2 1935 7 1962-12-01 1994-05-01 18345 14275.50 0 M TECHN 5745 ESCOURCHE BENEDICTE 2 1935 7 1962-12-01 1994-05-01 18345 14275.50 0 M TECHN
......
...@@ -185,8 +185,6 @@ UK 10 ...@@ -185,8 +185,6 @@ UK 10
FR 20 FR 20
RU 30 RU 30
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -202,8 +200,6 @@ ERROR HY000: Table 't1' is read only ...@@ -202,8 +200,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=0; ALTER TABLE t1 READONLY=0;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -193,6 +193,8 @@ Kevin 8 ...@@ -193,6 +193,8 @@ Kevin 8
Lisbeth 2 Lisbeth 2
Mary 2 Mary 2
ALTER TABLE xpet MODIFY number INT NOT NULL; ALTER TABLE xpet MODIFY number INT NOT NULL;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
SELECT * FROM xpet; SELECT * FROM xpet;
name race number name race number
John dog 2 John dog 2
......
...@@ -44,8 +44,6 @@ Car DOUBLE(8,2) FLAG=1, ...@@ -44,8 +44,6 @@ Car DOUBLE(8,2) FLAG=1,
Food DOUBLE(8,2) FLAG=1) Food DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses; ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
ALTER TABLE pivex OPTION_LIST='port=PORT'; ALTER TABLE pivex OPTION_LIST='port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex; SELECT * FROM pivex;
Who Week Beer Car Food Who Week Beer Car Food
Beth 3 16.00 0.00 0.00 Beth 3 16.00 0.00 0.00
...@@ -61,6 +59,8 @@ Joe 5 14.00 0.00 12.00 ...@@ -61,6 +59,8 @@ Joe 5 14.00 0.00 12.00
# Restricting the columns in a Pivot Table # Restricting the columns in a Pivot Table
# #
ALTER TABLE pivex DROP COLUMN week; ALTER TABLE pivex DROP COLUMN week;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
SELECT * FROM pivex; SELECT * FROM pivex;
Who Beer Car Food Who Beer Car Food
Beth 51.00 0.00 29.00 Beth 51.00 0.00 29.00
...@@ -81,8 +81,6 @@ SRCDEF='select who, week, what, sum(amount) as amount from expenses where week i ...@@ -81,8 +81,6 @@ SRCDEF='select who, week, what, sum(amount) as amount from expenses where week i
Warnings: Warnings:
Warning 1105 Cannot check looping reference Warning 1105 Cannot check looping reference
ALTER TABLE pivex OPTION_LIST='PivotCol=what,FncCol=amount,port=PORT'; ALTER TABLE pivex OPTION_LIST='PivotCol=what,FncCol=amount,port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex; SELECT * FROM pivex;
Who Week Beer Car Food Who Week Beer Car Food
Beth 4 15.00 0.00 17.00 Beth 4 15.00 0.00 17.00
...@@ -103,8 +101,6 @@ What CHAR(12) NOT NULL, ...@@ -103,8 +101,6 @@ What CHAR(12) NOT NULL,
`5` DOUBLE(8,2) FLAG=1) `5` DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses; ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
ALTER TABLE pivex OPTION_LIST='PivotCol=Week,port=PORT'; ALTER TABLE pivex OPTION_LIST='PivotCol=Week,port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex; SELECT * FROM pivex;
Who What 3 4 5 Who What 3 4 5
Beth Beer 16.00 15.00 20.00 Beth Beer 16.00 15.00 20.00
...@@ -130,8 +126,6 @@ SRCDEF='select who, what, case when week=3 then ''First'' when week=5 then ''Las ...@@ -130,8 +126,6 @@ SRCDEF='select who, what, case when week=3 then ''First'' when week=5 then ''Las
Warnings: Warnings:
Warning 1105 Cannot check looping reference Warning 1105 Cannot check looping reference
ALTER TABLE pivex OPTION_LIST='PivotCol=wk,FncCol=amnt,port=PORT'; ALTER TABLE pivex OPTION_LIST='PivotCol=wk,FncCol=amnt,port=PORT';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivex; SELECT * FROM pivex;
Who What First Middle Last Who What First Middle Last
Beth Beer 104.96 98.40 131.20 Beth Beer 104.96 98.40 131.20
...@@ -202,8 +196,6 @@ ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby= ...@@ -202,8 +196,6 @@ ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=
SELECT * FROM pivet; SELECT * FROM pivet;
ERROR HY000: Got error 122 'Cannot find matching column' from CONNECT ERROR HY000: Got error 122 'Cannot find matching column' from CONNECT
ALTER TABLE pivet OPTION_LIST='PivotCol=race,groupby=1,accept=1'; ALTER TABLE pivet OPTION_LIST='PivotCol=race,groupby=1,accept=1';
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SELECT * FROM pivet; SELECT * FROM pivet;
name dog cat name dog cat
John 2 0 John 2 0
......
...@@ -94,8 +94,6 @@ t1vec .blk 8 ...@@ -94,8 +94,6 @@ t1vec .blk 8
# Testing READONLY # Testing READONLY
# #
ALTER TABLE t1 READONLY=yes; ALTER TABLE t1 READONLY=yes;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -111,8 +109,6 @@ ERROR HY000: Table 't1' is read only ...@@ -111,8 +109,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only ERROR HY000: Table 't1' is read only
ALTER TABLE t1 READONLY=no; ALTER TABLE t1 READONLY=no;
Warnings:
Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use at your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
......
...@@ -413,7 +413,7 @@ DROP TABLE t1; ...@@ -413,7 +413,7 @@ DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml'); SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1); SELECT CAST(@a AS CHAR CHARACTER SET latin1);
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?> CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by CONNECT Version 1.01.0011 December 15, 2013 --> <!-- Created by CONNECT Version 1.02.0001 February 03, 2014 -->
<t1> <t1>
<line> <line>
<node>ÀÁÂÃ</node> <node>ÀÁÂÃ</node>
......
...@@ -442,30 +442,32 @@ DROP TABLE IF EXISTS t1; ...@@ -442,30 +442,32 @@ DROP TABLE IF EXISTS t1;
--echo # --echo #
--echo # Testing ALTER --echo # Testing ALTER
--echo # --echo #
# Temporarily change the file name because ALTER that are not executed not in place
# delete the data file when it has the same path/name than the default file name.
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(10) NOT NULL a VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1c.dbf';
INSERT INTO t1 VALUES ('10'); INSERT INTO t1 VALUES ('10');
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1c.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1c.dbf');
--horizontal_results --horizontal_results
ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL; ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1c.dbf');
--horizontal_results --horizontal_results
ALTER TABLE t1 MODIFY a INT(10) NOT NULL; ALTER TABLE t1 MODIFY a INT(10) NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1c.dbf');
--horizontal_results --horizontal_results
# TODO: this does not work on Windows # TODO: this does not work on Windows
...@@ -478,7 +480,7 @@ eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); ...@@ -478,7 +480,7 @@ eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
#eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); #eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
#--horizontal_results #--horizontal_results
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1c.dbf
--echo # --echo #
......
/**************************************************************************/ /**************************************************************************/
/* PLGCNX.H */ /* PLGCNX.H */
/* Copyright to the author: Olivier Bertrand 2000-2012 */ /* Copyright to the author: Olivier Bertrand 2000-2014 */
/* */ /* */
/* This is the connection DLL's declares. */ /* This is the connection DLL's declares. */
/**************************************************************************/ /**************************************************************************/
...@@ -62,6 +62,7 @@ enum INFO {INDX_RC, /* Index of PlugDB return code field */ ...@@ -62,6 +62,7 @@ enum INFO {INDX_RC, /* Index of PlugDB return code field */
INDX_SIZE, /* Index of returned data size field */ INDX_SIZE, /* Index of returned data size field */
INDX_MAX}; /* Size of info array */ INDX_MAX}; /* Size of info array */
#ifdef NOT_USED
/**************************************************************************/ /**************************************************************************/
/* Internal message types. */ /* Internal message types. */
/**************************************************************************/ /**************************************************************************/
...@@ -97,9 +98,9 @@ enum VENDOR {VDR_UNKNOWN = -2, /* Not known or not connected */ ...@@ -97,9 +98,9 @@ enum VENDOR {VDR_UNKNOWN = -2, /* Not known or not connected */
/**************************************************************************/ /**************************************************************************/
enum CKEYS {K_ProgMsg, K_Lang, K_ActiveDB, K_Cmax}; enum CKEYS {K_ProgMsg, K_Lang, K_ActiveDB, K_Cmax};
enum LKEYS {K_NBcol, K_NBlin, K_CurPos, K_RC, K_Result, K_Elapsed, enum LKEYS {K_NBcol, K_NBlin, K_CurPos, K_RC, K_Result, K_Elapsed,
K_Continued, K_Maxsize, K_Lmax, K_Maxcol, K_Continued, K_Maxsize, K_Affrows, K_Lmax, K_Maxcol,
K_Maxres, K_Maxlin, K_NBparm}; K_Maxres, K_Maxlin, K_NBparm};
enum NKEYS {K_Type, K_Length, K_Prec, K_DataLen, K_Nmax}; enum NKEYS {K_Type, K_Length, K_Prec, K_DataLen, K_Unsigned, K_Nmax};
/**************************************************************************/ /**************************************************************************/
/* Result description structures. */ /* Result description structures. */
...@@ -157,7 +158,6 @@ typedef struct _ResDesc { ...@@ -157,7 +158,6 @@ typedef struct _ResDesc {
#define XTRN #define XTRN
#endif #endif
#ifdef NOT_USED
//#if !defined(NO_FUNC) //#if !defined(NO_FUNC)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -172,7 +172,7 @@ XTRN bool CNXFUNC(PLGGetCharValue)(CNXKEY, char *, int, int); ...@@ -172,7 +172,7 @@ XTRN bool CNXFUNC(PLGGetCharValue)(CNXKEY, char *, int, int);
XTRN bool CNXFUNC(PLGGetIntValue)(CNXKEY, int *, int); XTRN bool CNXFUNC(PLGGetIntValue)(CNXKEY, int *, int);
XTRN bool CNXFUNC(PLGGetColValue) (CNXKEY, int *, int, int); XTRN bool CNXFUNC(PLGGetColValue) (CNXKEY, int *, int, int);
XTRN bool CNXFUNC(PLGGetMessage) (CNXKEY, char *, int); XTRN bool CNXFUNC(PLGGetMessage) (CNXKEY, char *, int);
XTRN bool CNXFUNC(PLGGetHeader) (CNXKEY, char *, int, int); XTRN bool CNXFUNC(PLGGetHeader) (CNXKEY, char *, int, int, int);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
/************** PlgDBSem H Declares Source Code File (.H) **************/ /************** PlgDBSem H Declares Source Code File (.H) **************/
/* Name: PLGDBSEM.H Version 3.5 */ /* Name: PLGDBSEM.H Version 3.6 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 1998-2012 */ /* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
/* */ /* */
/* This file contains the PlugDB++ application type definitions. */ /* This file contains the PlugDB++ application type definitions. */
/***********************************************************************/ /***********************************************************************/
...@@ -166,7 +166,8 @@ enum MODE {MODE_ERROR = -1, /* Invalid mode */ ...@@ -166,7 +166,8 @@ enum MODE {MODE_ERROR = -1, /* Invalid mode */
MODE_WRITE = 20, /* Input/Output mode */ MODE_WRITE = 20, /* Input/Output mode */
MODE_UPDATE = 30, /* Input/Output mode */ MODE_UPDATE = 30, /* Input/Output mode */
MODE_INSERT = 40, /* Input/Output mode */ MODE_INSERT = 40, /* Input/Output mode */
MODE_DELETE = 50}; /* Input/Output mode */ MODE_DELETE = 50, /* Input/Output mode */
MODE_ALTER = 60}; /* alter mode */
#if !defined(RC_OK_DEFINED) #if !defined(RC_OK_DEFINED)
#define RC_OK_DEFINED #define RC_OK_DEFINED
...@@ -549,8 +550,6 @@ PPARM Vcolist(PGLOBAL, PTDB, PSZ, bool); ...@@ -549,8 +550,6 @@ PPARM Vcolist(PGLOBAL, PTDB, PSZ, bool);
void PlugPutOut(PGLOBAL, FILE *, short, void *, uint); void PlugPutOut(PGLOBAL, FILE *, short, void *, uint);
void PlugLineDB(PGLOBAL, PSZ, short, void *, uint); void PlugLineDB(PGLOBAL, PSZ, short, void *, uint);
char *PlgGetDataPath(PGLOBAL g); char *PlgGetDataPath(PGLOBAL g);
void *PlgDBalloc(PGLOBAL, void *, MBLOCK&);
void *PlgDBrealloc(PGLOBAL, void *, MBLOCK&, size_t);
void AddPointer(PTABS, void *); void AddPointer(PTABS, void *);
PDTP MakeDateFormat(PGLOBAL, PSZ, bool, bool, int); PDTP MakeDateFormat(PGLOBAL, PSZ, bool, bool, int);
int ExtractDate(char *, PDTP, int, int val[6]); int ExtractDate(char *, PDTP, int, int val[6]);
...@@ -558,9 +557,10 @@ int ExtractDate(char *, PDTP, int, int val[6]); ...@@ -558,9 +557,10 @@ int ExtractDate(char *, PDTP, int, int val[6]);
/**************************************************************************/ /**************************************************************************/
/* Allocate the result structure that will contain result data. */ /* Allocate the result structure that will contain result data. */
/**************************************************************************/ /**************************************************************************/
PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids, DllExport PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
int *buftyp, XFLD *fldtyp, int *buftyp, XFLD *fldtyp,
unsigned int *length, bool blank, bool nonull); unsigned int *length,
bool blank, bool nonull);
/***********************************************************************/ /***********************************************************************/
/* Exported utility routines. */ /* Exported utility routines. */
...@@ -576,12 +576,16 @@ DllExport PCATLG PlgGetCatalog(PGLOBAL g, bool jump = true); ...@@ -576,12 +576,16 @@ DllExport PCATLG PlgGetCatalog(PGLOBAL g, bool jump = true);
DllExport bool PlgSetXdbPath(PGLOBAL g, PSZ, PSZ, char *, int, char *, int); DllExport bool PlgSetXdbPath(PGLOBAL g, PSZ, PSZ, char *, int, char *, int);
DllExport void PlgDBfree(MBLOCK&); DllExport void PlgDBfree(MBLOCK&);
DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size); DllExport void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size);
DllExport void *PlgDBalloc(PGLOBAL, void *, MBLOCK&);
DllExport void *PlgDBrealloc(PGLOBAL, void *, MBLOCK&, size_t);
//lExport PSZ GetIniString(PGLOBAL, void *, LPCSTR, LPCSTR, LPCSTR, LPCSTR); //lExport PSZ GetIniString(PGLOBAL, void *, LPCSTR, LPCSTR, LPCSTR, LPCSTR);
//lExport int GetIniSize(char *, char *, char *, char *); //lExport int GetIniSize(char *, char *, char *, char *);
//lExport bool WritePrivateProfileInt(LPCSTR, LPCSTR, int, LPCSTR); //lExport bool WritePrivateProfileInt(LPCSTR, LPCSTR, int, LPCSTR);
DllExport void NewPointer(PTABS, void *, void *); DllExport void NewPointer(PTABS, void *, void *);
DllExport char *GetIni(int n= 0); DllExport char *GetIni(int n= 0);
DllExport void SetTrc(void); DllExport void SetTrc(void);
DllExport char *GetListOption(PGLOBAL, const char *, const char *,
const char *def=NULL);
#define MSGID_NONE 0 #define MSGID_NONE 0
#define MSGID_CANNOT_OPEN 1 #define MSGID_CANNOT_OPEN 1
...@@ -597,4 +601,4 @@ int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode) ...@@ -597,4 +601,4 @@ int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode)
DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir); DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir);
char *MakeEscape(PGLOBAL g, char* str, char q); char *MakeEscape(PGLOBAL g, char* str, char q);
bool PushWarning(PGLOBAL, PTDBASE, int level = 1); DllExport bool PushWarning(PGLOBAL, PTDBASE, int level = 1);
/********** PlgDBUtl Fpe C++ Program Source Code File (.CPP) ***********/ /********** PlgDBUtl Fpe C++ Program Source Code File (.CPP) ***********/
/* PROGRAM NAME: PLGDBUTL */ /* PROGRAM NAME: PLGDBUTL */
/* ------------- */ /* ------------- */
/* Version 3.8 */ /* Version 3.9 */
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 1998-2013 */ /* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -90,6 +90,7 @@ bool Initdone = false; ...@@ -90,6 +90,7 @@ 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" {
extern char connectini[];
char plgxini[_MAX_PATH] = PLGXINI; char plgxini[_MAX_PATH] = PLGXINI;
char plgini[_MAX_PATH] = PLGINI; char plgini[_MAX_PATH] = PLGINI;
#if defined(WIN32) #if defined(WIN32)
...@@ -232,6 +233,7 @@ DllExport char *GetIni(int n) ...@@ -232,6 +233,7 @@ DllExport char *GetIni(int n)
#if defined(XMSG) #if defined(XMSG)
case 5: return msglang; break; case 5: return msglang; break;
#endif // XMSG #endif // XMSG
case 6: return connectini; break;
// default: return plgini; // default: return plgini;
} // endswitch GetIni } // endswitch GetIni
...@@ -1329,7 +1331,7 @@ void *PlgDBalloc(PGLOBAL g, void *area, MBLOCK& mp) ...@@ -1329,7 +1331,7 @@ void *PlgDBalloc(PGLOBAL g, void *area, MBLOCK& mp)
maxsub = (pph->FreeBlk < minsub) ? 0 : pph->FreeBlk - minsub; maxsub = (pph->FreeBlk < minsub) ? 0 : pph->FreeBlk - minsub;
mp.Sub = mp.Size <= ((mp.Sub) ? maxsub : (maxsub >> 2)); mp.Sub = mp.Size <= ((mp.Sub) ? maxsub : (maxsub >> 2));
if (trace) if (trace > 1)
htrc("PlgDBalloc: in %p size=%d used=%d free=%d sub=%d\n", htrc("PlgDBalloc: in %p size=%d used=%d free=%d sub=%d\n",
arp, mp.Size, pph->To_Free, pph->FreeBlk, mp.Sub); arp, mp.Size, pph->To_Free, pph->FreeBlk, mp.Sub);
...@@ -1372,7 +1374,7 @@ void *PlgDBrealloc(PGLOBAL g, void *area, MBLOCK& mp, size_t newsize) ...@@ -1372,7 +1374,7 @@ void *PlgDBrealloc(PGLOBAL g, void *area, MBLOCK& mp, size_t newsize)
// assert (mp.Memp != NULL); // assert (mp.Memp != NULL);
#endif #endif
if (trace) if (trace > 1)
htrc("PlgDBrealloc: %p size=%d sub=%d\n", mp.Memp, mp.Size, mp.Sub); htrc("PlgDBrealloc: %p size=%d sub=%d\n", mp.Memp, mp.Size, mp.Sub);
if (newsize == mp.Size) if (newsize == mp.Size)
...@@ -1429,7 +1431,7 @@ void *PlgDBrealloc(PGLOBAL g, void *area, MBLOCK& mp, size_t newsize) ...@@ -1429,7 +1431,7 @@ void *PlgDBrealloc(PGLOBAL g, void *area, MBLOCK& mp, size_t newsize)
/***********************************************************************/ /***********************************************************************/
void PlgDBfree(MBLOCK& mp) void PlgDBfree(MBLOCK& mp)
{ {
if (trace) if (trace > 1)
htrc("PlgDBfree: %p sub=%d size=%d\n", mp.Memp, mp.Sub, mp.Size); htrc("PlgDBfree: %p sub=%d size=%d\n", mp.Memp, mp.Sub, mp.Size);
if (!mp.Sub && mp.Memp) if (!mp.Sub && mp.Memp)
......
...@@ -152,6 +152,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize) ...@@ -152,6 +152,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
g->Sarea_Size = worksize; g->Sarea_Size = worksize;
g->Trace = 0; g->Trace = 0;
g->Createas = 0; g->Createas = 0;
g->Alchecked = 0;
g->Activityp = g->ActivityStart = NULL; g->Activityp = g->ActivityStart = NULL;
g->Xchk = NULL; g->Xchk = NULL;
strcpy(g->Message, ""); strcpy(g->Message, "");
......
...@@ -331,7 +331,7 @@ void BINCOL::ReadColumn(PGLOBAL g) ...@@ -331,7 +331,7 @@ void BINCOL::ReadColumn(PGLOBAL g)
int rc; int rc;
PTDBFIX tdbp = (PTDBFIX)To_Tdb; PTDBFIX tdbp = (PTDBFIX)To_Tdb;
if (trace) if (trace > 1)
htrc("BIN ReadColumn: col %s R%d coluse=%.4X status=%.4X buf_type=%d\n", htrc("BIN ReadColumn: col %s R%d coluse=%.4X status=%.4X buf_type=%d\n",
Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type); Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type);
......
/************** Table C++ Functions Source Code File (.CPP) ************/ /************** Table C++ Functions Source Code File (.CPP) ************/
/* Name: TABLE.CPP Version 2.6 */ /* Name: TABLE.CPP Version 2.7 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 1999-2013 */ /* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
/* */ /* */
/* This file contains the TBX, TDB and OPJOIN classes functions. */ /* This file contains the TBX, TDB and OPJOIN classes functions. */
/***********************************************************************/ /***********************************************************************/
...@@ -262,6 +262,17 @@ PCATLG TDBASE::GetCat(void) ...@@ -262,6 +262,17 @@ PCATLG TDBASE::GetCat(void)
return (To_Def) ? To_Def->GetCat() : NULL; return (To_Def) ? To_Def->GetCat() : NULL;
} // end of GetCat } // end of GetCat
/***********************************************************************/
/* Return the pointer on the charset of this table. */
/***********************************************************************/
CHARSET_INFO *TDBASE::data_charset(void)
{
// If no DATA_CHARSET is specified, we assume that character
// set of the remote data is the same with CHARACTER SET
// definition of the SQL column.
return m_data_charset ? m_data_charset : &my_charset_bin;
} // end of data_charset
/***********************************************************************/ /***********************************************************************/
/* Return the datapath of the DB this table belongs to. */ /* Return the datapath of the DB this table belongs to. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -1283,7 +1283,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g) ...@@ -1283,7 +1283,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g)
tdbp->Fetched = TRUE; tdbp->Fetched = TRUE;
if ((buf = ((PTDBMY)To_Tdb)->Myc.GetCharField(Rank))) { if ((buf = ((PTDBMY)To_Tdb)->Myc.GetCharField(Rank))) {
if (trace) if (trace > 1)
htrc("MySQL ReadColumn: name=%s buf=%s\n", Name, buf); htrc("MySQL ReadColumn: name=%s buf=%s\n", Name, buf);
// TODO: have a true way to differenciate temporal values // TODO: have a true way to differenciate temporal values
......
/************* Tabxml C++ Program Source Code File (.CPP) **************/ /************* Tabxml C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABXML */ /* PROGRAM NAME: TABXML */
/* ------------- */ /* ------------- */
/* Version 2.6 */ /* Version 2.7 */
/* */ /* */
/* Author Olivier BERTRAND 2007 - 2013 */ /* Author Olivier BERTRAND 2007 - 2014 */
/* */ /* */
/* This program are the XML tables classes using MS-DOM or libxml2. */ /* This program are the XML tables classes using MS-DOM or libxml2. */
/***********************************************************************/ /***********************************************************************/
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "xindex.h" #include "xindex.h"
#include "plgxml.h" #include "plgxml.h"
#include "tabxml.h" #include "tabxml.h"
#include "tabmul.h"
extern "C" { extern "C" {
extern char version[]; extern char version[];
...@@ -136,7 +137,8 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -136,7 +137,8 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
} // endswitch typname } // endswitch typname
Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated Tabname = Cat->GetStringCatInfo(g, "Name", Name); // Deprecated
Tabname = Cat->GetStringCatInfo(g, "Table_name", Tabname); Tabname = Cat->GetStringCatInfo(g, "Table_name", Tabname); // Deprecated
Tabname = Cat->GetStringCatInfo(g, "Tabname", Tabname);
Rowname = Cat->GetStringCatInfo(g, "Rownode", defrow); Rowname = Cat->GetStringCatInfo(g, "Rownode", defrow);
Colname = Cat->GetStringCatInfo(g, "Colnode", defcol); Colname = Cat->GetStringCatInfo(g, "Colnode", defcol);
Mulnode = Cat->GetStringCatInfo(g, "Mulnode", ""); Mulnode = Cat->GetStringCatInfo(g, "Mulnode", "");
...@@ -177,7 +179,12 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -177,7 +179,12 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/ /***********************************************************************/
PTDB XMLDEF::GetTable(PGLOBAL g, MODE m) PTDB XMLDEF::GetTable(PGLOBAL g, MODE m)
{ {
return new(g) TDBXML(this); PTDBASE tdbp = new(g) TDBXML(this);
if (Multiple)
tdbp = new(g) TDBMUL(tdbp);
return tdbp;
} // end of GetTable } // end of GetTable
/***********************************************************************/ /***********************************************************************/
...@@ -245,6 +252,7 @@ TDBXML::TDBXML(PXMLDEF tdp) : TDBASE(tdp) ...@@ -245,6 +252,7 @@ TDBXML::TDBXML(PXMLDEF tdp) : TDBASE(tdp)
Void = false; Void = false;
Usedom = tdp->Usedom; Usedom = tdp->Usedom;
Header = tdp->Header; Header = tdp->Header;
Multiple = tdp->Multiple;
Nrow = -1; Nrow = -1;
Irow = Header - 1; Irow = Header - 1;
Nsub = 0; Nsub = 0;
...@@ -287,6 +295,7 @@ TDBXML::TDBXML(PTDBXML tdbp) : TDBASE(tdbp) ...@@ -287,6 +295,7 @@ TDBXML::TDBXML(PTDBXML tdbp) : TDBASE(tdbp)
Void = tdbp->Void; Void = tdbp->Void;
Usedom = tdbp->Usedom; Usedom = tdbp->Usedom;
Header = tdbp->Header; Header = tdbp->Header;
Multiple = tdbp->Multiple;
Nrow = tdbp->Nrow; Nrow = tdbp->Nrow;
Irow = tdbp->Irow; Irow = tdbp->Irow;
Nsub = tdbp->Nsub; Nsub = tdbp->Nsub;
...@@ -578,7 +587,7 @@ bool TDBXML::Initialize(PGLOBAL g) ...@@ -578,7 +587,7 @@ bool TDBXML::Initialize(PGLOBAL g)
#endif #endif
} // end of try-catches } // end of try-catches
if (Root && Columns && !Nodedone) { if (Root && Columns && (Multiple || !Nodedone)) {
// Allocate class nodes to avoid dynamic allocation // Allocate class nodes to avoid dynamic allocation
for (colp = (PXMLCOL)Columns; colp; colp = (PXMLCOL)colp->GetNext()) for (colp = (PXMLCOL)Columns; colp; colp = (PXMLCOL)colp->GetNext())
if (!colp->IsSpecial()) // Not a pseudo column if (!colp->IsSpecial()) // Not a pseudo column
...@@ -671,7 +680,10 @@ void TDBXML::SetNodeAttr(PGLOBAL g, char *attr, PXNODE node) ...@@ -671,7 +680,10 @@ void TDBXML::SetNodeAttr(PGLOBAL g, char *attr, PXNODE node)
int TDBXML::Cardinality(PGLOBAL g) int TDBXML::Cardinality(PGLOBAL g)
{ {
if (!g) if (!g)
return (Xpand || Coltype == 2) ? 0 : 1; return (Multiple || Xpand || Coltype == 2) ? 0 : 1;
if (Multiple)
return 10;
if (Nrow < 0) if (Nrow < 0)
if (Initialize(g)) if (Initialize(g))
...@@ -685,8 +697,13 @@ int TDBXML::Cardinality(PGLOBAL g) ...@@ -685,8 +697,13 @@ int TDBXML::Cardinality(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
int TDBXML::GetMaxSize(PGLOBAL g) int TDBXML::GetMaxSize(PGLOBAL g)
{ {
if (MaxSize < 0) if (MaxSize < 0) {
if (!Multiple)
MaxSize = Cardinality(g) * ((Xpand) ? Limit : 1); MaxSize = Cardinality(g) * ((Xpand) ? Limit : 1);
else
MaxSize = 10;
} // endif MaxSize
return MaxSize; return MaxSize;
} // end of GetMaxSize } // end of GetMaxSize
...@@ -952,6 +969,34 @@ void TDBXML::CloseDB(PGLOBAL g) ...@@ -952,6 +969,34 @@ void TDBXML::CloseDB(PGLOBAL g)
Docp->CloseDoc(g, To_Xb); Docp->CloseDoc(g, To_Xb);
} // endif docp } // endif docp
if (Multiple) {
// Reset all constants to start a new parse
Docp = NULL;
Root = NULL;
Curp = NULL;
DBnode = NULL;
TabNode = NULL;
RowNode = NULL;
ColNode = NULL;
Nlist = NULL;
Clist = NULL;
To_Xb = NULL;
Colp = NULL;
Changed = false;
Checked = false;
NextSame = false;
NewRow = false;
Hasnod = false;
Write = false;
// Bufdone = false;
Nodedone = false;
Void = false;
Nrow = -1;
Irow = Header - 1;
Nsub = 0;
N = 0;
} // endif Multiple
} // end of CloseDB } // end of CloseDB
// ------------------------ XMLCOL functions ---------------------------- // ------------------------ XMLCOL functions ----------------------------
......
...@@ -139,6 +139,7 @@ class DllExport TDBXML : public TDBASE { ...@@ -139,6 +139,7 @@ class DllExport TDBXML : public TDBASE {
int Coltype; // Default column type int Coltype; // Default column type
int Limit; // Limit of multiple values int Limit; // Limit of multiple values
int Header; // n first rows are header rows int Header; // n first rows are header rows
int Multiple; // If multiple files
int Nrow; // The table cardinality int Nrow; // The table cardinality
int Irow; // The current row index int Irow; // The current row index
int Nsub; // The current subrow index int Nsub; // The current subrow index
......
...@@ -146,6 +146,7 @@ bool user_connect::CheckCleanup(void) ...@@ -146,6 +146,7 @@ bool user_connect::CheckCleanup(void)
PlugSubSet(g, g->Sarea, g->Sarea_Size); PlugSubSet(g, g->Sarea, g->Sarea_Size);
g->Xchk = NULL; g->Xchk = NULL;
g->Createas = 0; g->Createas = 0;
g->Alchecked = 0;
last_query_id= thdp->query_id; last_query_id= thdp->query_id;
if (xtrace) if (xtrace)
......
/************ Valblk C++ Functions Source Code File (.CPP) *************/ /************ Valblk C++ Functions Source Code File (.CPP) *************/
/* Name: VALBLK.CPP Version 2.0 */ /* Name: VALBLK.CPP Version 2.1 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */ /* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
/* */ /* */
/* This file contains the VALBLK and derived classes functions. */ /* This file contains the VALBLK and derived classes functions. */
/* Second family is VALBLK, representing simple suballocated arrays */ /* Second family is VALBLK, representing simple suballocated arrays */
...@@ -236,6 +236,23 @@ void TYPBLK<TYPE>::Init(PGLOBAL g, bool check) ...@@ -236,6 +236,23 @@ void TYPBLK<TYPE>::Init(PGLOBAL g, bool check)
Global = g; Global = g;
} // end of Init } // end of Init
/***********************************************************************/
/* TYPVAL GetCharString: get string representation of a typed value. */
/***********************************************************************/
template <class TYPE>
char *TYPBLK<TYPE>::GetCharString(char *p, int n)
{
sprintf(p, Fmt, Typp[n]);
return p;
} // end of GetCharString
template <>
char *TYPBLK<double>::GetCharString(char *p, int n)
{
sprintf(p, Fmt, Prec, Typp[n]);
return p;
} // end of GetCharString
/***********************************************************************/ /***********************************************************************/
/* Set one value in a block. */ /* Set one value in a block. */
/***********************************************************************/ /***********************************************************************/
...@@ -677,6 +694,14 @@ double CHRBLK::GetFloatValue(int n) ...@@ -677,6 +694,14 @@ double CHRBLK::GetFloatValue(int n)
return atof((char *)GetValPtrEx(n)); return atof((char *)GetValPtrEx(n));
} // end of GetFloatValue } // end of GetFloatValue
/***********************************************************************/
/* STRING GetCharString: get string representation of a char value. */
/***********************************************************************/
char *CHRBLK::GetCharString(char *p, int n)
{
return (char *)GetValPtrEx(n);
} // end of GetCharString
/***********************************************************************/ /***********************************************************************/
/* Set one value in a block. */ /* Set one value in a block. */
/***********************************************************************/ /***********************************************************************/
...@@ -1185,6 +1210,22 @@ bool DATBLK::SetFormat(PGLOBAL g, PSZ fmt, int len, int year) ...@@ -1185,6 +1210,22 @@ bool DATBLK::SetFormat(PGLOBAL g, PSZ fmt, int len, int year)
return false; return false;
} // end of SetFormat } // end of SetFormat
/***********************************************************************/
/* DTVAL GetCharString: get string representation of a date value. */
/***********************************************************************/
char *DATBLK::GetCharString(char *p, int n)
{
char *vp;
if (Dvalp) {
Dvalp->SetValue(Typp[n]);
vp = Dvalp->GetCharString(p);
} else
vp = TYPBLK<int>::GetCharString(p, n);
return vp;
} // end of GetCharString
/***********************************************************************/ /***********************************************************************/
/* Set one value in a block from a char string. */ /* Set one value in a block from a char string. */
/***********************************************************************/ /***********************************************************************/
......
/*************** Valblk H Declares Source Code File (.H) ***************/ /*************** Valblk H Declares Source Code File (.H) ***************/
/* Name: VALBLK.H Version 2.0 */ /* Name: VALBLK.H Version 2.1 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2013 */ /* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
/* */ /* */
/* This file contains the VALBLK and derived classes declares. */ /* This file contains the VALBLK and derived classes declares. */
/***********************************************************************/ /***********************************************************************/
...@@ -58,6 +58,7 @@ class VALBLK : public BLOCK { ...@@ -58,6 +58,7 @@ class VALBLK : public BLOCK {
virtual longlong GetBigintValue(int n) = 0; virtual longlong GetBigintValue(int n) = 0;
virtual ulonglong GetUBigintValue(int n) = 0; virtual ulonglong GetUBigintValue(int n) = 0;
virtual double GetFloatValue(int n) = 0; virtual double GetFloatValue(int n) = 0;
virtual char *GetCharString(char *p, int n) = 0;
virtual void ReAlloc(void *mp, int n) {Blkp = mp; Nval = n;} virtual void ReAlloc(void *mp, int n) {Blkp = mp; Nval = n;}
virtual void Reset(int n) = 0; virtual void Reset(int n) = 0;
virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0); virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
...@@ -133,6 +134,7 @@ class TYPBLK : public VALBLK { ...@@ -133,6 +134,7 @@ class TYPBLK : public VALBLK {
virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];} virtual longlong GetBigintValue(int n) {return (longlong)Typp[n];}
virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];} virtual ulonglong GetUBigintValue(int n) {return (ulonglong)Typp[n];}
virtual double GetFloatValue(int n) {return (double)Typp[n];} virtual double GetFloatValue(int n) {return (double)Typp[n];}
virtual char *GetCharString(char *p, int n);
virtual void Reset(int n) {Typp[n] = 0;} virtual void Reset(int n) {Typp[n] = 0;}
// Methods // Methods
...@@ -199,6 +201,7 @@ class CHRBLK : public VALBLK { ...@@ -199,6 +201,7 @@ class CHRBLK : public VALBLK {
virtual longlong GetBigintValue(int n); virtual longlong GetBigintValue(int n);
virtual ulonglong GetUBigintValue(int n); virtual ulonglong GetUBigintValue(int n);
virtual double GetFloatValue(int n); virtual double GetFloatValue(int n);
virtual char *GetCharString(char *p, int n);
virtual void Reset(int n); virtual void Reset(int n);
virtual void SetPrec(int p) {Ci = (p != 0);} virtual void SetPrec(int p) {Ci = (p != 0);}
virtual bool IsCi(void) {return Ci;} virtual bool IsCi(void) {return Ci;}
...@@ -252,6 +255,7 @@ class STRBLK : public VALBLK { ...@@ -252,6 +255,7 @@ class STRBLK : public VALBLK {
virtual longlong GetBigintValue(int n); virtual longlong GetBigintValue(int n);
virtual ulonglong GetUBigintValue(int n); virtual ulonglong GetUBigintValue(int n);
virtual double GetFloatValue(int n) {return atof(Strp[n]);} virtual double GetFloatValue(int n) {return atof(Strp[n]);}
virtual char *GetCharString(char *p, int n) {return Strp[n];}
virtual void Reset(int n) {Strp[n] = NULL;} virtual void Reset(int n) {Strp[n] = NULL;}
// Methods // Methods
...@@ -287,6 +291,7 @@ class DATBLK : public TYPBLK<int> { ...@@ -287,6 +291,7 @@ class DATBLK : public TYPBLK<int> {
// Implementation // Implementation
virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0); virtual bool SetFormat(PGLOBAL g, PSZ fmt, int len, int year = 0);
virtual char *GetCharString(char *p, int n);
// Methods // Methods
virtual void SetValue(PSZ sp, int n); virtual void SetValue(PSZ sp, int n);
......
/************* Value C++ Functions Source Code File (.CPP) *************/ /************* Value C++ Functions Source Code File (.CPP) *************/
/* Name: VALUE.CPP Version 2.3 */ /* Name: VALUE.CPP Version 2.4 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2001-2013 */ /* (C) Copyright to the author Olivier BERTRAND 2001-2014 */
/* */ /* */
/* This file contains the VALUE and derived classes family functions. */ /* This file contains the VALUE and derived classes family functions. */
/* These classes contain values of different types. They are used so */ /* These classes contain values of different types. They are used so */
...@@ -1142,7 +1142,11 @@ void TYPVAL<PSZ>::SetValue_psz(PSZ s) ...@@ -1142,7 +1142,11 @@ void TYPVAL<PSZ>::SetValue_psz(PSZ s)
void TYPVAL<PSZ>::SetValue_pvblk(PVBLK blk, int n) void TYPVAL<PSZ>::SetValue_pvblk(PVBLK blk, int n)
{ {
// STRBLK's can return a NULL pointer // STRBLK's can return a NULL pointer
SetValue_psz(blk->GetCharValue(n)); PSZ vp = blk->GetCharString(Strp, n);
if (vp != Strp)
SetValue_psz(vp);
} // end of SetValue_pvblk } // end of SetValue_pvblk
/***********************************************************************/ /***********************************************************************/
......
/**************** Table H Declares Source Code File (.H) ***************/ /**************** Table H Declares Source Code File (.H) ***************/
/* Name: TABLE.H Version 2.2 */ /* Name: TABLE.H Version 2.3 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 1999-2012 */ /* (C) Copyright to the author Olivier BERTRAND 1999-2014 */
/* */ /* */
/* This file contains the TBX, OPJOIN and TDB class definitions. */ /* This file contains the TBX, OPJOIN and TDB class definitions. */
/***********************************************************************/ /***********************************************************************/
...@@ -185,15 +185,7 @@ class DllExport TDBASE : public TDB { ...@@ -185,15 +185,7 @@ class DllExport TDBASE : public TDB {
virtual bool SetRecpos(PGLOBAL g, int recpos); virtual bool SetRecpos(PGLOBAL g, int recpos);
virtual bool IsReadOnly(void) {return Read_Only;} virtual bool IsReadOnly(void) {return Read_Only;}
virtual bool IsView(void) {return FALSE;} virtual bool IsView(void) {return FALSE;}
virtual CHARSET_INFO *data_charset() virtual CHARSET_INFO *data_charset(void);
{
/*
If no DATA_CHARSET is specified, we assume that character
set of the remote data is the same with CHARACTER SET
definition of the SQL column.
*/
return m_data_charset ? m_data_charset : &my_charset_bin;
}
virtual int GetProgMax(PGLOBAL g) {return GetMaxSize(g);} virtual int GetProgMax(PGLOBAL g) {return GetMaxSize(g);}
virtual int GetProgCur(void) {return GetRecpos();} virtual int GetProgCur(void) {return GetRecpos();}
virtual PSZ GetFile(PGLOBAL g) {return "Not a file";} virtual PSZ GetFile(PGLOBAL g) {return "Not a file";}
...@@ -229,7 +221,7 @@ class DllExport TDBASE : public TDB { ...@@ -229,7 +221,7 @@ class DllExport TDBASE : public TDB {
/***********************************************************************/ /***********************************************************************/
/* The abstract base class declaration for the catalog tables. */ /* The abstract base class declaration for the catalog tables. */
/***********************************************************************/ /***********************************************************************/
class TDBCAT : public TDBASE { class DllExport TDBCAT : public TDBASE {
friend class CATCOL; friend class CATCOL;
public: public:
// Constructor // Constructor
...@@ -268,7 +260,7 @@ class TDBCAT : public TDBASE { ...@@ -268,7 +260,7 @@ class TDBCAT : public TDBASE {
/***********************************************************************/ /***********************************************************************/
/* Class CATCOL: ODBC info column. */ /* Class CATCOL: ODBC info column. */
/***********************************************************************/ /***********************************************************************/
class CATCOL : public COLBLK { class DllExport CATCOL : public COLBLK {
friend class TDBCAT; friend class TDBCAT;
public: public:
// Constructors // Constructors
......
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