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
3f444827
Commit
3f444827
authored
May 03, 2017
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ob-10.1' into 10.1
parents
040ccce8
ce3c7cd9
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
176 additions
and
178 deletions
+176
-178
storage/connect/catalog.h
storage/connect/catalog.h
+0
-3
storage/connect/connect.cc
storage/connect/connect.cc
+2
-6
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+28
-27
storage/connect/ha_connect.h
storage/connect/ha_connect.h
+1
-1
storage/connect/mongofam.cpp
storage/connect/mongofam.cpp
+4
-1
storage/connect/mycat.cc
storage/connect/mycat.cc
+0
-33
storage/connect/mycat.h
storage/connect/mycat.h
+0
-5
storage/connect/mysql-test/connect/disabled.def
storage/connect/mysql-test/connect/disabled.def
+4
-2
storage/connect/plgdbutl.cpp
storage/connect/plgdbutl.cpp
+10
-9
storage/connect/plugutil.cpp
storage/connect/plugutil.cpp
+13
-6
storage/connect/reldef.cpp
storage/connect/reldef.cpp
+6
-1
storage/connect/tabjson.cpp
storage/connect/tabjson.cpp
+6
-4
storage/connect/tabmgo.cpp
storage/connect/tabmgo.cpp
+55
-49
storage/connect/tabmgo.h
storage/connect/tabmgo.h
+4
-4
storage/connect/tabmul.cpp
storage/connect/tabmul.cpp
+36
-25
storage/connect/tabmul.h
storage/connect/tabmul.h
+3
-1
storage/connect/tabxml.cpp
storage/connect/tabxml.cpp
+4
-1
No files found.
storage/connect/catalog.h
View file @
3f444827
...
@@ -68,11 +68,9 @@ class DllExport CATALOG {
...
@@ -68,11 +68,9 @@ class DllExport CATALOG {
bool
GetDefHuge
(
void
)
{
return
DefHuge
;}
bool
GetDefHuge
(
void
)
{
return
DefHuge
;}
void
SetDefHuge
(
bool
b
)
{
DefHuge
=
b
;}
void
SetDefHuge
(
bool
b
)
{
DefHuge
=
b
;}
char
*
GetCbuf
(
void
)
{
return
Cbuf
;}
char
*
GetCbuf
(
void
)
{
return
Cbuf
;}
//char *GetDataPath(void) {return (char*)DataPath;}
// Methods
// Methods
virtual
void
Reset
(
void
)
{}
virtual
void
Reset
(
void
)
{}
//virtual void SetDataPath(PGLOBAL g, const char *path) {}
virtual
bool
CheckName
(
PGLOBAL
,
char
*
)
{
return
true
;}
virtual
bool
CheckName
(
PGLOBAL
,
char
*
)
{
return
true
;}
virtual
bool
ClearName
(
PGLOBAL
,
PSZ
)
{
return
true
;}
virtual
bool
ClearName
(
PGLOBAL
,
PSZ
)
{
return
true
;}
virtual
PRELDEF
MakeOneTableDesc
(
PGLOBAL
,
LPCSTR
,
LPCSTR
)
{
return
NULL
;}
virtual
PRELDEF
MakeOneTableDesc
(
PGLOBAL
,
LPCSTR
,
LPCSTR
)
{
return
NULL
;}
...
@@ -102,7 +100,6 @@ class DllExport CATALOG {
...
@@ -102,7 +100,6 @@ class DllExport CATALOG {
int
Cblen
;
/* Length of suballoc. buffer */
int
Cblen
;
/* Length of suballoc. buffer */
CURTAB
Ctb
;
/* Used to enumerate tables */
CURTAB
Ctb
;
/* Used to enumerate tables */
bool
DefHuge
;
/* true: tables default to huge */
bool
DefHuge
;
/* true: tables default to huge */
//LPCSTR DataPath; /* Is the Path of DB data dir */
};
// end of class CATALOG
};
// end of class CATALOG
#endif // __CATALOG__H
#endif // __CATALOG__H
storage/connect/connect.cc
View file @
3f444827
...
@@ -117,11 +117,10 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
...
@@ -117,11 +117,10 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
handler
);
handler
);
// Set the database path for this table
// Set the database path for this table
handler
->
SetDataPath
(
g
,
pathname
);
if
(
handler
->
SetDataPath
(
g
,
pathname
))
return
true
;
if
(
dbuserp
->
Catalog
)
{
if
(
dbuserp
->
Catalog
)
{
// ((MYCAT *)dbuserp->Catalog)->SetHandler(handler); done later
// ((MYCAT *)dbuserp->Catalog)->SetDataPath(g, pathname);
return
false
;
// Nothing else to do
return
false
;
// Nothing else to do
}
// endif Catalog
}
// endif Catalog
...
@@ -138,9 +137,6 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
...
@@ -138,9 +137,6 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
if
(
!
(
dbuserp
->
Catalog
=
new
MYCAT
(
handler
)))
if
(
!
(
dbuserp
->
Catalog
=
new
MYCAT
(
handler
)))
return
true
;
return
true
;
//((MYCAT *)dbuserp->Catalog)->SetDataPath(g, pathname);
//dbuserp->UseTemp= TMP_AUTO;
/*********************************************************************/
/*********************************************************************/
/* All is correct. */
/* All is correct. */
/*********************************************************************/
/*********************************************************************/
...
...
storage/connect/ha_connect.cc
View file @
3f444827
...
@@ -212,7 +212,7 @@ PQRYRES VirColumns(PGLOBAL g, bool info);
...
@@ -212,7 +212,7 @@ PQRYRES VirColumns(PGLOBAL g, bool info);
PQRYRES
JSONColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
dsn
,
PTOS
topt
,
bool
info
);
PQRYRES
JSONColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
dsn
,
PTOS
topt
,
bool
info
);
PQRYRES
XMLColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
tab
,
PTOS
topt
,
bool
info
);
PQRYRES
XMLColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
tab
,
PTOS
topt
,
bool
info
);
#if defined(MONGO_SUPPORT)
#if defined(MONGO_SUPPORT)
PQRYRES
MGOColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
dsn
,
PTOS
topt
,
bool
info
);
PQRYRES
MGOColumns
(
PGLOBAL
g
,
char
*
db
,
PTOS
topt
,
bool
info
);
#endif // MONGO_SUPPORT
#endif // MONGO_SUPPORT
int
TranslateJDBCType
(
int
stp
,
char
*
tn
,
int
prec
,
int
&
len
,
char
&
v
);
int
TranslateJDBCType
(
int
stp
,
char
*
tn
,
int
prec
,
int
&
len
,
char
&
v
);
void
PushWarning
(
PGLOBAL
g
,
THD
*
thd
,
int
level
);
void
PushWarning
(
PGLOBAL
g
,
THD
*
thd
,
int
level
);
...
@@ -1751,9 +1751,9 @@ void ha_connect::AddColName(char *cp, Field *fp)
...
@@ -1751,9 +1751,9 @@ void ha_connect::AddColName(char *cp, Field *fp)
/***********************************************************************/
/***********************************************************************/
/* This function sets the current database path. */
/* This function sets the current database path. */
/***********************************************************************/
/***********************************************************************/
void
ha_connect
::
SetDataPath
(
PGLOBAL
g
,
const
char
*
path
)
bool
ha_connect
::
SetDataPath
(
PGLOBAL
g
,
const
char
*
path
)
{
{
datapath
=
SetPath
(
g
,
path
);
return
(
!
(
datapath
=
SetPath
(
g
,
path
))
);
}
// end of SetDataPath
}
// end of SetDataPath
/****************************************************************************/
/****************************************************************************/
...
@@ -2709,6 +2709,8 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
...
@@ -2709,6 +2709,8 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
if
(
x
)
if
(
x
)
return
NULL
;
return
NULL
;
else
pb0
=
pb1
=
pb2
=
ph0
=
ph1
=
ph2
=
NULL
;
if
(
trace
)
if
(
trace
)
htrc
(
"Cond: Ftype=%d name=%s
\n
"
,
cond_item
->
functype
(),
htrc
(
"Cond: Ftype=%d name=%s
\n
"
,
cond_item
->
functype
(),
...
@@ -4004,8 +4006,12 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
...
@@ -4004,8 +4006,12 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos)
tdbp
->
SetFilter
(
NULL
);
tdbp
->
SetFilter
(
NULL
);
rc
=
rnd_next
(
buf
);
rc
=
rnd_next
(
buf
);
}
else
}
else
{
rc
=
HA_ERR_KEY_NOT_FOUND
;
PGLOBAL
g
=
GetPlug
((
table
)
?
table
->
in_use
:
NULL
,
xp
);
strcpy
(
g
->
Message
,
"Not supported by this table type"
);
my_message
(
ER_UNKNOWN_ERROR
,
g
->
Message
,
MYF
(
0
));
rc
=
HA_ERR_INTERNAL_ERROR
;
}
// endif SetRecpos
DBUG_RETURN
(
rc
);
DBUG_RETURN
(
rc
);
}
// end of rnd_pos
}
// end of rnd_pos
...
@@ -4071,9 +4077,13 @@ int ha_connect::info(uint flag)
...
@@ -4071,9 +4077,13 @@ int ha_connect::info(uint flag)
}
// endif xmod
}
// endif xmod
// This is necessary for getting file length
// This is necessary for getting file length
if
(
table
)
if
(
table
)
{
SetDataPath
(
g
,
table
->
s
->
db
.
str
);
if
(
SetDataPath
(
g
,
table
->
s
->
db
.
str
))
{
else
my_message
(
ER_UNKNOWN_ERROR
,
g
->
Message
,
MYF
(
0
));
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
}
// endif SetDataPath
}
else
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
// Should never happen
DBUG_RETURN
(
HA_ERR_INTERNAL_ERROR
);
// Should never happen
if
(
!
(
tdbp
=
GetTDB
(
g
)))
if
(
!
(
tdbp
=
GetTDB
(
g
)))
...
@@ -5562,13 +5572,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5562,13 +5572,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break
;
break
;
#if defined(MONGO_SUPPORT)
#if defined(MONGO_SUPPORT)
case
TAB_MONGO
:
case
TAB_MONGO
:
dsn
=
strz
(
g
,
create_info
->
connect_string
);
ok
=
true
;
if
(
!
dsn
)
strcpy
(
g
->
Message
,
"Missing URI"
);
else
ok
=
true
;
break
;
break
;
#endif // MONGO_SUPPORT
#endif // MONGO_SUPPORT
case
TAB_VIR
:
case
TAB_VIR
:
...
@@ -5595,12 +5599,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5595,12 +5599,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
char
*
cnm
,
*
rem
,
*
dft
,
*
xtra
,
*
key
,
*
fmt
;
char
*
cnm
,
*
rem
,
*
dft
,
*
xtra
,
*
key
,
*
fmt
;
int
i
,
len
,
prec
,
dec
,
typ
,
flg
;
int
i
,
len
,
prec
,
dec
,
typ
,
flg
;
// if (cat)
if
(
!
(
dpath
=
SetPath
(
g
,
table_s
->
db
.
str
)))
{
// cat->SetDataPath(g, table_s->db.str);
rc
=
HA_ERR_INTERNAL_ERROR
;
// else
goto
err
;
// return HA_ERR_INTERNAL_ERROR; // Should never happen
}
// endif dpath
dpath
=
SetPath
(
g
,
table_s
->
db
.
str
);
if
(
src
&&
ttp
!=
TAB_PIVOT
&&
ttp
!=
TAB_ODBC
&&
ttp
!=
TAB_JDBC
)
{
if
(
src
&&
ttp
!=
TAB_PIVOT
&&
ttp
!=
TAB_ODBC
&&
ttp
!=
TAB_JDBC
)
{
qrp
=
SrcColumns
(
g
,
host
,
db
,
user
,
pwd
,
src
,
port
);
qrp
=
SrcColumns
(
g
,
host
,
db
,
user
,
pwd
,
src
,
port
);
...
@@ -5716,7 +5718,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5716,7 +5718,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break
;
break
;
#if defined(MONGO_SUPPORT)
#if defined(MONGO_SUPPORT)
case
TAB_MONGO
:
case
TAB_MONGO
:
qrp
=
MGOColumns
(
g
,
(
char
*
)
db
,
dsn
,
topt
,
fnc
==
FNC_COL
);
qrp
=
MGOColumns
(
g
,
(
char
*
)
db
,
topt
,
fnc
==
FNC_COL
);
break
;
break
;
#endif // MONGO_SUPPORT
#endif // MONGO_SUPPORT
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
...
@@ -6521,11 +6523,10 @@ int ha_connect::create(const char *name, TABLE *table_arg,
...
@@ -6521,11 +6523,10 @@ int ha_connect::create(const char *name, TABLE *table_arg,
PDBUSER
dup
=
PlgGetUser
(
g
);
PDBUSER
dup
=
PlgGetUser
(
g
);
PCATLG
cat
=
(
dup
)
?
dup
->
Catalog
:
NULL
;
PCATLG
cat
=
(
dup
)
?
dup
->
Catalog
:
NULL
;
SetDataPath
(
g
,
table_arg
->
s
->
db
.
str
);
if
(
SetDataPath
(
g
,
table_arg
->
s
->
db
.
str
))
{
my_message
(
ER_UNKNOWN_ERROR
,
g
->
Message
,
MYF
(
0
));
if
(
cat
)
{
rc
=
HA_ERR_INTERNAL_ERROR
;
// cat->SetDataPath(g, table_arg->s->db.str);
}
else
if
(
cat
)
{
#if defined(WITH_PARTITION_STORAGE_ENGINE)
#if defined(WITH_PARTITION_STORAGE_ENGINE)
if
(
part_info
)
if
(
part_info
)
strncpy
(
partname
,
strncpy
(
partname
,
...
...
storage/connect/ha_connect.h
View file @
3f444827
...
@@ -199,7 +199,7 @@ class ha_connect: public handler
...
@@ -199,7 +199,7 @@ class ha_connect: public handler
bool
IsUnique
(
uint
n
);
bool
IsUnique
(
uint
n
);
char
*
GetDataPath
(
void
)
{
return
(
char
*
)
datapath
;}
char
*
GetDataPath
(
void
)
{
return
(
char
*
)
datapath
;}
void
SetDataPath
(
PGLOBAL
g
,
const
char
*
path
);
bool
SetDataPath
(
PGLOBAL
g
,
const
char
*
path
);
PTDB
GetTDB
(
PGLOBAL
g
);
PTDB
GetTDB
(
PGLOBAL
g
);
int
OpenTable
(
PGLOBAL
g
,
bool
del
=
false
);
int
OpenTable
(
PGLOBAL
g
,
bool
del
=
false
);
bool
CheckColumnList
(
PGLOBAL
g
);
bool
CheckColumnList
(
PGLOBAL
g
);
...
...
storage/connect/mongofam.cpp
View file @
3f444827
...
@@ -767,6 +767,9 @@ void MGOFAM::CloseTableFile(PGLOBAL g, bool)
...
@@ -767,6 +767,9 @@ void MGOFAM::CloseTableFile(PGLOBAL g, bool)
/***********************************************************************/
/***********************************************************************/
void
MGOFAM
::
Rewind
(
void
)
void
MGOFAM
::
Rewind
(
void
)
{
{
// TODO implement me
mongoc_cursor_t
*
cursor
=
mongoc_cursor_clone
(
Cursor
);
mongoc_cursor_destroy
(
Cursor
);
Cursor
=
cursor
;
}
// end of Rewind
}
// end of Rewind
storage/connect/mycat.cc
View file @
3f444827
...
@@ -484,39 +484,6 @@ void MYCAT::Reset(void)
...
@@ -484,39 +484,6 @@ void MYCAT::Reset(void)
{
{
}
// end of Reset
}
// end of Reset
#if 0
/***********************************************************************/
/* This function sets the current database path. */
/***********************************************************************/
void MYCAT::SetPath(PGLOBAL g, LPCSTR *datapath, const char *path)
{
if (path) {
size_t len= strlen(path) + (*path != '.' ? 4 : 1);
char *buf= (char*)PlugSubAlloc(g, NULL, len);
if (PlugIsAbsolutePath(path))
{
strcpy(buf, path);
*datapath= buf;
return;
}
if (*path != '.') {
#if defined(__WIN__)
char *s= "\\";
#else // !__WIN__
char *s= "/";
#endif // !__WIN__
strcat
(
strcat
(
strcat
(
strcpy
(
buf
,
"."
),
s
),
path
),
s
);
}
else
strcpy
(
buf
,
path
);
*
datapath
=
buf
;
}
// endif path
}
// end of SetDataPath
#endif // 0
/***********************************************************************/
/***********************************************************************/
/* GetTableDesc: retrieve a table descriptor. */
/* GetTableDesc: retrieve a table descriptor. */
/* Look for a table descriptor matching the name and type. */
/* Look for a table descriptor matching the name and type. */
...
...
storage/connect/mycat.h
View file @
3f444827
...
@@ -98,10 +98,7 @@ class MYCAT : public CATALOG {
...
@@ -98,10 +98,7 @@ class MYCAT : public CATALOG {
// Methods
// Methods
void
Reset
(
void
);
void
Reset
(
void
);
//void SetDataPath(PGLOBAL g, const char *path)
// {SetPath(g, &DataPath, path);}
bool
StoreIndex
(
PGLOBAL
,
PTABDEF
)
{
return
false
;}
// Temporary
bool
StoreIndex
(
PGLOBAL
,
PTABDEF
)
{
return
false
;}
// Temporary
// PRELDEF GetTableDesc(PGLOBAL g, LPCSTR name,
PRELDEF
GetTableDesc
(
PGLOBAL
g
,
PTABLE
tablep
,
PRELDEF
GetTableDesc
(
PGLOBAL
g
,
PTABLE
tablep
,
LPCSTR
type
,
PRELDEF
*
prp
=
NULL
);
LPCSTR
type
,
PRELDEF
*
prp
=
NULL
);
PTDB
GetTable
(
PGLOBAL
g
,
PTABLE
tablep
,
PTDB
GetTable
(
PGLOBAL
g
,
PTABLE
tablep
,
...
@@ -109,9 +106,7 @@ class MYCAT : public CATALOG {
...
@@ -109,9 +106,7 @@ class MYCAT : public CATALOG {
void
ClearDB
(
PGLOBAL
g
);
void
ClearDB
(
PGLOBAL
g
);
protected:
protected:
// PRELDEF MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am);
PRELDEF
MakeTableDesc
(
PGLOBAL
g
,
PTABLE
tablep
,
LPCSTR
am
);
PRELDEF
MakeTableDesc
(
PGLOBAL
g
,
PTABLE
tablep
,
LPCSTR
am
);
//void SetPath(PGLOBAL g, LPCSTR *datapath, const char *path);
// Members
// Members
ha_connect
*
Hc
;
// The Connect handler
ha_connect
*
Hc
;
// The Connect handler
...
...
storage/connect/mysql-test/connect/disabled.def
View file @
3f444827
...
@@ -9,7 +9,9 @@
...
@@ -9,7 +9,9 @@
# Do not use any TAB characters for whitespace.
# Do not use any TAB characters for whitespace.
#
#
##############################################################################
##############################################################################
#
jdbc : Variable settings depend on machine configuration
jdbc : Variable settings depend on machine configuration
#
jdbc_new : Variable settings depend on machine configuration
jdbc_new : Variable settings depend on machine configuration
jdbc_oracle : Variable settings depend on machine configuration
jdbc_oracle : Variable settings depend on machine configuration
jdbc_postgresql : Variable settings depend on machine configuration
jdbc_postgresql : Variable settings depend on machine configuration
json_mgo : Need MongoDB running and its C Driver installed
mongo : Need MongoDB running and its C Driver installed
storage/connect/plgdbutl.cpp
View file @
3f444827
...
@@ -387,26 +387,27 @@ char *SetPath(PGLOBAL g, const char *path)
...
@@ -387,26 +387,27 @@ char *SetPath(PGLOBAL g, const char *path)
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
if
(
path
)
{
if
(
path
)
{
size_t
len
=
strlen
(
path
)
+
(
*
path
!=
'.'
?
4
:
1
);
size_t
len
=
strlen
(
path
)
+
(
*
path
!=
'.'
?
4
:
1
);
if
(
!
(
buf
=
(
char
*
)
PlgDBSubAlloc
(
g
,
NULL
,
len
)))
return
NULL
;
buf
=
(
char
*
)
PlugSubAlloc
(
g
,
NULL
,
len
);
if
(
PlugIsAbsolutePath
(
path
))
{
if
(
PlugIsAbsolutePath
(
path
))
{
strcpy
(
buf
,
path
);
strcpy
(
buf
,
path
);
return
buf
;
return
buf
;
}
// endif path
}
// endif path
if
(
*
path
!=
'.'
)
{
if
(
*
path
!=
'.'
)
{
#if defined(__WIN__)
#if defined(__WIN__)
char
*
s
=
"
\\
"
;
char
*
s
=
"
\\
"
;
#else // !__WIN__
#else // !__WIN__
char
*
s
=
"/"
;
char
*
s
=
"/"
;
#endif // !__WIN__
#endif // !__WIN__
strcat
(
strcat
(
strcat
(
strcpy
(
buf
,
"."
),
s
),
path
),
s
);
strcat
(
strcat
(
strcat
(
strcpy
(
buf
,
"."
),
s
),
path
),
s
);
}
else
}
else
strcpy
(
buf
,
path
);
strcpy
(
buf
,
path
);
}
// endif path
}
// endif path
return
buf
;
return
buf
;
}
// end of SetPath
}
// end of SetPath
...
...
storage/connect/plugutil.cpp
View file @
3f444827
...
@@ -139,10 +139,17 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
...
@@ -139,10 +139,17 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
htrc
(
"PlugInit: Language='%s'
\n
"
,
htrc
(
"PlugInit: Language='%s'
\n
"
,
((
!
Language
)
?
"Null"
:
(
char
*
)
Language
));
((
!
Language
)
?
"Null"
:
(
char
*
)
Language
));
if
(
!
(
g
=
(
PGLOBAL
)
malloc
(
sizeof
(
GLOBAL
))))
{
try
{
fprintf
(
stderr
,
MSG
(
GLOBAL_ERROR
),
(
int
)
sizeof
(
GLOBAL
));
g
=
new
GLOBAL
;
return
NULL
;
}
catch
(...)
{
}
else
{
fprintf
(
stderr
,
MSG
(
GLOBAL_ERROR
),
(
int
)
sizeof
(
GLOBAL
));
return
NULL
;
}
// end try/catch
//if (!(g = (PGLOBAL)malloc(sizeof(GLOBAL)))) {
// fprintf(stderr, MSG(GLOBAL_ERROR), (int)sizeof(GLOBAL));
// return NULL;
// } else {
g
->
Sarea
=
NULL
;
g
->
Sarea
=
NULL
;
g
->
Createas
=
0
;
g
->
Createas
=
0
;
g
->
Alchecked
=
0
;
g
->
Alchecked
=
0
;
...
@@ -164,7 +171,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
...
@@ -164,7 +171,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
}
else
}
else
g
->
Sarea_Size
=
worksize
;
g
->
Sarea_Size
=
worksize
;
}
/* endif g */
//
} /* endif g */
g
->
jump_level
=
-
1
;
/* New setting to allow recursive call of Plug */
g
->
jump_level
=
-
1
;
/* New setting to allow recursive call of Plug */
return
(
g
);
return
(
g
);
...
@@ -183,7 +190,7 @@ int PlugExit(PGLOBAL g)
...
@@ -183,7 +190,7 @@ int PlugExit(PGLOBAL g)
if
(
g
->
Sarea
)
if
(
g
->
Sarea
)
free
(
g
->
Sarea
);
free
(
g
->
Sarea
);
free
(
g
)
;
delete
g
;
return
rc
;
return
rc
;
}
/* end of PlugExit */
}
/* end of PlugExit */
...
...
storage/connect/reldef.cpp
View file @
3f444827
...
@@ -277,8 +277,13 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
...
@@ -277,8 +277,13 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
// Take care of the column definitions
// Take care of the column definitions
i
=
poff
=
nof
=
nlg
=
0
;
i
=
poff
=
nof
=
nlg
=
0
;
#if defined(__WIN__)
// Offsets of HTML and DIR tables start from 0, DBF at 1
// Offsets of HTML and DIR tables start from 0, DBF at 1
loff
=
(
tc
==
TAB_DBF
)
?
1
:
(
tc
==
TAB_XML
||
tc
==
TAB_DIR
)
?
-
1
:
0
;
loff
=
(
tc
==
TAB_DBF
)
?
1
:
(
tc
==
TAB_XML
||
tc
==
TAB_DIR
)
?
-
1
:
0
;
#else // !__WIN__
// Offsets of HTML tables start from 0, DIR and DBF at 1
loff
=
(
tc
==
TAB_DBF
||
tc
==
TAB_DIR
)
?
1
:
(
tc
==
TAB_XML
)
?
-
1
:
0
;
#endif // !__WIN__
while
(
true
)
{
while
(
true
)
{
// Default Offset depends on table type
// Default Offset depends on table type
...
...
storage/connect/tabjson.cpp
View file @
3f444827
...
@@ -120,7 +120,9 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, char *dsn, PTOS topt, bool info)
...
@@ -120,7 +120,9 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, char *dsn, PTOS topt, bool info)
return
NULL
;
return
NULL
;
}
// endif Fn
}
// endif Fn
tdp
->
Database
=
SetPath
(
g
,
db
);
if
(
!
(
tdp
->
Database
=
SetPath
(
g
,
db
)))
return
NULL
;
tdp
->
Objname
=
GetStringTableOption
(
g
,
topt
,
"Object"
,
NULL
);
tdp
->
Objname
=
GetStringTableOption
(
g
,
topt
,
"Object"
,
NULL
);
tdp
->
Base
=
GetIntegerTableOption
(
g
,
topt
,
"Base"
,
0
)
?
1
:
0
;
tdp
->
Base
=
GetIntegerTableOption
(
g
,
topt
,
"Base"
,
0
)
?
1
:
0
;
tdp
->
Pretty
=
GetIntegerTableOption
(
g
,
topt
,
"Pretty"
,
2
);
tdp
->
Pretty
=
GetIntegerTableOption
(
g
,
topt
,
"Pretty"
,
2
);
...
@@ -746,10 +748,10 @@ bool TDBJSN::OpenDB(PGLOBAL g)
...
@@ -746,10 +748,10 @@ bool TDBJSN::OpenDB(PGLOBAL g)
return
true
;
return
true
;
}
// endswitch Jmode
}
// endswitch Jmode
}
// endif Use
if
(
Xcol
&&
Txfp
->
GetAmType
()
!=
TYPE_AM_MGO
)
To_Filter
=
NULL
;
// Imcompatible
if
(
Xcol
&&
Txfp
->
GetAmType
()
!=
TYPE_AM_MGO
)
}
// endif Use
To_Filter
=
NULL
;
// Imcompatible
return
TDBDOS
::
OpenDB
(
g
);
return
TDBDOS
::
OpenDB
(
g
);
}
// end of OpenDB
}
// end of OpenDB
...
...
storage/connect/tabmgo.cpp
View file @
3f444827
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
/* MGOColumns: construct the result blocks containing the description */
/* MGOColumns: construct the result blocks containing the description */
/* of all the columns of a document contained inside MongoDB. */
/* of all the columns of a document contained inside MongoDB. */
/***********************************************************************/
/***********************************************************************/
PQRYRES
MGOColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
dsn
,
PTOS
topt
,
bool
info
)
PQRYRES
MGOColumns
(
PGLOBAL
g
,
char
*
db
,
PTOS
topt
,
bool
info
)
{
{
static
int
buftyp
[]
=
{
TYPE_STRING
,
TYPE_SHORT
,
TYPE_STRING
,
TYPE_INT
,
static
int
buftyp
[]
=
{
TYPE_STRING
,
TYPE_SHORT
,
TYPE_STRING
,
TYPE_INT
,
TYPE_INT
,
TYPE_SHORT
,
TYPE_SHORT
,
TYPE_STRING
};
TYPE_INT
,
TYPE_SHORT
,
TYPE_SHORT
,
TYPE_STRING
};
...
@@ -64,7 +64,7 @@ PQRYRES MGOColumns(PGLOBAL g, char *db, char *dsn, PTOS topt, bool info)
...
@@ -64,7 +64,7 @@ PQRYRES MGOColumns(PGLOBAL g, char *db, char *dsn, PTOS topt, bool info)
/*********************************************************************/
/*********************************************************************/
mgd
=
new
(
g
)
MGODISC
(
g
,
(
int
*
)
length
);
mgd
=
new
(
g
)
MGODISC
(
g
,
(
int
*
)
length
);
if
((
n
=
mgd
->
GetColumns
(
g
,
db
,
dsn
,
topt
))
<
0
)
if
((
n
=
mgd
->
GetColumns
(
g
,
db
,
topt
))
<
0
)
goto
err
;
goto
err
;
skipit:
skipit:
...
@@ -142,7 +142,7 @@ MGODISC::MGODISC(PGLOBAL g, int *lg) {
...
@@ -142,7 +142,7 @@ MGODISC::MGODISC(PGLOBAL g, int *lg) {
/***********************************************************************/
/***********************************************************************/
/* Class used to get the columns of a mongo collection. */
/* Class used to get the columns of a mongo collection. */
/***********************************************************************/
/***********************************************************************/
int
MGODISC
::
GetColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
dsn
,
PTOS
topt
)
int
MGODISC
::
GetColumns
(
PGLOBAL
g
,
char
*
db
,
PTOS
topt
)
{
{
bson_iter_t
iter
;
bson_iter_t
iter
;
const
bson_t
*
doc
;
const
bson_t
*
doc
;
...
@@ -153,16 +153,11 @@ int MGODISC::GetColumns(PGLOBAL g, char *db, char *dsn, PTOS topt)
...
@@ -153,16 +153,11 @@ int MGODISC::GetColumns(PGLOBAL g, char *db, char *dsn, PTOS topt)
lvl
=
(
lvl
>
16
)
?
16
:
lvl
;
lvl
=
(
lvl
>
16
)
?
16
:
lvl
;
all
=
GetBooleanTableOption
(
g
,
topt
,
"Fullarray"
,
false
);
all
=
GetBooleanTableOption
(
g
,
topt
,
"Fullarray"
,
false
);
if
(
!
dsn
)
{
strcpy
(
g
->
Message
,
"Missing URI"
);
return
-
1
;
}
// endif dsn
/*********************************************************************/
/*********************************************************************/
/* Open the MongoDB collection. */
/* Open the MongoDB collection. */
/*********************************************************************/
/*********************************************************************/
tdp
=
new
(
g
)
MGODEF
;
tdp
=
new
(
g
)
MGODEF
;
tdp
->
Uri
=
dsn
;
tdp
->
Uri
=
GetStringTableOption
(
g
,
topt
,
"Connect"
,
"mongodb://localhost:27017"
)
;
tdp
->
Tabname
=
GetStringTableOption
(
g
,
topt
,
"Name"
,
NULL
);
tdp
->
Tabname
=
GetStringTableOption
(
g
,
topt
,
"Name"
,
NULL
);
tdp
->
Tabname
=
GetStringTableOption
(
g
,
topt
,
"Tabname"
,
tdp
->
Tabname
);
tdp
->
Tabname
=
GetStringTableOption
(
g
,
topt
,
"Tabname"
,
tdp
->
Tabname
);
tdp
->
Tabschema
=
GetStringTableOption
(
g
,
topt
,
"Dbname"
,
db
);
tdp
->
Tabschema
=
GetStringTableOption
(
g
,
topt
,
"Dbname"
,
db
);
...
@@ -397,7 +392,7 @@ bool MGODEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
...
@@ -397,7 +392,7 @@ bool MGODEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
else
if
(
!
Tabschema
)
else
if
(
!
Tabschema
)
Tabschema
=
GetStringCatInfo
(
g
,
"Dbname"
,
"*"
);
Tabschema
=
GetStringCatInfo
(
g
,
"Dbname"
,
"*"
);
Uri
=
GetStringCatInfo
(
g
,
"Connect"
,
NULL
);
Uri
=
GetStringCatInfo
(
g
,
"Connect"
,
"mongodb://localhost:27017"
);
Colist
=
GetStringCatInfo
(
g
,
"Colist"
,
NULL
);
Colist
=
GetStringCatInfo
(
g
,
"Colist"
,
NULL
);
Filter
=
GetStringCatInfo
(
g
,
"Filter"
,
NULL
);
Filter
=
GetStringCatInfo
(
g
,
"Filter"
,
NULL
);
Base
=
GetIntCatInfo
(
"Base"
,
0
)
?
1
:
0
;
Base
=
GetIntCatInfo
(
"Base"
,
0
)
?
1
:
0
;
...
@@ -713,13 +708,13 @@ void TDBMGO::SetFilter(PFIL fp)
...
@@ -713,13 +708,13 @@ void TDBMGO::SetFilter(PFIL fp)
To_Filter
=
fp
;
To_Filter
=
fp
;
if
(
fp
&&
Cursor
&&
Cnd
!=
Cond
)
{
if
(
fp
&&
Cursor
&&
Cnd
!=
Cond
)
{
mongoc_cursor_t
*
cursor
=
NULL
;
mongoc_cursor_t
*
cursor
=
MakeCursor
(
G
)
;
if
(
!
MakeCursor
(
G
,
cursor
)
)
{
if
(
cursor
)
{
mongoc_cursor_destroy
(
Cursor
);
mongoc_cursor_destroy
(
Cursor
);
Cursor
=
cursor
;
Cursor
=
cursor
;
}
else
if
(
cursor
)
}
else
mongoc_cursor_destroy
(
cursor
);
htrc
(
"SetFilter: %s
\n
"
,
G
->
Message
);
}
// endif Cursor
}
// endif Cursor
...
@@ -728,10 +723,11 @@ void TDBMGO::SetFilter(PFIL fp)
...
@@ -728,10 +723,11 @@ void TDBMGO::SetFilter(PFIL fp)
/***********************************************************************/
/***********************************************************************/
/* OpenDB: Data Base open routine for MONGO access method. */
/* OpenDB: Data Base open routine for MONGO access method. */
/***********************************************************************/
/***********************************************************************/
bool
TDBMGO
::
MakeCursor
(
PGLOBAL
g
,
mongoc_cursor_t
*
cursor
)
mongoc_cursor_t
*
TDBMGO
::
MakeCursor
(
PGLOBAL
g
)
{
{
const
char
*
p
;
const
char
*
p
;
PSTRG
s
=
NULL
;
mongoc_cursor_t
*
cursor
;
PSTRG
s
=
NULL
;
if
(
Pipe
)
{
if
(
Pipe
)
{
if
(
trace
)
if
(
trace
)
...
@@ -741,7 +737,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
...
@@ -741,7 +737,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
if
(
!
p
)
{
if
(
!
p
)
{
strcpy
(
g
->
Message
,
"Missing ] in pipeline"
);
strcpy
(
g
->
Message
,
"Missing ] in pipeline"
);
return
true
;
return
NULL
;
}
else
}
else
*
(
char
*
)
p
=
0
;
*
(
char
*
)
p
=
0
;
...
@@ -752,7 +748,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
...
@@ -752,7 +748,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
if
(
To_Filter
->
MakeSelector
(
g
,
s
,
true
))
{
if
(
To_Filter
->
MakeSelector
(
g
,
s
,
true
))
{
strcpy
(
g
->
Message
,
"Failed making selector"
);
strcpy
(
g
->
Message
,
"Failed making selector"
);
return
true
;
return
NULL
;
}
else
}
else
s
->
Append
(
'}'
);
s
->
Append
(
'}'
);
...
@@ -779,15 +775,15 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
...
@@ -779,15 +775,15 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
if
(
!
Query
)
{
if
(
!
Query
)
{
sprintf
(
g
->
Message
,
"Wrong pipeline: %s"
,
Error
.
message
);
sprintf
(
g
->
Message
,
"Wrong pipeline: %s"
,
Error
.
message
);
return
true
;
return
NULL
;
}
// endif Query
}
// endif Query
C
ursor
=
mongoc_collection_aggregate
(
Collection
,
MONGOC_QUERY_NONE
,
c
ursor
=
mongoc_collection_aggregate
(
Collection
,
MONGOC_QUERY_NONE
,
Query
,
NULL
,
NULL
);
Query
,
NULL
,
NULL
);
if
(
mongoc_cursor_error
(
C
ursor
,
&
Error
))
{
if
(
mongoc_cursor_error
(
c
ursor
,
&
Error
))
{
sprintf
(
g
->
Message
,
"Mongo aggregate Failure: %s"
,
Error
.
message
);
sprintf
(
g
->
Message
,
"Mongo aggregate Failure: %s"
,
Error
.
message
);
return
true
;
return
NULL
;
}
// endif cursor
}
// endif cursor
}
else
{
}
else
{
...
@@ -813,7 +809,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
...
@@ -813,7 +809,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
if
(
To_Filter
->
MakeSelector
(
g
,
s
,
true
))
{
if
(
To_Filter
->
MakeSelector
(
g
,
s
,
true
))
{
strcpy
(
g
->
Message
,
"Failed making selector"
);
strcpy
(
g
->
Message
,
"Failed making selector"
);
return
true
;
return
NULL
;
}
// endif Selector
}
// endif Selector
To_Filter
=
NULL
;
// Not needed anymore
To_Filter
=
NULL
;
// Not needed anymore
...
@@ -827,7 +823,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
...
@@ -827,7 +823,7 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
if
(
!
Query
)
{
if
(
!
Query
)
{
sprintf
(
g
->
Message
,
"Wrong filter: %s"
,
Error
.
message
);
sprintf
(
g
->
Message
,
"Wrong filter: %s"
,
Error
.
message
);
return
true
;
return
NULL
;
}
// endif Query
}
// endif Query
}
else
}
else
...
@@ -858,13 +854,13 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
...
@@ -858,13 +854,13 @@ bool TDBMGO::MakeCursor(PGLOBAL g, mongoc_cursor_t *cursor)
if
(
!
Opts
)
{
if
(
!
Opts
)
{
sprintf
(
g
->
Message
,
"Wrong options: %s"
,
Error
.
message
);
sprintf
(
g
->
Message
,
"Wrong options: %s"
,
Error
.
message
);
return
true
;
return
NULL
;
}
// endif Opts
}
// endif Opts
C
ursor
=
mongoc_collection_find_with_opts
(
Collection
,
Query
,
Opts
,
NULL
);
c
ursor
=
mongoc_collection_find_with_opts
(
Collection
,
Query
,
Opts
,
NULL
);
}
// endif Pipe
}
// endif Pipe
return
false
;
return
cursor
;
}
// end of MakeCursor
}
// end of MakeCursor
/***********************************************************************/
/***********************************************************************/
...
@@ -876,33 +872,37 @@ bool TDBMGO::OpenDB(PGLOBAL g)
...
@@ -876,33 +872,37 @@ bool TDBMGO::OpenDB(PGLOBAL g)
/*******************************************************************/
/*******************************************************************/
/* Table already open replace it at its beginning. */
/* Table already open replace it at its beginning. */
/*******************************************************************/
/*******************************************************************/
mongoc_cursor_t
*
cursor
=
mongoc_cursor_clone
(
Cursor
);
mongoc_cursor_destroy
(
Cursor
);
Cursor
=
cursor
;
Fpos
=
-
1
;
Fpos
=
-
1
;
}
else
{
return
false
;
/*******************************************************************/
}
// endif Use
/* First opening. */
/*******************************************************************/
if
(
Pipe
&&
Mode
!=
MODE_READ
)
{
strcpy
(
g
->
Message
,
"Pipeline tables are read only"
);
return
true
;
}
// endif Pipe
if
(
Init
(
g
))
/*********************************************************************/
return
true
;
/* First opening. */
/*********************************************************************/
if
(
Pipe
&&
Mode
!=
MODE_READ
)
{
strcpy
(
g
->
Message
,
"Pipeline tables are read only"
);
return
true
;
}
// endif Pipe
if
(
Mode
==
MODE_DELETE
&&
!
Next
)
{
if
(
Init
(
g
))
// Delete all documents
return
true
;
if
(
!
mongoc_collection_remove
(
Collection
,
MONGOC_REMOVE_NONE
,
Query
,
NULL
,
&
Error
))
{
sprintf
(
g
->
Message
,
"Mongo remove all: %s"
,
Error
.
message
);
return
true
;
}
// endif remove
}
else
if
(
Mode
==
MODE_INSERT
)
if
(
Mode
==
MODE_DELETE
&&
!
Next
)
{
MakeColumnGroups
(
g
);
// Delete all documents
else
if
(
MakeCursor
(
g
,
Cursor
))
if
(
!
mongoc_collection_remove
(
Collection
,
MONGOC_REMOVE_NONE
,
Query
,
NULL
,
&
Error
))
{
sprintf
(
g
->
Message
,
"Mongo remove all: %s"
,
Error
.
message
);
return
true
;
return
true
;
}
// endif remove
}
// endif Use
}
else
if
(
Mode
==
MODE_INSERT
)
MakeColumnGroups
(
g
);
else
if
(
!
(
Cursor
=
MakeCursor
(
g
)))
return
true
;
return
false
;
return
false
;
}
// end of OpenDB
}
// end of OpenDB
...
@@ -1081,6 +1081,12 @@ int TDBMGO::WriteDB(PGLOBAL g)
...
@@ -1081,6 +1081,12 @@ int TDBMGO::WriteDB(PGLOBAL g)
}
// endif iter
}
// endif iter
if
(
b
)
{
if
(
b
)
{
if
(
trace
)
{
char
*
str
=
bson_as_json
(
query
,
NULL
);
htrc
(
"update query: %s
\n
"
,
str
);
bson_free
(
str
);
}
// endif trace
if
(
Mode
==
MODE_UPDATE
)
{
if
(
Mode
==
MODE_UPDATE
)
{
bson_t
child
;
bson_t
child
;
bson_t
*
update
=
bson_new
();
bson_t
*
update
=
bson_new
();
...
...
storage/connect/tabmgo.h
View file @
3f444827
...
@@ -48,7 +48,7 @@ class MGODISC : public BLOCK {
...
@@ -48,7 +48,7 @@ class MGODISC : public BLOCK {
MGODISC
(
PGLOBAL
g
,
int
*
lg
);
MGODISC
(
PGLOBAL
g
,
int
*
lg
);
// Functions
// Functions
int
GetColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
dsn
,
PTOS
topt
);
int
GetColumns
(
PGLOBAL
g
,
char
*
db
,
PTOS
topt
);
bool
FindInDoc
(
PGLOBAL
g
,
bson_iter_t
*
iter
,
const
bson_t
*
doc
,
bool
FindInDoc
(
PGLOBAL
g
,
bson_iter_t
*
iter
,
const
bson_t
*
doc
,
char
*
pcn
,
char
*
pfmt
,
int
i
,
int
k
,
bool
b
);
char
*
pcn
,
char
*
pfmt
,
int
i
,
int
k
,
bool
b
);
...
@@ -69,7 +69,7 @@ class DllExport MGODEF : public EXTDEF { /* Table description */
...
@@ -69,7 +69,7 @@ class DllExport MGODEF : public EXTDEF { /* Table description */
friend
class
TDBMGO
;
friend
class
TDBMGO
;
friend
class
MGOFAM
;
friend
class
MGOFAM
;
friend
class
MGODISC
;
friend
class
MGODISC
;
friend
PQRYRES
MGOColumns
(
PGLOBAL
,
char
*
,
char
*
,
PTOS
,
bool
);
friend
PQRYRES
MGOColumns
(
PGLOBAL
,
char
*
,
PTOS
,
bool
);
public:
public:
// Constructor
// Constructor
MGODEF
(
void
);
MGODEF
(
void
);
...
@@ -117,7 +117,7 @@ class DllExport TDBMGO : public TDBEXT {
...
@@ -117,7 +117,7 @@ class DllExport TDBMGO : public TDBEXT {
friend
class
MGOCOL
;
friend
class
MGOCOL
;
friend
class
MGODEF
;
friend
class
MGODEF
;
friend
class
MGODISC
;
friend
class
MGODISC
;
friend
PQRYRES
MGOColumns
(
PGLOBAL
,
char
*
,
char
*
,
PTOS
,
bool
);
friend
PQRYRES
MGOColumns
(
PGLOBAL
,
char
*
,
PTOS
,
bool
);
public:
public:
// Constructor
// Constructor
TDBMGO
(
PMGODEF
tdp
);
TDBMGO
(
PMGODEF
tdp
);
...
@@ -146,7 +146,7 @@ class DllExport TDBMGO : public TDBEXT {
...
@@ -146,7 +146,7 @@ class DllExport TDBMGO : public TDBEXT {
protected:
protected:
bool
Init
(
PGLOBAL
g
);
bool
Init
(
PGLOBAL
g
);
bool
MakeCursor
(
PGLOBAL
g
,
mongoc_cursor_t
*
cursor
);
mongoc_cursor_t
*
MakeCursor
(
PGLOBAL
g
);
void
ShowDocument
(
bson_iter_t
*
i
,
const
bson_t
*
b
,
const
char
*
k
);
void
ShowDocument
(
bson_iter_t
*
i
,
const
bson_t
*
b
,
const
char
*
k
);
void
MakeColumnGroups
(
PGLOBAL
g
);
void
MakeColumnGroups
(
PGLOBAL
g
);
bool
DocWrite
(
PGLOBAL
g
,
PINCOL
icp
);
bool
DocWrite
(
PGLOBAL
g
,
PINCOL
icp
);
...
...
storage/connect/tabmul.cpp
View file @
3f444827
...
@@ -603,8 +603,9 @@ bool TDBMSD::InitFileNames(PGLOBAL g)
...
@@ -603,8 +603,9 @@ bool TDBMSD::InitFileNames(PGLOBAL g)
bool
DIRDEF
::
DefineAM
(
PGLOBAL
g
,
LPCSTR
,
int
)
bool
DIRDEF
::
DefineAM
(
PGLOBAL
g
,
LPCSTR
,
int
)
{
{
Desc
=
Fn
=
GetStringCatInfo
(
g
,
"Filename"
,
NULL
);
Desc
=
Fn
=
GetStringCatInfo
(
g
,
"Filename"
,
NULL
);
Incl
=
(
GetIntCatInfo
(
"Subdir"
,
0
)
!=
0
);
Incl
=
GetBoolCatInfo
(
"Subdir"
,
false
);
Huge
=
(
GetIntCatInfo
(
"Huge"
,
0
)
!=
0
);
Huge
=
GetBoolCatInfo
(
"Huge"
,
false
);
Nodir
=
GetBoolCatInfo
(
"Nodir"
,
true
);
return
false
;
return
false
;
}
// end of DefineAM
}
// end of DefineAM
...
@@ -654,12 +655,14 @@ void TDBDIR::Init(void)
...
@@ -654,12 +655,14 @@ void TDBDIR::Init(void)
TDBDIR
::
TDBDIR
(
PDIRDEF
tdp
)
:
TDBASE
(
tdp
)
TDBDIR
::
TDBDIR
(
PDIRDEF
tdp
)
:
TDBASE
(
tdp
)
{
{
To_File
=
tdp
->
Fn
;
To_File
=
tdp
->
Fn
;
Nodir
=
tdp
->
Nodir
;
Init
();
Init
();
}
// end of TDBDIR standard constructor
}
// end of TDBDIR standard constructor
TDBDIR
::
TDBDIR
(
PSZ
fpat
)
:
TDBASE
((
PTABDEF
)
NULL
)
TDBDIR
::
TDBDIR
(
PSZ
fpat
)
:
TDBASE
((
PTABDEF
)
NULL
)
{
{
To_File
=
fpat
;
To_File
=
fpat
;
Nodir
=
true
;
Init
();
Init
();
}
// end of TDBDIR constructor
}
// end of TDBDIR constructor
...
@@ -812,27 +815,32 @@ int TDBDIR::ReadDB(PGLOBAL g)
...
@@ -812,27 +815,32 @@ int TDBDIR::ReadDB(PGLOBAL g)
int
rc
=
RC_OK
;
int
rc
=
RC_OK
;
#if defined(__WIN__)
#if defined(__WIN__)
if
(
hSearch
==
INVALID_HANDLE_VALUE
)
{
do
{
/*******************************************************************/
if
(
hSearch
==
INVALID_HANDLE_VALUE
)
{
/* Start searching files in the target directory. The use of the */
/*****************************************************************/
/* Path function is required when called from TDBSDR. */
/* Start searching files in the target directory. The use of */
/*******************************************************************/
/* the Path function is required when called from TDBSDR. */
hSearch
=
FindFirstFile
(
Path
(
g
),
&
FileData
);
/*****************************************************************/
hSearch
=
FindFirstFile
(
Path
(
g
),
&
FileData
);
if
(
hSearch
==
INVALID_HANDLE_VALUE
)
{
rc
=
RC_EF
;
break
;
}
else
iFile
++
;
if
(
hSearch
==
INVALID_HANDLE_VALUE
)
}
else
{
rc
=
RC_EF
;
if
(
!
FindNextFile
(
hSearch
,
&
FileData
))
{
else
// Restore file name and type pattern
iFile
++
;
_splitpath
(
To_File
,
NULL
,
NULL
,
Fname
,
Ftype
);
rc
=
RC_EF
;
break
;
}
else
iFile
++
;
}
else
{
}
// endif hSearch
if
(
!
FindNextFile
(
hSearch
,
&
FileData
))
{
// Restore file name and type pattern
_splitpath
(
To_File
,
NULL
,
NULL
,
Fname
,
Ftype
);
rc
=
RC_EF
;
}
else
iFile
++
;
}
// endif hSearch
}
while
(
Nodir
&&
FileData
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
);
if
(
rc
==
RC_OK
)
if
(
rc
==
RC_OK
)
_splitpath
(
FileData
.
cFileName
,
NULL
,
NULL
,
Fname
,
Ftype
);
_splitpath
(
FileData
.
cFileName
,
NULL
,
NULL
,
Fname
,
Ftype
);
...
@@ -1225,8 +1233,9 @@ int TDBSDR::ReadDB(PGLOBAL g)
...
@@ -1225,8 +1233,9 @@ int TDBSDR::ReadDB(PGLOBAL g)
retry:
retry:
do
{
do
{
if
(
Sub
->
H
==
INVALID_HANDLE_VALUE
)
{
if
(
Sub
->
H
==
INVALID_HANDLE_VALUE
)
{
_makepath
(
Fpath
,
Drive
,
Direc
,
"*"
,
"."
);
// _makepath(Fpath, Drive, Direc, "*", "."); why was this made?
Sub
->
H
=
FindFirstFile
(
Fpath
,
&
FileData
);
_makepath
(
Fpath
,
Drive
,
Direc
,
"*"
,
NULL
);
Sub
->
H
=
FindFirstFile
(
Fpath
,
&
FileData
);
}
else
if
(
!
FindNextFile
(
Sub
->
H
,
&
FileData
))
{
}
else
if
(
!
FindNextFile
(
Sub
->
H
,
&
FileData
))
{
FindClose
(
Sub
->
H
);
FindClose
(
Sub
->
H
);
Sub
->
H
=
INVALID_HANDLE_VALUE
;
Sub
->
H
=
INVALID_HANDLE_VALUE
;
...
@@ -1234,8 +1243,9 @@ int TDBSDR::ReadDB(PGLOBAL g)
...
@@ -1234,8 +1243,9 @@ int TDBSDR::ReadDB(PGLOBAL g)
break
;
break
;
}
// endif findnext
}
// endif findnext
}
while
(
!
(
FileData
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
}
while
(
!
(
FileData
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
||
||
*
FileData
.
cFileName
==
'.'
);
(
*
FileData
.
cFileName
==
'.'
&&
(
!
FileData
.
cFileName
[
1
]
||
FileData
.
cFileName
[
1
]
==
'.'
)));
if
(
Sub
->
H
==
INVALID_HANDLE_VALUE
)
{
if
(
Sub
->
H
==
INVALID_HANDLE_VALUE
)
{
// No more sub-directories. Are we in a sub-directory?
// No more sub-directories. Are we in a sub-directory?
...
@@ -1289,7 +1299,8 @@ int TDBSDR::ReadDB(PGLOBAL g)
...
@@ -1289,7 +1299,8 @@ int TDBSDR::ReadDB(PGLOBAL g)
if
(
lstat
(
Fpath
,
&
Fileinfo
)
<
0
)
{
if
(
lstat
(
Fpath
,
&
Fileinfo
)
<
0
)
{
sprintf
(
g
->
Message
,
"%s: %s"
,
Fpath
,
strerror
(
errno
));
sprintf
(
g
->
Message
,
"%s: %s"
,
Fpath
,
strerror
(
errno
));
rc
=
RC_FX
;
rc
=
RC_FX
;
}
else
if
(
S_ISDIR
(
Fileinfo
.
st_mode
)
&&
*
Entry
->
d_name
!=
'.'
)
{
}
else
if
(
S_ISDIR
(
Fileinfo
.
st_mode
)
&&
strcmp
(
Entry
->
d_name
,
"."
)
&&
strcmp
(
Entry
->
d_name
,
".."
))
{
// Look in the name sub-directory
// Look in the name sub-directory
if
(
!
Sub
->
Next
)
{
if
(
!
Sub
->
Next
)
{
PSUBDIR
sup
;
PSUBDIR
sup
;
...
...
storage/connect/tabmul.h
View file @
3f444827
...
@@ -118,7 +118,8 @@ class DllExport DIRDEF : public TABDEF { /* Directory listing table */
...
@@ -118,7 +118,8 @@ class DllExport DIRDEF : public TABDEF { /* Directory listing table */
// Members
// Members
PSZ
Fn
;
/* Path/Name of file search */
PSZ
Fn
;
/* Path/Name of file search */
bool
Incl
;
/* true to include sub-directories */
bool
Incl
;
/* true to include sub-directories */
bool
Huge
;
/* true if files can be larger than 2GB */
bool
Huge
;
/* true if files can be larger than 2GB */
bool
Nodir
;
/* true to exclude directories */
};
// end of DIRDEF
};
// end of DIRDEF
/***********************************************************************/
/***********************************************************************/
...
@@ -175,6 +176,7 @@ class TDBDIR : public TDBASE {
...
@@ -175,6 +176,7 @@ class TDBDIR : public TDBASE {
char
Direc
[
_MAX_DIR
];
// Search path
char
Direc
[
_MAX_DIR
];
// Search path
char
Fname
[
_MAX_FNAME
];
// File name
char
Fname
[
_MAX_FNAME
];
// File name
char
Ftype
[
_MAX_EXT
];
// File extention
char
Ftype
[
_MAX_EXT
];
// File extention
bool
Nodir
;
// Exclude directories from file list
};
// end of class TDBDIR
};
// end of class TDBDIR
/***********************************************************************/
/***********************************************************************/
...
...
storage/connect/tabxml.cpp
View file @
3f444827
...
@@ -157,7 +157,10 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
...
@@ -157,7 +157,10 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
tdp
=
new
(
g
)
XMLDEF
;
tdp
=
new
(
g
)
XMLDEF
;
tdp
->
Fn
=
fn
;
tdp
->
Fn
=
fn
;
tdp
->
Database
=
SetPath
(
g
,
db
);
if
(
!
(
tdp
->
Database
=
SetPath
(
g
,
db
)))
return
NULL
;
tdp
->
Tabname
=
tab
;
tdp
->
Tabname
=
tab
;
tdp
->
Zipped
=
GetBooleanTableOption
(
g
,
topt
,
"Zipped"
,
false
);
tdp
->
Zipped
=
GetBooleanTableOption
(
g
,
topt
,
"Zipped"
,
false
);
tdp
->
Entry
=
GetStringTableOption
(
g
,
topt
,
"Entry"
,
NULL
);
tdp
->
Entry
=
GetStringTableOption
(
g
,
topt
,
"Entry"
,
NULL
);
...
...
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