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
736f821c
Commit
736f821c
authored
Jun 28, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'connect/10.1' into 10.1
parents
62e0a455
7e64b079
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
844 additions
and
630 deletions
+844
-630
.gitattributes
.gitattributes
+3
-0
.gitignore
.gitignore
+2
-0
storage/connect/JdbcInterface.class
storage/connect/JdbcInterface.class
+0
-0
storage/connect/JdbcInterface.java
storage/connect/JdbcInterface.java
+1
-1
storage/connect/ha_connect.cc
storage/connect/ha_connect.cc
+29
-20
storage/connect/jdbccat.h
storage/connect/jdbccat.h
+4
-4
storage/connect/jdbconn.cpp
storage/connect/jdbconn.cpp
+566
-528
storage/connect/jdbconn.h
storage/connect/jdbconn.h
+44
-23
storage/connect/odbccat.h
storage/connect/odbccat.h
+1
-1
storage/connect/odbconn.cpp
storage/connect/odbconn.cpp
+2
-2
storage/connect/tabjdbc.cpp
storage/connect/tabjdbc.cpp
+150
-30
storage/connect/tabjdbc.h
storage/connect/tabjdbc.h
+11
-10
storage/connect/tabodbc.cpp
storage/connect/tabodbc.cpp
+21
-6
storage/connect/tabodbc.h
storage/connect/tabodbc.h
+10
-5
No files found.
.gitattributes
View file @
736f821c
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
*.cpp text
*.cpp text
*.h text
*.h text
*.test text
*.test text
*.java text
# These files should be checked out as is
# These files should be checked out as is
*.result -text -whitespace
*.result -text -whitespace
...
@@ -23,9 +24,11 @@ pcre/testdata/greppatN4 -text
...
@@ -23,9 +24,11 @@ pcre/testdata/greppatN4 -text
*.frm binary
*.frm binary
*.MYD binary
*.MYD binary
*.MYI binary
*.MYI binary
*.class binary
*.c diff=cpp
*.c diff=cpp
*.h diff=cpp
*.h diff=cpp
*.cc diff=cpp
*.cc diff=cpp
*.ic diff=cpp
*.ic diff=cpp
*.cpp diff=cpp
*.cpp diff=cpp
*.java diff=cpp
.gitignore
View file @
736f821c
...
@@ -244,6 +244,8 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
...
@@ -244,6 +244,8 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
*.exp
*.exp
*.dep
*.dep
*.idb
*.idb
*.res
*.tlog
# Precompiled Headers
# Precompiled Headers
*.gch
*.gch
...
...
storage/connect/JdbcInterface.class
View file @
736f821c
This diff was suppressed by a .gitattributes entry.
storage/connect/JdbcInterface.java
View file @
736f821c
...
@@ -307,7 +307,7 @@ public class JdbcInterface {
...
@@ -307,7 +307,7 @@ public class JdbcInterface {
}
// end of GetMaxValue
}
// end of GetMaxValue
public
int
GetColumns
(
String
[]
parms
)
{
public
int
GetColumns
(
String
[]
parms
)
{
int
ncol
=
0
;
int
ncol
=
-
1
;
try
{
try
{
if
(
rs
!=
null
)
rs
.
close
();
if
(
rs
!=
null
)
rs
.
close
();
...
...
storage/connect/ha_connect.cc
View file @
736f821c
...
@@ -129,7 +129,8 @@
...
@@ -129,7 +129,8 @@
#include "odbccat.h"
#include "odbccat.h"
#endif // ODBC_SUPPORT
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
#if defined(JDBC_SUPPORT)
#include "jdbccat.h"
#include "tabjdbc.h"
#include "jdbconn.h"
#endif // JDBC_SUPPORT
#endif // JDBC_SUPPORT
#include "xtable.h"
#include "xtable.h"
#include "tabmysql.h"
#include "tabmysql.h"
...
@@ -5163,7 +5164,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5163,7 +5164,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#endif // ODBC_SUPPORT
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
#if defined(JDBC_SUPPORT)
PJPARM
sjp
=
NULL
;
PJPARM
sjp
=
NULL
;
char
*
jpath
=
NULL
;
char
*
driver
=
NULL
;
char
*
driver
=
NULL
;
char
*
url
=
NULL
;
char
*
url
=
NULL
;
char
*
tabtyp
=
NULL
;
char
*
tabtyp
=
NULL
;
...
@@ -5230,9 +5230,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5230,9 +5230,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
cnc
=
(
!*
ucnc
||
*
ucnc
==
'y'
||
*
ucnc
==
'Y'
||
atoi
(
ucnc
)
!=
0
);
cnc
=
(
!*
ucnc
||
*
ucnc
==
'y'
||
*
ucnc
==
'Y'
||
atoi
(
ucnc
)
!=
0
);
#endif
#endif
#if defined(JDBC_SUPPORT)
#if defined(JDBC_SUPPORT)
jpath
=
GetListOption
(
g
,
"Jpath"
,
topt
->
oplist
,
NULL
);
driver
=
GetListOption
(
g
,
"Driver"
,
topt
->
oplist
,
NULL
);
driver
=
GetListOption
(
g
,
"Driver"
,
topt
->
oplist
,
NULL
);
url
=
GetListOption
(
g
,
"URL"
,
topt
->
oplist
,
NULL
);
//
url= GetListOption(g, "URL", topt->oplist, NULL);
tabtyp
=
GetListOption
(
g
,
"Tabtype"
,
topt
->
oplist
,
NULL
);
tabtyp
=
GetListOption
(
g
,
"Tabtype"
,
topt
->
oplist
,
NULL
);
#endif // JDBC_SUPPORT
#endif // JDBC_SUPPORT
mxe
=
atoi
(
GetListOption
(
g
,
"maxerr"
,
topt
->
oplist
,
"0"
));
mxe
=
atoi
(
GetListOption
(
g
,
"maxerr"
,
topt
->
oplist
,
"0"
));
...
@@ -5333,18 +5332,31 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5333,18 +5332,31 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case
TAB_JDBC
:
case
TAB_JDBC
:
if
(
fnc
&
FNC_DRIVER
)
{
if
(
fnc
&
FNC_DRIVER
)
{
ok
=
true
;
ok
=
true
;
}
else
if
(
!
url
)
{
}
else
if
(
!
(
url
=
strz
(
g
,
create_info
->
connect_string
))
)
{
strcpy
(
g
->
Message
,
"Missing URL"
);
strcpy
(
g
->
Message
,
"Missing URL"
);
}
else
{
}
else
{
// Store ODBC additional parameters
// Store JDBC additional parameters
int
rc
;
PJDBCDEF
jdef
=
new
(
g
)
JDBCDEF
();
jdef
->
SetName
(
create_info
->
alias
);
sjp
=
(
PJPARM
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
JDBCPARM
));
sjp
=
(
PJPARM
)
PlugSubAlloc
(
g
,
NULL
,
sizeof
(
JDBCPARM
));
sjp
->
Driver
=
driver
;
sjp
->
Driver
=
driver
;
sjp
->
Url
=
url
;
sjp
->
User
=
(
char
*
)
user
;
sjp
->
Pwd
=
(
char
*
)
pwd
;
sjp
->
Fsize
=
0
;
sjp
->
Fsize
=
0
;
sjp
->
Scrollable
=
false
;
sjp
->
Scrollable
=
false
;
ok
=
true
;
if
((
rc
=
jdef
->
ParseURL
(
g
,
url
,
false
))
==
RC_OK
)
{
sjp
->
Url
=
url
;
sjp
->
User
=
(
char
*
)
user
;
sjp
->
Pwd
=
(
char
*
)
pwd
;
ok
=
true
;
}
else
if
(
rc
==
RC_NF
)
{
if
(
jdef
->
GetTabname
())
tab
=
jdef
->
GetTabname
();
ok
=
jdef
->
SetParms
(
sjp
);
}
// endif rc
}
// endif's
}
// endif's
supfnc
|=
(
FNC_DRIVER
|
FNC_TABLE
);
supfnc
|=
(
FNC_DRIVER
|
FNC_TABLE
);
...
@@ -5496,7 +5508,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5496,7 +5508,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break
;
break
;
case
FNC_TABLE
:
case
FNC_TABLE
:
qrp
=
ODBCTables
(
g
,
dsn
,
shm
,
tab
,
mxr
,
true
,
sop
);
qrp
=
ODBCTables
(
g
,
dsn
,
shm
,
tab
,
NULL
,
mxr
,
true
,
sop
);
break
;
break
;
case
FNC_DSN
:
case
FNC_DSN
:
qrp
=
ODBCDataSources
(
g
,
mxr
,
true
);
qrp
=
ODBCDataSources
(
g
,
mxr
,
true
);
...
@@ -5517,15 +5529,14 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5517,15 +5529,14 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case
FNC_NO
:
case
FNC_NO
:
case
FNC_COL
:
case
FNC_COL
:
if
(
src
)
{
if
(
src
)
{
qrp
=
JDBCSrcCols
(
g
,
jpath
,
(
char
*
)
src
,
sjp
);
qrp
=
JDBCSrcCols
(
g
,
(
char
*
)
src
,
sjp
);
src
=
NULL
;
// for next tests
src
=
NULL
;
// for next tests
}
else
}
else
qrp
=
JDBCColumns
(
g
,
jpath
,
shm
,
tab
,
NULL
,
qrp
=
JDBCColumns
(
g
,
shm
,
tab
,
NULL
,
mxr
,
fnc
==
FNC_COL
,
sjp
);
mxr
,
fnc
==
FNC_COL
,
sjp
);
break
;
break
;
case
FNC_TABLE
:
case
FNC_TABLE
:
qrp
=
JDBCTables
(
g
,
dsn
,
shm
,
tab
,
tabtyp
,
mxr
,
true
,
sjp
);
qrp
=
JDBCTables
(
g
,
shm
,
tab
,
tabtyp
,
mxr
,
true
,
sjp
);
break
;
break
;
#if 0
#if 0
case FNC_DSN:
case FNC_DSN:
...
@@ -5533,7 +5544,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5533,7 +5544,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break;
break;
#endif // 0
#endif // 0
case
FNC_DRIVER
:
case
FNC_DRIVER
:
qrp
=
JDBCDrivers
(
g
,
jpath
,
mxr
,
true
);
qrp
=
JDBCDrivers
(
g
,
mxr
,
true
);
break
;
break
;
default:
default:
sprintf
(
g
->
Message
,
"invalid catfunc %s"
,
fncn
);
sprintf
(
g
->
Message
,
"invalid catfunc %s"
,
fncn
);
...
@@ -5784,12 +5795,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
...
@@ -5784,12 +5795,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
switch
(
typ
)
{
switch
(
typ
)
{
case
TYPE_DOUBLE
:
case
TYPE_DOUBLE
:
case
TYPE_DECIM
:
// Some data sources do not count dec in length (prec)
// Some data sources do not count dec in length (prec)
prec
+=
(
dec
+
2
);
// To be safe
prec
+=
(
dec
+
2
);
// To be safe
break
;
break
;
case
TYPE_DECIM
:
prec
=
len
;
break
;
default:
default:
dec
=
0
;
dec
=
0
;
}
// endswitch typ
}
// endswitch typ
...
...
storage/connect/jdbccat.h
View file @
736f821c
...
@@ -21,9 +21,9 @@ typedef struct jdbc_parms {
...
@@ -21,9 +21,9 @@ typedef struct jdbc_parms {
char
*
JDBCCheckConnection
(
PGLOBAL
g
,
char
*
dsn
,
int
cop
);
char
*
JDBCCheckConnection
(
PGLOBAL
g
,
char
*
dsn
,
int
cop
);
#endif // PROMPT_OK
#endif // PROMPT_OK
//PQRYRES JDBCDataSources(PGLOBAL g, int maxres, bool info);
//PQRYRES JDBCDataSources(PGLOBAL g, int maxres, bool info);
PQRYRES
JDBCColumns
(
PGLOBAL
g
,
char
*
jpath
,
char
*
db
,
char
*
table
,
PQRYRES
JDBCColumns
(
PGLOBAL
g
,
char
*
db
,
char
*
table
,
char
*
colpat
,
int
maxres
,
bool
info
,
PJPARM
sop
);
char
*
colpat
,
int
maxres
,
bool
info
,
PJPARM
sop
);
PQRYRES
JDBCSrcCols
(
PGLOBAL
g
,
char
*
jpath
,
char
*
src
,
PJPARM
sop
);
PQRYRES
JDBCSrcCols
(
PGLOBAL
g
,
char
*
src
,
PJPARM
sop
);
PQRYRES
JDBCTables
(
PGLOBAL
g
,
char
*
jpath
,
char
*
db
,
char
*
tabpat
,
PQRYRES
JDBCTables
(
PGLOBAL
g
,
char
*
db
,
char
*
tabpat
,
char
*
tabtyp
,
int
maxres
,
bool
info
,
PJPARM
sop
);
char
*
tabtyp
,
int
maxres
,
bool
info
,
PJPARM
sop
);
PQRYRES
JDBCDrivers
(
PGLOBAL
g
,
char
*
jpath
,
int
maxres
,
bool
info
);
PQRYRES
JDBCDrivers
(
PGLOBAL
g
,
int
maxres
,
bool
info
);
storage/connect/jdbconn.cpp
View file @
736f821c
This diff is collapsed.
Click to expand it.
storage/connect/jdbconn.h
View file @
736f821c
...
@@ -32,15 +32,6 @@
...
@@ -32,15 +32,6 @@
typedef
unsigned
char
*
PUCHAR
;
typedef
unsigned
char
*
PUCHAR
;
#endif // !__WIN__
#endif // !__WIN__
// Field Flags, used to indicate status of fields
//efine SQL_FIELD_FLAG_DIRTY 0x1
//efine SQL_FIELD_FLAG_NULL 0x2
// Update options flags
//efine SQL_SETPOSUPDATES 0x0001
//efine SQL_POSITIONEDSQL 0x0002
//efine SQL_GDBOUND 0x0004
enum
JCATINFO
{
enum
JCATINFO
{
CAT_TAB
=
1
,
// JDBC Tables
CAT_TAB
=
1
,
// JDBC Tables
CAT_COL
=
2
,
// JDBC Columns
CAT_COL
=
2
,
// JDBC Columns
...
@@ -55,11 +46,17 @@ enum JCATINFO {
...
@@ -55,11 +46,17 @@ enum JCATINFO {
typedef
struct
tagJCATPARM
{
typedef
struct
tagJCATPARM
{
JCATINFO
Id
;
// Id to indicate function
JCATINFO
Id
;
// Id to indicate function
PQRYRES
Qrp
;
// Result set pointer
PQRYRES
Qrp
;
// Result set pointer
PUCHAR
DB
;
// Database (Schema)
char
*
DB
;
// Database (Schema)
PUCHAR
Tab
;
// Table name or pattern
char
*
Tab
;
// Table name or pattern
PUCHAR
Pat
;
// Table type or column pattern
char
*
Pat
;
// Table type or column pattern
}
JCATPARM
;
}
JCATPARM
;
typedef
jint
(
JNICALL
*
CRTJVM
)
(
JavaVM
**
,
void
**
,
void
*
);
typedef
jint
(
JNICALL
*
GETJVM
)
(
JavaVM
**
,
jsize
,
jsize
*
);
#if defined(_DEBUG)
typedef
jint
(
JNICALL
*
GETDEF
)
(
void
*
);
#endif // _DEBUG
// JDBC connection to a data source
// JDBC connection to a data source
class
TDBJDBC
;
class
TDBJDBC
;
class
JDBCCOL
;
class
JDBCCOL
;
...
@@ -79,7 +76,7 @@ class JDBConn : public BLOCK {
...
@@ -79,7 +76,7 @@ class JDBConn : public BLOCK {
public:
public:
JDBConn
(
PGLOBAL
g
,
TDBJDBC
*
tdbp
);
JDBConn
(
PGLOBAL
g
,
TDBJDBC
*
tdbp
);
int
Open
(
P
SZ
jpath
,
P
JPARM
sop
);
int
Open
(
PJPARM
sop
);
int
Rewind
(
char
*
sql
);
int
Rewind
(
char
*
sql
);
void
Close
(
void
);
void
Close
(
void
);
PQRYRES
AllocateResult
(
PGLOBAL
g
);
PQRYRES
AllocateResult
(
PGLOBAL
g
);
...
@@ -114,8 +111,18 @@ class JDBConn : public BLOCK {
...
@@ -114,8 +111,18 @@ class JDBConn : public BLOCK {
PQRYRES
GetMetaData
(
PGLOBAL
g
,
char
*
src
);
PQRYRES
GetMetaData
(
PGLOBAL
g
,
char
*
src
);
public:
public:
// Set special options
// Set static variables
//void OnSetOptions(HSTMT hstmt);
static
void
SetJVM
(
void
)
{
LibJvm
=
NULL
;
CreateJavaVM
=
NULL
;
GetCreatedJavaVMs
=
NULL
;
#if defined(_DEBUG)
GetDefaultJavaVMInitArgs
=
NULL
;
#endif // _DEBUG
}
// end of SetJVM
static
void
ResetJVM
(
void
);
static
bool
GetJVM
(
PGLOBAL
g
);
// Implementation
// Implementation
public:
public:
...
@@ -123,24 +130,30 @@ class JDBConn : public BLOCK {
...
@@ -123,24 +130,30 @@ class JDBConn : public BLOCK {
// JDBC operations
// JDBC operations
protected:
protected:
//bool Check(RETCODE rc);
bool
gmID
(
PGLOBAL
g
,
jmethodID
&
mid
,
const
char
*
name
,
const
char
*
sig
);
bool
Check
(
jint
rc
=
0
);
//void ThrowDJX(int rc, PSZ msg/*, HSTMT hstmt = SQL_NULL_HSTMT*/);
//void ThrowDJX(int rc, PSZ msg/*, HSTMT hstmt = SQL_NULL_HSTMT*/);
//void ThrowDJX(PSZ msg);
//void ThrowDJX(PSZ msg);
//void AllocConnect(DWORD dwOptions);
//void Connect(void);
//bool DriverConnect(DWORD Options);
//void VerifyConnect(void);
//void GetConnectInfo(void);
//void Free(void);
//void Free(void);
protected:
protected:
// Members
// Members
#if defined(__WIN__)
static
HANDLE
LibJvm
;
// Handle to the jvm DLL
#else // !__WIN__
static
void
*
LibJvm
;
// Handle for the jvm shared library
#endif // !__WIN__
static
CRTJVM
CreateJavaVM
;
static
GETJVM
GetCreatedJavaVMs
;
#if defined(_DEBUG)
static
GETDEF
GetDefaultJavaVMInitArgs
;
#endif // _DEBUG
PGLOBAL
m_G
;
PGLOBAL
m_G
;
TDBJDBC
*
m_Tdb
;
TDBJDBC
*
m_Tdb
;
JavaVM
*
jvm
;
// Pointer to the JVM (Java Virtual Machine)
JavaVM
*
jvm
;
// Pointer to the JVM (Java Virtual Machine)
JNIEnv
*
env
;
// Pointer to native interface
JNIEnv
*
env
;
// Pointer to native interface
jclass
jdi
;
// Pointer to the
JdbcInterface
class
jclass
jdi
;
// Pointer to the
java wrapper
class
jobject
job
;
// The
JdbcInterface
class object
jobject
job
;
// The
java wrapper
class object
jmethodID
xqid
;
// The ExecuteQuery method ID
jmethodID
xqid
;
// The ExecuteQuery method ID
jmethodID
xuid
;
// The ExecuteUpdate method ID
jmethodID
xuid
;
// The ExecuteUpdate method ID
jmethodID
xid
;
// The Execute method ID
jmethodID
xid
;
// The Execute method ID
...
@@ -151,9 +164,17 @@ class JDBConn : public BLOCK {
...
@@ -151,9 +164,17 @@ class JDBConn : public BLOCK {
jmethodID
prepid
;
// The CreatePrepStmt method ID
jmethodID
prepid
;
// The CreatePrepStmt method ID
jmethodID
xpid
;
// The ExecutePrep method ID
jmethodID
xpid
;
// The ExecutePrep method ID
jmethodID
pcid
;
// The ClosePrepStmt method ID
jmethodID
pcid
;
// The ClosePrepStmt method ID
jmethodID
errid
;
// The GetErrmsg method ID
jmethodID
chrfldid
;
// The StringField method ID
jmethodID
intfldid
;
// The IntField method ID
jmethodID
dblfldid
;
// The DoubleField method ID
jmethodID
fltfldid
;
// The FloatField method ID
jmethodID
datfldid
;
// The TimestampField method ID
jmethodID
bigfldid
;
// The BigintField method ID
//DWORD m_LoginTimeout;
//DWORD m_LoginTimeout;
//DWORD m_QueryTimeout;
//DWORD m_QueryTimeout;
//DWORD m_UpdateOptions;
//DWORD m_UpdateOptions;
char
*
Msg
;
char
m_IDQuoteChar
[
2
];
char
m_IDQuoteChar
[
2
];
PSZ
m_Driver
;
PSZ
m_Driver
;
PSZ
m_Url
;
PSZ
m_Url
;
...
...
storage/connect/odbccat.h
View file @
736f821c
...
@@ -21,5 +21,5 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
...
@@ -21,5 +21,5 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
char
*
colpat
,
int
maxres
,
bool
info
,
POPARM
sop
);
char
*
colpat
,
int
maxres
,
bool
info
,
POPARM
sop
);
PQRYRES
ODBCSrcCols
(
PGLOBAL
g
,
char
*
dsn
,
char
*
src
,
POPARM
sop
);
PQRYRES
ODBCSrcCols
(
PGLOBAL
g
,
char
*
dsn
,
char
*
src
,
POPARM
sop
);
PQRYRES
ODBCTables
(
PGLOBAL
g
,
char
*
dsn
,
char
*
db
,
char
*
tabpat
,
PQRYRES
ODBCTables
(
PGLOBAL
g
,
char
*
dsn
,
char
*
db
,
char
*
tabpat
,
int
maxres
,
bool
info
,
POPARM
sop
);
char
*
tabtyp
,
int
maxres
,
bool
info
,
POPARM
sop
);
PQRYRES
ODBCDrivers
(
PGLOBAL
g
,
int
maxres
,
bool
info
);
PQRYRES
ODBCDrivers
(
PGLOBAL
g
,
int
maxres
,
bool
info
);
storage/connect/odbconn.cpp
View file @
736f821c
...
@@ -606,7 +606,7 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
...
@@ -606,7 +606,7 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
/* an ODBC database that will be retrieved by GetData commands. */
/* an ODBC database that will be retrieved by GetData commands. */
/**************************************************************************/
/**************************************************************************/
PQRYRES
ODBCTables
(
PGLOBAL
g
,
char
*
dsn
,
char
*
db
,
char
*
tabpat
,
PQRYRES
ODBCTables
(
PGLOBAL
g
,
char
*
dsn
,
char
*
db
,
char
*
tabpat
,
int
maxres
,
bool
info
,
POPARM
sop
)
char
*
tabtyp
,
int
maxres
,
bool
info
,
POPARM
sop
)
{
{
int
buftyp
[]
=
{
TYPE_STRING
,
TYPE_STRING
,
TYPE_STRING
,
int
buftyp
[]
=
{
TYPE_STRING
,
TYPE_STRING
,
TYPE_STRING
,
TYPE_STRING
,
TYPE_STRING
};
TYPE_STRING
,
TYPE_STRING
};
...
@@ -668,7 +668,7 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
...
@@ -668,7 +668,7 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
if
(
!
(
cap
=
AllocCatInfo
(
g
,
CAT_TAB
,
db
,
tabpat
,
qrp
)))
if
(
!
(
cap
=
AllocCatInfo
(
g
,
CAT_TAB
,
db
,
tabpat
,
qrp
)))
return
NULL
;
return
NULL
;
//
cap->Pat = (PUCHAR)tabtyp;
cap
->
Pat
=
(
PUCHAR
)
tabtyp
;
if
(
trace
)
if
(
trace
)
htrc
(
"Getting table results ncol=%d
\n
"
,
cap
->
Qrp
->
Nbcol
);
htrc
(
"Getting table results ncol=%d
\n
"
,
cap
->
Qrp
->
Nbcol
);
...
...
storage/connect/tabjdbc.cpp
View file @
736f821c
This diff is collapsed.
Click to expand it.
storage/connect/tabjdbc.h
View file @
736f821c
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
/***********************************************************************/
/***********************************************************************/
#include "colblk.h"
#include "colblk.h"
#include "resource.h"
#include "resource.h"
#include "jdbccat.h"
typedef
class
JDBCDEF
*
PJDBCDEF
;
typedef
class
JDBCDEF
*
PJDBCDEF
;
typedef
class
TDBJDBC
*
PTDBJDBC
;
typedef
class
TDBJDBC
*
PTDBJDBC
;
...
@@ -25,13 +26,13 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
...
@@ -25,13 +26,13 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
friend
class
TDBXJDC
;
friend
class
TDBXJDC
;
friend
class
TDBJDRV
;
friend
class
TDBJDRV
;
friend
class
TDBJTB
;
friend
class
TDBJTB
;
friend
class
TDBJDBCL
;
public:
public:
// Constructor
// Constructor
JDBCDEF
(
void
);
JDBCDEF
(
void
);
// Implementation
// Implementation
virtual
const
char
*
GetType
(
void
)
{
return
"JDBC"
;
}
virtual
const
char
*
GetType
(
void
)
{
return
"JDBC"
;
}
PSZ
GetJpath
(
void
)
{
return
Jpath
;
}
PSZ
GetTabname
(
void
)
{
return
Tabname
;
}
PSZ
GetTabname
(
void
)
{
return
Tabname
;
}
PSZ
GetTabschema
(
void
)
{
return
Tabschema
;
}
PSZ
GetTabschema
(
void
)
{
return
Tabschema
;
}
PSZ
GetTabcat
(
void
)
{
return
Tabcat
;
}
PSZ
GetTabcat
(
void
)
{
return
Tabcat
;
}
...
@@ -45,10 +46,11 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
...
@@ -45,10 +46,11 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
virtual
int
Indexable
(
void
)
{
return
2
;
}
virtual
int
Indexable
(
void
)
{
return
2
;
}
virtual
bool
DefineAM
(
PGLOBAL
g
,
LPCSTR
am
,
int
poff
);
virtual
bool
DefineAM
(
PGLOBAL
g
,
LPCSTR
am
,
int
poff
);
virtual
PTDB
GetTable
(
PGLOBAL
g
,
MODE
m
);
virtual
PTDB
GetTable
(
PGLOBAL
g
,
MODE
m
);
int
ParseURL
(
PGLOBAL
g
,
char
*
url
,
bool
b
=
true
);
bool
SetParms
(
PJPARM
sjp
);
protected:
protected:
// Members
// Members
PSZ
Jpath
;
/* Java class path */
PSZ
Driver
;
/* JDBC driver */
PSZ
Driver
;
/* JDBC driver */
PSZ
Url
;
/* JDBC driver URL */
PSZ
Url
;
/* JDBC driver URL */
PSZ
Tabname
;
/* External table name */
PSZ
Tabname
;
/* External table name */
...
@@ -57,6 +59,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
...
@@ -57,6 +59,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
PSZ
Password
;
/* Password connect info */
PSZ
Password
;
/* Password connect info */
PSZ
Tabcat
;
/* External table catalog */
PSZ
Tabcat
;
/* External table catalog */
PSZ
Tabtype
;
/* External table type */
PSZ
Tabtype
;
/* External table type */
PSZ
Colpat
;
/* Catalog column pattern */
PSZ
Srcdef
;
/* The source table SQL definition */
PSZ
Srcdef
;
/* The source table SQL definition */
PSZ
Qchar
;
/* Identifier quoting character */
PSZ
Qchar
;
/* Identifier quoting character */
PSZ
Qrystr
;
/* The original query */
PSZ
Qrystr
;
/* The original query */
...
@@ -73,7 +76,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
...
@@ -73,7 +76,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
};
// end of JDBCDEF
};
// end of JDBCDEF
#if !defined(NJDBC)
#if !defined(NJDBC)
#include "
JDBC
onn.h"
#include "
jdbc
onn.h"
/***********************************************************************/
/***********************************************************************/
/* This is the JDBC Access Method class declaration for files from */
/* This is the JDBC Access Method class declaration for files from */
...
@@ -130,7 +133,6 @@ class TDBJDBC : public TDBASE {
...
@@ -130,7 +133,6 @@ class TDBJDBC : public TDBASE {
JDBCCOL
*
Cnp
;
// Points to count(*) column
JDBCCOL
*
Cnp
;
// Points to count(*) column
JDBCPARM
Ops
;
// Additional parameters
JDBCPARM
Ops
;
// Additional parameters
PSTRG
Query
;
// Constructed SQL query
PSTRG
Query
;
// Constructed SQL query
char
*
Jpath
;
// Java class path
char
*
TableName
;
// Points to JDBC table name
char
*
TableName
;
// Points to JDBC table name
char
*
Schema
;
// Points to JDBC table Schema
char
*
Schema
;
// Points to JDBC table Schema
char
*
User
;
// User connect info
char
*
User
;
// User connect info
...
@@ -282,7 +284,7 @@ class JSRCCOL : public JDBCCOL {
...
@@ -282,7 +284,7 @@ class JSRCCOL : public JDBCCOL {
class
TDBJDRV
:
public
TDBCAT
{
class
TDBJDRV
:
public
TDBCAT
{
public:
public:
// Constructor
// Constructor
TDBJDRV
(
PJDBCDEF
tdp
)
:
TDBCAT
(
tdp
)
{
Maxres
=
tdp
->
Maxres
;
Jpath
=
tdp
->
Jpath
;
}
TDBJDRV
(
PJDBCDEF
tdp
)
:
TDBCAT
(
tdp
)
{
Maxres
=
tdp
->
Maxres
;}
protected:
protected:
// Specific routines
// Specific routines
...
@@ -290,7 +292,6 @@ class TDBJDRV : public TDBCAT {
...
@@ -290,7 +292,6 @@ class TDBJDRV : public TDBCAT {
// Members
// Members
int
Maxres
;
// Returned lines limit
int
Maxres
;
// Returned lines limit
char
*
Jpath
;
// Java class path
};
// end of class TDBJDRV
};
// end of class TDBJDRV
/***********************************************************************/
/***********************************************************************/
...
@@ -306,7 +307,6 @@ class TDBJTB : public TDBJDRV {
...
@@ -306,7 +307,6 @@ class TDBJTB : public TDBJDRV {
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// Members
// Members
char
*
Jpath
;
// Points to Java classpath
char
*
Schema
;
// Points to schema name or NULL
char
*
Schema
;
// Points to schema name or NULL
char
*
Tab
;
// Points to JDBC table name or pattern
char
*
Tab
;
// Points to JDBC table name or pattern
char
*
Tabtype
;
// Points to JDBC table type
char
*
Tabtype
;
// Points to JDBC table type
...
@@ -319,14 +319,15 @@ class TDBJTB : public TDBJDRV {
...
@@ -319,14 +319,15 @@ class TDBJTB : public TDBJDRV {
class
TDBJDBCL
:
public
TDBJTB
{
class
TDBJDBCL
:
public
TDBJTB
{
public:
public:
// Constructor
// Constructor
TDBJDBCL
(
PJDBCDEF
tdp
)
:
TDBJTB
(
tdp
)
{}
TDBJDBCL
(
PJDBCDEF
tdp
)
;
protected:
protected:
// Specific routines
// Specific routines
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// No additional Members
// Members
};
// end of class TDBJCL
char
*
Colpat
;
// Points to catalog column pattern
};
// end of class TDBJDBCL
#if 0
#if 0
/***********************************************************************/
/***********************************************************************/
...
...
storage/connect/tabodbc.cpp
View file @
736f821c
/************* Tabodbc C++ Program Source Code File (.CPP) *************/
/************* Tabodbc C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: TABODBC */
/* PROGRAM NAME: TABODBC */
/* ------------- */
/* ------------- */
/* Version 3.
0
*/
/* Version 3.
1
*/
/* */
/* */
/* COPYRIGHT: */
/* COPYRIGHT: */
/* ---------- */
/* ---------- */
...
@@ -96,7 +96,7 @@ bool ExactInfo(void);
...
@@ -96,7 +96,7 @@ bool ExactInfo(void);
ODBCDEF
::
ODBCDEF
(
void
)
ODBCDEF
::
ODBCDEF
(
void
)
{
{
Connect
=
Tabname
=
Tabschema
=
Username
=
Password
=
NULL
;
Connect
=
Tabname
=
Tabschema
=
Username
=
Password
=
NULL
;
Tabcat
=
Srcdef
=
Qchar
=
Qrystr
=
Sep
=
NULL
;
Tabcat
=
Colpat
=
Srcdef
=
Qchar
=
Qrystr
=
Sep
=
NULL
;
Catver
=
Options
=
Cto
=
Qto
=
Quoted
=
Maxerr
=
Maxres
=
Memory
=
0
;
Catver
=
Options
=
Cto
=
Qto
=
Quoted
=
Maxerr
=
Maxres
=
Memory
=
0
;
Scrollable
=
Xsrc
=
UseCnc
=
false
;
Scrollable
=
Xsrc
=
UseCnc
=
false
;
}
// end of ODBCDEF constructor
}
// end of ODBCDEF constructor
...
@@ -120,7 +120,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
...
@@ -120,7 +120,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Tabschema
=
GetStringCatInfo
(
g
,
"Schema"
,
Tabschema
);
Tabschema
=
GetStringCatInfo
(
g
,
"Schema"
,
Tabschema
);
Tabcat
=
GetStringCatInfo
(
g
,
"Qualifier"
,
NULL
);
Tabcat
=
GetStringCatInfo
(
g
,
"Qualifier"
,
NULL
);
Tabcat
=
GetStringCatInfo
(
g
,
"Catalog"
,
Tabcat
);
Tabcat
=
GetStringCatInfo
(
g
,
"Catalog"
,
Tabcat
);
Username
=
GetStringCatInfo
(
g
,
"User"
,
NULL
);
Username
=
GetStringCatInfo
(
g
,
"User"
,
NULL
);
Password
=
GetStringCatInfo
(
g
,
"Password"
,
NULL
);
Password
=
GetStringCatInfo
(
g
,
"Password"
,
NULL
);
if
((
Srcdef
=
GetStringCatInfo
(
g
,
"Srcdef"
,
NULL
)))
if
((
Srcdef
=
GetStringCatInfo
(
g
,
"Srcdef"
,
NULL
)))
...
@@ -141,7 +141,13 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
...
@@ -141,7 +141,13 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if
((
Scrollable
=
GetBoolCatInfo
(
"Scrollable"
,
false
))
&&
!
Elemt
)
if
((
Scrollable
=
GetBoolCatInfo
(
"Scrollable"
,
false
))
&&
!
Elemt
)
Elemt
=
1
;
// Cannot merge SQLFetch and SQLExtendedFetch
Elemt
=
1
;
// Cannot merge SQLFetch and SQLExtendedFetch
UseCnc
=
GetBoolCatInfo
(
"UseDSN"
,
false
);
if
(
Catfunc
==
FNC_COL
)
Colpat
=
GetStringCatInfo
(
g
,
"Colpat"
,
NULL
);
if
(
Catfunc
==
FNC_TABLE
)
Tabtyp
=
GetStringCatInfo
(
g
,
"Tabtype"
,
NULL
);
UseCnc
=
GetBoolCatInfo
(
"UseDSN"
,
false
);
// Memory was Boolean, it is now integer
// Memory was Boolean, it is now integer
if
(
!
(
Memory
=
GetIntCatInfo
(
"Memory"
,
0
)))
if
(
!
(
Memory
=
GetIntCatInfo
(
"Memory"
,
0
)))
...
@@ -1768,6 +1774,7 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
...
@@ -1768,6 +1774,7 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
Dsn
=
tdp
->
GetConnect
();
Dsn
=
tdp
->
GetConnect
();
Schema
=
tdp
->
GetTabschema
();
Schema
=
tdp
->
GetTabschema
();
Tab
=
tdp
->
GetTabname
();
Tab
=
tdp
->
GetTabname
();
Tabtyp
=
tdp
->
Tabtyp
;
Ops
.
User
=
tdp
->
Username
;
Ops
.
User
=
tdp
->
Username
;
Ops
.
Pwd
=
tdp
->
Password
;
Ops
.
Pwd
=
tdp
->
Password
;
Ops
.
Cto
=
tdp
->
Cto
;
Ops
.
Cto
=
tdp
->
Cto
;
...
@@ -1780,17 +1787,25 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
...
@@ -1780,17 +1787,25 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
/***********************************************************************/
/***********************************************************************/
PQRYRES
TDBOTB
::
GetResult
(
PGLOBAL
g
)
PQRYRES
TDBOTB
::
GetResult
(
PGLOBAL
g
)
{
{
return
ODBCTables
(
g
,
Dsn
,
Schema
,
Tab
,
Maxres
,
false
,
&
Ops
);
return
ODBCTables
(
g
,
Dsn
,
Schema
,
Tab
,
Tabtyp
,
Maxres
,
false
,
&
Ops
);
}
// end of GetResult
}
// end of GetResult
/* ---------------------------TDBOCL class --------------------------- */
/* ---------------------------TDBOCL class --------------------------- */
/***********************************************************************/
/* TDBOCL class constructor. */
/***********************************************************************/
TDBOCL
::
TDBOCL
(
PODEF
tdp
)
:
TDBOTB
(
tdp
)
{
Colpat
=
tdp
->
Colpat
;
}
// end of TDBOTB constructor
/***********************************************************************/
/***********************************************************************/
/* GetResult: Get the list of ODBC table columns. */
/* GetResult: Get the list of ODBC table columns. */
/***********************************************************************/
/***********************************************************************/
PQRYRES
TDBOCL
::
GetResult
(
PGLOBAL
g
)
PQRYRES
TDBOCL
::
GetResult
(
PGLOBAL
g
)
{
{
return
ODBCColumns
(
g
,
Dsn
,
Schema
,
Tab
,
NULL
,
Maxres
,
false
,
&
Ops
);
return
ODBCColumns
(
g
,
Dsn
,
Schema
,
Tab
,
Colpat
,
Maxres
,
false
,
&
Ops
);
}
// end of GetResult
}
// end of GetResult
/* ------------------------ End of Tabodbc --------------------------- */
/* ------------------------ End of Tabodbc --------------------------- */
storage/connect/tabodbc.h
View file @
736f821c
...
@@ -25,7 +25,8 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
...
@@ -25,7 +25,8 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
friend
class
TDBXDBC
;
friend
class
TDBXDBC
;
friend
class
TDBDRV
;
friend
class
TDBDRV
;
friend
class
TDBOTB
;
friend
class
TDBOTB
;
public:
friend
class
TDBOCL
;
public:
// Constructor
// Constructor
ODBCDEF
(
void
);
ODBCDEF
(
void
);
...
@@ -54,7 +55,9 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
...
@@ -54,7 +55,9 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
PSZ
Username
;
/* User connect name */
PSZ
Username
;
/* User connect name */
PSZ
Password
;
/* Password connect info */
PSZ
Password
;
/* Password connect info */
PSZ
Tabcat
;
/* External table catalog */
PSZ
Tabcat
;
/* External table catalog */
PSZ
Srcdef
;
/* The source table SQL definition */
PSZ
Tabtyp
;
/* Catalog table type */
PSZ
Colpat
;
/* Catalog column pattern */
PSZ
Srcdef
;
/* The source table SQL definition */
PSZ
Qchar
;
/* Identifier quoting character */
PSZ
Qchar
;
/* Identifier quoting character */
PSZ
Qrystr
;
/* The original query */
PSZ
Qrystr
;
/* The original query */
PSZ
Sep
;
/* Decimal separator */
PSZ
Sep
;
/* Decimal separator */
...
@@ -326,7 +329,8 @@ class TDBOTB : public TDBDRV {
...
@@ -326,7 +329,8 @@ class TDBOTB : public TDBDRV {
char
*
Dsn
;
// Points to connection string
char
*
Dsn
;
// Points to connection string
char
*
Schema
;
// Points to schema name or NULL
char
*
Schema
;
// Points to schema name or NULL
char
*
Tab
;
// Points to ODBC table name or pattern
char
*
Tab
;
// Points to ODBC table name or pattern
ODBCPARM
Ops
;
// Additional parameters
char
*
Tabtyp
;
// Points to ODBC table type
ODBCPARM
Ops
;
// Additional parameters
};
// end of class TDBOTB
};
// end of class TDBOTB
/***********************************************************************/
/***********************************************************************/
...
@@ -335,13 +339,14 @@ class TDBOTB : public TDBDRV {
...
@@ -335,13 +339,14 @@ class TDBOTB : public TDBDRV {
class
TDBOCL
:
public
TDBOTB
{
class
TDBOCL
:
public
TDBOTB
{
public:
public:
// Constructor
// Constructor
TDBOCL
(
PODEF
tdp
)
:
TDBOTB
(
tdp
)
{}
TDBOCL
(
PODEF
tdp
);
protected:
protected:
// Specific routines
// Specific routines
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// No additional Members
// Members
char
*
Colpat
;
// Points to column pattern
};
// end of class TDBOCL
};
// end of class TDBOCL
#endif // !NODBC
#endif // !NODBC
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