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 @@
*.cpp text
*.h text
*.test text
*.java text
# These files should be checked out as is
*.result -text -whitespace
...
...
@@ -23,9 +24,11 @@ pcre/testdata/greppatN4 -text
*.frm binary
*.MYD binary
*.MYI binary
*.class binary
*.c diff=cpp
*.h diff=cpp
*.cc diff=cpp
*.ic 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
*.exp
*.dep
*.idb
*.res
*.tlog
# Precompiled Headers
*.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 {
}
// end of GetMaxValue
public
int
GetColumns
(
String
[]
parms
)
{
int
ncol
=
0
;
int
ncol
=
-
1
;
try
{
if
(
rs
!=
null
)
rs
.
close
();
...
...
storage/connect/ha_connect.cc
View file @
736f821c
...
...
@@ -129,7 +129,8 @@
#include "odbccat.h"
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
#include "jdbccat.h"
#include "tabjdbc.h"
#include "jdbconn.h"
#endif // JDBC_SUPPORT
#include "xtable.h"
#include "tabmysql.h"
...
...
@@ -5163,7 +5164,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
PJPARM
sjp
=
NULL
;
char
*
jpath
=
NULL
;
char
*
driver
=
NULL
;
char
*
url
=
NULL
;
char
*
tabtyp
=
NULL
;
...
...
@@ -5230,9 +5230,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
cnc
=
(
!*
ucnc
||
*
ucnc
==
'y'
||
*
ucnc
==
'Y'
||
atoi
(
ucnc
)
!=
0
);
#endif
#if defined(JDBC_SUPPORT)
jpath
=
GetListOption
(
g
,
"Jpath"
,
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
);
#endif // JDBC_SUPPORT
mxe
=
atoi
(
GetListOption
(
g
,
"maxerr"
,
topt
->
oplist
,
"0"
));
...
...
@@ -5333,18 +5332,31 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case
TAB_JDBC
:
if
(
fnc
&
FNC_DRIVER
)
{
ok
=
true
;
}
else
if
(
!
url
)
{
strcpy
(
g
->
Message
,
"Missing URL"
);
}
else
if
(
!
(
url
=
strz
(
g
,
create_info
->
connect_string
))
)
{
strcpy
(
g
->
Message
,
"Missing URL"
);
}
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
->
Driver
=
driver
;
sjp
->
Url
=
url
;
sjp
->
User
=
(
char
*
)
user
;
sjp
->
Pwd
=
(
char
*
)
pwd
;
sjp
->
Fsize
=
0
;
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
supfnc
|=
(
FNC_DRIVER
|
FNC_TABLE
);
...
...
@@ -5496,7 +5508,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break
;
case
FNC_TABLE
:
qrp
=
ODBCTables
(
g
,
dsn
,
shm
,
tab
,
mxr
,
true
,
sop
);
qrp
=
ODBCTables
(
g
,
dsn
,
shm
,
tab
,
NULL
,
mxr
,
true
,
sop
);
break
;
case
FNC_DSN
:
qrp
=
ODBCDataSources
(
g
,
mxr
,
true
);
...
...
@@ -5517,15 +5529,14 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case
FNC_NO
:
case
FNC_COL
:
if
(
src
)
{
qrp
=
JDBCSrcCols
(
g
,
jpath
,
(
char
*
)
src
,
sjp
);
qrp
=
JDBCSrcCols
(
g
,
(
char
*
)
src
,
sjp
);
src
=
NULL
;
// for next tests
}
else
qrp
=
JDBCColumns
(
g
,
jpath
,
shm
,
tab
,
NULL
,
mxr
,
fnc
==
FNC_COL
,
sjp
);
qrp
=
JDBCColumns
(
g
,
shm
,
tab
,
NULL
,
mxr
,
fnc
==
FNC_COL
,
sjp
);
break
;
case
FNC_TABLE
:
qrp
=
JDBCTables
(
g
,
dsn
,
shm
,
tab
,
tabtyp
,
mxr
,
true
,
sjp
);
qrp
=
JDBCTables
(
g
,
shm
,
tab
,
tabtyp
,
mxr
,
true
,
sjp
);
break
;
#if 0
case FNC_DSN:
...
...
@@ -5533,7 +5544,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break;
#endif // 0
case
FNC_DRIVER
:
qrp
=
JDBCDrivers
(
g
,
jpath
,
mxr
,
true
);
qrp
=
JDBCDrivers
(
g
,
mxr
,
true
);
break
;
default:
sprintf
(
g
->
Message
,
"invalid catfunc %s"
,
fncn
);
...
...
@@ -5784,12 +5795,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
switch
(
typ
)
{
case
TYPE_DOUBLE
:
case
TYPE_DECIM
:
// Some data sources do not count dec in length (prec)
prec
+=
(
dec
+
2
);
// To be safe
break
;
case
TYPE_DECIM
:
prec
=
len
;
break
;
default:
dec
=
0
;
}
// endswitch typ
...
...
storage/connect/jdbccat.h
View file @
736f821c
...
...
@@ -21,9 +21,9 @@ typedef struct jdbc_parms {
char
*
JDBCCheckConnection
(
PGLOBAL
g
,
char
*
dsn
,
int
cop
);
#endif // PROMPT_OK
//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
);
PQRYRES
JDBCSrcCols
(
PGLOBAL
g
,
char
*
jpath
,
char
*
src
,
PJPARM
sop
);
PQRYRES
JDBCTables
(
PGLOBAL
g
,
char
*
jpath
,
char
*
db
,
char
*
tabpat
,
PQRYRES
JDBCSrcCols
(
PGLOBAL
g
,
char
*
src
,
PJPARM
sop
);
PQRYRES
JDBCTables
(
PGLOBAL
g
,
char
*
db
,
char
*
tabpat
,
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 @@
typedef
unsigned
char
*
PUCHAR
;
#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
{
CAT_TAB
=
1
,
// JDBC Tables
CAT_COL
=
2
,
// JDBC Columns
...
...
@@ -55,11 +46,17 @@ enum JCATINFO {
typedef
struct
tagJCATPARM
{
JCATINFO
Id
;
// Id to indicate function
PQRYRES
Qrp
;
// Result set pointer
PUCHAR
DB
;
// Database (Schema)
PUCHAR
Tab
;
// Table name or pattern
PUCHAR
Pat
;
// Table type or column pattern
char
*
DB
;
// Database (Schema)
char
*
Tab
;
// Table name or pattern
char
*
Pat
;
// Table type or column pattern
}
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
class
TDBJDBC
;
class
JDBCCOL
;
...
...
@@ -79,7 +76,7 @@ class JDBConn : public BLOCK {
public:
JDBConn
(
PGLOBAL
g
,
TDBJDBC
*
tdbp
);
int
Open
(
P
SZ
jpath
,
P
JPARM
sop
);
int
Open
(
PJPARM
sop
);
int
Rewind
(
char
*
sql
);
void
Close
(
void
);
PQRYRES
AllocateResult
(
PGLOBAL
g
);
...
...
@@ -114,8 +111,18 @@ class JDBConn : public BLOCK {
PQRYRES
GetMetaData
(
PGLOBAL
g
,
char
*
src
);
public:
// Set special options
//void OnSetOptions(HSTMT hstmt);
// Set static variables
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
public:
...
...
@@ -123,24 +130,30 @@ class JDBConn : public BLOCK {
// JDBC operations
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(PSZ msg);
//void AllocConnect(DWORD dwOptions);
//void Connect(void);
//bool DriverConnect(DWORD Options);
//void VerifyConnect(void);
//void GetConnectInfo(void);
//void Free(void);
protected:
// 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
;
TDBJDBC
*
m_Tdb
;
JavaVM
*
jvm
;
// Pointer to the JVM (Java Virtual Machine)
JNIEnv
*
env
;
// Pointer to native interface
jclass
jdi
;
// Pointer to the
JdbcInterface
class
jobject
job
;
// The
JdbcInterface
class object
jclass
jdi
;
// Pointer to the
java wrapper
class
jobject
job
;
// The
java wrapper
class object
jmethodID
xqid
;
// The ExecuteQuery method ID
jmethodID
xuid
;
// The ExecuteUpdate method ID
jmethodID
xid
;
// The Execute method ID
...
...
@@ -151,9 +164,17 @@ class JDBConn : public BLOCK {
jmethodID
prepid
;
// The CreatePrepStmt method ID
jmethodID
xpid
;
// The ExecutePrep 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_QueryTimeout;
//DWORD m_UpdateOptions;
char
*
Msg
;
char
m_IDQuoteChar
[
2
];
PSZ
m_Driver
;
PSZ
m_Url
;
...
...
storage/connect/odbccat.h
View file @
736f821c
...
...
@@ -21,5 +21,5 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
char
*
colpat
,
int
maxres
,
bool
info
,
POPARM
sop
);
PQRYRES
ODBCSrcCols
(
PGLOBAL
g
,
char
*
dsn
,
char
*
src
,
POPARM
sop
);
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
);
storage/connect/odbconn.cpp
View file @
736f821c
...
...
@@ -606,7 +606,7 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
/* an ODBC database that will be retrieved by GetData commands. */
/**************************************************************************/
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
,
TYPE_STRING
,
TYPE_STRING
};
...
...
@@ -668,7 +668,7 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
if
(
!
(
cap
=
AllocCatInfo
(
g
,
CAT_TAB
,
db
,
tabpat
,
qrp
)))
return
NULL
;
//
cap->Pat = (PUCHAR)tabtyp;
cap
->
Pat
=
(
PUCHAR
)
tabtyp
;
if
(
trace
)
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 @@
/***********************************************************************/
#include "colblk.h"
#include "resource.h"
#include "jdbccat.h"
typedef
class
JDBCDEF
*
PJDBCDEF
;
typedef
class
TDBJDBC
*
PTDBJDBC
;
...
...
@@ -25,13 +26,13 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
friend
class
TDBXJDC
;
friend
class
TDBJDRV
;
friend
class
TDBJTB
;
friend
class
TDBJDBCL
;
public:
// Constructor
JDBCDEF
(
void
);
// Implementation
virtual
const
char
*
GetType
(
void
)
{
return
"JDBC"
;
}
PSZ
GetJpath
(
void
)
{
return
Jpath
;
}
PSZ
GetTabname
(
void
)
{
return
Tabname
;
}
PSZ
GetTabschema
(
void
)
{
return
Tabschema
;
}
PSZ
GetTabcat
(
void
)
{
return
Tabcat
;
}
...
...
@@ -45,10 +46,11 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
virtual
int
Indexable
(
void
)
{
return
2
;
}
virtual
bool
DefineAM
(
PGLOBAL
g
,
LPCSTR
am
,
int
poff
);
virtual
PTDB
GetTable
(
PGLOBAL
g
,
MODE
m
);
int
ParseURL
(
PGLOBAL
g
,
char
*
url
,
bool
b
=
true
);
bool
SetParms
(
PJPARM
sjp
);
protected:
// Members
PSZ
Jpath
;
/* Java class path */
PSZ
Driver
;
/* JDBC driver */
PSZ
Url
;
/* JDBC driver URL */
PSZ
Tabname
;
/* External table name */
...
...
@@ -57,6 +59,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
PSZ
Password
;
/* Password connect info */
PSZ
Tabcat
;
/* External table catalog */
PSZ
Tabtype
;
/* External table type */
PSZ
Colpat
;
/* Catalog column pattern */
PSZ
Srcdef
;
/* The source table SQL definition */
PSZ
Qchar
;
/* Identifier quoting character */
PSZ
Qrystr
;
/* The original query */
...
...
@@ -73,7 +76,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
};
// end of JDBCDEF
#if !defined(NJDBC)
#include "
JDBC
onn.h"
#include "
jdbc
onn.h"
/***********************************************************************/
/* This is the JDBC Access Method class declaration for files from */
...
...
@@ -130,7 +133,6 @@ class TDBJDBC : public TDBASE {
JDBCCOL
*
Cnp
;
// Points to count(*) column
JDBCPARM
Ops
;
// Additional parameters
PSTRG
Query
;
// Constructed SQL query
char
*
Jpath
;
// Java class path
char
*
TableName
;
// Points to JDBC table name
char
*
Schema
;
// Points to JDBC table Schema
char
*
User
;
// User connect info
...
...
@@ -282,7 +284,7 @@ class JSRCCOL : public JDBCCOL {
class
TDBJDRV
:
public
TDBCAT
{
public:
// Constructor
TDBJDRV
(
PJDBCDEF
tdp
)
:
TDBCAT
(
tdp
)
{
Maxres
=
tdp
->
Maxres
;
Jpath
=
tdp
->
Jpath
;
}
TDBJDRV
(
PJDBCDEF
tdp
)
:
TDBCAT
(
tdp
)
{
Maxres
=
tdp
->
Maxres
;}
protected:
// Specific routines
...
...
@@ -290,7 +292,6 @@ class TDBJDRV : public TDBCAT {
// Members
int
Maxres
;
// Returned lines limit
char
*
Jpath
;
// Java class path
};
// end of class TDBJDRV
/***********************************************************************/
...
...
@@ -306,7 +307,6 @@ class TDBJTB : public TDBJDRV {
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// Members
char
*
Jpath
;
// Points to Java classpath
char
*
Schema
;
// Points to schema name or NULL
char
*
Tab
;
// Points to JDBC table name or pattern
char
*
Tabtype
;
// Points to JDBC table type
...
...
@@ -319,14 +319,15 @@ class TDBJTB : public TDBJDRV {
class
TDBJDBCL
:
public
TDBJTB
{
public:
// Constructor
TDBJDBCL
(
PJDBCDEF
tdp
)
:
TDBJTB
(
tdp
)
{}
TDBJDBCL
(
PJDBCDEF
tdp
)
;
protected:
// Specific routines
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// No additional Members
};
// end of class TDBJCL
// Members
char
*
Colpat
;
// Points to catalog column pattern
};
// end of class TDBJDBCL
#if 0
/***********************************************************************/
...
...
storage/connect/tabodbc.cpp
View file @
736f821c
/************* Tabodbc C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: TABODBC */
/* ------------- */
/* Version 3.
0
*/
/* Version 3.
1
*/
/* */
/* COPYRIGHT: */
/* ---------- */
...
...
@@ -96,7 +96,7 @@ bool ExactInfo(void);
ODBCDEF
::
ODBCDEF
(
void
)
{
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
;
Scrollable
=
Xsrc
=
UseCnc
=
false
;
}
// end of ODBCDEF constructor
...
...
@@ -120,7 +120,7 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Tabschema
=
GetStringCatInfo
(
g
,
"Schema"
,
Tabschema
);
Tabcat
=
GetStringCatInfo
(
g
,
"Qualifier"
,
NULL
);
Tabcat
=
GetStringCatInfo
(
g
,
"Catalog"
,
Tabcat
);
Username
=
GetStringCatInfo
(
g
,
"User"
,
NULL
);
Username
=
GetStringCatInfo
(
g
,
"User"
,
NULL
);
Password
=
GetStringCatInfo
(
g
,
"Password"
,
NULL
);
if
((
Srcdef
=
GetStringCatInfo
(
g
,
"Srcdef"
,
NULL
)))
...
...
@@ -141,7 +141,13 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if
((
Scrollable
=
GetBoolCatInfo
(
"Scrollable"
,
false
))
&&
!
Elemt
)
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
if
(
!
(
Memory
=
GetIntCatInfo
(
"Memory"
,
0
)))
...
...
@@ -1768,6 +1774,7 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
Dsn
=
tdp
->
GetConnect
();
Schema
=
tdp
->
GetTabschema
();
Tab
=
tdp
->
GetTabname
();
Tabtyp
=
tdp
->
Tabtyp
;
Ops
.
User
=
tdp
->
Username
;
Ops
.
Pwd
=
tdp
->
Password
;
Ops
.
Cto
=
tdp
->
Cto
;
...
...
@@ -1780,17 +1787,25 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
/***********************************************************************/
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
/* ---------------------------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. */
/***********************************************************************/
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 Tabodbc --------------------------- */
storage/connect/tabodbc.h
View file @
736f821c
...
...
@@ -25,7 +25,8 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
friend
class
TDBXDBC
;
friend
class
TDBDRV
;
friend
class
TDBOTB
;
public:
friend
class
TDBOCL
;
public:
// Constructor
ODBCDEF
(
void
);
...
...
@@ -54,7 +55,9 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */
PSZ
Username
;
/* User connect name */
PSZ
Password
;
/* Password connect info */
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
Qrystr
;
/* The original query */
PSZ
Sep
;
/* Decimal separator */
...
...
@@ -326,7 +329,8 @@ class TDBOTB : public TDBDRV {
char
*
Dsn
;
// Points to connection string
char
*
Schema
;
// Points to schema name or NULL
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
/***********************************************************************/
...
...
@@ -335,13 +339,14 @@ class TDBOTB : public TDBDRV {
class
TDBOCL
:
public
TDBOTB
{
public:
// Constructor
TDBOCL
(
PODEF
tdp
)
:
TDBOTB
(
tdp
)
{}
TDBOCL
(
PODEF
tdp
);
protected:
// Specific routines
virtual
PQRYRES
GetResult
(
PGLOBAL
g
);
// No additional Members
// Members
char
*
Colpat
;
// Points to column pattern
};
// end of class TDBOCL
#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