Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
78f11e8e
Commit
78f11e8e
authored
Feb 06, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.0-connect -> 10.0
parents
a0de0fd5
1b1ffe40
Changes
33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
1031 additions
and
356 deletions
+1031
-356
storage/connect/colblk.h
storage/connect/colblk.h
+7
-7
storage/connect/connect.cc
storage/connect/connect.cc
+1
-1
storage/connect/filamtxt.cpp
storage/connect/filamtxt.cpp
+6
-6
storage/connect/global.h
storage/connect/global.h
+2
-1
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+721
-225
storage/connect/ha_connect.h
storage/connect/ha_connect.h
+28
-10
storage/connect/mycat.cc
storage/connect/mycat.cc
+85
-0
storage/connect/mysql-test/connect/r/bin.result
storage/connect/mysql-test/connect/r/bin.result
+0
-4
storage/connect/mysql-test/connect/r/csv.result
storage/connect/mysql-test/connect/r/csv.result
+0
-4
storage/connect/mysql-test/connect/r/dbf.result
storage/connect/mysql-test/connect/r/dbf.result
+8
-12
storage/connect/mysql-test/connect/r/dir.result
storage/connect/mysql-test/connect/r/dir.result
+0
-2
storage/connect/mysql-test/connect/r/fix.result
storage/connect/mysql-test/connect/r/fix.result
+0
-4
storage/connect/mysql-test/connect/r/index.result
storage/connect/mysql-test/connect/r/index.result
+0
-2
storage/connect/mysql-test/connect/r/ini.result
storage/connect/mysql-test/connect/r/ini.result
+0
-4
storage/connect/mysql-test/connect/r/occur.result
storage/connect/mysql-test/connect/r/occur.result
+2
-0
storage/connect/mysql-test/connect/r/pivot.result
storage/connect/mysql-test/connect/r/pivot.result
+2
-10
storage/connect/mysql-test/connect/r/vec.result
storage/connect/mysql-test/connect/r/vec.result
+0
-4
storage/connect/mysql-test/connect/r/xml.result
storage/connect/mysql-test/connect/r/xml.result
+1
-1
storage/connect/mysql-test/connect/t/dbf.test
storage/connect/mysql-test/connect/t/dbf.test
+8
-6
storage/connect/plgcnx.h
storage/connect/plgcnx.h
+5
-5
storage/connect/plgdbsem.h
storage/connect/plgdbsem.h
+13
-9
storage/connect/plgdbutl.cpp
storage/connect/plgdbutl.cpp
+7
-5
storage/connect/plugutil.c
storage/connect/plugutil.c
+1
-0
storage/connect/tabfix.cpp
storage/connect/tabfix.cpp
+1
-1
storage/connect/table.cpp
storage/connect/table.cpp
+13
-2
storage/connect/tabmysql.cpp
storage/connect/tabmysql.cpp
+1
-1
storage/connect/tabxml.cpp
storage/connect/tabxml.cpp
+53
-8
storage/connect/tabxml.h
storage/connect/tabxml.h
+1
-0
storage/connect/user_connect.cc
storage/connect/user_connect.cc
+1
-0
storage/connect/valblk.cpp
storage/connect/valblk.cpp
+43
-2
storage/connect/valblk.h
storage/connect/valblk.h
+9
-4
storage/connect/value.cpp
storage/connect/value.cpp
+7
-3
storage/connect/xtable.h
storage/connect/xtable.h
+5
-13
No files found.
storage/connect/colblk.h
View file @
78f11e8e
/*************** 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* */
/* This file contains the COLBLK and derived classes declares. */
/***********************************************************************/
...
...
@@ -99,7 +99,7 @@ class DllExport COLBLK : public XOBJECT {
/***********************************************************************/
/* Class SPCBLK: Base class for special column descriptors. */
/***********************************************************************/
class
SPCBLK
:
public
COLBLK
{
class
DllExport
SPCBLK
:
public
COLBLK
{
public:
// Constructor
SPCBLK
(
PCOLUMN
cp
);
...
...
@@ -121,7 +121,7 @@ class SPCBLK : public COLBLK {
/***********************************************************************/
/* Class RIDBLK: ROWID special column descriptor. */
/***********************************************************************/
class
RIDBLK
:
public
SPCBLK
{
class
DllExport
RIDBLK
:
public
SPCBLK
{
public:
// Constructor
RIDBLK
(
PCOLUMN
cp
,
bool
rnm
);
...
...
@@ -140,7 +140,7 @@ class RIDBLK : public SPCBLK {
/***********************************************************************/
/* Class FIDBLK: FILEID special column descriptor. */
/***********************************************************************/
class
FIDBLK
:
public
SPCBLK
{
class
DllExport
FIDBLK
:
public
SPCBLK
{
public:
// Constructor
FIDBLK
(
PCOLUMN
cp
);
...
...
@@ -161,7 +161,7 @@ class FIDBLK : public SPCBLK {
/***********************************************************************/
/* Class TIDBLK: TABID special column descriptor. */
/***********************************************************************/
class
TIDBLK
:
public
SPCBLK
{
class
DllExport
TIDBLK
:
public
SPCBLK
{
public:
// Constructor
TIDBLK
(
PCOLUMN
cp
);
...
...
@@ -186,7 +186,7 @@ class TIDBLK : public SPCBLK {
/***********************************************************************/
/* Class SIDBLK: SERVID special column descriptor. */
/***********************************************************************/
class
SIDBLK
:
public
SPCBLK
{
class
DllExport
SIDBLK
:
public
SPCBLK
{
public:
// Constructor
SIDBLK
(
PCOLUMN
cp
);
...
...
storage/connect/connect.cc
View file @
78f11e8e
...
...
@@ -347,7 +347,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
if
(
xtrace
)
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
))
{
printf
(
"%s
\n
"
,
g
->
Message
);
return
true
;
...
...
storage/connect/filamtxt.cpp
View file @
78f11e8e
...
...
@@ -535,7 +535,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
if
(
!
Stream
)
return
RC_EF
;
if
(
trace
)
if
(
trace
>
1
)
htrc
(
"ReadBuffer: Tdbp=%p To_Line=%p Placed=%d
\n
"
,
Tdbp
,
Tdbp
->
To_Line
,
Placed
);
...
...
@@ -548,20 +548,20 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
CurBlk
=
(
int
)
Rows
++
;
if
(
trace
)
if
(
trace
>
1
)
htrc
(
"ReadBuffer: CurBlk=%d
\n
"
,
CurBlk
);
}
else
Placed
=
false
;
if
(
trace
)
if
(
trace
>
1
)
htrc
(
" About to read: stream=%p To_Buf=%p Buflen=%d
\n
"
,
Stream
,
To_Buf
,
Buflen
);
if
(
fgets
(
To_Buf
,
Buflen
,
Stream
))
{
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
);
#if defined(UNIX)
...
...
@@ -589,7 +589,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
}
else
if
(
*
p
==
'\n'
)
*
p
=
'\0'
;
// Eliminate ending new-line character
if
(
trace
)
if
(
trace
>
1
)
htrc
(
" To_Buf='%s'
\n
"
,
To_Buf
);
strcpy
(
Tdbp
->
To_Line
,
To_Buf
);
...
...
@@ -610,7 +610,7 @@ int DOSFAM::ReadBuffer(PGLOBAL g)
rc
=
RC_FX
;
}
// endif's fgets
if
(
trace
)
if
(
trace
>
1
)
htrc
(
"ReadBuffer: rc=%d
\n
"
,
rc
);
IsRead
=
true
;
...
...
storage/connect/global.h
View file @
78f11e8e
...
...
@@ -219,9 +219,10 @@ typedef struct _global { /* Global structure */
uint
Sarea_Size
;
/* Work area size */
PACTIVITY
Activityp
,
ActivityStart
;
char
Message
[
MAX_STR
];
short
Trace
;
int
Createas
;
/* To pass info to created table */
void
*
Xchk
;
/* indexes in create/alter */
short
Alchecked
;
/* Checked for ALTER */
short
Trace
;
int
jump_level
;
jmp_buf
jumper
[
MAX_JUMP
+
2
];
}
GLOBAL
;
...
...
storage/connect/ha_connect.cc
View file @
78f11e8e
This diff is collapsed.
Click to expand it.
storage/connect/ha_connect.h
View file @
78f11e8e
...
...
@@ -50,9 +50,20 @@ typedef struct _xinfo {
class
XCHK
:
public
BLOCK
{
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
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
newpix
;
// The indexes after create/alter
};
// end of class XCHK
...
...
@@ -156,15 +167,20 @@ class ha_connect: public handler
// CONNECT Implementation
static
bool
connect_init
(
void
);
static
bool
connect_end
(
void
);
TABTYPE
GetRealType
(
PTOS
pos
);
char
*
GetStringOption
(
char
*
opname
,
char
*
sdef
=
NULL
);
PTOS
GetTableOptionStruct
(
TABLE
*
table_arg
);
bool
GetBooleanOption
(
char
*
opname
,
bool
bdef
);
bool
SetBooleanOption
(
char
*
opname
,
bool
b
);
int
GetIntegerOption
(
char
*
opname
);
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
);
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
*
GetTableName
(
void
);
//int GetColNameLen(Field *fp);
...
...
@@ -199,18 +215,19 @@ class ha_connect: public handler
*/
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
This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h
*/
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
);
}
ulonglong
table_flags
()
const
;
/** @brief
This is a bitmap of flags that indicates how the storage engine
...
...
@@ -464,6 +481,7 @@ const char *GetValStr(OPVAL vop, bool neg);
XINFO
xinfo
;
// The table info structure
bool
valid_info
;
// True if xinfo is valid
bool
stop
;
// Used when creating index
bool
alter
;
// True when converting to other engine
int
indexing
;
// Type of indexing for CONNECT
int
locked
;
// Table lock
THR_LOCK_DATA
lock_data
;
...
...
storage/connect/mycat.cc
View file @
78f11e8e
...
...
@@ -98,6 +98,8 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
extern
int
xtrace
;
PQRYRES
OEMColumns
(
PGLOBAL
g
,
PTOS
topt
,
char
*
tab
,
char
*
db
,
bool
info
);
/***********************************************************************/
/* Get a unique enum table type ID. */
/***********************************************************************/
...
...
@@ -259,6 +261,89 @@ uint GetFuncID(const char *func)
return
fnc
;
}
// 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 --------------------------- */
/***********************************************************************/
...
...
storage/connect/mysql-test/connect/r/bin.result
View file @
78f11e8e
...
...
@@ -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);
ERROR HY000: Table 't1' is read only
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -71,8 +69,6 @@ fig name birth id salary dept
5555 RONALD 1980-02-26 3333 4444.44 555
7777 BILL 1973-06-30 4444 5555.56 777
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
storage/connect/mysql-test/connect/r/csv.result
View file @
78f11e8e
...
...
@@ -63,8 +63,6 @@ Archibald 2001-05-17 3
Nabucho 2003-08-12 2
RONALD 1980-02-26 4
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -80,8 +78,6 @@ Nabucho 2003-08-12 2
RONALD 1980-02-26 4
BILL 1973-06-30 5
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
storage/connect/mysql-test/connect/r/dbf.result
View file @
78f11e8e
...
...
@@ -69,8 +69,6 @@ a
10
20
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -85,8 +83,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -508,12 +504,12 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1
(
a VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1
c
.dbf';
INSERT INTO t1 VALUES ('10');
SELECT * FROM t1;
a
10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
CALL dbf_header('MYSQLD_DATADIR/test/t1
c
.dbf');
-------- --------
FileSize 77
DBF_Version 03
...
...
@@ -532,17 +528,15 @@ Dec 0
Flags 00
-------- --------
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;
Table Create Table
t1 CREATE TABLE `t1` (
`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`='t1
c
.dbf'
SELECT * FROM t1;
a
10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
CALL dbf_header('MYSQLD_DATADIR/test/t1
c
.dbf');
-------- --------
FileSize 77
DBF_Version 03
...
...
@@ -561,15 +555,17 @@ Dec 0
Flags 00
-------- --------
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;
Table Create Table
t1 CREATE TABLE `t1` (
`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`='t1
c
.dbf'
SELECT * FROM t1;
a
10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
CALL dbf_header('MYSQLD_DATADIR/test/t1
c
.dbf');
-------- --------
FileSize 77
DBF_Version 03
...
...
storage/connect/mysql-test/connect/r/dir.result
View file @
78f11e8e
...
...
@@ -13,8 +13,6 @@ boys .txt 282
boys2 .txt 282
boyswin .txt 288
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
storage/connect/mysql-test/connect/r/fix.result
View file @
78f11e8e
...
...
@@ -22,8 +22,6 @@ SELECT * FROM t1;
id
10
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -38,8 +36,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
storage/connect/mysql-test/connect/r/index.result
View file @
78f11e8e
...
...
@@ -37,8 +37,6 @@ SUM(brut)
# Testing file mapping
#
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;
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
...
...
storage/connect/mysql-test/connect/r/ini.result
View file @
78f11e8e
...
...
@@ -185,8 +185,6 @@ UK 10
FR 20
RU 30
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -202,8 +200,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
storage/connect/mysql-test/connect/r/occur.result
View file @
78f11e8e
...
...
@@ -193,6 +193,8 @@ Kevin 8
Lisbeth 2
Mary 2
ALTER TABLE xpet MODIFY number INT NOT NULL;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
SELECT * FROM xpet;
name race number
John dog 2
...
...
storage/connect/mysql-test/connect/r/pivot.result
View file @
78f11e8e
...
...
@@ -44,8 +44,6 @@ Car DOUBLE(8,2) FLAG=1,
Food DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
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;
Who Week Beer Car Food
Beth 3 16.00 0.00 0.00
...
...
@@ -61,6 +59,8 @@ Joe 5 14.00 0.00 12.00
# Restricting the columns in a Pivot Table
#
ALTER TABLE pivex DROP COLUMN week;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
SELECT * FROM pivex;
Who Beer Car Food
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
Warnings:
Warning 1105 Cannot check looping reference
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;
Who Week Beer Car Food
Beth 4 15.00 0.00 17.00
...
...
@@ -103,8 +101,6 @@ What CHAR(12) NOT NULL,
`5` DOUBLE(8,2) FLAG=1)
ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=expenses;
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;
Who What 3 4 5
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
Warnings:
Warning 1105 Cannot check looping reference
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;
Who What First Middle Last
Beth Beer 104.96 98.40 131.20
...
...
@@ -202,8 +196,6 @@ ENGINE=CONNECT TABLE_TYPE=PIVOT TABNAME=pets OPTION_LIST='PivotCol=race,groupby=
SELECT * FROM pivet;
ERROR HY000: Got error 122 'Cannot find matching column' from CONNECT
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;
name dog cat
John 2 0
...
...
storage/connect/mysql-test/connect/r/vec.result
View file @
78f11e8e
...
...
@@ -94,8 +94,6 @@ t1vec .blk 8
# Testing READONLY
#
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -111,8 +109,6 @@ ERROR HY000: Table 't1' is read only
TRUNCATE TABLE t1;
ERROR HY000: Table 't1' is read only
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;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
storage/connect/mysql-test/connect/r/xml.result
View file @
78f11e8e
...
...
@@ -413,7 +413,7 @@ DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1);
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by CONNECT Version 1.0
1.0011 December 15, 2013
-->
<!-- Created by CONNECT Version 1.0
2.0001 February 03, 2014
-->
<t1>
<line>
<node>ÀÁÂÃ</node>
...
...
storage/connect/mysql-test/connect/t/dbf.test
View file @
78f11e8e
...
...
@@ -442,30 +442,32 @@ DROP TABLE IF EXISTS t1;
--
echo
#
--
echo
# Testing ALTER
--
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
(
a
VARCHAR
(
10
)
NOT
NULL
)
ENGINE
=
CONNECT
TABLE_TYPE
=
DBF
FILE_NAME
=
't1.dbf'
;
)
ENGINE
=
CONNECT
TABLE_TYPE
=
DBF
FILE_NAME
=
't1
c
.dbf'
;
INSERT
INTO
t1
VALUES
(
'10'
);
SELECT
*
FROM
t1
;
--
chmod
0777
$MYSQLD_DATADIR
/
test
/
t1
.
dbf
--
chmod
0777
$MYSQLD_DATADIR
/
test
/
t1
c
.
dbf
--
vertical_results
--
replace_result
$MYSQLD_DATADIR
MYSQLD_DATADIR
eval
CALL
dbf_header
(
'$MYSQLD_DATADIR/test/t1.dbf'
);
eval
CALL
dbf_header
(
'$MYSQLD_DATADIR/test/t1
c
.dbf'
);
--
horizontal_results
ALTER
TABLE
t1
MODIFY
a
VARCHAR
(
10
)
NOT
NULL
;
SHOW
CREATE
TABLE
t1
;
SELECT
*
FROM
t1
;
--
vertical_results
--
replace_result
$MYSQLD_DATADIR
MYSQLD_DATADIR
eval
CALL
dbf_header
(
'$MYSQLD_DATADIR/test/t1.dbf'
);
eval
CALL
dbf_header
(
'$MYSQLD_DATADIR/test/t1
c
.dbf'
);
--
horizontal_results
ALTER
TABLE
t1
MODIFY
a
INT
(
10
)
NOT
NULL
;
SHOW
CREATE
TABLE
t1
;
SELECT
*
FROM
t1
;
--
vertical_results
--
replace_result
$MYSQLD_DATADIR
MYSQLD_DATADIR
eval
CALL
dbf_header
(
'$MYSQLD_DATADIR/test/t1.dbf'
);
eval
CALL
dbf_header
(
'$MYSQLD_DATADIR/test/t1
c
.dbf'
);
--
horizontal_results
# TODO: this does not work on Windows
...
...
@@ -478,7 +480,7 @@ eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
#eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
#--horizontal_results
DROP
TABLE
IF
EXISTS
t1
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
dbf
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
c
.
dbf
--
echo
#
...
...
storage/connect/plgcnx.h
View file @
78f11e8e
/**************************************************************************/
/* PLGCNX.H */
/* Copyright to the author: Olivier Bertrand 2000-201
2
*/
/* Copyright to the author: Olivier Bertrand 2000-201
4
*/
/* */
/* This is the connection DLL's declares. */
/**************************************************************************/
...
...
@@ -62,6 +62,7 @@ enum INFO {INDX_RC, /* Index of PlugDB return code field */
INDX_SIZE
,
/* Index of returned data size field */
INDX_MAX
};
/* Size of info array */
#ifdef NOT_USED
/**************************************************************************/
/* Internal message types. */
/**************************************************************************/
...
...
@@ -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
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
};
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. */
...
...
@@ -157,7 +158,6 @@ typedef struct _ResDesc {
#define XTRN
#endif
#ifdef NOT_USED
//#if !defined(NO_FUNC)
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -172,7 +172,7 @@ XTRN bool CNXFUNC(PLGGetCharValue)(CNXKEY, char *, int, int);
XTRN
bool
CNXFUNC
(
PLGGetIntValue
)(
CNXKEY
,
int
*
,
int
);
XTRN
bool
CNXFUNC
(
PLGGetColValue
)
(
CNXKEY
,
int
*
,
int
,
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
}
...
...
storage/connect/plgdbsem.h
View file @
78f11e8e
/************** 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-201
2
*/
/* (C) Copyright to the author Olivier BERTRAND 1998-201
4
*/
/* */
/* This file contains the PlugDB++ application type definitions. */
/***********************************************************************/
...
...
@@ -166,7 +166,8 @@ enum MODE {MODE_ERROR = -1, /* Invalid mode */
MODE_WRITE
=
20
,
/* Input/Output mode */
MODE_UPDATE
=
30
,
/* 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)
#define RC_OK_DEFINED
...
...
@@ -549,8 +550,6 @@ PPARM Vcolist(PGLOBAL, PTDB, PSZ, bool);
void
PlugPutOut
(
PGLOBAL
,
FILE
*
,
short
,
void
*
,
uint
);
void
PlugLineDB
(
PGLOBAL
,
PSZ
,
short
,
void
*
,
uint
);
char
*
PlgGetDataPath
(
PGLOBAL
g
);
void
*
PlgDBalloc
(
PGLOBAL
,
void
*
,
MBLOCK
&
);
void
*
PlgDBrealloc
(
PGLOBAL
,
void
*
,
MBLOCK
&
,
size_t
);
void
AddPointer
(
PTABS
,
void
*
);
PDTP
MakeDateFormat
(
PGLOBAL
,
PSZ
,
bool
,
bool
,
int
);
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. */
/**************************************************************************/
PQRYRES
PlgAllocResult
(
PGLOBAL
g
,
int
ncol
,
int
maxres
,
int
ids
,
int
*
buftyp
,
XFLD
*
fldtyp
,
unsigned
int
*
length
,
bool
blank
,
bool
nonull
);
DllExport
PQRYRES
PlgAllocResult
(
PGLOBAL
g
,
int
ncol
,
int
maxres
,
int
ids
,
int
*
buftyp
,
XFLD
*
fldtyp
,
unsigned
int
*
length
,
bool
blank
,
bool
nonull
);
/***********************************************************************/
/* Exported utility routines. */
...
...
@@ -576,12 +576,16 @@ DllExport PCATLG PlgGetCatalog(PGLOBAL g, bool jump = true);
DllExport
bool
PlgSetXdbPath
(
PGLOBAL
g
,
PSZ
,
PSZ
,
char
*
,
int
,
char
*
,
int
);
DllExport
void
PlgDBfree
(
MBLOCK
&
);
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 int GetIniSize(char *, char *, char *, char *);
//lExport bool WritePrivateProfileInt(LPCSTR, LPCSTR, int, LPCSTR);
DllExport
void
NewPointer
(
PTABS
,
void
*
,
void
*
);
DllExport
char
*
GetIni
(
int
n
=
0
);
DllExport
void
SetTrc
(
void
);
DllExport
char
*
GetListOption
(
PGLOBAL
,
const
char
*
,
const
char
*
,
const
char
*
def
=
NULL
);
#define MSGID_NONE 0
#define MSGID_CANNOT_OPEN 1
...
...
@@ -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
);
char
*
MakeEscape
(
PGLOBAL
g
,
char
*
str
,
char
q
);
bool
PushWarning
(
PGLOBAL
,
PTDBASE
,
int
level
=
1
);
DllExport
bool
PushWarning
(
PGLOBAL
,
PTDBASE
,
int
level
=
1
);
storage/connect/plgdbutl.cpp
View file @
78f11e8e
/********** PlgDBUtl Fpe C++ Program Source Code File (.CPP) ***********/
/* PROGRAM NAME: PLGDBUTL */
/* ------------- */
/* Version 3.
8
*/
/* Version 3.
9
*/
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 1998-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 1998-201
4
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -90,6 +90,7 @@ bool Initdone = false;
bool
plugin
=
false
;
// True when called by the XDB plugin handler
extern
"C"
{
extern
char
connectini
[];
char
plgxini
[
_MAX_PATH
]
=
PLGXINI
;
char
plgini
[
_MAX_PATH
]
=
PLGINI
;
#if defined(WIN32)
...
...
@@ -232,6 +233,7 @@ DllExport char *GetIni(int n)
#if defined(XMSG)
case
5
:
return
msglang
;
break
;
#endif // XMSG
case
6
:
return
connectini
;
break
;
// default: return plgini;
}
// endswitch GetIni
...
...
@@ -1329,7 +1331,7 @@ void *PlgDBalloc(PGLOBAL g, void *area, MBLOCK& mp)
maxsub
=
(
pph
->
FreeBlk
<
minsub
)
?
0
:
pph
->
FreeBlk
-
minsub
;
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
"
,
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)
// assert (mp.Memp != NULL);
#endif
if
(
trace
)
if
(
trace
>
1
)
htrc
(
"PlgDBrealloc: %p size=%d sub=%d
\n
"
,
mp
.
Memp
,
mp
.
Size
,
mp
.
Sub
);
if
(
newsize
==
mp
.
Size
)
...
...
@@ -1429,7 +1431,7 @@ void *PlgDBrealloc(PGLOBAL g, void *area, MBLOCK& mp, size_t newsize)
/***********************************************************************/
void
PlgDBfree
(
MBLOCK
&
mp
)
{
if
(
trace
)
if
(
trace
>
1
)
htrc
(
"PlgDBfree: %p sub=%d size=%d
\n
"
,
mp
.
Memp
,
mp
.
Sub
,
mp
.
Size
);
if
(
!
mp
.
Sub
&&
mp
.
Memp
)
...
...
storage/connect/plugutil.c
View file @
78f11e8e
...
...
@@ -152,6 +152,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
g
->
Sarea_Size
=
worksize
;
g
->
Trace
=
0
;
g
->
Createas
=
0
;
g
->
Alchecked
=
0
;
g
->
Activityp
=
g
->
ActivityStart
=
NULL
;
g
->
Xchk
=
NULL
;
strcpy
(
g
->
Message
,
""
);
...
...
storage/connect/tabfix.cpp
View file @
78f11e8e
...
...
@@ -331,7 +331,7 @@ void BINCOL::ReadColumn(PGLOBAL g)
int
rc
;
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
"
,
Name
,
tdbp
->
GetTdb_No
(),
ColUse
,
Status
,
Buf_Type
);
...
...
storage/connect/table.cpp
View file @
78f11e8e
/************** 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 1999-201
4
*/
/* */
/* This file contains the TBX, TDB and OPJOIN classes functions. */
/***********************************************************************/
...
...
@@ -262,6 +262,17 @@ PCATLG TDBASE::GetCat(void)
return
(
To_Def
)
?
To_Def
->
GetCat
()
:
NULL
;
}
// 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. */
/***********************************************************************/
...
...
storage/connect/tabmysql.cpp
View file @
78f11e8e
...
...
@@ -1283,7 +1283,7 @@ void MYSQLCOL::ReadColumn(PGLOBAL g)
tdbp
->
Fetched
=
TRUE
;
if
((
buf
=
((
PTDBMY
)
To_Tdb
)
->
Myc
.
GetCharField
(
Rank
)))
{
if
(
trace
)
if
(
trace
>
1
)
htrc
(
"MySQL ReadColumn: name=%s buf=%s
\n
"
,
Name
,
buf
);
// TODO: have a true way to differenciate temporal values
...
...
storage/connect/tabxml.cpp
View file @
78f11e8e
/************* Tabxml C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABXML */
/* ------------- */
/* Version 2.
6
*/
/* Version 2.
7
*/
/* */
/* Author Olivier BERTRAND 2007 - 201
3
*/
/* Author Olivier BERTRAND 2007 - 201
4
*/
/* */
/* This program are the XML tables classes using MS-DOM or libxml2. */
/***********************************************************************/
...
...
@@ -47,6 +47,7 @@
#include "xindex.h"
#include "plgxml.h"
#include "tabxml.h"
#include "tabmul.h"
extern
"C"
{
extern
char
version
[];
...
...
@@ -136,7 +137,8 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
}
// endswitch typname
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
);
Colname
=
Cat
->
GetStringCatInfo
(
g
,
"Colnode"
,
defcol
);
Mulnode
=
Cat
->
GetStringCatInfo
(
g
,
"Mulnode"
,
""
);
...
...
@@ -177,7 +179,12 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
/***********************************************************************/
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
/***********************************************************************/
...
...
@@ -245,6 +252,7 @@ TDBXML::TDBXML(PXMLDEF tdp) : TDBASE(tdp)
Void
=
false
;
Usedom
=
tdp
->
Usedom
;
Header
=
tdp
->
Header
;
Multiple
=
tdp
->
Multiple
;
Nrow
=
-
1
;
Irow
=
Header
-
1
;
Nsub
=
0
;
...
...
@@ -287,6 +295,7 @@ TDBXML::TDBXML(PTDBXML tdbp) : TDBASE(tdbp)
Void
=
tdbp
->
Void
;
Usedom
=
tdbp
->
Usedom
;
Header
=
tdbp
->
Header
;
Multiple
=
tdbp
->
Multiple
;
Nrow
=
tdbp
->
Nrow
;
Irow
=
tdbp
->
Irow
;
Nsub
=
tdbp
->
Nsub
;
...
...
@@ -578,7 +587,7 @@ bool TDBXML::Initialize(PGLOBAL g)
#endif
}
// end of try-catches
if
(
Root
&&
Columns
&&
!
Nodedone
)
{
if
(
Root
&&
Columns
&&
(
Multiple
||
!
Nodedone
)
)
{
// Allocate class nodes to avoid dynamic allocation
for
(
colp
=
(
PXMLCOL
)
Columns
;
colp
;
colp
=
(
PXMLCOL
)
colp
->
GetNext
())
if
(
!
colp
->
IsSpecial
())
// Not a pseudo column
...
...
@@ -671,7 +680,10 @@ void TDBXML::SetNodeAttr(PGLOBAL g, char *attr, PXNODE node)
int
TDBXML
::
Cardinality
(
PGLOBAL
g
)
{
if
(
!
g
)
return
(
Xpand
||
Coltype
==
2
)
?
0
:
1
;
return
(
Multiple
||
Xpand
||
Coltype
==
2
)
?
0
:
1
;
if
(
Multiple
)
return
10
;
if
(
Nrow
<
0
)
if
(
Initialize
(
g
))
...
...
@@ -685,8 +697,13 @@ int TDBXML::Cardinality(PGLOBAL g)
/***********************************************************************/
int
TDBXML
::
GetMaxSize
(
PGLOBAL
g
)
{
if
(
MaxSize
<
0
)
MaxSize
=
Cardinality
(
g
)
*
((
Xpand
)
?
Limit
:
1
);
if
(
MaxSize
<
0
)
{
if
(
!
Multiple
)
MaxSize
=
Cardinality
(
g
)
*
((
Xpand
)
?
Limit
:
1
);
else
MaxSize
=
10
;
}
// endif MaxSize
return
MaxSize
;
}
// end of GetMaxSize
...
...
@@ -952,6 +969,34 @@ void TDBXML::CloseDB(PGLOBAL g)
Docp
->
CloseDoc
(
g
,
To_Xb
);
}
// 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
// ------------------------ XMLCOL functions ----------------------------
...
...
storage/connect/tabxml.h
View file @
78f11e8e
...
...
@@ -139,6 +139,7 @@ class DllExport TDBXML : public TDBASE {
int
Coltype
;
// Default column type
int
Limit
;
// Limit of multiple values
int
Header
;
// n first rows are header rows
int
Multiple
;
// If multiple files
int
Nrow
;
// The table cardinality
int
Irow
;
// The current row index
int
Nsub
;
// The current subrow index
...
...
storage/connect/user_connect.cc
View file @
78f11e8e
...
...
@@ -146,6 +146,7 @@ bool user_connect::CheckCleanup(void)
PlugSubSet
(
g
,
g
->
Sarea
,
g
->
Sarea_Size
);
g
->
Xchk
=
NULL
;
g
->
Createas
=
0
;
g
->
Alchecked
=
0
;
last_query_id
=
thdp
->
query_id
;
if
(
xtrace
)
...
...
storage/connect/valblk.cpp
View file @
78f11e8e
/************ 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* */
/* This file contains the VALBLK and derived classes functions. */
/* Second family is VALBLK, representing simple suballocated arrays */
...
...
@@ -236,6 +236,23 @@ void TYPBLK<TYPE>::Init(PGLOBAL g, bool check)
Global
=
g
;
}
// 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. */
/***********************************************************************/
...
...
@@ -677,6 +694,14 @@ double CHRBLK::GetFloatValue(int n)
return
atof
((
char
*
)
GetValPtrEx
(
n
));
}
// 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. */
/***********************************************************************/
...
...
@@ -1185,6 +1210,22 @@ bool DATBLK::SetFormat(PGLOBAL g, PSZ fmt, int len, int year)
return
false
;
}
// 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. */
/***********************************************************************/
...
...
storage/connect/valblk.h
View file @
78f11e8e
/*************** 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* */
/* This file contains the VALBLK and derived classes declares. */
/***********************************************************************/
...
...
@@ -58,6 +58,7 @@ class VALBLK : public BLOCK {
virtual
longlong
GetBigintValue
(
int
n
)
=
0
;
virtual
ulonglong
GetUBigintValue
(
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
Reset
(
int
n
)
=
0
;
virtual
bool
SetFormat
(
PGLOBAL
g
,
PSZ
fmt
,
int
len
,
int
year
=
0
);
...
...
@@ -133,6 +134,7 @@ class TYPBLK : public VALBLK {
virtual
longlong
GetBigintValue
(
int
n
)
{
return
(
longlong
)
Typp
[
n
];}
virtual
ulonglong
GetUBigintValue
(
int
n
)
{
return
(
ulonglong
)
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
;}
// Methods
...
...
@@ -199,6 +201,7 @@ class CHRBLK : public VALBLK {
virtual
longlong
GetBigintValue
(
int
n
);
virtual
ulonglong
GetUBigintValue
(
int
n
);
virtual
double
GetFloatValue
(
int
n
);
virtual
char
*
GetCharString
(
char
*
p
,
int
n
);
virtual
void
Reset
(
int
n
);
virtual
void
SetPrec
(
int
p
)
{
Ci
=
(
p
!=
0
);}
virtual
bool
IsCi
(
void
)
{
return
Ci
;}
...
...
@@ -252,6 +255,7 @@ class STRBLK : public VALBLK {
virtual
longlong
GetBigintValue
(
int
n
);
virtual
ulonglong
GetUBigintValue
(
int
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
;}
// Methods
...
...
@@ -286,10 +290,11 @@ class DATBLK : public TYPBLK<int> {
DATBLK
(
void
*
mp
,
int
size
);
// 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
virtual
void
SetValue
(
PSZ
sp
,
int
n
);
virtual
void
SetValue
(
PSZ
sp
,
int
n
);
protected:
// Members
...
...
storage/connect/value.cpp
View file @
78f11e8e
/************* 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2001-201
4
*/
/* */
/* This file contains the VALUE and derived classes family functions. */
/* These classes contain values of different types. They are used so */
...
...
@@ -1142,7 +1142,11 @@ void TYPVAL<PSZ>::SetValue_psz(PSZ s)
void
TYPVAL
<
PSZ
>::
SetValue_pvblk
(
PVBLK
blk
,
int
n
)
{
// 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
/***********************************************************************/
...
...
storage/connect/xtable.h
View file @
78f11e8e
/**************** 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-201
2
*/
/* (C) Copyright to the author Olivier BERTRAND 1999-201
4
*/
/* */
/* This file contains the TBX, OPJOIN and TDB class definitions. */
/***********************************************************************/
...
...
@@ -185,15 +185,7 @@ class DllExport TDBASE : public TDB {
virtual
bool
SetRecpos
(
PGLOBAL
g
,
int
recpos
);
virtual
bool
IsReadOnly
(
void
)
{
return
Read_Only
;}
virtual
bool
IsView
(
void
)
{
return
FALSE
;}
virtual
CHARSET_INFO
*
data_charset
()
{
/*
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
CHARSET_INFO
*
data_charset
(
void
);
virtual
int
GetProgMax
(
PGLOBAL
g
)
{
return
GetMaxSize
(
g
);}
virtual
int
GetProgCur
(
void
)
{
return
GetRecpos
();}
virtual
PSZ
GetFile
(
PGLOBAL
g
)
{
return
"Not a file"
;}
...
...
@@ -229,7 +221,7 @@ class DllExport TDBASE : public TDB {
/***********************************************************************/
/* The abstract base class declaration for the catalog tables. */
/***********************************************************************/
class
TDBCAT
:
public
TDBASE
{
class
DllExport
TDBCAT
:
public
TDBASE
{
friend
class
CATCOL
;
public:
// Constructor
...
...
@@ -268,7 +260,7 @@ class TDBCAT : public TDBASE {
/***********************************************************************/
/* Class CATCOL: ODBC info column. */
/***********************************************************************/
class
CATCOL
:
public
COLBLK
{
class
DllExport
CATCOL
:
public
COLBLK
{
friend
class
TDBCAT
;
public:
// Constructors
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment