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
5bc538dd
Commit
5bc538dd
authored
Mar 11, 2017
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit the 2 last commits merged from 10.1
parent
92d283c0
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
455 additions
and
291 deletions
+455
-291
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+2
-2
storage/connect/myconn.cpp
storage/connect/myconn.cpp
+32
-7
storage/connect/myutil.cpp
storage/connect/myutil.cpp
+8
-5
storage/connect/tabmul.cpp
storage/connect/tabmul.cpp
+371
-261
storage/connect/tabmul.h
storage/connect/tabmul.h
+42
-16
No files found.
storage/connect/ha_connect.cc
View file @
5bc538dd
...
...
@@ -172,7 +172,7 @@
#define JSONMAX 10 // JSON Default max grp size
extern
"C"
{
char
version
[]
=
"Version 1.05.0003
February 2
7, 2017"
;
char
version
[]
=
"Version 1.05.0003
March
7, 2017"
;
#if defined(__WIN__)
char
compver
[]
=
"Version 1.05.0003 "
__DATE__
" "
__TIME__
;
char
slash
=
'\\'
;
...
...
@@ -509,7 +509,7 @@ ha_create_table_option connect_table_option_list[]=
HA_TOPTION_NUMBER
(
"LRECL"
,
lrecl
,
0
,
0
,
INT_MAX32
,
1
),
HA_TOPTION_NUMBER
(
"BLOCK_SIZE"
,
elements
,
0
,
0
,
INT_MAX32
,
1
),
//HA_TOPTION_NUMBER("ESTIMATE", estimate, 0, 0, INT_MAX32, 1),
HA_TOPTION_NUMBER
(
"MULTIPLE"
,
multiple
,
0
,
0
,
2
,
1
),
HA_TOPTION_NUMBER
(
"MULTIPLE"
,
multiple
,
0
,
0
,
3
,
1
),
HA_TOPTION_NUMBER
(
"HEADER"
,
header
,
0
,
0
,
3
,
1
),
HA_TOPTION_NUMBER
(
"QUOTED"
,
quoted
,
(
ulonglong
)
-
1
,
0
,
3
,
1
),
HA_TOPTION_NUMBER
(
"ENDING"
,
ending
,
(
ulonglong
)
-
1
,
0
,
INT_MAX32
,
1
),
...
...
storage/connect/myconn.cpp
View file @
5bc538dd
...
...
@@ -135,10 +135,12 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
FLD_KEY
,
FLD_SCALE
,
FLD_RADIX
,
FLD_NULL
,
FLD_REM
,
FLD_NO
,
FLD_DEFAULT
,
FLD_EXTRA
,
FLD_CHARSET
};
unsigned
int
length
[]
=
{
0
,
4
,
16
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
0
,
0
};
char
*
fld
,
*
colname
,
*
chset
,
*
fmt
,
v
,
buf
[
128
],
uns
[
16
],
zero
[
16
];
//unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0};
unsigned
int
length
[]
=
{
0
,
4
,
0
,
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
0
,
0
};
char
*
fld
,
*
colname
,
*
chset
,
*
fmt
,
v
,
buf
[
128
],
uns
[
16
],
zero
[
16
];
int
i
,
n
,
nf
,
ncol
=
sizeof
(
buftyp
)
/
sizeof
(
int
);
int
len
,
type
,
prec
,
rc
,
k
=
0
;
bool
b
;
PQRYRES
qrp
;
PCOLRES
crp
;
MYSQLC
myc
;
...
...
@@ -157,7 +159,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
/* Do an evaluation of the result size. */
/********************************************************************/
STRING
cmd
(
g
,
64
,
"SHOW FULL COLUMNS FROM "
);
b
ool
b
=
cmd
.
Append
((
PSZ
)
table
);
b
=
cmd
.
Append
((
PSZ
)
table
);
b
|=
cmd
.
Append
(
" FROM "
);
b
|=
cmd
.
Append
((
PSZ
)(
db
?
db
:
PlgGetUser
(
g
)
->
DBName
));
...
...
@@ -232,11 +234,31 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
fld
=
myc
.
GetCharField
(
1
);
prec
=
0
;
len
=
0
;
v
=
(
chset
&&
!
strcmp
(
chset
,
"binary"
))
?
'B'
:
0
;
// v = (chset && !strcmp(chset, "binary")) ? 'B' : 0;
v
=
0
;
*
uns
=
0
;
*
zero
=
0
;
switch
((
nf
=
sscanf
(
fld
,
"%[^(](%d,%d"
,
buf
,
&
len
,
&
prec
)))
{
b
=
false
;
if
(
!
strnicmp
(
fld
,
"enum"
,
4
))
{
char
*
p2
,
*
p1
=
fld
+
6
;
// to skip enum('
while
(
true
)
{
p2
=
strchr
(
p1
,
'\''
);
len
=
MY_MAX
(
len
,
p2
-
p1
);
if
(
*++
p2
!=
','
)
break
;
p1
=
p2
+
2
;
}
// endwhile
v
=
(
len
>
255
)
?
'V'
:
0
;
strcpy
(
buf
,
"enum"
);
b
=
true
;
}
else
if
(
!
strnicmp
(
fld
,
"set"
,
3
))
{
len
=
(
int
)
strlen
(
fld
)
-
2
;
v
=
'V'
;
strcpy
(
buf
,
"set"
);
b
=
true
;
}
else
switch
((
nf
=
sscanf
(
fld
,
"%[^(](%d,%d"
,
buf
,
&
len
,
&
prec
)))
{
case
3
:
nf
=
sscanf
(
fld
,
"%[^(](%d,%d) %s %s"
,
buf
,
&
len
,
&
prec
,
uns
,
zero
);
break
;
...
...
@@ -271,7 +293,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
colname
,
len
);
PushWarning
(
g
,
thd
);
v
=
'V'
;
}
else
}
else
len
=
MY_MIN
(
len
,
4096
);
}
// endif type
...
...
@@ -286,6 +308,9 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
default:
crp
->
Nulls
[
i
]
=
v
;
break
;
}
// endswitch nf
if
(
b
)
// enum or set
nf
=
sscanf
(
fld
,
"%s "
,
buf
);
// get values
crp
=
crp
->
Next
;
// Type_Name
crp
->
Kdata
->
SetValue
(
buf
,
i
);
...
...
storage/connect/myutil.cpp
View file @
5bc538dd
...
...
@@ -42,7 +42,8 @@ int MYSQLtoPLG(char *typname, char *var)
type
=
TYPE_INT
;
else
if
(
!
stricmp
(
typname
,
"smallint"
))
type
=
TYPE_SHORT
;
else
if
(
!
stricmp
(
typname
,
"char"
)
||
!
stricmp
(
typname
,
"varchar"
))
else
if
(
!
stricmp
(
typname
,
"char"
)
||
!
stricmp
(
typname
,
"varchar"
)
||
!
stricmp
(
typname
,
"enum"
)
||
!
stricmp
(
typname
,
"set"
))
type
=
TYPE_STRING
;
else
if
(
!
stricmp
(
typname
,
"double"
)
||
!
stricmp
(
typname
,
"float"
)
||
!
stricmp
(
typname
,
"real"
))
...
...
@@ -87,10 +88,12 @@ int MYSQLtoPLG(char *typname, char *var)
else
if
(
!
stricmp
(
typname
,
"year"
))
*
var
=
'Y'
;
}
else
if
(
type
==
TYPE_STRING
&&
!
stricmp
(
typname
,
"varchar"
))
// This is to make the difference between CHAR and VARCHAR
*
var
=
'V'
;
else
if
(
type
==
TYPE_ERROR
&&
xconv
==
TPC_SKIP
)
}
else
if
(
type
==
TYPE_STRING
)
{
if
(
!
stricmp
(
typname
,
"varchar"
))
// This is to make the difference between CHAR and VARCHAR
*
var
=
'V'
;
}
else
if
(
type
==
TYPE_ERROR
&&
xconv
==
TPC_SKIP
)
*
var
=
'K'
;
else
*
var
=
0
;
...
...
storage/connect/tabmul.cpp
View file @
5bc538dd
This diff is collapsed.
Click to expand it.
storage/connect/tabmul.h
View file @
5bc538dd
...
...
@@ -69,6 +69,34 @@ class DllExport TDBMUL : public TDBASE {
int
iFile
;
// Index of currently processed file
};
// end of class TDBMUL
#if 0
/***********************************************************************/
/* This is the MSD Access Method class declaration for files that are */
/* physically split in multiple files having the same format. */
/* This sub-class also include files of the sub-directories. */
/***********************************************************************/
class DllExport TDBMSD : public TDBMUL {
//friend class MULCOL;
public:
// Constructor
TDBMSD(PTDB tdbp) : TDBMUL(tdbp) {}
TDBMSD(PTDBMSD tdbp) : TDBMUL(tdbp) {}
// Implementation
virtual PTDB Duplicate(PGLOBAL g);
// Methods
virtual PTDB Clone(PTABS t);
bool InitFileNames(PGLOBAL g);
// Database routines
protected:
// Members
}; // end of class TDBMSD
#endif
/***********************************************************************/
/* Directory listing table. */
/***********************************************************************/
...
...
@@ -101,18 +129,16 @@ class DllExport DIRDEF : public TABDEF { /* Directory listing table */
/***********************************************************************/
class
TDBDIR
:
public
TDBASE
{
friend
class
DIRCOL
;
public:
friend
class
TDBMUL
;
public:
// Constructor
TDBDIR
(
PDIRDEF
tdp
);
TDBDIR
(
PTDBDIR
tdbp
);
TDBDIR
(
PSZ
fpat
);
// Implementation
virtual
AMT
GetAmType
(
void
)
{
return
TYPE_AM_DIR
;}
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBDIR
(
this
);}
// Methods
virtual
PTDB
Clone
(
PTABS
t
);
virtual
int
GetRecpos
(
void
)
{
return
iFile
;}
// Database routines
...
...
@@ -127,14 +153,16 @@ class TDBDIR : public TDBASE {
virtual
void
CloseDB
(
PGLOBAL
g
);
protected:
void
Init
(
void
);
char
*
Path
(
PGLOBAL
g
);
// Members
PSZ
To_File
;
// Points to file search pathname
int
iFile
;
// Index of currently retrieved file
#if defined(__WIN__)
_finddata_t
FileData
;
// Find data structure
intptr_t
Hsearch
;
// Search handle
PVAL
Dvalp
;
// Used to retrieve file date values
WIN32_FIND_DATA
FileData
;
// Find data structure
HANDLE
hSearch
;
// Search handle
char
Drive
[
_MAX_DRIVE
];
// Drive name
#else // !__WIN__
struct
stat
Fileinfo
;
// File info structure
...
...
@@ -158,17 +186,11 @@ class TDBDIR : public TDBASE {
/***********************************************************************/
class
TDBSDR
:
public
TDBDIR
{
friend
class
DIRCOL
;
friend
class
TDBMUL
;
public:
// Constructors
TDBSDR
(
PDIRDEF
tdp
)
:
TDBDIR
(
tdp
)
{
Sub
=
NULL
;}
TDBSDR
(
PTDBSDR
tdbp
);
// Implementation
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBSDR
(
this
);}
// Methods
virtual
PTDB
Clone
(
PTABS
t
);
TDBSDR
(
PSZ
fpat
)
:
TDBDIR
(
fpat
)
{
Sub
=
NULL
;}
// Database routines
virtual
int
GetMaxSize
(
PGLOBAL
g
);
...
...
@@ -184,7 +206,7 @@ class TDBSDR : public TDBDIR {
struct
_Sub_Dir
*
Next
;
struct
_Sub_Dir
*
Prev
;
#if defined(__WIN__)
intptr_t
H
;
// Search handle
HANDLE
H
;
// Search handle
#else // !__WIN__
DIR
*
D
;
#endif // !__WIN__
...
...
@@ -214,7 +236,11 @@ class DIRCOL : public COLBLK {
protected:
// Default constructor not to be used
DIRCOL
(
void
)
{}
#if defined(__WIN__)
void
SetTimeValue
(
PGLOBAL
g
,
FILETIME
&
ftime
);
#endif // __WIN__
// Members
PTDBDIR
Tdbp
;
// To DIR table
int
N
;
// Column number
};
// end of class DIRCOL
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