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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5dcb111c
Commit
5dcb111c
authored
May 05, 2015
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Buggynours:10.0' into 10.0
parents
bbcc8e69
eae8318b
Changes
47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
2033 additions
and
696 deletions
+2033
-696
.gitattributes
.gitattributes
+20
-0
.gitignore
.gitignore
+233
-0
storage/connect/CMakeLists.txt
storage/connect/CMakeLists.txt
+17
-24
storage/connect/connect.cc
storage/connect/connect.cc
+0
-1
storage/connect/domdoc.cpp
storage/connect/domdoc.cpp
+89
-6
storage/connect/domdoc.h
storage/connect/domdoc.h
+14
-5
storage/connect/filamap.cpp
storage/connect/filamap.cpp
+2
-3
storage/connect/filamap.h
storage/connect/filamap.h
+1
-0
storage/connect/filamtxt.cpp
storage/connect/filamtxt.cpp
+3
-5
storage/connect/filamtxt.h
storage/connect/filamtxt.h
+1
-0
storage/connect/filamvct.cpp
storage/connect/filamvct.cpp
+3
-5
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+114
-43
storage/connect/ha_connect.h
storage/connect/ha_connect.h
+12
-8
storage/connect/json.cpp
storage/connect/json.cpp
+2
-2
storage/connect/json.h
storage/connect/json.h
+270
-264
storage/connect/libdoc.cpp
storage/connect/libdoc.cpp
+62
-9
storage/connect/mycat.cc
storage/connect/mycat.cc
+3
-10
storage/connect/mycat.h
storage/connect/mycat.h
+40
-0
storage/connect/mysql-test/connect/r/json.result
storage/connect/mysql-test/connect/r/json.result
+9
-9
storage/connect/odbconn.cpp
storage/connect/odbconn.cpp
+4
-7
storage/connect/plgdbsem.h
storage/connect/plgdbsem.h
+6
-4
storage/connect/plgdbutl.cpp
storage/connect/plgdbutl.cpp
+20
-5
storage/connect/plgxml.h
storage/connect/plgxml.h
+9
-6
storage/connect/plugutil.c
storage/connect/plugutil.c
+20
-6
storage/connect/reldef.cpp
storage/connect/reldef.cpp
+21
-23
storage/connect/reldef.h
storage/connect/reldef.h
+2
-0
storage/connect/tabjson.cpp
storage/connect/tabjson.cpp
+502
-128
storage/connect/tabjson.h
storage/connect/tabjson.h
+49
-17
storage/connect/table.cpp
storage/connect/table.cpp
+5
-1
storage/connect/tabmul.cpp
storage/connect/tabmul.cpp
+4
-7
storage/connect/tabmysql.cpp
storage/connect/tabmysql.cpp
+1
-3
storage/connect/taboccur.cpp
storage/connect/taboccur.cpp
+3
-8
storage/connect/tabpivot.cpp
storage/connect/tabpivot.cpp
+16
-7
storage/connect/tabtbl.cpp
storage/connect/tabtbl.cpp
+0
-3
storage/connect/tabutil.cpp
storage/connect/tabutil.cpp
+3
-18
storage/connect/tabxcl.cpp
storage/connect/tabxcl.cpp
+0
-3
storage/connect/tabxml.cpp
storage/connect/tabxml.cpp
+365
-11
storage/connect/tabxml.h
storage/connect/tabxml.h
+23
-0
storage/connect/valblk.cpp
storage/connect/valblk.cpp
+4
-5
storage/connect/value.cpp
storage/connect/value.cpp
+46
-34
storage/connect/xobject.cpp
storage/connect/xobject.cpp
+28
-0
storage/connect/xobject.h
storage/connect/xobject.h
+1
-0
storage/connect/xtable.h
storage/connect/xtable.h
+2
-4
storage/innobase/dict/dict0mem.cc
storage/innobase/dict/dict0mem.cc
+1
-1
storage/innobase/include/dict0mem.h
storage/innobase/include/dict0mem.h
+1
-0
storage/xtradb/dict/dict0mem.cc
storage/xtradb/dict/dict0mem.cc
+1
-1
storage/xtradb/include/dict0mem.h
storage/xtradb/include/dict0mem.h
+1
-0
No files found.
.gitattributes
View file @
5dcb111c
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.cc text
*.cpp text
*.h text
*.test text
# Declare files that will always have LF line endings on checkout.
*.result text eol=lf
storage/connect/mysql-test/connect/std_data/*.txt text eol=lf
storage/connect/mysql-test/connect/std_data/*.dat text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.c diff=cpp
*.h diff=cpp
*.cc diff=cpp
...
...
.gitignore
View file @
5dcb111c
# Edited by Olivier Bertrand
*-t
*.a
*.ctest
...
...
@@ -7,6 +8,8 @@
*.so.*
*.spec
*~
*.bak
*.log
.*.swp
*.ninja
.ninja_*
...
...
@@ -15,6 +18,9 @@ errmsg.sys
typescript
CMakeCache.txt
CMakeFiles/
MakeFile
cmake_install.cmake
install_manifest.txt
CPackConfig.cmake
CPackSourceConfig.cmake
CTestTestfile.cmake
...
...
@@ -230,3 +236,230 @@ storage/mroonga/vendor/groonga/src/grnslap
storage/mroonga/vendor/groonga/src/groonga
storage/mroonga/vendor/groonga/src/groonga-benchmark
storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
# C and C++
# Compiled Object files
*.slo
*.lo
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Compiled Static libraries
*.lib
*.a
*.la
*.lai
*.lo
# Compiled Dynamic libraries
*.so
*.so.*
*.dylib
*.dll
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
*.ncb
*.sln
*.vcproj
*.vcproj.*
*.vcproj.*.*
*.vcproj.*.*.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Roslyn cache directories
*.ide/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# If using the old MSBuild-Integrated Package Restore, uncomment this:
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
# sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
storage/connect/CMakeLists.txt
View file @
5dcb111c
...
...
@@ -21,18 +21,18 @@ ha_connect.cc connect.cc user_connect.cc mycat.cc
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
array.cpp blkfil.cpp colblk.cpp csort.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp
filter.cpp json.cpp jsonudf.cpp maputil.cpp my
util.cpp plgdbutl.cpp reldef
.cpp
tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp tabmul
.cpp
tab
occur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabvir
.cpp
tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
filter.cpp json.cpp jsonudf.cpp maputil.cpp my
conn.cpp myutil.cpp plgdbutl
.cpp
reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table
.cpp
tab
mul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil
.cpp
tab
vct.cpp tabvir.cpp tab
xcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h
filter.h global.h ha_connect.h inihandl.h json.h maputil.h msgid.h mycat.h
my
util.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h resource
.h
tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h taboccur.h tabpivot
.h
tab
sys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h user_connect
.h
valblk.h value.h xindex.h xobject.h xtable.h
)
my
conn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef
.h
resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql
.h
tab
occur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl
.h
user_connect.h
valblk.h value.h xindex.h xobject.h xtable.h
)
#
# Definitions that are shared for all OSes
...
...
@@ -166,24 +166,15 @@ IF(LIBXML2_FOUND OR MSXML_FOUND)
ENDIF
()
#
# MySQL
# MySQL
is now included unconditionnally
#
OPTION
(
CONNECT_WITH_MYSQL
"Compile CONNECT storage engine with remote MySQL connection support"
ON
)
IF
(
CONNECT_WITH_MYSQL
)
SET
(
CONNECT_SOURCES
${
CONNECT_SOURCES
}
myconn.cpp myconn.h tabmysql.cpp tabmysql.h
)
add_definitions
(
-DMYSQL_SUPPORT
)
IF
(
NOT UNIX
)
#
# TODO: remove this
# change to use "#include "../../include/mysql.h" in the sources.
INCLUDE_DIRECTORIES
(
"../../include/mysql"
)
ENDIF
(
NOT UNIX
)
ENDIF
(
CONNECT_WITH_MYSQL
)
IF
(
NOT UNIX
)
#
# TODO: remove this
# change to use "#include "../../include/mysql.h" in the sources.
INCLUDE_DIRECTORIES
(
"../../include/mysql"
)
ENDIF
(
NOT UNIX
)
#
...
...
@@ -232,6 +223,8 @@ IF(CONNECT_WITH_ODBC)
DOC
"Specify the ODBC driver manager library here."
)
mark_as_advanced
(
ODBC_LIBRARY ODBC_INCLUDE_DIR
)
IF
(
ODBC_INCLUDE_DIR AND ODBC_LIBRARY
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
ODBC_LIBRARY
}
)
set
(
CMAKE_REQUIRED_INCLUDES
${
ODBC_INCLUDE_DIR
}
)
...
...
storage/connect/connect.cc
View file @
5dcb111c
...
...
@@ -42,7 +42,6 @@
#include "tabcol.h"
#include "catalog.h"
#include "ha_connect.h"
#include "mycat.h"
#define my_strupr(p) my_caseup_str(default_charset_info, (p));
#define my_strlwr(p) my_casedn_str(default_charset_info, (p));
...
...
storage/connect/domdoc.cpp
View file @
5dcb111c
...
...
@@ -275,7 +275,7 @@ PXNODE DOMNODE::GetNext(PGLOBAL g)
{
if
(
Nodep
->
nextSibling
==
NULL
)
Next
=
NULL
;
else
if
(
!
Next
)
else
//
if (!Next)
Next
=
new
(
g
)
DOMNODE
(
Doc
,
Nodep
->
nextSibling
);
return
Next
;
...
...
@@ -288,7 +288,7 @@ PXNODE DOMNODE::GetChild(PGLOBAL g)
{
if
(
Nodep
->
firstChild
==
NULL
)
Children
=
NULL
;
else
if
(
!
Children
)
else
//
if (!Children)
Children
=
new
(
g
)
DOMNODE
(
Doc
,
Nodep
->
firstChild
);
return
Children
;
...
...
@@ -441,15 +441,27 @@ PXNODE DOMNODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/
PXATTR
DOMNODE
::
GetAttribute
(
PGLOBAL
g
,
char
*
name
,
PXATTR
ap
)
{
MSXML2
::
IXMLDOMElementPtr
ep
=
Nodep
;
MSXML2
::
IXMLDOMAttributePtr
atp
=
ep
->
getAttributeNode
(
name
);
MSXML2
::
IXMLDOMElementPtr
ep
;
MSXML2
::
IXMLDOMNamedNodeMapPtr
nmp
;
MSXML2
::
IXMLDOMAttributePtr
atp
;
if
(
name
)
{
ep
=
Nodep
;
atp
=
ep
->
getAttributeNode
(
name
);
nmp
=
NULL
;
}
else
{
nmp
=
Nodep
->
Getattributes
();
atp
=
nmp
->
Getitem
(
0
);
}
// endif name
if
(
atp
)
{
if
(
ap
)
{
((
PDOMATTR
)
ap
)
->
Atrp
=
atp
;
((
PDOMATTR
)
ap
)
->
Nmp
=
nmp
;
((
PDOMATTR
)
ap
)
->
K
=
0
;
return
ap
;
}
else
return
new
(
g
)
DOMATTR
(
Doc
,
atp
);
return
new
(
g
)
DOMATTR
(
Doc
,
atp
,
nmp
);
}
else
return
NULL
;
...
...
@@ -617,14 +629,85 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n)
/******************************************************************/
/* DOMATTR constructor. */
/******************************************************************/
DOMATTR
::
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
)
DOMATTR
::
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
,
MSXML2
::
IXMLDOMNamedNodeMapPtr
nmp
)
:
XMLATTRIBUTE
(
dp
)
{
Atrp
=
ap
;
Nmp
=
nmp
;
Ws
=
NULL
;
Len
=
0
;
K
=
0
;
}
// end of DOMATTR constructor
/******************************************************************/
/* Return the attribute name. */
/******************************************************************/
char
*
DOMATTR
::
GetName
(
PGLOBAL
g
)
{
if
(
!
WideCharToMultiByte
(
CP_ACP
,
0
,
Atrp
->
nodeName
,
-
1
,
Name
,
sizeof
(
Name
),
NULL
,
NULL
))
{
strcpy
(
g
->
Message
,
MSG
(
NAME_CONV_ERR
));
return
NULL
;
}
// endif
return
Name
;
}
// end of GetName
/******************************************************************/
/* Return the next attribute node. */
/* This funtion is implemented as needed by XMLColumns. */
/******************************************************************/
PXATTR
DOMATTR
::
GetNext
(
PGLOBAL
g
)
{
if
(
!
Nmp
)
return
NULL
;
if
(
++
K
>=
Nmp
->
Getlength
())
{
Nmp
->
reset
();
Nmp
=
NULL
;
K
=
0
;
return
NULL
;
}
// endif K
Atrp
=
Nmp
->
Getitem
(
K
);
return
this
;
}
// end of GetNext
/******************************************************************/
/* Return the content of a node and subnodes. */
/******************************************************************/
RCODE
DOMATTR
::
GetText
(
PGLOBAL
g
,
char
*
buf
,
int
len
)
{
RCODE
rc
=
RC_OK
;
if
(
!
WideCharToMultiByte
(
CP_UTF8
,
0
,
Atrp
->
text
,
-
1
,
buf
,
len
,
NULL
,
NULL
))
{
DWORD
lsr
=
GetLastError
();
switch
(
lsr
)
{
case
0
:
case
ERROR_INSUFFICIENT_BUFFER
:
// 122L
sprintf
(
g
->
Message
,
"Truncated %s content"
,
GetName
(
g
));
rc
=
RC_INFO
;
break
;
case
ERROR_NO_UNICODE_TRANSLATION
:
// 1113L
sprintf
(
g
->
Message
,
"Invalid character(s) in %s content"
,
GetName
(
g
));
rc
=
RC_INFO
;
break
;
default:
sprintf
(
g
->
Message
,
"System error getting %s content"
,
GetName
(
g
));
rc
=
RC_FX
;
break
;
}
// endswitch
}
// endif
return
rc
;
}
// end of GetText
/******************************************************************/
/* Set the text content of an attribute. */
/******************************************************************/
...
...
storage/connect/domdoc.h
View file @
5dcb111c
...
...
@@ -122,15 +122,24 @@ class DOMATTR : public XMLATTRIBUTE {
friend
class
DOMDOC
;
friend
class
DOMNODE
;
public:
// Properties
virtual
char
*
GetName
(
PGLOBAL
g
);
virtual
PXATTR
GetNext
(
PGLOBAL
);
// Methods
virtual
bool
SetText
(
PGLOBAL
g
,
char
*
txtp
,
int
len
);
virtual
RCODE
GetText
(
PGLOBAL
g
,
char
*
bufp
,
int
len
);
virtual
bool
SetText
(
PGLOBAL
g
,
char
*
txtp
,
int
len
);
protected:
// Constructor
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
);
DOMATTR
(
PXDOC
dp
,
MSXML2
::
IXMLDOMAttributePtr
ap
,
MSXML2
::
IXMLDOMNamedNodeMapPtr
nmp
=
NULL
);
// Members
MSXML2
::
IXMLDOMAttributePtr
Atrp
;
WCHAR
*
Ws
;
int
Len
;
MSXML2
::
IXMLDOMAttributePtr
Atrp
;
MSXML2
::
IXMLDOMNamedNodeMapPtr
Nmp
;
char
Name
[
64
];
WCHAR
*
Ws
;
int
Len
;
long
K
;
};
// end of class DOMATTR
storage/connect/filamap.cpp
View file @
5dcb111c
...
...
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
5
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -207,8 +207,7 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
/*******************************************************************/
fp
=
(
PFBLOCK
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
FBLOCK
));
fp
->
Type
=
TYPE_FB_MAP
;
fp
->
Fname
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filename
)
+
1
);
strcpy
((
char
*
)
fp
->
Fname
,
filename
);
fp
->
Fname
=
PlugDup
(
g
,
filename
);
fp
->
Next
=
dbuserp
->
Openlist
;
dbuserp
->
Openlist
=
fp
;
fp
->
Count
=
1
;
...
...
storage/connect/filamap.h
View file @
5dcb111c
...
...
@@ -17,6 +17,7 @@ typedef class MAPFAM *PMAPFAM;
/* This is the variable file access method using file mapping. */
/***********************************************************************/
class
DllExport
MAPFAM
:
public
TXTFAM
{
friend
class
TDBJSON
;
public:
// Constructor
MAPFAM
(
PDOSDEF
tdp
);
...
...
storage/connect/filamtxt.cpp
View file @
5dcb111c
...
...
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
5
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -289,8 +289,7 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top)
pp
->
Intval
=
*
(
int
*
)
val
;
break
;
// case TYPE_STRING:
// pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1);
// strcpy((char*)pp->Value, (char*)val);
// pp->Value = PlugDup(g, (char*)val);
// break;
case
TYPE_PCHAR
:
pp
->
Value
=
val
;
...
...
@@ -325,8 +324,7 @@ int TXTFAM::StoreValues(PGLOBAL g, bool upd)
if
(
Tdbp
->
PrepareWriting
(
g
))
return
RC_FX
;
buf
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
Tdbp
->
GetLine
())
+
1
);
strcpy
(
buf
,
Tdbp
->
GetLine
());
buf
=
PlugDup
(
g
,
Tdbp
->
GetLine
());
rc
=
AddListValue
(
g
,
TYPE_PCHAR
,
buf
,
&
To_Upd
);
}
// endif upd
...
...
storage/connect/filamtxt.h
View file @
5dcb111c
...
...
@@ -42,6 +42,7 @@ class DllExport TXTFAM : public BLOCK {
virtual
PTXF
Duplicate
(
PGLOBAL
g
)
=
0
;
virtual
bool
GetUseTemp
(
void
)
{
return
false
;}
virtual
int
GetDelRows
(
void
)
{
return
DelRows
;}
PFBLOCK
GetTo_Fb
(
void
)
{
return
To_Fb
;}
int
GetCurBlk
(
void
)
{
return
CurBlk
;}
void
SetTdbp
(
PTDBDOS
tdbp
)
{
Tdbp
=
tdbp
;}
int
GetBlock
(
void
)
{
return
Block
;}
...
...
storage/connect/filamvct.cpp
View file @
5dcb111c
...
...
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
5
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -1451,8 +1451,7 @@ bool VCMFAM::OpenTableFile(PGLOBAL g)
/*******************************************************************/
fp
=
(
PFBLOCK
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
FBLOCK
));
fp
->
Type
=
TYPE_FB_MAP
;
fp
->
Fname
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filename
)
+
1
);
strcpy
((
char
*
)
fp
->
Fname
,
filename
);
fp
->
Fname
=
PlugDup
(
g
,
filename
);
fp
->
Next
=
dbuserp
->
Openlist
;
dbuserp
->
Openlist
=
fp
;
fp
->
Count
=
1
;
...
...
@@ -2844,8 +2843,7 @@ bool VMPFAM::MapColumnFile(PGLOBAL g, MODE mode, int i)
/*******************************************************************/
fp
=
(
PFBLOCK
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
FBLOCK
));
fp
->
Type
=
TYPE_FB_MAP
;
fp
->
Fname
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filename
)
+
1
);
strcpy
((
char
*
)
fp
->
Fname
,
filename
);
fp
->
Fname
=
PlugDup
(
g
,
filename
);
fp
->
Next
=
dup
->
Openlist
;
dup
->
Openlist
=
fp
;
fp
->
Count
=
1
;
...
...
storage/connect/ha_connect.cc
View file @
5dcb111c
This diff is collapsed.
Click to expand it.
storage/connect/ha_connect.h
View file @
5dcb111c
/* Copyright (C) Olivier Bertrand 2004 - 201
4
/* Copyright (C) Olivier Bertrand 2004 - 201
5
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
...
...
@@ -26,6 +26,11 @@
#pragma interface
/* gcc class implementation */
#endif
/****************************************************************************/
/* mycat.h contains the TOS, PTOS, ha_table_option_struct declarations. */
/****************************************************************************/
#include "mycat.h"
static
char
*
strz
(
PGLOBAL
g
,
LEX_STRING
&
ls
);
/****************************************************************************/
...
...
@@ -56,11 +61,7 @@ public:
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
;}
inline
char
*
SetName
(
PGLOBAL
g
,
char
*
name
)
{
return
PlugDup
(
g
,
name
);}
bool
oldsep
;
// Sepindex before create/alter
bool
newsep
;
// Sepindex after create/alter
...
...
@@ -72,7 +73,6 @@ public:
typedef
class
XCHK
*
PCHK
;
typedef
class
user_connect
*
PCONNECT
;
typedef
struct
ha_table_option_struct
TOS
,
*
PTOS
;
typedef
struct
ha_field_option_struct
FOS
,
*
PFOS
;
typedef
struct
ha_index_option_struct
XOS
,
*
PXOS
;
...
...
@@ -84,6 +84,9 @@ extern handlerton *connect_hton;
These can be specified in the CREATE TABLE:
CREATE TABLE ( ... ) {...here...}
*/
#if 0 // moved to mycat.h
typedef struct ha_table_option_struct TOS, *PTOS;
struct ha_table_option_struct {
const char *type;
const char *filename;
...
...
@@ -115,6 +118,7 @@ struct ha_table_option_struct {
bool readonly;
bool sepindex;
};
#endif // 0
/**
structure for CREATE TABLE options (field options)
...
...
@@ -239,7 +243,7 @@ public:
int
CheckRecord
(
PGLOBAL
g
,
const
uchar
*
oldbuf
,
uchar
*
newbuf
);
int
ReadIndexed
(
uchar
*
buf
,
OPVAL
op
,
const
uchar
*
key
=
NULL
,
uint
key_len
=
0
);
bool
MakeKeyWhere
(
PGLOBAL
g
,
char
*
qry
,
OPVAL
op
,
char
*
q
,
bool
MakeKeyWhere
(
PGLOBAL
g
,
PSTRG
qry
,
OPVAL
op
,
char
q
,
const
void
*
key
,
int
klen
);
inline
char
*
Strz
(
LEX_STRING
&
ls
);
...
...
storage/connect/json.cpp
View file @
5dcb111c
/*************** json CPP Declares Source Code File (.H) ***************/
/* Name: json.cpp Version 1.
0
*/
/* Name: json.cpp Version 1.
1
*/
/* */
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
/* */
...
...
@@ -1157,6 +1157,6 @@ void JVALUE::SetString(PGLOBAL g, PSZ s)
/***********************************************************************/
bool
JVALUE
::
IsNull
(
void
)
{
return
(
Jsp
)
?
Jsp
->
IsNull
()
:
(
Value
)
?
Value
->
Is
Null
()
:
true
;
return
(
Jsp
)
?
Jsp
->
IsNull
()
:
(
Value
)
?
Value
->
Is
Zero
()
:
true
;
}
// end of IsNull
storage/connect/json.h
View file @
5dcb111c
This diff is collapsed.
Click to expand it.
storage/connect/libdoc.cpp
View file @
5dcb111c
/******************************************************************/
/* Implementation of XML document processing using libxml2 */
/* Author: Olivier Bertrand 2007-201
3
*/
/* Author: Olivier Bertrand 2007-201
5
*/
/******************************************************************/
#include "my_global.h"
#include <string.h>
...
...
@@ -162,10 +162,12 @@ class XML2ATTR : public XMLATTRIBUTE {
friend
class
XML2NODE
;
public:
// Properties
//virtual char *GetText(void);
virtual
char
*
GetName
(
PGLOBAL
g
)
{
return
(
char
*
)
Atrp
->
name
;}
virtual
PXATTR
GetNext
(
PGLOBAL
g
);
// Methods
virtual
bool
SetText
(
PGLOBAL
g
,
char
*
txtp
,
int
len
);
virtual
RCODE
GetText
(
PGLOBAL
g
,
char
*
bufp
,
int
len
);
virtual
bool
SetText
(
PGLOBAL
g
,
char
*
txtp
,
int
len
);
protected:
// Constructor
...
...
@@ -408,8 +410,7 @@ PFBLOCK LIBXMLDOC::LinkXblock(PGLOBAL g, MODE m, int rc, char *fn)
xp
->
Next
=
(
PX2BLOCK
)
dup
->
Openlist
;
dup
->
Openlist
=
(
PFBLOCK
)
xp
;
xp
->
Type
=
TYPE_FB_XML2
;
xp
->
Fname
=
(
LPCSTR
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
fn
)
+
1
);
strcpy
((
char
*
)
xp
->
Fname
,
fn
);
xp
->
Fname
=
(
LPCSTR
)
PlugDup
(
g
,
fn
);
xp
->
Count
=
1
;
xp
->
Length
=
(
m
==
MODE_READ
)
?
1
:
0
;
xp
->
Retcode
=
rc
;
...
...
@@ -813,7 +814,7 @@ PXNODE XML2NODE::GetNext(PGLOBAL g)
if
(
!
Nodep
->
next
)
Next
=
NULL
;
else
if
(
!
Next
)
else
//
if (!Next)
Next
=
new
(
g
)
XML2NODE
(
Doc
,
Nodep
->
next
);
return
Next
;
...
...
@@ -829,7 +830,7 @@ PXNODE XML2NODE::GetChild(PGLOBAL g)
if
(
!
Nodep
->
children
)
Children
=
NULL
;
else
if
(
!
Children
)
else
//
if (!Children)
Children
=
new
(
g
)
XML2NODE
(
Doc
,
Nodep
->
children
);
return
Children
;
...
...
@@ -979,10 +980,16 @@ PXNODE XML2NODE::SelectSingleNode(PGLOBAL g, char *xp, PXNODE np)
/******************************************************************/
PXATTR
XML2NODE
::
GetAttribute
(
PGLOBAL
g
,
char
*
name
,
PXATTR
ap
)
{
xmlAttrPtr
atp
;
if
(
trace
)
htrc
(
"GetAttribute: %s
\n
"
,
name
);
htrc
(
"GetAttribute: %s
\n
"
,
SVP
(
name
));
if
(
name
)
atp
=
xmlHasProp
(
Nodep
,
BAD_CAST
name
);
else
atp
=
Nodep
->
properties
;
xmlAttrPtr
atp
=
xmlHasProp
(
Nodep
,
BAD_CAST
name
);
if
(
atp
)
{
if
(
ap
)
{
...
...
@@ -1210,6 +1217,52 @@ XML2ATTR::XML2ATTR(PXDOC dp, xmlAttrPtr ap, xmlNodePtr np)
Parent
=
np
;
}
// end of XML2ATTR constructor
/******************************************************************/
/* Return the next sibling of the attribute. */
/******************************************************************/
PXATTR
XML2ATTR
::
GetNext
(
PGLOBAL
g
)
{
if
(
trace
)
htrc
(
"Attr GetNext
\n
"
);
if
(
!
Atrp
->
next
)
return
NULL
;
else
return
new
(
g
)
XML2ATTR
(
Doc
,
Atrp
->
next
,
Atrp
->
parent
);
}
// end of GetNext
/******************************************************************/
/* Return the text of an attribute. */
/******************************************************************/
RCODE
XML2ATTR
::
GetText
(
PGLOBAL
g
,
char
*
buf
,
int
len
)
{
RCODE
rc
=
RC_OK
;
xmlChar
*
txt
;
if
(
trace
)
htrc
(
"GetText
\n
"
);
if
((
txt
=
xmlGetProp
(
Atrp
->
parent
,
Atrp
->
name
)))
{
// Copy the text to the buffer
if
(
strlen
((
char
*
)
txt
)
>=
(
unsigned
)
len
)
{
memcpy
(
buf
,
txt
,
len
-
1
);
buf
[
len
-
1
]
=
0
;
sprintf
(
g
->
Message
,
"Truncated %s content"
,
Atrp
->
name
);
rc
=
RC_INFO
;
}
else
strcpy
(
buf
,
(
const
char
*
)
txt
);
xmlFree
(
txt
);
}
else
*
buf
=
'\0'
;
if
(
trace
)
htrc
(
"GetText: %s
\n
"
,
buf
);
return
rc
;
}
// end of GetText
/******************************************************************/
/* Set the content of an attribute. */
/******************************************************************/
...
...
storage/connect/mycat.cc
View file @
5dcb111c
...
...
@@ -74,13 +74,8 @@
#include "tabxcl.h"
#include "tabtbl.h"
#include "taboccur.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
#endif // XML_SUPPORT
#include "tabmul.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
#endif // MYSQL_SUPPORT
#if defined(ODBC_SUPPORT)
#define NODBC
#include "tabodbc.h"
...
...
@@ -91,7 +86,9 @@
#include "tabvir.h"
#include "tabjson.h"
#include "ha_connect.h"
#include "mycat.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
#endif // XML_SUPPORT
/***********************************************************************/
/* Extern static variables. */
...
...
@@ -122,10 +119,8 @@ TABTYPE GetTypeID(const char *type)
#ifdef ODBC_SUPPORT
:
(
!
stricmp
(
type
,
"ODBC"
))
?
TAB_ODBC
#endif
#ifdef MYSQL_SUPPORT
:
(
!
stricmp
(
type
,
"MYSQL"
))
?
TAB_MYSQL
:
(
!
stricmp
(
type
,
"MYPRX"
))
?
TAB_MYSQL
#endif
:
(
!
stricmp
(
type
,
"DIR"
))
?
TAB_DIR
#ifdef WIN32
:
(
!
stricmp
(
type
,
"MAC"
))
?
TAB_MAC
...
...
@@ -537,9 +532,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am)
case
TAB_XCL
:
tdp
=
new
(
g
)
XCLDEF
;
break
;
case
TAB_PRX
:
tdp
=
new
(
g
)
PRXDEF
;
break
;
case
TAB_OCCUR
:
tdp
=
new
(
g
)
OCCURDEF
;
break
;
#if defined(MYSQL_SUPPORT)
case
TAB_MYSQL
:
tdp
=
new
(
g
)
MYSQLDEF
;
break
;
#endif // MYSQL_SUPPORT
#if defined(PIVOT_SUPPORT)
case
TAB_PIVOT
:
tdp
=
new
(
g
)
PIVOTDEF
;
break
;
#endif // PIVOT_SUPPORT
...
...
storage/connect/mycat.h
View file @
5dcb111c
...
...
@@ -24,6 +24,46 @@
#include "block.h"
#include "catalog.h"
typedef
struct
ha_table_option_struct
TOS
,
*
PTOS
;
/**
structure for CREATE TABLE options (table options)
These can be specified in the CREATE TABLE:
CREATE TABLE ( ... ) {...here...}
*/
struct
ha_table_option_struct
{
const
char
*
type
;
const
char
*
filename
;
const
char
*
optname
;
const
char
*
tabname
;
const
char
*
tablist
;
const
char
*
dbname
;
const
char
*
separator
;
//const char *connect;
const
char
*
qchar
;
const
char
*
module
;
const
char
*
subtype
;
const
char
*
catfunc
;
const
char
*
srcdef
;
const
char
*
colist
;
const
char
*
oplist
;
const
char
*
data_charset
;
ulonglong
lrecl
;
ulonglong
elements
;
//ulonglong estimate;
ulonglong
multiple
;
ulonglong
header
;
ulonglong
quoted
;
ulonglong
ending
;
ulonglong
compressed
;
bool
mapped
;
bool
huge
;
bool
split
;
bool
readonly
;
bool
sepindex
;
};
// Possible value for catalog functions
#define FNC_NO (1 << 0) // Not a catalog table
#define FNC_COL (1 << 1) // Column catalog function
...
...
storage/connect/mysql-test/connect/r/json.result
View file @
5dcb111c
...
...
@@ -15,7 +15,7 @@ DATEPUB int(4)
) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN LANG SUBJECT AUTHOR TITLE TRANSLATION TRANSLATOR PUBLISHER DATEPUB
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML
NULL NULL
Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
#
...
...
@@ -37,7 +37,7 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN Language Subject Authors Title Translation Translator Publisher Location Year
9782212090819 fr applications 2 Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications 2 Construire une application XML
NULL NULL
Eyrolles Paris 1999
9782840825685 fr applications 1 XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
#
...
...
@@ -60,7 +60,7 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Jean-Christophe and Franois Bernadac and Knab Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Jean-Christophe and Franois Bernadac and Knab Construire une application XML N
ULL NULL
Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
#
...
...
@@ -83,14 +83,14 @@ Year int(4) FIELD_FORMAT='DATEPUB'
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML
NULL NULL
Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML N
ULL NULL
Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
SELECT * FROM t1 WHERE ISBN = '9782212090819';
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Philippe Bernadac Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Philippe Bernadac Construire une application XML
NULL NULL
Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML N
ULL NULL
Eyrolles Paris 1999
#
# To add an author a new table must be created
#
...
...
@@ -104,8 +104,8 @@ William J. Pardi
INSERT INTO t2 VALUES('Charles','Dickens');
SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
9782212090819 fr applications Philippe Bernadac Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML
Eyrolles Paris 1999
9782212090819 fr applications Philippe Bernadac Construire une application XML
NULL NULL
Eyrolles Paris 1999
9782212090819 fr applications Franois Knab Construire une application XML N
ULL NULL
Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
9782840825685 fr applications Charles Dickens XML en Action adapt de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
...
...
storage/connect/odbconn.cpp
View file @
5dcb111c
/************ Odbconn C++ Functions Source Code File (.CPP) ************/
/* Name: ODBCONN.CPP Version 2.
1
*/
/* Name: ODBCONN.CPP Version 2.
2
*/
/* */
/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
...
...
@@ -867,8 +867,7 @@ bool DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
(
rc
==
SQL_SUCCESS
||
rc
==
SQL_SUCCESS_WITH_INFO
)
&&
strcmp
((
char
*
)
state
,
"00000"
);
i
++
)
{
m_ErrMsg
[
i
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
strlen
((
char
*
)
msg
)
+
1
);
strcpy
(
m_ErrMsg
[
i
],
(
char
*
)
msg
);
m_ErrMsg
[
i
]
=
(
PSZ
)
PlugDup
(
g
,
(
char
*
)
msg
);
if
(
trace
)
htrc
(
"%s: %s, Native=%d
\n
"
,
state
,
msg
,
native
);
...
...
@@ -882,8 +881,7 @@ bool DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt)
}
else
{
snprintf
((
char
*
)
msg
,
SQL_MAX_MESSAGE_LENGTH
+
1
,
"%s: %s"
,
m_Msg
,
MSG
(
BAD_HANDLE_VAL
));
m_ErrMsg
[
0
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
strlen
((
char
*
)
msg
)
+
1
);
strcpy
(
m_ErrMsg
[
0
],
(
char
*
)
msg
);
m_ErrMsg
[
0
]
=
(
PSZ
)
PlugDup
(
g
,
(
char
*
)
msg
);
if
(
trace
)
htrc
(
"%s: rc=%hd
\n
"
,
SVP
(
m_ErrMsg
[
0
]),
m_RC
);
...
...
@@ -1012,8 +1010,7 @@ PSZ ODBConn::GetStringInfo(ushort infotype)
// *buffer = '\0';
}
// endif rc
p
=
(
char
*
)
PlugSubAlloc
(
m_G
,
NULL
,
strlen
(
buffer
)
+
1
);
strcpy
(
p
,
buffer
);
p
=
PlugDup
(
m_G
,
buffer
);
return
p
;
}
// end of GetStringInfo
...
...
storage/connect/plgdbsem.h
View file @
5dcb111c
/************** PlgDBSem H Declares Source Code File (.H) **************/
/* Name: PLGDBSEM.H Version 3.6 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 1998-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 1998-201
5
*/
/* */
/* This file contains the PlugDB++ application type definitions. */
/***********************************************************************/
...
...
@@ -504,9 +504,10 @@ enum XFLD {FLD_NO = 0, /* Not a field definition item */
FLD_EXTRA
=
13
,
/* Field extra info */
FLD_PRIV
=
14
,
/* Field priviledges */
FLD_DATEFMT
=
15
,
/* Field date format */
FLD_CAT
=
16
,
/* Table catalog */
FLD_SCHEM
=
17
,
/* Table schema */
FLD_TABNAME
=
18
};
/* Column Table name */
FLD_FORMAT
=
16
,
/* Field format */
FLD_CAT
=
17
,
/* Table catalog */
FLD_SCHEM
=
18
,
/* Table schema */
FLD_TABNAME
=
19
};
/* Column Table name */
/***********************************************************************/
/* Result of last SQL noconv query. */
...
...
@@ -584,6 +585,7 @@ DllExport PCATLG PlgGetCatalog(PGLOBAL g, bool jump = true);
DllExport
bool
PlgSetXdbPath
(
PGLOBAL
g
,
PSZ
,
PSZ
,
char
*
,
int
,
char
*
,
int
);
DllExport
void
PlgDBfree
(
MBLOCK
&
);
DllExport
void
*
PlgDBSubAlloc
(
PGLOBAL
g
,
void
*
memp
,
size_t
size
);
DllExport
char
*
PlgDBDup
(
PGLOBAL
g
,
const
char
*
str
);
DllExport
void
*
PlgDBalloc
(
PGLOBAL
,
void
*
,
MBLOCK
&
);
DllExport
void
*
PlgDBrealloc
(
PGLOBAL
,
void
*
,
MBLOCK
&
,
size_t
);
DllExport
void
NewPointer
(
PTABS
,
void
*
,
void
*
);
...
...
storage/connect/plgdbutl.cpp
View file @
5dcb111c
...
...
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 1998-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 1998-201
5
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -294,8 +294,7 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
#else // !XMSG
GetRcString
(
ids
+
crp
->
Ncol
,
cname
,
sizeof
(
cname
));
#endif // !XMSG
crp
->
Name
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
cname
)
+
1
);
strcpy
(
crp
->
Name
,
cname
);
crp
->
Name
=
(
PSZ
)
PlugDup
(
g
,
cname
);
}
else
crp
->
Name
=
NULL
;
// Will be set by caller
...
...
@@ -853,8 +852,7 @@ FILE *PlugOpenFile(PGLOBAL g, LPCSTR fname, LPCSTR ftype)
htrc
(
" fp=%p
\n
"
,
fp
);
// fname may be in volatile memory such as stack
fp
->
Fname
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
fname
)
+
1
);
strcpy
((
char
*
)
fp
->
Fname
,
fname
);
fp
->
Fname
=
PlugDup
(
g
,
fname
);
fp
->
Count
=
1
;
fp
->
Type
=
TYPE_FB_FILE
;
fp
->
File
=
fop
;
...
...
@@ -1400,6 +1398,23 @@ void *PlgDBSubAlloc(PGLOBAL g, void *memp, size_t size)
return
(
memp
);
}
// end of PlgDBSubAlloc
/***********************************************************************/
/* Program for sub-allocating and copying a string in a storage area. */
/***********************************************************************/
char
*
PlgDBDup
(
PGLOBAL
g
,
const
char
*
str
)
{
if
(
str
)
{
char
*
sm
=
(
char
*
)
PlgDBSubAlloc
(
g
,
NULL
,
strlen
(
str
)
+
1
);
if
(
sm
)
strcpy
(
sm
,
str
);
return
sm
;
}
else
return
NULL
;
}
// end of PlgDBDup
/***********************************************************************/
/* PUTOUT: Plug DB object typing routine. */
/***********************************************************************/
...
...
storage/connect/plgxml.h
View file @
5dcb111c
/******************************************************************/
/* Dual XML implementation
base classes defines.
*/
/* Dual XML implementation
base classes defines.
*/
/******************************************************************/
#if !defined(BASE_BUFFER_SIZE)
enum
ElementType
{
// libxml2
...
...
@@ -43,7 +43,7 @@ enum NodeType { // MS DOM
NODE_NOTATION
=
12
};
#endif // !NODE_TYPE_LIST
typedef
class
XMLDOCUMENT
*
PXDOC
;
// Document
typedef
class
XMLDOCUMENT
*
PXDOC
;
// Document
typedef
class
XMLNODE
*
PXNODE
;
// Node (Element)
typedef
class
XMLNODELIST
*
PXLIST
;
// Node list
typedef
class
XMLATTRIBUTE
*
PXATTR
;
// Attribute
...
...
@@ -93,9 +93,9 @@ class XMLDOCUMENT : public BLOCK {
bool
MakeNSlist
(
PGLOBAL
g
);
// Members
PNS
Namespaces
;
/* To the namespaces */
PNS
Namespaces
;
/* To the namespaces */
char
*
Encoding
;
/* The document encoding */
char
*
Nslist
;
/* Namespace list */
char
*
Nslist
;
/* Namespace list */
char
*
DefNs
;
/* Default namespace */
};
// end of class XMLDOCUMENT
...
...
@@ -109,6 +109,7 @@ class XMLNODE : public BLOCK {
virtual
int
GetType
(
void
)
=
0
;
virtual
PXNODE
GetNext
(
PGLOBAL
)
=
0
;
virtual
PXNODE
GetChild
(
PGLOBAL
)
=
0
;
virtual
int
GetLen
(
void
)
{
return
Len
;}
// Methods
virtual
RCODE
GetContent
(
PGLOBAL
,
char
*
,
int
)
=
0
;
...
...
@@ -163,10 +164,12 @@ class XMLNODELIST : public BLOCK {
class
XMLATTRIBUTE
:
public
BLOCK
{
public:
// Properties
//virtual char *GetText(void) = 0;
virtual
char
*
GetName
(
PGLOBAL
)
=
0
;
virtual
PXATTR
GetNext
(
PGLOBAL
)
=
0
;
// Methods
virtual
bool
SetText
(
PGLOBAL
,
char
*
,
int
)
=
0
;
virtual
RCODE
GetText
(
PGLOBAL
,
char
*
,
int
)
=
0
;
virtual
bool
SetText
(
PGLOBAL
,
char
*
,
int
)
=
0
;
protected:
// Constructor
...
...
storage/connect/plugutil.c
View file @
5dcb111c
...
...
@@ -6,7 +6,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 1993-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 1993-201
5
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -228,7 +228,6 @@ BOOL PlugIsAbsolutePath(LPCSTR path)
#endif
}
/***********************************************************************/
/* Set the full path of a file relatively to a given path. */
/* Note: this routine is not really implemented for Unix. */
...
...
@@ -385,8 +384,7 @@ char *PlugReadMessage(PGLOBAL g, int mid, char *m)
err:
if
(
g
)
{
// Called by STEP
msg
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
stmsg
)
+
1
);
strcpy
(
msg
,
stmsg
);
msg
=
PlugDup
(
g
,
stmsg
);
}
else
// Called by MSG or PlgGetErrorMsg
msg
=
stmsg
;
...
...
@@ -421,8 +419,7 @@ char *PlugGetMessage(PGLOBAL g, int mid)
if
(
g
)
{
// Called by STEP
msg
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
stmsg
)
+
1
);
strcpy
(
msg
,
stmsg
);
msg
=
PlugDup
(
g
,
stmsg
);
}
else
// Called by MSG or PlgGetErrorMsg
msg
=
stmsg
;
...
...
@@ -536,6 +533,22 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
return
(
memp
);
}
/* end of PlugSubAlloc */
/***********************************************************************/
/* Program for sub-allocating and copying a string in a storage area. */
/***********************************************************************/
char
*
PlugDup
(
PGLOBAL
g
,
const
char
*
str
)
{
if
(
str
)
{
char
*
sm
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
str
)
+
1
);
strcpy
(
sm
,
str
);
return
sm
;
}
else
return
NULL
;
}
// end of PlugDup
#if 0
/***********************************************************************/
/* This routine suballocate a copy of the passed string. */
/***********************************************************************/
...
...
@@ -552,6 +565,7 @@ char *PlugDup(PGLOBAL g, const char *str)
return(buf);
} /* end of PlugDup */
#endif // 0
/***********************************************************************/
/* This routine makes a pointer from an offset to a memory pointer. */
...
...
storage/connect/reldef.cpp
View file @
5dcb111c
/************* RelDef CPP Program Source Code File (.CPP) **************/
/* PROGRAM NAME: RE
F
DEF */
/* PROGRAM NAME: RE
L
DEF */
/* ------------- */
/* Version 1.4 */
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2004-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 2004-201
5
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -35,7 +35,6 @@
/***********************************************************************/
#include "global.h"
#include "plgdbsem.h"
#include "mycat.h"
#include "reldef.h"
#include "colblk.h"
#include "filamap.h"
...
...
@@ -73,6 +72,14 @@ RELDEF::RELDEF(void)
Hc
=
NULL
;
}
// end of RELDEF constructor
/***********************************************************************/
/* This function return a pointer to the Table Option Struct. */
/***********************************************************************/
PTOS
RELDEF
::
GetTopt
(
void
)
{
return
Hc
->
GetTableOptionStruct
();
}
// end of GetTopt
/***********************************************************************/
/* This function sets an integer table information. */
/***********************************************************************/
...
...
@@ -153,10 +160,9 @@ char *RELDEF::GetStringCatInfo(PGLOBAL g, PSZ what, PSZ sdef)
if
(
s
)
{
if
(
!
Hc
->
IsPartitioned
()
||
(
stricmp
(
what
,
"filename"
)
&&
stricmp
(
what
,
"tabname"
)
&&
stricmp
(
what
,
"connect"
)))
{
sval
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
s
)
+
1
);
strcpy
(
sval
,
s
);
}
else
&&
stricmp
(
what
,
"connect"
)))
sval
=
PlugDup
(
g
,
s
);
else
sval
=
s
;
}
else
if
(
!
stricmp
(
what
,
"filename"
))
{
...
...
@@ -213,8 +219,7 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR am)
{
int
poff
=
0
;
Name
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
name
)
+
1
);
strcpy
(
Name
,
name
);
Name
=
(
PSZ
)
PlugDup
(
g
,
name
);
Cat
=
cat
;
Hc
=
((
MYCAT
*
)
cat
)
->
GetHandler
();
Catfunc
=
GetFuncID
(
GetStringCatInfo
(
g
,
"Catfunc"
,
NULL
));
...
...
@@ -712,8 +717,7 @@ COLDEF::COLDEF(void) : COLCRT()
/***********************************************************************/
int
COLDEF
::
Define
(
PGLOBAL
g
,
void
*
memp
,
PCOLINFO
cfp
,
int
poff
)
{
Name
=
(
PSZ
)
PlugSubAlloc
(
g
,
memp
,
strlen
(
cfp
->
Name
)
+
1
);
strcpy
(
Name
,
cfp
->
Name
);
Name
=
(
PSZ
)
PlugDup
(
g
,
cfp
->
Name
);
if
(
!
(
cfp
->
Flags
&
U_SPECIAL
))
{
Poff
=
poff
;
...
...
@@ -735,22 +739,16 @@ int COLDEF::Define(PGLOBAL g, void *memp, PCOLINFO cfp, int poff)
Key
=
cfp
->
Key
;
Freq
=
cfp
->
Freq
;
if
(
cfp
->
Remark
&&
*
cfp
->
Remark
)
{
Desc
=
(
PSZ
)
PlugSubAlloc
(
g
,
memp
,
strlen
(
cfp
->
Remark
)
+
1
);
strcpy
(
Desc
,
cfp
->
Remark
);
}
// endif Remark
if
(
cfp
->
Remark
&&
*
cfp
->
Remark
)
Desc
=
(
PSZ
)
PlugDup
(
g
,
cfp
->
Remark
);
if
(
cfp
->
Datefmt
)
{
Decode
=
(
PSZ
)
PlugSubAlloc
(
g
,
memp
,
strlen
(
cfp
->
Datefmt
)
+
1
);
strcpy
(
Decode
,
cfp
->
Datefmt
);
}
// endif Datefmt
if
(
cfp
->
Datefmt
)
Decode
=
(
PSZ
)
PlugDup
(
g
,
cfp
->
Datefmt
);
}
// endif special
if
(
cfp
->
Fieldfmt
)
{
Fmt
=
(
PSZ
)
PlugSubAlloc
(
g
,
memp
,
strlen
(
cfp
->
Fieldfmt
)
+
1
);
strcpy
(
Fmt
,
cfp
->
Fieldfmt
);
}
// endif Fieldfmt
if
(
cfp
->
Fieldfmt
)
Fmt
=
(
PSZ
)
PlugDup
(
g
,
cfp
->
Fieldfmt
);
Flags
=
cfp
->
Flags
;
return
(
Flags
&
(
U_VIRTUAL
|
U_SPECIAL
))
?
0
:
Long
;
...
...
storage/connect/reldef.h
View file @
5dcb111c
...
...
@@ -12,6 +12,7 @@
#include "block.h"
#include "catalog.h"
#include "my_sys.h"
#include "mycat.h"
typedef
class
INDEXDEF
*
PIXDEF
;
typedef
class
ha_connect
*
PHC
;
...
...
@@ -40,6 +41,7 @@ class DllExport RELDEF : public BLOCK { // Relation definition block
void
SetCat
(
PCATLG
cat
)
{
Cat
=
cat
;
}
// Methods
PTOS
GetTopt
(
void
);
bool
GetBoolCatInfo
(
PSZ
what
,
bool
bdef
);
bool
SetIntCatInfo
(
PSZ
what
,
int
ival
);
bool
Partitioned
(
void
);
...
...
storage/connect/tabjson.cpp
View file @
5dcb111c
This diff is collapsed.
Click to expand it.
storage/connect/tabjson.h
View file @
5dcb111c
/*************** tabjson H Declares Source Code File (.H) **************/
/* Name: tabjson.h Version 1.
0
*/
/* Name: tabjson.h Version 1.
1
*/
/* */
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
/* */
...
...
@@ -34,6 +34,9 @@ typedef struct _jnode {
class
JSONDEF
:
public
DOSDEF
{
/* Table description */
friend
class
TDBJSON
;
friend
class
TDBJSN
;
friend
class
TDBJCL
;
friend
PQRYRES
JSONColumns
(
PGLOBAL
,
char
*
,
const
char
*
,
char
*
,
int
,
int
,
int
,
bool
);
public:
// Constructor
JSONDEF
(
void
);
...
...
@@ -52,6 +55,7 @@ class JSONDEF : public DOSDEF { /* Table description */
char
*
Xcol
;
/* Name of expandable column */
int
Limit
;
/* Limit of multiple values */
int
Pretty
;
/* Depends on file structure */
int
Level
;
/* Used for catalog table */
bool
Strict
;
/* Strict syntax checking */
};
// end of JSONDEF
...
...
@@ -69,29 +73,36 @@ class TDBJSN : public TDBDOS {
TDBJSN
(
TDBJSN
*
tdbp
);
// Implementation
virtual
AMT
GetAmType
(
void
)
{
return
TYPE_AM_JSN
;}
virtual
bool
SkipHeader
(
PGLOBAL
g
);
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBJSN
(
this
);}
virtual
AMT
GetAmType
(
void
)
{
return
TYPE_AM_JSN
;}
virtual
bool
SkipHeader
(
PGLOBAL
g
);
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBJSN
(
this
);}
PJSON
GetRow
(
void
)
{
return
Row
;}
// Methods
virtual
PTDB
CopyOne
(
PTABS
t
);
virtual
PCOL
MakeCol
(
PGLOBAL
g
,
PCOLDEF
cdp
,
PCOL
cprec
,
int
n
);
virtual
PCOL
InsertSpecialColumn
(
PGLOBAL
g
,
PCOL
colp
);
virtual
int
RowNumber
(
PGLOBAL
g
,
bool
b
=
FALSE
)
{
return
(
b
)
?
N
:
Fpos
+
1
;}
virtual
PTDB
CopyOne
(
PTABS
t
);
virtual
PCOL
MakeCol
(
PGLOBAL
g
,
PCOLDEF
cdp
,
PCOL
cprec
,
int
n
);
virtual
PCOL
InsertSpecialColumn
(
PGLOBAL
g
,
PCOL
colp
);
virtual
int
RowNumber
(
PGLOBAL
g
,
bool
b
=
FALSE
)
{
return
(
b
)
?
N
:
Fpos
+
1
;}
// Database routines
virtual
int
Cardinality
(
PGLOBAL
g
);
virtual
int
GetMaxSize
(
PGLOBAL
g
);
virtual
bool
OpenDB
(
PGLOBAL
g
);
virtual
bool
PrepareWriting
(
PGLOBAL
g
);
virtual
int
ReadDB
(
PGLOBAL
g
);
virtual
int
Cardinality
(
PGLOBAL
g
);
virtual
int
GetMaxSize
(
PGLOBAL
g
);
virtual
bool
OpenDB
(
PGLOBAL
g
);
virtual
bool
PrepareWriting
(
PGLOBAL
g
);
virtual
int
ReadDB
(
PGLOBAL
g
);
protected:
PJSON
FindRow
(
PGLOBAL
g
);
int
MakeTopTree
(
PGLOBAL
g
,
PJSON
jsp
);
// Members
PJSON
Top
;
// The top JSON tree
PJSON
Row
;
// The current row
PJSON
Val
;
// The value of the current row
PJCOL
Colp
;
// The multiple column
JMODE
Jmode
;
// MODE_OBJECT by default
char
*
Objname
;
// The table object name
char
*
Xcol
;
// Name of expandable column
int
Fpos
;
// The current row index
//int Spos; // DELETE start index
...
...
@@ -166,6 +177,7 @@ class TDBJSON : public TDBJSN {
// Implementation
virtual
AMT
GetAmType
(
void
)
{
return
TYPE_AM_JSON
;}
virtual
PTDB
Duplicate
(
PGLOBAL
g
)
{
return
(
PTDB
)
new
(
g
)
TDBJSON
(
this
);}
PJAR
GetDoc
(
void
)
{
return
Doc
;}
// Methods
virtual
PTDB
CopyOne
(
PTABS
t
);
...
...
@@ -183,19 +195,39 @@ class TDBJSON : public TDBJSN {
virtual
int
WriteDB
(
PGLOBAL
g
);
virtual
int
DeleteDB
(
PGLOBAL
g
,
int
irc
);
virtual
void
CloseDB
(
PGLOBAL
g
);
int
MakeDocument
(
PGLOBAL
g
);
// Optimization routines
virtual
int
MakeIndex
(
PGLOBAL
g
,
PIXDEF
pxdf
,
bool
add
);
protected:
int
MakeNewDoc
(
PGLOBAL
g
);
int
MakeDocument
(
PGLOBAL
g
);
// Members
PJSON
Top
;
// The file JSON tree
PJAR
Doc
;
// The document array
char
*
Objname
;
// The table object name
int
Multiple
;
// 0: No 1: DIR 2: Section 3: filelist
bool
Done
;
// True when document parsing is done
bool
Changed
;
// After Update, Insert or Delete
};
// end of class TDBJSON
/***********************************************************************/
/* This is the class declaration for the JSON catalog table. */
/***********************************************************************/
class
TDBJCL
:
public
TDBCAT
{
public:
// Constructor
TDBJCL
(
PJDEF
tdp
);
protected:
// Specific routines
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// Members
//char *Dp;
const
char
*
Fn
;
char
*
Objn
;
int
Pretty
;
int
Lrecl
;
int
lvl
;
};
// end of class TDBJCL
storage/connect/table.cpp
View file @
5dcb111c
...
...
@@ -587,6 +587,10 @@ CATCOL::CATCOL(PCOLDEF cdp, PTDB tdbp, int n)
void
CATCOL
::
ReadColumn
(
PGLOBAL
g
)
{
// Get the value of the Name or Description property
Value
->
SetValue_pvblk
(
Crp
->
Kdata
,
Tdbp
->
N
);
if
(
Crp
->
Kdata
)
Value
->
SetValue_pvblk
(
Crp
->
Kdata
,
Tdbp
->
N
);
else
Value
->
Reset
();
}
// end of ReadColumn
storage/connect/tabmul.cpp
View file @
5dcb111c
...
...
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to PlugDB Software Development 2003 - 201
2
*/
/* (C) Copyright to PlugDB Software Development 2003 - 201
5
*/
/* Author: Olivier BERTRAND */
/* */
/* WHAT THIS PROGRAM DOES: */
...
...
@@ -172,8 +172,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
while
(
n
<
PFNZ
)
{
strcat
(
strcat
(
strcpy
(
filename
,
drive
),
direc
),
FileData
.
cFileName
);
pfn
[
n
]
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filename
)
+
1
);
strcpy
(
pfn
[
n
++
],
filename
);
pfn
[
n
++
]
=
PlugDup
(
g
,
filename
);
if
(
!
FindNextFile
(
hSearch
,
&
FileData
))
{
rc
=
GetLastError
();
...
...
@@ -239,8 +238,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
continue
;
// Not a match
strcat
(
strcpy
(
filename
,
direc
),
entry
->
d_name
);
pfn
[
n
]
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filename
)
+
1
);
strcpy
(
pfn
[
n
++
],
filename
);
pfn
[
n
++
]
=
PlugDup
(
g
,
filename
);
if
(
trace
)
htrc
(
"Adding pfn[%d] %s
\n
"
,
n
,
filename
);
...
...
@@ -292,8 +290,7 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
*
(
++
p
)
=
'\0'
;
// Suballocate the file name
pfn
[
n
]
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
filename
)
+
1
);
strcpy
(
pfn
[
n
++
],
filename
);
pfn
[
n
++
]
=
PlugDup
(
g
,
filename
);
}
// endfor n
}
// endif Mul
...
...
storage/connect/tabmysql.cpp
View file @
5dcb111c
...
...
@@ -56,7 +56,6 @@
#include "xtable.h"
#include "tabcol.h"
#include "colblk.h"
#include "mycat.h"
#include "reldef.h"
#include "tabmysql.h"
#include "valblk.h"
...
...
@@ -1078,8 +1077,7 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
if
(
Myc
.
m_Res
)
Myc
.
FreeResult
();
To_Def
->
GetHandler
()
->
MakeKeyWhere
(
g
,
Query
->
GetStr
(),
op
,
"`"
,
key
,
len
);
To_Def
->
GetHandler
()
->
MakeKeyWhere
(
g
,
Query
,
op
,
'`'
,
key
,
len
);
if
(
To_CondFil
)
{
oom
=
Query
->
Append
(
" AND ("
);
...
...
storage/connect/taboccur.cpp
View file @
5dcb111c
/************ TabOccur CPP Declares Source Code File (.CPP) ************/
/* Name: TABOCCUR.CPP Version 1.1 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2013
*/
/* (C) Copyright to the author Olivier BERTRAND 2013
- 2015
*/
/* */
/* OCCUR: Table that provides a view of a source table where the */
/* contain of several columns of the source table is placed in only */
...
...
@@ -45,11 +45,8 @@
#include "tabcol.h"
#include "taboccur.h"
#include "xtable.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "ha_connect.h"
#include "mycat.h"
/***********************************************************************/
/* Prepare and count columns in the column list. */
...
...
@@ -93,8 +90,7 @@ bool OcrColumns(PGLOBAL g, PQRYRES qrp, const char *col,
}
// endif col
// Prepare the column list
colist
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
col
)
+
1
);
strcpy
(
colist
,
col
);
colist
=
PlugDup
(
g
,
col
);
m
=
PrepareColist
(
colist
);
if
((
rk
=
(
rank
&&
*
rank
)))
{
...
...
@@ -191,8 +187,7 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
}
// endif col
// Prepare the column list
colist
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
col
)
+
1
);
strcpy
(
colist
,
col
);
colist
=
PlugDup
(
g
,
col
);
m
=
PrepareColist
(
colist
);
if
((
rk
=
(
rank
&&
*
rank
)))
...
...
storage/connect/tabpivot.cpp
View file @
5dcb111c
...
...
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 2005-201
3
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
5
*/
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
...
...
@@ -49,7 +49,6 @@
#include "tabpivot.h"
#include "valblk.h"
#include "ha_connect.h"
#include "mycat.h" // For GetHandler
/***********************************************************************/
/* Make the Pivot table column list. */
...
...
@@ -150,11 +149,18 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
query
=
Tabsrc
;
// Open a MySQL connection for this table
if
(
Myc
.
Open
(
g
,
Host
,
Database
,
User
,
Pwd
,
Port
))
return
NULL
;
else
if
(
!
Myc
.
Open
(
g
,
Host
,
Database
,
User
,
Pwd
,
Port
))
{
b
=
true
;
// Returned values must be in their original character set
if
(
Myc
.
ExecSQL
(
g
,
"SET character_set_results=NULL"
,
&
w
)
==
RC_FX
)
goto
err
;
else
Myc
.
FreeResult
();
}
else
return
NULL
;
// Send the source command to MySQL
if
(
Myc
.
ExecSQL
(
g
,
query
,
&
w
)
==
RC_FX
)
goto
err
;
...
...
@@ -241,6 +247,10 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
}
else
{
// The query was limited, we must get pivot column values
// Returned values must be in their original character set
// if (Myc.ExecSQL(g, "SET character_set_results=NULL", &w) == RC_FX)
// goto err;
query
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
0
);
sprintf
(
query
,
"SELECT DISTINCT `%s` FROM `%s`"
,
Picol
,
Tabname
);
PlugSubAlloc
(
g
,
NULL
,
strlen
(
query
)
+
1
);
...
...
@@ -284,8 +294,7 @@ PQRYRES PIVAID::MakePivotColumns(PGLOBAL g)
valp
->
SetValue_pvblk
(
Rblkp
,
i
);
colname
=
valp
->
GetCharString
(
buf
);
crp
->
Name
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
colname
)
+
1
);
strcpy
(
crp
->
Name
,
colname
);
crp
->
Name
=
PlugDup
(
g
,
colname
);
crp
->
Flag
=
1
;
// Add this column
...
...
storage/connect/tabtbl.cpp
View file @
5dcb111c
...
...
@@ -70,11 +70,8 @@
#include "tabcol.h"
#include "tabdos.h" // TDBDOS and DOSCOL class dcls
#include "tabtbl.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "ha_connect.h"
#include "mycat.h" // For GetHandler
#if defined(WIN32)
#if defined(__BORLANDC__)
...
...
storage/connect/tabutil.cpp
View file @
5dcb111c
...
...
@@ -43,14 +43,11 @@
#include "plgdbsem.h"
#include "plgcnx.h" // For DB types
#include "myutil.h"
#include "mycat.h"
#include "valblk.h"
#include "resource.h"
#include "reldef.h"
#include "xtable.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "tabcol.h"
#include "tabutil.h"
#include "ha_connect.h"
...
...
@@ -94,19 +91,13 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
if
(
!
open_table_def
(
thd
,
s
,
GTS_TABLE
|
GTS_VIEW
))
{
if
(
!
s
->
is_view
)
{
if
(
stricmp
(
plugin_name
(
s
->
db_plugin
)
->
str
,
"connect"
))
{
#if defined(MYSQL_SUPPORT)
if
(
stricmp
(
plugin_name
(
s
->
db_plugin
)
->
str
,
"connect"
))
mysql
=
true
;
#else // !MYSQL_SUPPORT
sprintf
(
g
->
Message
,
"%s.%s is not a CONNECT table"
,
db
,
name
);
return
NULL
;
#endif // MYSQL_SUPPORT
}
else
else
mysql
=
false
;
}
else
{
}
else
mysql
=
true
;
}
// endif is_view
}
else
{
if
(
thd
->
is_error
())
...
...
@@ -428,7 +419,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
}
// endif srcdef
if
(
mysql
)
{
#if defined(MYSQL_SUPPORT)
// Access sub-table via MySQL API
if
(
!
(
tdbp
=
cat
->
GetTable
(
g
,
tabp
,
Mode
,
"MYPRX"
)))
{
char
buf
[
MAX_STR
];
...
...
@@ -445,11 +435,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
if
(
Mode
==
MODE_UPDATE
||
Mode
==
MODE_DELETE
)
tdbp
->
SetName
(
Name
);
// For Make_Command
#else // !MYSQL_SUPPORT
sprintf
(
g
->
Message
,
"%s.%s is not a CONNECT table"
,
db
,
tblp
->
Name
);
goto
err
;
#endif // MYSQL_SUPPORT
}
else
{
// Sub-table is a CONNECT table
tabp
->
Next
=
To_Table
;
// For loop checking
...
...
storage/connect/tabxcl.cpp
View file @
5dcb111c
...
...
@@ -51,11 +51,8 @@
#include "tabcol.h"
#include "tabxcl.h"
#include "xtable.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "ha_connect.h"
#include "mycat.h"
/* -------------- Implementation of the XCOL classes ---------------- */
...
...
storage/connect/tabxml.cpp
View file @
5dcb111c
This diff is collapsed.
Click to expand it.
storage/connect/tabxml.h
View file @
5dcb111c
...
...
@@ -16,6 +16,8 @@ typedef class XMLCOL *PXMLCOL;
/***********************************************************************/
class
DllExport
XMLDEF
:
public
TABDEF
{
/* Logical table description */
friend
class
TDBXML
;
friend
class
TDBXCT
;
friend
PQRYRES
XMLColumns
(
PGLOBAL
,
char
*
,
char
*
,
PTOS
,
bool
);
public:
// Constructor
XMLDEF
(
void
);
...
...
@@ -55,6 +57,7 @@ class DllExport TDBXML : public TDBASE {
friend
class
XMLCOL
;
friend
class
XMULCOL
;
friend
class
XPOSCOL
;
friend
PQRYRES
XMLColumns
(
PGLOBAL
,
char
*
,
char
*
,
PTOS
,
bool
);
public:
// Constructor
TDBXML
(
PXMLDEF
tdp
);
...
...
@@ -237,4 +240,24 @@ class XPOSCOL : public XMLCOLX {
virtual
void
ReadColumn
(
PGLOBAL
g
);
virtual
void
WriteColumn
(
PGLOBAL
g
);
};
// end of class XPOSCOL
/***********************************************************************/
/* This is the class declaration for the XML catalog table. */
/***********************************************************************/
class
TDBXCT
:
public
TDBCAT
{
public:
// Constructor
TDBXCT
(
PXMLDEF
tdp
);
protected:
// Specific routines
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// Members
PTOS
Topt
;
char
*
Dp
;
//const char *Fn;
char
*
Tabn
;
};
// end of class TDBXCT
#endif // INCLUDE_TDBXML
storage/connect/valblk.cpp
View file @
5dcb111c
/************ Valblk C++ Functions Source Code File (.CPP) *************/
/* Name: VALBLK.CPP Version 2.1 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 2005-201
5
*/
/* */
/* This file contains the VALBLK and derived classes functions. */
/* Second family is VALBLK, representing simple suballocated arrays */
...
...
@@ -1155,10 +1155,9 @@ void STRBLK::SetValue(PVAL valp, int n)
void
STRBLK
::
SetValue
(
PSZ
p
,
int
n
)
{
if
(
p
)
{
if
(
!
Sorted
||
!
n
||
!
Strp
[
n
-
1
]
||
strcmp
(
p
,
Strp
[
n
-
1
]))
{
Strp
[
n
]
=
(
PSZ
)
PlugSubAlloc
(
Global
,
NULL
,
strlen
(
p
)
+
1
);
strcpy
(
Strp
[
n
],
p
);
}
else
if
(
!
Sorted
||
!
n
||
!
Strp
[
n
-
1
]
||
strcmp
(
p
,
Strp
[
n
-
1
]))
Strp
[
n
]
=
(
PSZ
)
PlugDup
(
Global
,
p
);
else
Strp
[
n
]
=
Strp
[
n
-
1
];
}
else
...
...
storage/connect/value.cpp
View file @
5dcb111c
...
...
@@ -627,13 +627,16 @@ int TYPVAL<double>::GetValLen(void)
template
<
class
TYPE
>
bool
TYPVAL
<
TYPE
>::
SetValue_pval
(
PVAL
valp
,
bool
chktype
)
{
if
(
chktype
&&
Type
!=
valp
->
GetType
())
return
true
;
if
(
valp
!=
this
)
{
if
(
chktype
&&
Type
!=
valp
->
GetType
())
return
true
;
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
))
Tval
=
GetTypedValue
(
valp
);
else
Reset
();
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
))
Tval
=
GetTypedValue
(
valp
);
else
Reset
();
}
// endif valp
return
false
;
}
// end of SetValue
...
...
@@ -1319,15 +1322,18 @@ ulonglong TYPVAL<PSZ>::GetUBigintValue(void)
/***********************************************************************/
bool
TYPVAL
<
PSZ
>::
SetValue_pval
(
PVAL
valp
,
bool
chktype
)
{
if
(
chktype
&&
(
valp
->
GetType
()
!=
Type
||
valp
->
GetSize
()
>
Len
))
return
true
;
if
(
valp
!=
this
)
{
if
(
chktype
&&
(
valp
->
GetType
()
!=
Type
||
valp
->
GetSize
()
>
Len
))
return
true
;
char
buf
[
64
];
char
buf
[
64
];
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
))
strncpy
(
Strp
,
valp
->
GetCharString
(
buf
),
Len
);
else
Reset
();
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
))
strncpy
(
Strp
,
valp
->
GetCharString
(
buf
),
Len
);
else
Reset
();
}
// endif valp
return
false
;
}
// end of SetValue_pval
...
...
@@ -2063,18 +2069,21 @@ double BINVAL::GetFloatValue(void)
/***********************************************************************/
bool
BINVAL
::
SetValue_pval
(
PVAL
valp
,
bool
chktype
)
{
if
(
chktype
&&
(
valp
->
GetType
()
!=
Type
||
valp
->
GetSize
()
>
Clen
))
return
true
;
bool
rc
=
false
;
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
)
)
{
if
(
(
rc
=
(
Len
=
valp
->
GetSize
()
)
>
Clen
))
Len
=
Clen
;
if
(
valp
!=
this
)
{
if
(
chktype
&&
(
valp
->
GetType
()
!=
Type
||
valp
->
GetSize
(
)
>
Clen
))
return
true
;
memcpy
(
Binp
,
valp
->
GetTo_Val
(),
Len
);
}
else
Reset
();
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
))
{
if
((
rc
=
(
Len
=
valp
->
GetSize
())
>
Clen
))
Len
=
Clen
;
memcpy
(
Binp
,
valp
->
GetTo_Val
(),
Len
);
}
else
Reset
();
}
// endif valp
return
rc
;
}
// end of SetValue_pval
...
...
@@ -2629,21 +2638,24 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
/***********************************************************************/
bool
DTVAL
::
SetValue_pval
(
PVAL
valp
,
bool
chktype
)
{
if
(
chktype
&&
Type
!=
valp
->
GetType
())
return
true
;
if
(
valp
!=
this
)
{
if
(
chktype
&&
Type
!=
valp
->
GetType
())
return
true
;
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
))
{
if
(
Pdtp
&&
!
valp
->
IsTypeNum
())
{
int
ndv
;
int
dval
[
6
];
if
(
!
(
Null
=
valp
->
IsNull
()
&&
Nullable
))
{
if
(
Pdtp
&&
!
valp
->
IsTypeNum
())
{
int
ndv
;
int
dval
[
6
];
ndv
=
ExtractDate
(
valp
->
GetCharValue
(),
Pdtp
,
DefYear
,
dval
);
MakeDate
(
NULL
,
dval
,
ndv
);
}
else
Tval
=
valp
->
GetIntValue
();
ndv
=
ExtractDate
(
valp
->
GetCharValue
(),
Pdtp
,
DefYear
,
dval
);
MakeDate
(
NULL
,
dval
,
ndv
);
}
else
Tval
=
valp
->
GetIntValue
();
Reset
();
}
else
Reset
();
}
// endif valp
return
false
;
}
// end of SetValue
...
...
storage/connect/xobject.cpp
View file @
5dcb111c
...
...
@@ -289,6 +289,34 @@ bool STRING::Set(char *s, uint n)
return
false
;
}
// end of Set
/***********************************************************************/
/* Append a char* to a STRING. */
/***********************************************************************/
bool
STRING
::
Append
(
const
char
*
s
,
uint
ln
)
{
if
(
!
s
)
return
false
;
uint
len
=
Length
+
ln
+
1
;
if
(
len
>
Size
)
{
char
*
p
=
Realloc
(
len
);
if
(
!
p
)
return
true
;
else
if
(
p
!=
Strp
)
{
strcpy
(
p
,
Strp
);
Strp
=
p
;
}
// endif p
}
// endif n
strncpy
(
Strp
+
Length
,
s
,
ln
);
Length
=
len
-
1
;
Strp
[
Length
]
=
0
;
return
false
;
}
// end of Append
/***********************************************************************/
/* Append a PSZ to a STRING. */
/***********************************************************************/
...
...
storage/connect/xobject.h
View file @
5dcb111c
...
...
@@ -134,6 +134,7 @@ class DllExport STRING : public BLOCK {
inline
void
Reset
(
void
)
{
*
Strp
=
0
;}
bool
Set
(
PSZ
s
);
bool
Set
(
char
*
s
,
uint
n
);
bool
Append
(
const
char
*
s
,
uint
ln
);
bool
Append
(
PSZ
s
);
bool
Append
(
STRING
&
str
);
bool
Append
(
char
c
);
...
...
storage/connect/xtable.h
View file @
5dcb111c
/**************** Table H Declares Source Code File (.H) ***************/
/* Name: TABLE.H Version 2.3 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 1999-201
4
*/
/* (C) Copyright to the author Olivier BERTRAND 1999-201
5
*/
/* */
/* This file contains the TBX, OPJOIN and TDB class definitions. */
/***********************************************************************/
...
...
@@ -24,9 +24,7 @@ typedef class CMD *PCMD;
class
CMD
:
public
BLOCK
{
public:
// Constructor
CMD
(
PGLOBAL
g
,
char
*
cmd
)
{
Cmd
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
strlen
(
cmd
)
+
1
);
strcpy
(
Cmd
,
cmd
);
Next
=
NULL
;
}
CMD
(
PGLOBAL
g
,
char
*
cmd
)
{
Cmd
=
PlugDup
(
g
,
cmd
);
Next
=
NULL
;}
// Members
PCMD
Next
;
...
...
storage/innobase/dict/dict0mem.cc
View file @
5dcb111c
...
...
@@ -770,7 +770,7 @@ dict_foreign_set_validate(
{
dict_foreign_not_exists
not_exists
(
fk_set
);
dict_foreign_set
::
iterator
it
=
std
::
find_if
(
dict_foreign_set
::
const_
iterator
it
=
std
::
find_if
(
fk_set
.
begin
(),
fk_set
.
end
(),
not_exists
);
if
(
it
==
fk_set
.
end
())
{
...
...
storage/innobase/include/dict0mem.h
View file @
5dcb111c
...
...
@@ -50,6 +50,7 @@ Created 1/8/1996 Heikki Tuuri
#include <set>
#include <algorithm>
#include <iterator>
#include <ostream>
/* Forward declaration. */
struct
ib_rbt_t
;
...
...
storage/xtradb/dict/dict0mem.cc
View file @
5dcb111c
...
...
@@ -788,7 +788,7 @@ dict_foreign_set_validate(
{
dict_foreign_not_exists
not_exists
(
fk_set
);
dict_foreign_set
::
iterator
it
=
std
::
find_if
(
dict_foreign_set
::
const_
iterator
it
=
std
::
find_if
(
fk_set
.
begin
(),
fk_set
.
end
(),
not_exists
);
if
(
it
==
fk_set
.
end
())
{
...
...
storage/xtradb/include/dict0mem.h
View file @
5dcb111c
...
...
@@ -53,6 +53,7 @@ Created 1/8/1996 Heikki Tuuri
#include <set>
#include <algorithm>
#include <iterator>
#include <ostream>
/* Forward declaration. */
struct
ib_rbt_t
;
...
...
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