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
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) ***************/
/*************** 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. */
/* 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
);
...
...
storage/connect/connect.cc
View file @
78f11e8e
...
@@ -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
;
...
...
storage/connect/filamtxt.cpp
View file @
78f11e8e
...
@@ -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
;
...
...
storage/connect/global.h
View file @
78f11e8e
...
@@ -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
;
...
...
storage/connect/ha_connect.cc
View file @
78f11e8e
/* Copyright (C) Olivier Bertrand 2004 - 201
3
/* Copyright (C) Olivier Bertrand 2004 - 201
4
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
@@ -107,6 +107,7 @@
...
@@ -107,6 +107,7 @@
#include "field.h"
#include "field.h"
#include "sql_parse.h"
#include "sql_parse.h"
#include "sql_base.h"
#include "sql_base.h"
#include <sys/stat.h>
#if defined(NEW_WAY)
#if defined(NEW_WAY)
#include "sql_table.h"
#include "sql_table.h"
#endif // NEW_WAY
#endif // NEW_WAY
...
@@ -164,8 +165,13 @@ extern "C" char plgini[];
...
@@ -164,8 +165,13 @@ extern "C" char plgini[];
extern
"C"
char
nmfile
[];
extern
"C"
char
nmfile
[];
extern
"C"
char
pdebug
[];
extern
"C"
char
pdebug
[];
/***********************************************************************/
/* Initialize the ha_connect static members. */
/***********************************************************************/
#define CONNECT_INI "connect.ini"
extern
"C"
{
extern
"C"
{
char
version
[]
=
"Version 1.01.0011 December 15, 2013"
;
char
connectini
[
_MAX_PATH
]
=
CONNECT_INI
;
char
version
[]
=
"Version 1.02.0001 February 03, 2014"
;
#if defined(XMSG)
#if defined(XMSG)
char
msglang
[];
// Default message language
char
msglang
[];
// Default message language
...
@@ -173,17 +179,17 @@ extern "C" {
...
@@ -173,17 +179,17 @@ extern "C" {
int
trace
=
0
;
// The general trace value
int
trace
=
0
;
// The general trace value
}
// extern "C"
}
// extern "C"
/****************************************************************************/
/* Initialize the ha_connect static members. */
/****************************************************************************/
#define CONNECT_INI "connect.ini"
char
connectini
[
_MAX_PATH
]
=
CONNECT_INI
;
int
xtrace
=
0
;
int
xtrace
=
0
;
ulong
ha_connect
::
num
=
0
;
ulong
ha_connect
::
num
=
0
;
//int DTVAL::Shift= 0;
//int DTVAL::Shift= 0;
/***********************************************************************/
/* Utility functions. */
/***********************************************************************/
PQRYRES
OEMColumns
(
PGLOBAL
g
,
PTOS
topt
,
char
*
tab
,
char
*
db
,
bool
info
);
static
PCONNECT
GetUser
(
THD
*
thd
,
PCONNECT
xp
);
static
PCONNECT
GetUser
(
THD
*
thd
,
PCONNECT
xp
);
static
PGLOBAL
GetPlug
(
THD
*
thd
,
PCONNECT
&
lxp
);
static
PGLOBAL
GetPlug
(
THD
*
thd
,
PCONNECT
&
lxp
);
static
handler
*
connect_create_handler
(
handlerton
*
hton
,
static
handler
*
connect_create_handler
(
handlerton
*
hton
,
TABLE_SHARE
*
table
,
TABLE_SHARE
*
table
,
...
@@ -474,6 +480,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
...
@@ -474,6 +480,7 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
valid_query_id
=
0
;
valid_query_id
=
0
;
creat_query_id
=
(
table
&&
table
->
in_use
)
?
table
->
in_use
->
query_id
:
0
;
creat_query_id
=
(
table
&&
table
->
in_use
)
?
table
->
in_use
->
query_id
:
0
;
stop
=
false
;
stop
=
false
;
alter
=
false
;
indexing
=
-
1
;
indexing
=
-
1
;
locked
=
0
;
locked
=
0
;
data_file_name
=
NULL
;
data_file_name
=
NULL
;
...
@@ -491,6 +498,11 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
...
@@ -491,6 +498,11 @@ ha_connect::ha_connect(handlerton *hton, TABLE_SHARE *table_arg)
/****************************************************************************/
/****************************************************************************/
ha_connect
::~
ha_connect
(
void
)
ha_connect
::~
ha_connect
(
void
)
{
{
if
(
xtrace
)
printf
(
"Delete CONNECT %p, table: %s, xp=%p count=%d
\n
"
,
this
,
table
?
table
->
s
->
table_name
.
str
:
"<null>"
,
xp
,
xp
?
xp
->
count
:
0
);
if
(
xp
)
{
if
(
xp
)
{
PCONNECT
p
;
PCONNECT
p
;
...
@@ -562,12 +574,55 @@ static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp)
...
@@ -562,12 +574,55 @@ static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp)
return
(
lxp
)
?
lxp
->
g
:
NULL
;
return
(
lxp
)
?
lxp
->
g
:
NULL
;
}
// end of GetPlug
}
// end of GetPlug
/****************************************************************************/
/* Get the implied table type. */
/****************************************************************************/
TABTYPE
ha_connect
::
GetRealType
(
PTOS
pos
)
{
TABTYPE
type
=
GetTypeID
(
pos
->
type
);
if
(
type
==
TAB_UNDEF
)
type
=
pos
->
srcdef
?
TAB_MYSQL
:
pos
->
tabname
?
TAB_PRX
:
TAB_DOS
;
return
type
;
}
// end of GetRealType
/** @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
ha_connect
::
table_flags
()
const
{
ulonglong
flags
=
HA_NO_TRANSACTIONS
|
HA_REC_NOT_IN_SEQ
|
HA_NO_AUTO_INCREMENT
|
HA_NO_PREFIX_CHAR_KEYS
|
HA_HAS_RECORDS
|
HA_CAN_VIRTUAL_COLUMNS
|
HA_BINLOG_ROW_CAPABLE
|
HA_BINLOG_STMT_CAPABLE
|
// HA_NULL_IN_KEY | not implemented yet
HA_DUPLICATE_KEY_NOT_IN_ORDER
|
HA_MUST_USE_TABLE_CONDITION_PUSHDOWN
;
ha_connect
*
hp
=
(
ha_connect
*
)
this
;
PTOS
pos
=
hp
->
GetTableOptionStruct
(
table
);
if
(
pos
)
{
TABTYPE
type
=
hp
->
GetRealType
(
pos
);
if
(
IsFileType
(
type
))
flags
|=
HA_FILE_BASED
;
// No data change on ALTER for outward tables
if
(
!
IsFileType
(
type
)
||
hp
->
FileExists
(
pos
->
filename
))
flags
|=
HA_NO_COPY_ON_ALTER
;
}
// endif pos
return
flags
;
}
// end of table_flags
/****************************************************************************/
/****************************************************************************/
/* Return the value of an option specified in the option list. */
/* Return the value of an option specified in the option list. */
/****************************************************************************/
/****************************************************************************/
static
char
*
GetListOption
(
PGLOBAL
g
,
const
char
*
opname
,
char
*
GetListOption
(
PGLOBAL
g
,
const
char
*
opname
,
const
char
*
oplist
,
const
char
*
def
=
NULL
)
const
char
*
oplist
,
const
char
*
def
)
{
{
char
key
[
16
],
val
[
256
];
char
key
[
16
],
val
[
256
];
char
*
pk
,
*
pv
,
*
pn
;
char
*
pk
,
*
pv
,
*
pn
;
...
@@ -619,7 +674,8 @@ static char *GetListOption(PGLOBAL g, const char *opname,
...
@@ -619,7 +674,8 @@ static char *GetListOption(PGLOBAL g, const char *opname,
/****************************************************************************/
/****************************************************************************/
PTOS
ha_connect
::
GetTableOptionStruct
(
TABLE
*
tab
)
PTOS
ha_connect
::
GetTableOptionStruct
(
TABLE
*
tab
)
{
{
return
(
tshp
)
?
tshp
->
option_struct
:
tab
->
s
->
option_struct
;
return
(
tshp
)
?
tshp
->
option_struct
:
(
tab
)
?
tab
->
s
->
option_struct
:
NULL
;
}
// end of GetTableOptionStruct
}
// end of GetTableOptionStruct
/****************************************************************************/
/****************************************************************************/
...
@@ -972,24 +1028,27 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
...
@@ -972,24 +1028,27 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
/****************************************************************************/
/****************************************************************************/
/* Returns the index description structure used to make the index. */
/* Returns the index description structure used to make the index. */
/****************************************************************************/
/****************************************************************************/
PIXDEF
ha_connect
::
GetIndexInfo
(
void
)
PIXDEF
ha_connect
::
GetIndexInfo
(
TABLE_SHARE
*
s
)
{
{
char
*
name
,
*
pn
;
char
*
name
,
*
pn
;
bool
unique
;
bool
unique
;
PIXDEF
xdp
,
pxd
=
NULL
,
toidx
=
NULL
;
PIXDEF
xdp
,
pxd
=
NULL
,
toidx
=
NULL
;
PKPDEF
kpp
,
pkp
;
PKPDEF
kpp
,
pkp
;
PGLOBAL
&
g
=
xp
->
g
;
KEY
kp
;
KEY
kp
;
PGLOBAL
&
g
=
xp
->
g
;
for
(
int
n
=
0
;
(
unsigned
)
n
<
table
->
s
->
keynames
.
count
;
n
++
)
{
if
(
!
s
)
s
=
table
->
s
;
for
(
int
n
=
0
;
(
unsigned
)
n
<
s
->
keynames
.
count
;
n
++
)
{
if
(
xtrace
)
if
(
xtrace
)
printf
(
"Getting created index %d info
\n
"
,
n
+
1
);
printf
(
"Getting created index %d info
\n
"
,
n
+
1
);
// Find the index to describe
// Find the index to describe
kp
=
table
->
s
->
key_info
[
n
];
kp
=
s
->
key_info
[
n
];
// Now get index information
// Now get index information
pn
=
(
char
*
)
table
->
s
->
keynames
.
type_names
[
n
];
pn
=
(
char
*
)
s
->
keynames
.
type_names
[
n
];
name
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
pn
)
+
1
);
name
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
pn
)
+
1
);
strcpy
(
name
,
pn
);
// This is probably unuseful
strcpy
(
name
,
pn
);
// This is probably unuseful
unique
=
(
kp
.
flags
&
1
)
!=
0
;
unique
=
(
kp
.
flags
&
1
)
!=
0
;
...
@@ -1292,7 +1351,7 @@ int ha_connect::MakeRecord(char *buf)
...
@@ -1292,7 +1351,7 @@ int ha_connect::MakeRecord(char *buf)
if
(
fp
->
vcol_info
&&
!
fp
->
stored_in_db
)
if
(
fp
->
vcol_info
&&
!
fp
->
stored_in_db
)
continue
;
// This is a virtual column
continue
;
// This is a virtual column
if
(
bitmap_is_set
(
map
,
fp
->
field_index
))
{
if
(
bitmap_is_set
(
map
,
fp
->
field_index
)
||
alter
)
{
// This is a used field, fill the buffer with value
// This is a used field, fill the buffer with value
for
(
colp
=
tdbp
->
GetColumns
();
colp
;
colp
=
colp
->
GetNext
())
for
(
colp
=
tdbp
->
GetColumns
();
colp
;
colp
=
colp
->
GetNext
())
if
(
!
stricmp
(
colp
->
GetName
(),
(
char
*
)
fp
->
field_name
))
if
(
!
stricmp
(
colp
->
GetName
(),
(
char
*
)
fp
->
field_name
))
...
@@ -1457,18 +1516,17 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf)
...
@@ -1457,18 +1516,17 @@ int ha_connect::ScanRecord(PGLOBAL g, uchar *buf)
break
;
break
;
default:
default:
fp
->
val_str
(
&
attribute
);
fp
->
val_str
(
&
attribute
);
if
(
charset
==
&
my_charset_bin
)
{
if
(
charset
!=
&
my_charset_bin
)
{
value
->
SetValue_psz
(
attribute
.
c_ptr_safe
());
}
else
{
// Convert from SQL field charset to DATA_CHARSET
// Convert from SQL field charset to DATA_CHARSET
uint
cnv_errors
;
uint
cnv_errors
;
data_charset_value
.
copy
(
attribute
.
ptr
(),
attribute
.
length
(),
data_charset_value
.
copy
(
attribute
.
ptr
(),
attribute
.
length
(),
attribute
.
charset
(),
charset
,
&
cnv_errors
);
attribute
.
charset
(),
charset
,
&
cnv_errors
);
value
->
SetValue_psz
(
data_charset_value
.
c_ptr_safe
());
value
->
SetValue_psz
(
data_charset_value
.
c_ptr_safe
());
}
}
else
value
->
SetValue_psz
(
attribute
.
c_ptr_safe
());
break
;
break
;
}
// endswitch Type
}
// endswitch Type
...
@@ -1598,7 +1656,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1598,7 +1656,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
if
(
!
cond
)
if
(
!
cond
)
return
NULL
;
return
NULL
;
if
(
xtrace
>
1
)
if
(
xtrace
)
printf
(
"Cond type=%d
\n
"
,
cond
->
type
());
printf
(
"Cond type=%d
\n
"
,
cond
->
type
());
if
(
cond
->
type
()
==
COND
::
COND_ITEM
)
{
if
(
cond
->
type
()
==
COND
::
COND_ITEM
)
{
...
@@ -1608,7 +1666,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1608,7 +1666,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
if
(
x
)
if
(
x
)
return
NULL
;
return
NULL
;
if
(
xtrace
>
1
)
if
(
xtrace
)
printf
(
"Cond: Ftype=%d name=%s
\n
"
,
cond_item
->
functype
(),
printf
(
"Cond: Ftype=%d name=%s
\n
"
,
cond_item
->
functype
(),
cond_item
->
func_name
());
cond_item
->
func_name
());
...
@@ -1655,7 +1713,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1655,7 +1713,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
Item_func
*
condf
=
(
Item_func
*
)
cond
;
Item_func
*
condf
=
(
Item_func
*
)
cond
;
Item
*
*
args
=
condf
->
arguments
();
Item
*
*
args
=
condf
->
arguments
();
if
(
xtrace
>
1
)
if
(
xtrace
)
printf
(
"Func type=%d argnum=%d
\n
"
,
condf
->
functype
(),
printf
(
"Func type=%d argnum=%d
\n
"
,
condf
->
functype
(),
condf
->
argument_count
());
condf
->
argument_count
());
...
@@ -1684,11 +1742,11 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1684,11 +1742,11 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
return
NULL
;
return
NULL
;
for
(
i
=
0
;
i
<
condf
->
argument_count
();
i
++
)
{
for
(
i
=
0
;
i
<
condf
->
argument_count
();
i
++
)
{
if
(
xtrace
>
1
)
if
(
xtrace
)
printf
(
"Argtype(%d)=%d
\n
"
,
i
,
args
[
i
]
->
type
());
printf
(
"Argtype(%d)=%d
\n
"
,
i
,
args
[
i
]
->
type
());
if
(
i
>=
2
&&
!
ismul
)
{
if
(
i
>=
2
&&
!
ismul
)
{
if
(
xtrace
>
1
)
if
(
xtrace
)
printf
(
"Unexpected arg for vop=%d
\n
"
,
vop
);
printf
(
"Unexpected arg for vop=%d
\n
"
,
vop
);
continue
;
continue
;
...
@@ -1710,6 +1768,8 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1710,6 +1768,8 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
if
(
fop
&&
fop
->
special
)
{
if
(
fop
&&
fop
->
special
)
{
if
(
tty
==
TYPE_AM_TBL
&&
!
stricmp
(
fop
->
special
,
"TABID"
))
if
(
tty
==
TYPE_AM_TBL
&&
!
stricmp
(
fop
->
special
,
"TABID"
))
fnm
=
"TABID"
;
fnm
=
"TABID"
;
else
if
(
tty
==
TYPE_AM_PLG
)
fnm
=
fop
->
special
;
else
else
return
NULL
;
return
NULL
;
...
@@ -1718,7 +1778,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1718,7 +1778,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
else
else
fnm
=
pField
->
field
->
field_name
;
fnm
=
pField
->
field
->
field_name
;
if
(
xtrace
>
1
)
{
if
(
xtrace
)
{
printf
(
"Field index=%d
\n
"
,
pField
->
field
->
field_index
);
printf
(
"Field index=%d
\n
"
,
pField
->
field
->
field_index
);
printf
(
"Field name=%s
\n
"
,
pField
->
field
->
field_name
);
printf
(
"Field name=%s
\n
"
,
pField
->
field
->
field_name
);
}
// endif xtrace
}
// endif xtrace
...
@@ -1728,15 +1788,36 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1728,15 +1788,36 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
return
NULL
;
return
NULL
;
strcat
(
body
,
fnm
);
strcat
(
body
,
fnm
);
}
else
if
(
args
[
i
]
->
type
()
==
COND
::
FUNC_ITEM
)
{
if
(
tty
==
TYPE_AM_MYSQL
)
{
if
(
!
CheckCond
(
g
,
filp
,
tty
,
args
[
i
]))
return
NULL
;
}
else
return
NULL
;
}
else
{
}
else
{
char
buff
[
256
];
char
buff
[
256
];
String
*
res
,
tmp
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
String
*
res
,
tmp
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
Item_basic_constant
*
pval
=
(
Item_basic_constant
*
)
args
[
i
];
Item_basic_constant
*
pval
=
(
Item_basic_constant
*
)
args
[
i
];
switch
(
args
[
i
]
->
type
())
{
case
COND
:
:
STRING_ITEM
:
case
COND
:
:
INT_ITEM
:
case
COND
:
:
REAL_ITEM
:
case
COND
:
:
NULL_ITEM
:
case
COND
:
:
DECIMAL_ITEM
:
case
COND
:
:
DATE_ITEM
:
case
COND
:
:
CACHE_ITEM
:
break
;
default:
return
NULL
;
}
// endswitch type
if
((
res
=
pval
->
val_str
(
&
tmp
))
==
NULL
)
if
((
res
=
pval
->
val_str
(
&
tmp
))
==
NULL
)
return
NULL
;
// To be clarified
return
NULL
;
// To be clarified
if
(
xtrace
>
1
)
if
(
xtrace
)
printf
(
"Value=%.*s
\n
"
,
res
->
length
(),
res
->
ptr
());
printf
(
"Value=%.*s
\n
"
,
res
->
length
(),
res
->
ptr
());
// IN and BETWEEN clauses should be col VOP list
// IN and BETWEEN clauses should be col VOP list
...
@@ -1781,7 +1862,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
...
@@ -1781,7 +1862,7 @@ PFIL ha_connect::CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond)
filp
->
Op
=
vop
;
filp
->
Op
=
vop
;
}
else
{
}
else
{
if
(
xtrace
>
1
)
if
(
xtrace
)
printf
(
"Unsupported condition
\n
"
);
printf
(
"Unsupported condition
\n
"
);
return
NULL
;
return
NULL
;
...
@@ -1819,7 +1900,8 @@ const COND *ha_connect::cond_push(const COND *cond)
...
@@ -1819,7 +1900,8 @@ const COND *ha_connect::cond_push(const COND *cond)
bool
x
=
(
tty
==
TYPE_AM_MYX
||
tty
==
TYPE_AM_XDBC
);
bool
x
=
(
tty
==
TYPE_AM_MYX
||
tty
==
TYPE_AM_XDBC
);
if
(
tty
==
TYPE_AM_WMI
||
tty
==
TYPE_AM_ODBC
||
if
(
tty
==
TYPE_AM_WMI
||
tty
==
TYPE_AM_ODBC
||
tty
==
TYPE_AM_TBL
||
tty
==
TYPE_AM_MYSQL
||
x
)
{
tty
==
TYPE_AM_TBL
||
tty
==
TYPE_AM_MYSQL
||
tty
==
TYPE_AM_PLG
||
x
)
{
PGLOBAL
&
g
=
xp
->
g
;
PGLOBAL
&
g
=
xp
->
g
;
PFIL
filp
=
(
PFIL
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
FILTER
));
PFIL
filp
=
(
PFIL
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
FILTER
));
...
@@ -1830,7 +1912,7 @@ const COND *ha_connect::cond_push(const COND *cond)
...
@@ -1830,7 +1912,7 @@ const COND *ha_connect::cond_push(const COND *cond)
if
(
CheckCond
(
g
,
filp
,
tty
,
(
Item
*
)
cond
))
{
if
(
CheckCond
(
g
,
filp
,
tty
,
(
Item
*
)
cond
))
{
if
(
xtrace
)
if
(
xtrace
)
p
uts
(
filp
->
Body
);
p
rintf
(
"cond_push: %s
\n
"
,
filp
->
Body
);
if
(
!
x
)
if
(
!
x
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filp
->
Body
)
+
1
);
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filp
->
Body
)
+
1
);
...
@@ -1879,9 +1961,19 @@ bool ha_connect::get_error_message(int error, String* buf)
...
@@ -1879,9 +1961,19 @@ bool ha_connect::get_error_message(int error, String* buf)
{
{
DBUG_ENTER
(
"ha_connect::get_error_message"
);
DBUG_ENTER
(
"ha_connect::get_error_message"
);
if
(
xp
&&
xp
->
g
)
if
(
xp
&&
xp
->
g
)
{
buf
->
copy
(
xp
->
g
->
Message
,
(
uint
)
strlen
(
xp
->
g
->
Message
),
PGLOBAL
g
=
xp
->
g
;
system_charset_info
);
char
*
msg
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
g
->
Message
)
*
3
);
uint
dummy_errors
;
uint32
len
=
copy_and_convert
(
msg
,
strlen
(
g
->
Message
)
*
3
,
system_charset_info
,
g
->
Message
,
strlen
(
g
->
Message
),
&
my_charset_latin1
,
&
dummy_errors
);
msg
[
len
]
=
'\0'
;
buf
->
copy
(
msg
,
(
uint
)
strlen
(
msg
),
system_charset_info
);
}
else
buf
->
copy
(
"Cannot retrieve msg"
,
19
,
system_charset_info
);
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
}
// end of get_error_message
}
// end of get_error_message
...
@@ -2030,6 +2122,10 @@ int ha_connect::write_row(uchar *buf)
...
@@ -2030,6 +2122,10 @@ int ha_connect::write_row(uchar *buf)
PGLOBAL
&
g
=
xp
->
g
;
PGLOBAL
&
g
=
xp
->
g
;
DBUG_ENTER
(
"ha_connect::write_row"
);
DBUG_ENTER
(
"ha_connect::write_row"
);
// This is not tested yet
if
(
xmod
==
MODE_ALTER
)
xmod
=
MODE_INSERT
;
// Open the table if it was not opened yet (locked)
// Open the table if it was not opened yet (locked)
if
(
!
IsOpened
()
||
xmod
!=
tdbp
->
GetMode
())
{
if
(
!
IsOpened
()
||
xmod
!=
tdbp
->
GetMode
())
{
if
(
IsOpened
())
if
(
IsOpened
())
...
@@ -2155,6 +2251,9 @@ int ha_connect::index_init(uint idx, bool sorted)
...
@@ -2155,6 +2251,9 @@ int ha_connect::index_init(uint idx, bool sorted)
PGLOBAL
&
g
=
xp
->
g
;
PGLOBAL
&
g
=
xp
->
g
;
DBUG_ENTER
(
"index_init"
);
DBUG_ENTER
(
"index_init"
);
if
(
xtrace
)
printf
(
"index_init: this=%p idx=%u sorted=%d
\n
"
,
this
,
idx
,
sorted
);
if
((
rc
=
rnd_init
(
0
)))
if
((
rc
=
rnd_init
(
0
)))
return
rc
;
return
rc
;
...
@@ -2184,6 +2283,10 @@ int ha_connect::index_init(uint idx, bool sorted)
...
@@ -2184,6 +2283,10 @@ int ha_connect::index_init(uint idx, bool sorted)
rc
=
0
;
rc
=
0
;
}
// endif indexing
}
// endif indexing
if
(
xtrace
)
printf
(
"index_init: rc=%d indexing=%d active_index=%d
\n
"
,
rc
,
indexing
,
active_index
);
DBUG_RETURN
(
rc
);
DBUG_RETURN
(
rc
);
}
// end of index_init
}
// end of index_init
...
@@ -2406,8 +2509,15 @@ int ha_connect::rnd_init(bool scan)
...
@@ -2406,8 +2509,15 @@ int ha_connect::rnd_init(bool scan)
(
xp
)
?
xp
->
g
:
NULL
);
(
xp
)
?
xp
->
g
:
NULL
);
DBUG_ENTER
(
"ha_connect::rnd_init"
);
DBUG_ENTER
(
"ha_connect::rnd_init"
);
// This is not tested yet
if
(
xmod
==
MODE_ALTER
)
{
xmod
=
MODE_READ
;
alter
=
1
;
}
// endif xmod
if
(
xtrace
)
if
(
xtrace
)
printf
(
"%p in rnd_init: scan=%d
\n
"
,
this
,
scan
);
printf
(
"rnd_init: this=%p scan=%d xmod=%d alter=%d
\n
"
,
this
,
scan
,
xmod
,
alter
);
if
(
!
g
||
!
table
||
xmod
==
MODE_INSERT
)
if
(
!
g
||
!
table
||
xmod
==
MODE_INSERT
)
DBUG_RETURN
(
HA_ERR_INITIALIZATION
);
DBUG_RETURN
(
HA_ERR_INITIALIZATION
);
...
@@ -2632,7 +2742,8 @@ int ha_connect::info(uint flag)
...
@@ -2632,7 +2742,8 @@ int ha_connect::info(uint flag)
if
(
!
valid_info
)
{
if
(
!
valid_info
)
{
// tdbp must be available to get updated info
// tdbp must be available to get updated info
if
(
xp
->
CheckQuery
(
valid_query_id
)
||
!
tdbp
)
{
if
(
xp
->
CheckQuery
(
valid_query_id
)
||
!
tdbp
)
{
if
(
xmod
==
MODE_ANY
)
{
// Pure info, not a query
if
(
xmod
==
MODE_ANY
||
xmod
==
MODE_ALTER
)
{
// Pure info, not a query
pure
=
true
;
pure
=
true
;
xp
->
CheckCleanup
();
xp
->
CheckCleanup
();
}
// endif xmod
}
// endif xmod
...
@@ -2752,19 +2863,9 @@ int ha_connect::delete_all_rows()
...
@@ -2752,19 +2863,9 @@ int ha_connect::delete_all_rows()
bool
ha_connect
::
check_privileges
(
THD
*
thd
,
PTOS
options
,
char
*
dbn
)
bool
ha_connect
::
check_privileges
(
THD
*
thd
,
PTOS
options
,
char
*
dbn
)
{
{
const
char
*
db
=
(
dbn
&&
*
dbn
)
?
dbn
:
NULL
;
const
char
*
db
=
(
dbn
&&
*
dbn
)
?
dbn
:
NULL
;
TABTYPE
type
=
GetRealType
(
options
);
if
(
!
options
->
type
)
{
switch
(
type
)
{
if
(
options
->
srcdef
)
options
->
type
=
"MYSQL"
;
else
if
(
options
->
tabname
)
options
->
type
=
"PROXY"
;
else
options
->
type
=
"DOS"
;
}
// endif type
switch
(
GetTypeID
(
options
->
type
))
{
case
TAB_UNDEF
:
case
TAB_UNDEF
:
// case TAB_CATLG:
// case TAB_CATLG:
case
TAB_PLG
:
case
TAB_PLG
:
...
@@ -2784,18 +2885,30 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn)
...
@@ -2784,18 +2885,30 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn)
case
TAB_XML
:
case
TAB_XML
:
case
TAB_INI
:
case
TAB_INI
:
case
TAB_VEC
:
case
TAB_VEC
:
if
(
!
options
->
filename
)
if
(
options
->
filename
&&
*
options
->
filename
)
{
char
*
s
,
path
[
FN_REFLEN
],
dbpath
[
FN_REFLEN
];
#if defined(WIN32)
s
=
"
\\
"
;
#else // !WIN32
s
=
"/"
;
#endif // !WIN32
strcpy
(
dbpath
,
mysql_real_data_home
);
if
(
db
)
strcat
(
strcat
(
dbpath
,
db
),
s
);
(
void
)
fn_format
(
path
,
options
->
filename
,
dbpath
,
""
,
MY_RELATIVE_PATH
|
MY_UNPACK_FILENAME
);
if
(
!
is_secure_file_path
(
path
))
{
my_error
(
ER_OPTION_PREVENTS_STATEMENT
,
MYF
(
0
),
"--secure-file-priv"
);
return
true
;
}
// endif path
}
else
return
false
;
return
false
;
char
path
[
FN_REFLEN
];
(
void
)
fn_format
(
path
,
options
->
filename
,
mysql_real_data_home
,
""
,
MY_RELATIVE_PATH
|
MY_UNPACK_FILENAME
);
if
(
!
is_secure_file_path
(
path
))
{
my_error
(
ER_OPTION_PREVENTS_STATEMENT
,
MYF
(
0
),
"--secure-file-priv"
);
return
true
;
}
/* Fall through to check FILE_ACL */
/* Fall through to check FILE_ACL */
case
TAB_ODBC
:
case
TAB_ODBC
:
case
TAB_MYSQL
:
case
TAB_MYSQL
:
case
TAB_DIR
:
case
TAB_DIR
:
...
@@ -2811,7 +2924,7 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn)
...
@@ -2811,7 +2924,7 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn)
case
TAB_OCCUR
:
case
TAB_OCCUR
:
case
TAB_PIVOT
:
case
TAB_PIVOT
:
return
false
;
return
false
;
}
}
// endswitch type
my_printf_error
(
ER_UNKNOWN_ERROR
,
"check_privileges failed"
,
MYF
(
0
));
my_printf_error
(
ER_UNKNOWN_ERROR
,
"check_privileges failed"
,
MYF
(
0
));
return
true
;
return
true
;
...
@@ -2883,7 +2996,6 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
...
@@ -2883,7 +2996,6 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
break
;
break
;
case
SQLCOM_DROP_TABLE
:
case
SQLCOM_DROP_TABLE
:
case
SQLCOM_RENAME_TABLE
:
case
SQLCOM_RENAME_TABLE
:
case
SQLCOM_ALTER_TABLE
:
newmode
=
MODE_ANY
;
newmode
=
MODE_ANY
;
break
;
break
;
case
SQLCOM_DROP_INDEX
:
case
SQLCOM_DROP_INDEX
:
...
@@ -2895,6 +3007,9 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
...
@@ -2895,6 +3007,9 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
case
SQLCOM_DROP_VIEW
:
case
SQLCOM_DROP_VIEW
:
newmode
=
MODE_ANY
;
newmode
=
MODE_ANY
;
break
;
break
;
case
SQLCOM_ALTER_TABLE
:
newmode
=
MODE_ALTER
;
break
;
default:
default:
printf
(
"Unsupported sql_command=%d"
,
thd_sql_command
(
thd
));
printf
(
"Unsupported sql_command=%d"
,
thd_sql_command
(
thd
));
strcpy
(
g
->
Message
,
"CONNECT Unsupported command"
);
strcpy
(
g
->
Message
,
"CONNECT Unsupported command"
);
...
@@ -2926,7 +3041,6 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
...
@@ -2926,7 +3041,6 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
break
;
break
;
case
SQLCOM_DROP_INDEX
:
case
SQLCOM_DROP_INDEX
:
case
SQLCOM_CREATE_INDEX
:
case
SQLCOM_CREATE_INDEX
:
case
SQLCOM_ALTER_TABLE
:
*
chk
=
true
;
*
chk
=
true
;
// stop= true;
// stop= true;
case
SQLCOM_DROP_TABLE
:
case
SQLCOM_DROP_TABLE
:
...
@@ -2937,6 +3051,10 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
...
@@ -2937,6 +3051,10 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
case
SQLCOM_DROP_VIEW
:
case
SQLCOM_DROP_VIEW
:
newmode
=
MODE_ANY
;
newmode
=
MODE_ANY
;
break
;
break
;
case
SQLCOM_ALTER_TABLE
:
*
chk
=
true
;
newmode
=
MODE_ALTER
;
break
;
default:
default:
printf
(
"Unsupported sql_command=%d"
,
thd_sql_command
(
thd
));
printf
(
"Unsupported sql_command=%d"
,
thd_sql_command
(
thd
));
strcpy
(
g
->
Message
,
"CONNECT Unsupported command"
);
strcpy
(
g
->
Message
,
"CONNECT Unsupported command"
);
...
@@ -3023,7 +3141,8 @@ int ha_connect::external_lock(THD *thd, int lock_type)
...
@@ -3023,7 +3141,8 @@ int ha_connect::external_lock(THD *thd, int lock_type)
DBUG_ASSERT
(
thd
==
current_thd
);
DBUG_ASSERT
(
thd
==
current_thd
);
if
(
xtrace
)
if
(
xtrace
)
printf
(
"%p external_lock: lock_type=%d
\n
"
,
this
,
lock_type
);
printf
(
"external_lock: this=%p thd=%p xp=%p g=%p lock_type=%d
\n
"
,
this
,
thd
,
xp
,
g
,
lock_type
);
if
(
!
g
)
if
(
!
g
)
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
...
@@ -3043,13 +3162,17 @@ int ha_connect::external_lock(THD *thd, int lock_type)
...
@@ -3043,13 +3162,17 @@ int ha_connect::external_lock(THD *thd, int lock_type)
}
// endswitch mode
}
// endswitch mode
if
(
newmode
==
MODE_ANY
)
{
if
(
newmode
==
MODE_ANY
)
{
int
sqlcom
=
thd_sql_command
(
thd
);
// This is unlocking, do it by closing the table
// This is unlocking, do it by closing the table
if
(
xp
->
CheckQueryID
()
&&
thd_sql_command
(
thd
)
!=
SQLCOM_UNLOCK_TABLES
if
(
xp
->
CheckQueryID
()
&&
sqlcom
!=
SQLCOM_UNLOCK_TABLES
&&
thd_sql_command
(
thd
)
!=
SQLCOM_LOCK_TABLES
)
&&
sqlcom
!=
SQLCOM_LOCK_TABLES
)
rc
=
2
;
// Logical error ???
rc
=
2
;
// Logical error ???
else
if
(
g
->
Xchk
)
{
// else if (g->Xchk && (sqlcom == SQLCOM_CREATE_INDEX ||
if
(
!
tdbp
||
*
tdbp
->
GetName
()
==
'#'
)
{
// sqlcom == SQLCOM_DROP_INDEX)) {
if
(
!
tdbp
&&
!
(
tdbp
=
GetTDB
(
g
)))
else
if
(
g
->
Xchk
)
{
if
(
!
tdbp
)
{
if
(
!
(
tdbp
=
GetTDB
(
g
)))
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
else
if
(
!
((
PTDBASE
)
tdbp
)
->
GetDef
()
->
Indexable
())
{
else
if
(
!
((
PTDBASE
)
tdbp
)
->
GetDef
()
->
Indexable
())
{
sprintf
(
g
->
Message
,
"external_lock: Table %s is not indexable"
,
tdbp
->
GetName
());
sprintf
(
g
->
Message
,
"external_lock: Table %s is not indexable"
,
tdbp
->
GetName
());
...
@@ -3132,31 +3255,21 @@ int ha_connect::external_lock(THD *thd, int lock_type)
...
@@ -3132,31 +3255,21 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if
(
adp
)
if
(
adp
)
// Here we do make the new indexes
// Here we do make the new indexes
if
(
tdp
->
MakeIndex
(
g
,
adp
,
true
)
==
RC_FX
)
{
if
(
tdp
->
MakeIndex
(
g
,
adp
,
true
)
==
RC_FX
)
{
//#if defined(_DEBUG)
// Make it a warning to avoid crash
// Make it a warning to avoid crash on debug
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
g
->
Message
);
0
,
g
->
Message
);
rc
=
0
;
rc
=
0
;
//#else // !_DEBUG
// my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
// rc= HA_ERR_INTERNAL_ERROR;
//#endif // !DEBUG
}
// endif MakeIndex
}
// endif MakeIndex
}
// endif
Mode
}
// endif
Tdbp
}
// endelse Xchk
}
// endelse Xchk
if
(
CloseTable
(
g
))
{
if
(
CloseTable
(
g
))
{
// This is an error while builing index
// This is an error while builing index
//#if defined(_DEBUG)
// Make it a warning to avoid crash
// Make it a warning to avoid crash on debug
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
g
->
Message
);
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
g
->
Message
);
rc
=
0
;
rc
=
0
;
//#else // !_DEBUG
// my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
// rc= HA_ERR_INTERNAL_ERROR;
//#endif // !DEBUG
}
// endif Close
}
// endif Close
locked
=
0
;
locked
=
0
;
...
@@ -3183,19 +3296,32 @@ int ha_connect::external_lock(THD *thd, int lock_type)
...
@@ -3183,19 +3296,32 @@ int ha_connect::external_lock(THD *thd, int lock_type)
valid_info
=
false
;
valid_info
=
false
;
}
// endif CheckCleanup
}
// endif CheckCleanup
#if 0
if (xcheck) {
if (xcheck) {
// This must occur after CheckCleanup
// This must occur after CheckCleanup
g
->
Xchk
=
new
(
g
)
XCHK
;
if (!g->Xchk) {
((
PCHK
)
g
->
Xchk
)
->
oldsep
=
GetBooleanOption
(
"Sepindex"
,
false
);
g->Xchk= new(g) XCHK;
((
PCHK
)
g
->
Xchk
)
->
oldpix
=
GetIndexInfo
();
((PCHK)g->Xchk)->oldsep= GetBooleanOption("Sepindex", false);
((PCHK)g->Xchk)->oldpix= GetIndexInfo();
} // endif Xchk
} else
} else
g->Xchk= NULL;
g->Xchk= NULL;
#endif // 0
if
(
cras
)
if
(
cras
)
g
->
Createas
=
1
;
// To tell created table to ignore FLAG
g
->
Createas
=
1
;
// To tell created table to ignore FLAG
if
(
xtrace
)
if
(
xtrace
)
{
printf
(
"Calling CntCheckDB db=%s
\n
"
,
GetDBName
(
NULL
));
#if 0
printf("xcheck=%d cras=%d\n", xcheck, cras);
if (xcheck)
printf("oldsep=%d oldpix=%p\n",
((PCHK)g->Xchk)->oldsep, ((PCHK)g->Xchk)->oldpix);
#endif // 0
printf
(
"Calling CntCheckDB db=%s cras=%d
\n
"
,
GetDBName
(
NULL
),
cras
);
}
// endif xtrace
// Set or reset the good database environment
// Set or reset the good database environment
if
(
CntCheckDB
(
g
,
this
,
GetDBName
(
NULL
)))
{
if
(
CntCheckDB
(
g
,
this
,
GetDBName
(
NULL
)))
{
...
@@ -3212,7 +3338,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
...
@@ -3212,7 +3338,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
else
else
tdbp
=
NULL
;
tdbp
=
NULL
;
}
// endif tdbp
}
// endif tdbp
xmod
=
newmode
;
xmod
=
newmode
;
...
@@ -3330,7 +3456,6 @@ filename_to_dbname_and_tablename(const char *filename,
...
@@ -3330,7 +3456,6 @@ filename_to_dbname_and_tablename(const char *filename,
return
false
;
return
false
;
}
// end of filename_to_dbname_and_tablename
}
// end of filename_to_dbname_and_tablename
/**
/**
@brief
@brief
Used to delete or rename a table. By the time delete_table() has been
Used to delete or rename a table. By the time delete_table() has been
...
@@ -3355,55 +3480,86 @@ filename_to_dbname_and_tablename(const char *filename,
...
@@ -3355,55 +3480,86 @@ filename_to_dbname_and_tablename(const char *filename,
int
ha_connect
::
delete_or_rename_table
(
const
char
*
name
,
const
char
*
to
)
int
ha_connect
::
delete_or_rename_table
(
const
char
*
name
,
const
char
*
to
)
{
{
DBUG_ENTER
(
"ha_connect::delete_or_rename_table"
);
DBUG_ENTER
(
"ha_connect::delete_or_rename_table"
);
/* We have to retrieve the information about this table options. */
char
db
[
128
],
tabname
[
128
];
ha_table_option_struct
*
pos
;
int
rc
=
0
;
char
key
[
MAX_DBKEY_LENGTH
],
db
[
128
],
tabname
[
128
];
bool
ok
=
false
;
int
rc
=
0
;
THD
*
thd
=
current_thd
;
uint
key_length
;
int
sqlcom
=
thd_sql_command
(
thd
);
TABLE_SHARE
*
share
;
THD
*
thd
=
current_thd
;
if
(
xtrace
)
{
if
(
to
)
printf
(
"rename_table: this=%p thd=%p sqlcom=%d from=%s to=%s
\n
"
,
this
,
thd
,
sqlcom
,
name
,
to
);
else
printf
(
"delete_table: this=%p thd=%p sqlcom=%d name=%s
\n
"
,
this
,
thd
,
sqlcom
,
name
);
}
// endif xtrace
if
(
to
&&
(
filename_to_dbname_and_tablename
(
to
,
db
,
sizeof
(
db
),
if
(
to
&&
(
filename_to_dbname_and_tablename
(
to
,
db
,
sizeof
(
db
),
tabname
,
sizeof
(
tabname
))
||
tabname
,
sizeof
(
tabname
))
*
tabname
==
'#'
))
||
(
*
tabname
==
'#'
&&
sqlcom
==
SQLCOM_CREATE_INDEX
)
))
goto
fin
;
DBUG_RETURN
(
0
)
;
if
(
filename_to_dbname_and_tablename
(
name
,
db
,
sizeof
(
db
),
if
(
filename_to_dbname_and_tablename
(
name
,
db
,
sizeof
(
db
),
tabname
,
sizeof
(
tabname
))
||
tabname
,
sizeof
(
tabname
))
*
tabname
==
'#'
)
||
(
*
tabname
==
'#'
&&
sqlcom
==
SQLCOM_CREATE_INDEX
)
)
goto
fin
;
DBUG_RETURN
(
0
)
;
key_length
=
tdc_create_key
(
key
,
db
,
tabname
);
// If a temporary file exists, all the tests below were passed
// successfully when making it, so they are not needed anymore
// in particular because they sometimes cause DBUG_ASSERT crash.
if
(
*
tabname
!=
'#'
)
{
// We have to retrieve the information about this table options.
ha_table_option_struct
*
pos
;
char
key
[
MAX_DBKEY_LENGTH
];
uint
key_length
;
TABLE_SHARE
*
share
;
// share contains the option struct that we need
key_length
=
tdc_create_key
(
key
,
db
,
tabname
);
if
(
!
(
share
=
alloc_table_share
(
db
,
tabname
,
key
,
key_length
)))
goto
fin
;
// Get the share info from the .frm file
// share contains the option struct that we need
if
(
open_table_def
(
thd
,
share
))
if
(
!
(
share
=
alloc_table_share
(
db
,
tabname
,
key
,
key_length
)
))
goto
err
;
DBUG_RETURN
(
rc
)
;
// Now we can work
#if 0
pos
=
share
->
option_struct
;
if (*tabname == '#') {
// These are in ???? charset after renaming
char *p= strchr(share->path.str, '@');
strcpy(p, share->table_name.str);
share->path.length= strlen(share->path.str);
share->normalized_path.length= share->path.length;
} // endif tabname
#endif // 0
// Get the share info from the .frm file
if
(
!
open_table_def
(
thd
,
share
))
{
// Now we can work
if
((
pos
=
share
->
option_struct
))
{
if
(
check_privileges
(
thd
,
pos
,
db
))
rc
=
HA_ERR_INTERNAL_ERROR
;
// ???
else
if
(
IsFileType
(
GetRealType
(
pos
))
&&
!
pos
->
filename
)
ok
=
true
;
}
// endif pos
}
else
// Avoid infamous DBUG_ASSERT
thd
->
get_stmt_da
()
->
reset_diagnostics_area
();
if
(
check_privileges
(
thd
,
pos
,
db
))
{
free_table_share
(
share
);
free_table_share
(
share
);
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
}
else
// Temporary file
}
ok
=
true
;
if
(
IsFileType
(
GetTypeID
(
pos
->
type
))
&&
!
pos
->
filename
)
{
if
(
ok
)
{
// Let the base handler do the job
// Let the base handler do the job
if
(
to
)
if
(
to
)
rc
=
handler
::
rename_table
(
name
,
to
);
rc
=
handler
::
rename_table
(
name
,
to
);
else
else
if
((
rc
=
handler
::
delete_table
(
name
))
==
ENOENT
)
rc
=
handler
::
delete_table
(
name
);
rc
=
0
;
// No files is not an error for CONNECT
}
// endif filename
}
// endif ok
// Done no more need for this
err:
free_table_share
(
share
);
fin:
DBUG_RETURN
(
rc
);
DBUG_RETURN
(
rc
);
}
// end of delete_or_rename_table
}
// end of delete_or_rename_table
...
@@ -4113,6 +4269,13 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
...
@@ -4113,6 +4269,13 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
else
else
ok
=
true
;
ok
=
true
;
break
;
case
TAB_OEM
:
if
(
topt
->
module
&&
topt
->
subtype
)
ok
=
true
;
else
strcpy
(
g
->
Message
,
"Missing OEM module or subtype"
);
break
;
break
;
default:
default:
sprintf
(
g
->
Message
,
"Cannot get column info for table type %s"
,
topt
->
type
);
sprintf
(
g
->
Message
,
"Cannot get column info for table type %s"
,
topt
->
type
);
...
@@ -4217,6 +4380,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
...
@@ -4217,6 +4380,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
case
TAB_PIVOT
:
case
TAB_PIVOT
:
qrp
=
PivotColumns
(
g
,
tab
,
src
,
pic
,
fcl
,
host
,
db
,
user
,
pwd
,
port
);
qrp
=
PivotColumns
(
g
,
tab
,
src
,
pic
,
fcl
,
host
,
db
,
user
,
pwd
,
port
);
break
;
break
;
case
TAB_OEM
:
qrp
=
OEMColumns
(
g
,
topt
,
tab
,
(
char
*
)
db
,
fnc
==
FNC_COL
);
break
;
default:
default:
strcpy
(
g
->
Message
,
"System error during assisted discovery"
);
strcpy
(
g
->
Message
,
"System error during assisted discovery"
);
break
;
break
;
...
@@ -4236,6 +4402,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
...
@@ -4236,6 +4402,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
dec
=
crp
->
Prec
;
dec
=
crp
->
Prec
;
flg
=
crp
->
Flag
;
flg
=
crp
->
Flag
;
if
(
!
len
&&
typ
==
TYPE_STRING
)
len
=
256
;
// STRBLK's have 0 length
#if defined(NEW_WAY)
#if defined(NEW_WAY)
// Now add the field
// Now add the field
rc
=
add_fields
(
g
,
thd
,
&
alter_info
,
cnm
,
typ
,
len
,
dec
,
rc
=
add_fields
(
g
,
thd
,
&
alter_info
,
cnm
,
typ
,
len
,
dec
,
...
@@ -4422,8 +4591,15 @@ int ha_connect::create(const char *name, TABLE *table_arg,
...
@@ -4422,8 +4591,15 @@ int ha_connect::create(const char *name, TABLE *table_arg,
PGLOBAL
g
=
xp
->
g
;
PGLOBAL
g
=
xp
->
g
;
DBUG_ENTER
(
"ha_connect::create"
);
DBUG_ENTER
(
"ha_connect::create"
);
int
sqlcom
=
thd_sql_command
(
table_arg
->
in_use
);
PTOS
options
=
GetTableOptionStruct
(
table_arg
);
PTOS
options
=
GetTableOptionStruct
(
table_arg
);
table
=
table_arg
;
// Used by called functions
if
(
xtrace
)
printf
(
"create: this=%p thd=%p xp=%p g=%p sqlcom=%d name=%s
\n
"
,
this
,
thd
,
xp
,
g
,
sqlcom
,
GetTableName
());
// CONNECT engine specific table options:
// CONNECT engine specific table options:
DBUG_ASSERT
(
options
);
DBUG_ASSERT
(
options
);
type
=
GetTypeID
(
options
->
type
);
type
=
GetTypeID
(
options
->
type
);
...
@@ -4682,83 +4858,89 @@ int ha_connect::create(const char *name, TABLE *table_arg,
...
@@ -4682,83 +4858,89 @@ int ha_connect::create(const char *name, TABLE *table_arg,
}
// endfor field
}
// endfor field
table
=
table_arg
;
// Used by called functions
if
((
sqlcom
==
SQLCOM_CREATE_TABLE
||
*
GetTableName
()
==
'#'
)
&&
IsFileType
(
type
)
&&
!
options
->
filename
)
{
if
(
IsFileType
(
type
))
{
// The file name is not specified, create a default file in
if
(
!
options
->
filename
)
{
// the database directory named table_name.table_type.
// The file name is not specified, create a default file in
// (temporarily not done for XML because a void file causes
// the database directory named table_name.table_type.
// the XML parsers to report an error on the first Insert)
// (temporarily not done for XML because a void file causes
char
buf
[
256
],
fn
[
_MAX_PATH
],
dbpath
[
128
],
lwt
[
12
];
// the XML parsers to report an error on the first Insert)
int
h
;
char
buf
[
256
],
fn
[
_MAX_PATH
],
dbpath
[
128
],
lwt
[
12
];
int
h
;
strcpy
(
buf
,
GetTableName
());
strcpy
(
buf
,
GetTableName
());
// Check for incompatible options
if
(
options
->
sepindex
)
{
if
(
*
buf
!=
'#'
)
{
my_message
(
ER_UNKNOWN_ERROR
,
// Check for incompatible options
"SEPINDEX is incompatible with unspecified file name"
,
if
(
options
->
sepindex
)
{
MYF
(
0
));
my_message
(
ER_UNKNOWN_ERROR
,
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
"SEPINDEX is incompatible with unspecified file name"
,
}
else
if
(
GetTypeID
(
options
->
type
)
==
TAB_VEC
)
MYF
(
0
));
if
(
!
table
->
s
->
max_rows
||
options
->
split
)
{
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
my_printf_error
(
ER_UNKNOWN_ERROR
,
}
else
if
(
GetTypeID
(
options
->
type
)
==
TAB_VEC
)
"%s tables whose file name is unspecified cannot be split"
,
if
(
!
table
->
s
->
max_rows
||
options
->
split
)
{
MYF
(
0
),
options
->
type
);
my_printf_error
(
ER_UNKNOWN_ERROR
,
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
"%s tables whose file name is unspecified cannot be split"
,
}
else
if
(
options
->
header
==
2
)
{
MYF
(
0
),
options
->
type
);
my_printf_error
(
ER_UNKNOWN_ERROR
,
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
"header=2 is not allowed for %s tables whose file name is unspecified"
,
}
else
if
(
options
->
header
==
2
)
{
MYF
(
0
),
options
->
type
);
my_printf_error
(
ER_UNKNOWN_ERROR
,
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
"header=2 is not allowed for %s tables whose file name is unspecified"
,
}
// endif's
MYF
(
0
),
options
->
type
);
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
// Fold type to lower case
}
// endif's
for
(
int
i
=
0
;
i
<
12
;
i
++
)
if
(
!
options
->
type
[
i
])
{
// Fold type to lower case
lwt
[
i
]
=
0
;
for
(
int
i
=
0
;
i
<
12
;
i
++
)
break
;
if
(
!
options
->
type
[
i
])
{
}
else
lwt
[
i
]
=
0
;
lwt
[
i
]
=
tolower
(
options
->
type
[
i
]);
break
;
}
else
lwt
[
i
]
=
tolower
(
options
->
type
[
i
]);
strcat
(
strcat
(
buf
,
"."
),
lwt
);
sprintf
(
g
->
Message
,
"No file name. Table will use %s"
,
buf
);
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
g
->
Message
);
strcat
(
strcat
(
strcpy
(
dbpath
,
"./"
),
table
->
s
->
db
.
str
),
"/"
);
PlugSetPath
(
fn
,
buf
,
dbpath
);
if
((
h
=
::
open
(
fn
,
O_CREAT
|
O_EXCL
,
0666
))
==
-
1
)
{
strcat
(
strcat
(
buf
,
"."
),
lwt
);
if
(
errno
==
EEXIST
)
sprintf
(
g
->
Message
,
"No file name. Table will use %s"
,
buf
);
sprintf
(
g
->
Message
,
"Default file %s already exists"
,
fn
);
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
g
->
Message
);
else
strcat
(
strcat
(
strcpy
(
dbpath
,
"./"
),
table
->
s
->
db
.
str
),
"/"
);
sprintf
(
g
->
Message
,
"Error %d creating file %s"
,
errno
,
fn
);
PlugSetPath
(
fn
,
buf
,
dbpath
);
push_warning
(
table
->
in_use
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
g
->
Message
);
}
else
::
close
(
h
);
if
(
type
==
TAB_FMT
||
options
->
readonly
)
if
((
h
=
::
open
(
fn
,
O_CREAT
|
O_EXCL
,
0666
))
==
-
1
)
{
push_warning
(
table
->
in_use
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
if
(
errno
==
EEXIST
)
"Congratulation, you just created a read-only void table!"
);
sprintf
(
g
->
Message
,
"Default file %s already exists"
,
fn
);
else
sprintf
(
g
->
Message
,
"Error %d creating file %s"
,
errno
,
fn
);
}
// endif buf
push_warning
(
table
->
in_use
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
g
->
Message
);
}
else
::
close
(
h
);
if
(
type
==
TAB_FMT
||
options
->
readonly
)
push_warning
(
table
->
in_use
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
"Congratulation, you just created a read-only void table!"
);
}
// endif filename
}
// endif
}
// endif type
if
(
xtrace
)
printf
(
"xchk=%p createas=%d
\n
"
,
g
->
Xchk
,
g
->
Createas
);
// To check whether ind
ex
es have to be made or remade
// To check whether ind
ic
es have to be made or remade
if
(
!
g
->
Xchk
)
{
if
(
!
g
->
Xchk
)
{
PIXDEF
xdp
;
PIXDEF
xdp
;
// We should be in CREATE TABLE
// We should be in CREATE TABLE
or ALTER_TABLE
if
(
thd_sql_command
(
table
->
in_use
)
!=
SQLCOM_CREATE
_TABLE
)
if
(
sqlcom
!=
SQLCOM_CREATE_TABLE
&&
sqlcom
!=
SQLCOM_ALTER
_TABLE
)
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
"Wrong command in create, please contact CONNECT team"
);
"Wrong command in create, please contact CONNECT team"
);
if
(
sqlcom
==
SQLCOM_ALTER_TABLE
&&
g
->
Alchecked
==
0
&&
(
!
IsFileType
(
type
)
||
FileExists
(
options
->
filename
)))
{
// This is an ALTER to CONNECT from another engine.
// It cannot be accepted because the table data would be lost
// except when the target file does not exist.
strcpy
(
g
->
Message
,
"Operation denied. Table data would be lost."
);
my_message
(
ER_UNKNOWN_ERROR
,
g
->
Message
,
MYF
(
0
));
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
}
// endif outward
// Get the index definitions
// Get the index definitions
if
(
xdp
=
GetIndexInfo
())
{
if
(
xdp
=
GetIndexInfo
())
{
if
(
IsTypeIndexable
(
type
))
{
if
(
IsTypeIndexable
(
type
))
{
...
@@ -4786,7 +4968,13 @@ int ha_connect::create(const char *name, TABLE *table_arg,
...
@@ -4786,7 +4968,13 @@ int ha_connect::create(const char *name, TABLE *table_arg,
}
// endif xdp
}
// endif xdp
}
else
{
}
else
{
// This should not happen anymore with indexing new way
my_message
(
ER_UNKNOWN_ERROR
,
"CONNECT index modification should be in-place"
,
MYF
(
0
));
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
#if 0
PIXDEF xdp= GetIndexInfo();
PIXDEF xdp= GetIndexInfo();
PCHK xcp= (PCHK)g->Xchk;
if (xdp) {
if (xdp) {
if (!IsTypeIndexable(type)) {
if (!IsTypeIndexable(type)) {
...
@@ -4795,19 +4983,356 @@ int ha_connect::create(const char *name, TABLE *table_arg,
...
@@ -4795,19 +4983,356 @@ int ha_connect::create(const char *name, TABLE *table_arg,
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR;
rc= HA_ERR_INTERNAL_ERROR;
} else {
} else {
((
PCHK
)
g
->
Xchk
)
->
newpix
=
xdp
;
xcp
->newpix= xdp;
((
PCHK
)
g
->
Xchk
)
->
newsep
=
GetBooleanOption
(
"Sepindex"
,
false
);
xcp
->newsep= GetBooleanOption("Sepindex", false);
} // endif Indexable
} // endif Indexable
}
else
if
(
!
((
PCHK
)
g
->
Xchk
)
->
oldpix
)
} else if (!
xcp
->oldpix)
g->Xchk= NULL;
g->Xchk= NULL;
if (xtrace && g->Xchk)
printf("oldsep=%d newsep=%d oldpix=%p newpix=%p\n",
xcp->oldsep, xcp->newsep, xcp->oldpix, xcp->newpix);
// if (g->Xchk &&
// (sqlcom != SQLCOM_CREATE_INDEX && sqlcom != SQLCOM_DROP_INDEX)) {
if (g->Xchk) {
PIXDEF xp1, xp2;
bool b= false; // true if index changes
if (xcp->oldsep == xcp->newsep) {
for (xp1= xcp->newpix, xp2= xcp->oldpix;
xp1 || xp2;
xp1= xp1->Next, xp2= xp2->Next)
if (!xp1 || !xp2 || !IsSameIndex(xp1, xp2)) {
b= true;
break;
} // endif xp1
} else
b= true;
if (!b)
g->Xchk= NULL;
#if 0
if (b) {
// CONNECT does not support indexing via ALTER TABLE
my_message(ER_UNKNOWN_ERROR,
"CONNECT does not support index modification via ALTER TABLE",
MYF(0));
DBUG_RETURN(HA_ERR_UNSUPPORTED);
} // endif b
#endif // 0
} // endif Xchk
#endif // 0
}
// endif Xchk
}
// endif Xchk
table
=
st
;
table
=
st
;
DBUG_RETURN
(
rc
);
DBUG_RETURN
(
rc
);
}
// end of create
}
// end of create
/**
Used to check whether a file based outward table can be populated by
an ALTER TABLE command. The conditions are:
- file does not exist or is void
- user has file privilege
*/
bool
ha_connect
::
FileExists
(
const
char
*
fn
)
{
if
(
!
fn
||
!*
fn
)
return
false
;
if
(
table
)
{
char
*
s
,
filename
[
_MAX_PATH
],
path
[
128
];
int
n
;
struct
stat
info
;
if
(
check_access
(
ha_thd
(),
FILE_ACL
,
table
->
s
->
db
.
str
,
NULL
,
NULL
,
0
,
0
))
return
true
;
#if defined(WIN32)
s
=
"
\\
"
;
#else // !WIN32
s
=
"/"
;
#endif // !WIN32
strcat
(
strcat
(
strcat
(
strcpy
(
path
,
"."
),
s
),
table
->
s
->
db
.
str
),
s
);
PlugSetPath
(
filename
,
fn
,
path
);
n
=
stat
(
filename
,
&
info
);
if
(
n
<
0
)
{
if
(
errno
!=
ENOENT
)
{
char
buf
[
_MAX_PATH
+
20
];
sprintf
(
buf
,
"Error %d for file %s"
,
errno
,
filename
);
push_warning
(
table
->
in_use
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
buf
);
return
true
;
}
else
return
false
;
}
else
return
(
info
.
st_size
)
?
true
:
false
;
}
// endif table
return
true
;
}
// end of FileExists
/**
check whether a string option have changed
*/
bool
ha_connect
::
SameChar
(
TABLE
*
tab
,
char
*
opn
)
{
char
*
str1
,
*
str2
;
bool
b1
,
b2
;
tshp
=
tab
->
s
;
// The altered table
str1
=
GetStringOption
(
opn
);
tshp
=
NULL
;
str2
=
GetStringOption
(
opn
);
b1
=
(
!
str1
||
!*
str1
);
b2
=
(
!
str2
||
!*
str2
);
if
(
b1
&&
b2
)
return
true
;
else
if
((
b1
&&
!
b2
)
||
(
!
b1
&&
b2
)
||
stricmp
(
str1
,
str2
))
return
false
;
return
true
;
}
// end of SameChar
/**
check whether a Boolean option have changed
*/
bool
ha_connect
::
SameBool
(
TABLE
*
tab
,
char
*
opn
)
{
bool
b1
,
b2
;
tshp
=
tab
->
s
;
// The altered table
b1
=
GetBooleanOption
(
opn
,
false
);
tshp
=
NULL
;
b2
=
GetBooleanOption
(
opn
,
false
);
return
(
b1
==
b2
);
}
// end of SameBool
/**
check whether an integer option have changed
*/
bool
ha_connect
::
SameInt
(
TABLE
*
tab
,
char
*
opn
)
{
int
i1
,
i2
;
tshp
=
tab
->
s
;
// The altered table
i1
=
GetIntegerOption
(
opn
);
tshp
=
NULL
;
i2
=
GetIntegerOption
(
opn
);
if
(
!
stricmp
(
opn
,
"lrecl"
))
return
(
i1
==
i2
||
!
i1
||
!
i2
);
else
if
(
!
stricmp
(
opn
,
"ending"
))
return
(
i1
==
i2
||
i1
<=
0
||
i2
<=
0
);
else
return
(
i1
==
i2
);
}
// end of SameInt
/**
Check if a storage engine supports a particular alter table in-place
@param altered_table TABLE object for new version of table.
@param ha_alter_info Structure describing changes to be done
by ALTER TABLE and holding data used
during in-place alter.
@retval HA_ALTER_ERROR Unexpected error.
@retval HA_ALTER_INPLACE_NOT_SUPPORTED Not supported, must use copy.
@retval HA_ALTER_INPLACE_EXCLUSIVE_LOCK Supported, but requires X lock.
@retval HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE
Supported, but requires SNW lock
during main phase. Prepare phase
requires X lock.
@retval HA_ALTER_INPLACE_SHARED_LOCK Supported, but requires SNW lock.
@retval HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE
Supported, concurrent reads/writes
allowed. However, prepare phase
requires X lock.
@retval HA_ALTER_INPLACE_NO_LOCK Supported, concurrent
reads/writes allowed.
@note The default implementation uses the old in-place ALTER API
to determine if the storage engine supports in-place ALTER or not.
@note Called without holding thr_lock.c lock.
*/
enum_alter_inplace_result
ha_connect
::
check_if_supported_inplace_alter
(
TABLE
*
altered_table
,
Alter_inplace_info
*
ha_alter_info
)
{
DBUG_ENTER
(
"check_if_supported_alter"
);
bool
idx
=
false
,
outward
=
false
;
THD
*
thd
=
ha_thd
();
int
sqlcom
=
thd_sql_command
(
thd
);
TABTYPE
newtyp
,
type
=
TAB_UNDEF
;
HA_CREATE_INFO
*
create_info
=
ha_alter_info
->
create_info
;
//PTOS pos= GetTableOptionStruct(table);
PTOS
newopt
,
oldopt
;
xp
=
GetUser
(
thd
,
xp
);
PGLOBAL
g
=
xp
->
g
;
if
(
!
g
||
!
table
)
{
my_message
(
ER_UNKNOWN_ERROR
,
"Cannot check ALTER operations"
,
MYF
(
0
));
DBUG_RETURN
(
HA_ALTER_ERROR
);
}
// endif Xchk
newopt
=
altered_table
->
s
->
option_struct
;
oldopt
=
table
->
s
->
option_struct
;
// If this is the start of a new query, cleanup the previous one
if
(
xp
->
CheckCleanup
())
{
tdbp
=
NULL
;
valid_info
=
false
;
}
// endif CheckCleanup
g
->
Alchecked
=
1
;
// Tested in create
g
->
Xchk
=
NULL
;
type
=
GetRealType
(
oldopt
);
newtyp
=
GetRealType
(
newopt
);
// No copy algorithm for outward tables
outward
=
(
!
IsFileType
(
type
)
||
(
oldopt
->
filename
&&
*
oldopt
->
filename
));
// Index operations
Alter_inplace_info
::
HA_ALTER_FLAGS
index_operations
=
Alter_inplace_info
::
ADD_INDEX
|
Alter_inplace_info
::
DROP_INDEX
|
Alter_inplace_info
::
ADD_UNIQUE_INDEX
|
Alter_inplace_info
::
DROP_UNIQUE_INDEX
|
Alter_inplace_info
::
ADD_PK_INDEX
|
Alter_inplace_info
::
DROP_PK_INDEX
;
Alter_inplace_info
::
HA_ALTER_FLAGS
inplace_offline_operations
=
Alter_inplace_info
::
ALTER_COLUMN_EQUAL_PACK_LENGTH
|
Alter_inplace_info
::
ALTER_COLUMN_NAME
|
Alter_inplace_info
::
ALTER_COLUMN_DEFAULT
|
Alter_inplace_info
::
CHANGE_CREATE_OPTION
|
Alter_inplace_info
::
ALTER_RENAME
|
index_operations
;
if
(
ha_alter_info
->
handler_flags
&
index_operations
||
!
SameChar
(
altered_table
,
"optname"
)
||
!
SameBool
(
altered_table
,
"sepindex"
))
{
if
(
!
IsTypeIndexable
(
type
))
{
sprintf
(
g
->
Message
,
"Table type %s is not indexable"
,
oldopt
->
type
);
my_message
(
ER_UNKNOWN_ERROR
,
g
->
Message
,
MYF
(
0
));
DBUG_RETURN
(
HA_ALTER_ERROR
);
}
// endif Indexable
g
->
Xchk
=
new
(
g
)
XCHK
;
PCHK
xcp
=
(
PCHK
)
g
->
Xchk
;
xcp
->
oldpix
=
GetIndexInfo
(
table
->
s
);
xcp
->
newpix
=
GetIndexInfo
(
altered_table
->
s
);
xcp
->
oldsep
=
GetBooleanOption
(
"sepindex"
,
false
);
xcp
->
oldsep
=
xcp
->
SetName
(
g
,
GetStringOption
(
"optname"
));
tshp
=
altered_table
->
s
;
xcp
->
newsep
=
GetBooleanOption
(
"sepindex"
,
false
);
xcp
->
newsep
=
xcp
->
SetName
(
g
,
GetStringOption
(
"optname"
));
tshp
=
NULL
;
if
(
xtrace
&&
g
->
Xchk
)
printf
(
"oldsep=%d newsep=%d oldopn=%s newopn=%s oldpix=%p newpix=%p
\n
"
,
xcp
->
oldsep
,
xcp
->
newsep
,
SVP
(
xcp
->
oldopn
),
SVP
(
xcp
->
newopn
),
xcp
->
oldpix
,
xcp
->
newpix
);
if
(
sqlcom
==
SQLCOM_ALTER_TABLE
)
idx
=
true
;
else
DBUG_RETURN
(
HA_ALTER_INPLACE_EXCLUSIVE_LOCK
);
}
// endif index operation
if
(
!
SameChar
(
altered_table
,
"filename"
))
{
if
(
!
outward
)
{
// Conversion to outward table is only allowed for file based
// tables whose file does not exist.
tshp
=
altered_table
->
s
;
char
*
fn
=
GetStringOption
(
"filename"
);
tshp
=
NULL
;
if
(
FileExists
(
fn
))
{
strcpy
(
g
->
Message
,
"Operation denied. Table data would be lost."
);
my_message
(
ER_UNKNOWN_ERROR
,
g
->
Message
,
MYF
(
0
));
DBUG_RETURN
(
HA_ALTER_ERROR
);
}
else
goto
fin
;
}
else
goto
fin
;
}
// endif filename
/* Is there at least one operation that requires copy algorithm? */
if
(
ha_alter_info
->
handler_flags
&
~
inplace_offline_operations
)
goto
fin
;
/*
ALTER TABLE tbl_name CONVERT TO CHARACTER SET .. and
ALTER TABLE table_name DEFAULT CHARSET = .. most likely
change column charsets and so not supported in-place through
old API.
Changing of PACK_KEYS, MAX_ROWS and ROW_FORMAT options were
not supported as in-place operations in old API either.
*/
if
(
create_info
->
used_fields
&
(
HA_CREATE_USED_CHARSET
|
HA_CREATE_USED_DEFAULT_CHARSET
|
HA_CREATE_USED_PACK_KEYS
|
HA_CREATE_USED_MAX_ROWS
)
||
(
table
->
s
->
row_type
!=
create_info
->
row_type
))
goto
fin
;
#if 0
uint table_changes= (ha_alter_info->handler_flags &
Alter_inplace_info::ALTER_COLUMN_EQUAL_PACK_LENGTH) ?
IS_EQUAL_PACK_LENGTH : IS_EQUAL_YES;
if (table->file->check_if_incompatible_data(create_info, table_changes)
== COMPATIBLE_DATA_YES)
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
#endif // 0
// This was in check_if_incompatible_data
if
(
type
==
newtyp
&&
SameInt
(
altered_table
,
"lrecl"
)
&&
SameInt
(
altered_table
,
"elements"
)
&&
SameInt
(
altered_table
,
"header"
)
&&
SameInt
(
altered_table
,
"quoted"
)
&&
SameInt
(
altered_table
,
"ending"
)
&&
SameInt
(
altered_table
,
"compressed"
))
DBUG_RETURN
(
HA_ALTER_INPLACE_EXCLUSIVE_LOCK
);
fin:
if
(
idx
)
{
// Indexing is only supported inplace
my_message
(
ER_UNKNOWN_ERROR
,
"Alter operations not supported together by CONNECT"
,
MYF
(
0
));
DBUG_RETURN
(
HA_ALTER_ERROR
);
}
else
if
(
outward
)
{
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
"This is an outward table, table data were not modified."
);
DBUG_RETURN
(
HA_ALTER_INPLACE_EXCLUSIVE_LOCK
);
}
else
DBUG_RETURN
(
HA_ALTER_INPLACE_NOT_SUPPORTED
);
}
// end of check_if_supported_inplace_alter
/**
/**
check_if_incompatible_data() called if ALTER TABLE can't detect otherwise
check_if_incompatible_data() called if ALTER TABLE can't detect otherwise
...
@@ -4818,46 +5343,17 @@ int ha_connect::create(const char *name, TABLE *table_arg,
...
@@ -4818,46 +5343,17 @@ int ha_connect::create(const char *name, TABLE *table_arg,
(sql/sql_tables.cc) to decide should we rewrite whole table or only .frm
(sql/sql_tables.cc) to decide should we rewrite whole table or only .frm
file.
file.
@note: This function is no more called by check_if_supported_inplace_alter
*/
*/
bool
ha_connect
::
check_if_incompatible_data
(
HA_CREATE_INFO
*
info
,
bool
ha_connect
::
check_if_incompatible_data
(
HA_CREATE_INFO
*
info
,
uint
table_changes
)
uint
table_changes
)
{
{
//ha_table_option_struct *param_old, *param_new;
DBUG_ENTER
(
"ha_connect::check_if_incompatible_data"
);
DBUG_ENTER
(
"ha_connect::check_if_incompatible_data"
);
// TO DO: really implement and check it.
// TO DO: really implement and check it.
THD
*
thd
=
current_thd
;
push_warning
(
ha_thd
(),
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
"Unexpected call to check_if_incompatible_data."
);
push_warning
(
thd
,
Sql_condition
::
WARN_LEVEL_WARN
,
0
,
DBUG_RETURN
(
COMPATIBLE_DATA_NO
);
"The current version of CONNECT did not check what you changed in ALTER. Use at your own risk"
);
if
(
table
)
{
PTOS
newopt
=
info
->
option_struct
;
PTOS
oldopt
=
table
->
s
->
option_struct
;
#if 0
if (newopt->sepindex != oldopt->sepindex) {
// All indexes to be remade
PGLOBAL g= GetPlug(thd);
if (!g)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
"Execute OPTIMIZE TABLE to remake the indexes");
else
g->Xchk= new(g) XCHK;
} // endif sepindex
#endif // 0
if
(
oldopt
->
type
!=
newopt
->
type
)
DBUG_RETURN
(
COMPATIBLE_DATA_NO
);
if
(
newopt
->
filename
)
DBUG_RETURN
(
COMPATIBLE_DATA_NO
);
}
// endif table
DBUG_RETURN
(
COMPATIBLE_DATA_YES
);
}
// end of check_if_incompatible_data
}
// end of check_if_incompatible_data
...
...
storage/connect/ha_connect.h
View file @
78f11e8e
...
@@ -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
;
...
...
storage/connect/mycat.cc
View file @
78f11e8e
...
@@ -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 --------------------------- */
/***********************************************************************/
/***********************************************************************/
...
...
storage/connect/mysql-test/connect/r/bin.result
View file @
78f11e8e
...
@@ -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` (
...
...
storage/connect/mysql-test/connect/r/csv.result
View file @
78f11e8e
...
@@ -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` (
...
...
storage/connect/mysql-test/connect/r/dbf.result
View file @
78f11e8e
...
@@ -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='t1
c
.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/t1
c
.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`='t1
c
.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/t1
c
.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`='t1
c
.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/t1
c
.dbf');
-------- --------
-------- --------
FileSize 77
FileSize 77
DBF_Version 03
DBF_Version 03
...
...
storage/connect/mysql-test/connect/r/dir.result
View file @
78f11e8e
...
@@ -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` (
...
...
storage/connect/mysql-test/connect/r/fix.result
View file @
78f11e8e
...
@@ -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` (
...
...
storage/connect/mysql-test/connect/r/index.result
View file @
78f11e8e
...
@@ -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
...
...
storage/connect/mysql-test/connect/r/ini.result
View file @
78f11e8e
...
@@ -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` (
...
...
storage/connect/mysql-test/connect/r/occur.result
View file @
78f11e8e
...
@@ -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
...
...
storage/connect/mysql-test/connect/r/pivot.result
View file @
78f11e8e
...
@@ -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
...
...
storage/connect/mysql-test/connect/r/vec.result
View file @
78f11e8e
...
@@ -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` (
...
...
storage/connect/mysql-test/connect/r/xml.result
View file @
78f11e8e
...
@@ -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.0
1.0011 December 15, 2013
-->
<!-- Created by CONNECT Version 1.0
2.0001 February 03, 2014
-->
<t1>
<t1>
<line>
<line>
<node>ÀÁÂÃ</node>
<node>ÀÁÂÃ</node>
...
...
storage/connect/mysql-test/connect/t/dbf.test
View file @
78f11e8e
...
@@ -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
=
't1
c
.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
/
t1
c
.
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/t1
c
.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/t1
c
.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/t1
c
.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
/
t1
c
.
dbf
--
echo
#
--
echo
#
...
...
storage/connect/plgcnx.h
View file @
78f11e8e
/**************************************************************************/
/**************************************************************************/
/* PLGCNX.H */
/* 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. */
/* 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
}
}
...
...
storage/connect/plgdbsem.h
View file @
78f11e8e
/************** 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-201
2
*/
/* (C) Copyright to the author Olivier BERTRAND 1998-201
4
*/
/* */
/* */
/* 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
);
storage/connect/plgdbutl.cpp
View file @
78f11e8e
/********** 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 1998-201
4
*/
/* */
/* */
/* 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
)
...
...
storage/connect/plugutil.c
View file @
78f11e8e
...
@@ -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
,
""
);
...
...
storage/connect/tabfix.cpp
View file @
78f11e8e
...
@@ -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
);
...
...
storage/connect/table.cpp
View file @
78f11e8e
/************** 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 1999-201
4
*/
/* */
/* */
/* 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. */
/***********************************************************************/
/***********************************************************************/
...
...
storage/connect/tabmysql.cpp
View file @
78f11e8e
...
@@ -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
...
...
storage/connect/tabxml.cpp
View file @
78f11e8e
/************* 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 - 201
3
*/
/* Author Olivier BERTRAND 2007 - 201
4
*/
/* */
/* */
/* 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
)
{
MaxSize
=
Cardinality
(
g
)
*
((
Xpand
)
?
Limit
:
1
);
if
(
!
Multiple
)
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 ----------------------------
...
...
storage/connect/tabxml.h
View file @
78f11e8e
...
@@ -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
...
...
storage/connect/user_connect.cc
View file @
78f11e8e
...
@@ -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
)
...
...
storage/connect/valblk.cpp
View file @
78f11e8e
/************ 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* */
/* */
/* 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. */
/***********************************************************************/
/***********************************************************************/
...
...
storage/connect/valblk.h
View file @
78f11e8e
/*************** 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* */
/* */
/* 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
...
@@ -286,10 +290,11 @@ class DATBLK : public TYPBLK<int> {
...
@@ -286,10 +290,11 @@ class DATBLK : public TYPBLK<int> {
DATBLK
(
void
*
mp
,
int
size
);
DATBLK
(
void
*
mp
,
int
size
);
// 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
);
protected:
protected:
// Members
// Members
...
...
storage/connect/value.cpp
View file @
78f11e8e
/************* 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-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2001-201
4
*/
/* */
/* */
/* 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
/***********************************************************************/
/***********************************************************************/
...
...
storage/connect/xtable.h
View file @
78f11e8e
/**************** 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-201
2
*/
/* (C) Copyright to the author Olivier BERTRAND 1999-201
4
*/
/* */
/* */
/* 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
...
...
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