diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2013-02-05 01:56:22 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2013-02-05 01:56:22 +0100 |
commit | 1830e732fb6a47bad7c4a6c97d3bcf964e70aae7 (patch) | |
tree | 81b778893081f11629c6a27fa20d0abc7da1e0f3 /storage/connect/tabodbc.h | |
parent | 9d8d62eeffd3b03a70f536490b46a38cc4522672 (diff) | |
download | mariadb-git-1830e732fb6a47bad7c4a6c97d3bcf964e70aae7.tar.gz |
Make possible to get ODBC DataSources name and description by:
create table datasrc (
`anyname` varchar(256) flag=1,
`anyother name` varchar(256) flag=2)
engine=CONNECT table_type=ODBC option_list='info=yes';
or simply by:
create table datasrc engine=CONNECT table_type=ODBC option_list='info=yes';
then:
select * from datasrc;
Modified:
ha_connect.cc
odbconn.h
odbconn.cpp
tabodbc.h
tabodbc.cpp
Diffstat (limited to 'storage/connect/tabodbc.h')
-rw-r--r-- | storage/connect/tabodbc.h | 71 |
1 files changed, 67 insertions, 4 deletions
diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h index 2b24ebc8e7c..5509d3df679 100644 --- a/storage/connect/tabodbc.h +++ b/storage/connect/tabodbc.h @@ -1,7 +1,7 @@ /*************** Tabodbc H Declares Source Code File (.H) **************/
-/* Name: TABODBC.H Version 1.4 */
+/* Name: TABODBC.H Version 1.5 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2000-2012 */
+/* (C) Copyright to the author Olivier BERTRAND 2000-2013 */
/* */
/* This file contains the TDBODBC classes declares. */
/***********************************************************************/
@@ -10,6 +10,8 @@ typedef class ODBCDEF *PODEF;
typedef class TDBODBC *PTDBODBC;
typedef class ODBCCOL *PODBCCOL;
+typedef class TDBOIF *PTDBOIF;
+typedef class OIFCOL *POIFCOL;
/***********************************************************************/
/* ODBC table. */
@@ -17,8 +19,7 @@ typedef class ODBCCOL *PODBCCOL; class DllExport ODBCDEF : public TABDEF { /* Logical table description */
public:
// Constructor
- ODBCDEF(void)
- {Connect = Tabname = Tabowner = Tabqual = Qchar = NULL; Options = 0;}
+ ODBCDEF(void);
// Implementation
virtual const char *GetType(void) {return "ODBC";}
@@ -43,6 +44,7 @@ class DllExport ODBCDEF : public TABDEF { /* Logical table description */ PSZ Qchar; /* Identifier quoting character */
int Catver; /* ODBC version for catalog functions */
int Options; /* Open connection options */
+ bool Info; /* true if getting data sources */
}; // end of ODBCDEF
#if !defined(NODBC)
@@ -158,5 +160,66 @@ class ODBCCOL : public COLBLK { SQLLEN Slen; // Used with Fetch
int Rank; // Rank (position) number in the query
}; // end of class ODBCCOL
+
+/***********************************************************************/
+/* This is the class declaration for the ODBC info table. */
+/***********************************************************************/
+class TDBOIF : public TDBASE {
+ friend class OIFCOL;
+ public:
+ // Constructor
+ TDBOIF(PODEF tdp);
+
+ // Implementation
+ virtual AMT GetAmType(void) {return TYPE_AM_ODBC;}
+
+ // Methods
+ virtual int GetRecpos(void) {return N;}
+ virtual int GetProgCur(void) {return N;}
+ virtual int RowNumber(PGLOBAL g, bool b = false) {return N + 1;}
+
+ // Database routines
+ virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n);
+ virtual int GetMaxSize(PGLOBAL g);
+ virtual bool OpenDB(PGLOBAL g);
+ virtual int ReadDB(PGLOBAL g);
+ virtual int WriteDB(PGLOBAL g);
+ virtual int DeleteDB(PGLOBAL g, int irc);
+ virtual void CloseDB(PGLOBAL g);
+
+ protected:
+ // Specific routines
+ bool Initialize(PGLOBAL g);
+ bool InitCol(PGLOBAL g);
+
+ // Members
+ PQRYRES Qrp;
+ int N; // Row number
+ bool Init;
+ }; // end of class TDBOIF
+
+/***********************************************************************/
+/* Class OIFCOL: ODBC info column. */
+/***********************************************************************/
+class OIFCOL : public COLBLK {
+ friend class TDBOIF;
+ public:
+ // Constructors
+ OIFCOL(PCOLDEF cdp, PTDB tdbp, int n);
+
+ // Implementation
+ virtual int GetAmType(void) {return TYPE_AM_ODBC;}
+
+ // Methods
+ virtual void ReadColumn(PGLOBAL g);
+
+ protected:
+ OIFCOL(void) {} // Default constructor not to be used
+
+ // Members
+ PTDBOIF Tdbp; // Points to ODBC table block
+ PCOLRES Crp; // The column data array
+ int Flag;
+ }; // end of class OIFCOL
#endif // !NODBC
|