diff options
author | Alexander Barkov <bar@mnogosearch.org> | 2013-02-07 13:34:27 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mnogosearch.org> | 2013-02-07 13:34:27 +0400 |
commit | 30c4b0ebc24fe0106e146b1f6577a4150e71e258 (patch) | |
tree | 592673d8c2f5b418833c3ee5fcfeb9dbf4ba1681 /storage/connect/tabmysql.h | |
parent | 60c4cab3bd00621cc03afb1be6de01c8fab0c5f0 (diff) | |
download | mariadb-git-30c4b0ebc24fe0106e146b1f6577a4150e71e258.tar.gz |
- Fixing TAB to 2 spaces
- Fixing line endings from "\r\n" to "\n"
Diffstat (limited to 'storage/connect/tabmysql.h')
-rw-r--r-- | storage/connect/tabmysql.h | 278 |
1 files changed, 139 insertions, 139 deletions
diff --git a/storage/connect/tabmysql.h b/storage/connect/tabmysql.h index 7507e3889fd..bdd4a80377a 100644 --- a/storage/connect/tabmysql.h +++ b/storage/connect/tabmysql.h @@ -1,139 +1,139 @@ -// TDBMYSQL.H Olivier Bertrand 2007-2012
-#include "myconn.h" // MySQL connection declares
-
-typedef class MYSQLDEF *PMYDEF;
-typedef class TDBMYSQL *PTDBMY;
-typedef class MYSQLC *PMYC;
-typedef class MYSQLCOL *PMYCOL;
-
-/* ------------------------- MYSQL classes --------------------------- */
-
-/***********************************************************************/
-/* MYSQL: table type that are MySQL tables. */
-/* Using embedded MySQL library (or optionally calling a MySQL server)*/
-/***********************************************************************/
-
-/***********************************************************************/
-/* MYSQL table. */
-/***********************************************************************/
-class MYSQLDEF : public TABDEF {/* Logical table description */
- friend class TDBMYSQL;
- public:
- // Constructor
- MYSQLDEF(void);
-
-
- // Implementation
- virtual const char *GetType(void) {return "MYSQL";}
- inline PSZ GetHostname(void) {return Hostname;};
- inline PSZ GetDatabase(void) {return Database;};
- inline PSZ GetTabname(void) {return Tabname;}
- inline PSZ GetUsername(void) {return Username;};
- inline PSZ GetPassword(void) {return Password;};
- inline int GetPortnumber(void) {return Portnumber;}
-
- // Methods
- virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
- virtual PTDB GetTable(PGLOBAL g, MODE m);
-
- protected:
- // Members
- PSZ Hostname; /* Host machine to use */
- PSZ Database; /* Database to be used by server */
- PSZ Tabname; /* External table name */
- PSZ Username; /* User logon name */
- PSZ Password; /* Password logon info */
- int Portnumber; /* MySQL port number (0 = default) */
- bool Bind; /* Use prepared statement on insert */
- bool Delayed; /* Delayed insert */
- }; // end of MYSQLDEF
-
-/***********************************************************************/
-/* This is the class declaration for the MYSQL table. */
-/***********************************************************************/
-class TDBMYSQL : public TDBASE {
- friend class MYSQLCOL;
- public:
- // Constructor
- TDBMYSQL(PMYDEF tdp);
- TDBMYSQL(PGLOBAL g, PTDBMY tdbp);
-
- // Implementation
- virtual AMT GetAmType(void) {return TYPE_AM_MYSQL;}
- virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(g, this);}
-
- // Methods
- virtual PTDB CopyOne(PTABS t);
- virtual int GetAffectedRows(void) {return AftRows;}
- virtual int GetRecpos(void) {return N;}
- virtual int GetProgMax(PGLOBAL g);
- virtual void ResetDB(void) {N = 0;}
- virtual int RowNumber(PGLOBAL g, bool b = FALSE);
-
- // 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:
- // Internal functions
- bool MakeSelect(PGLOBAL g);
- bool MakeInsert(PGLOBAL g);
-//bool MakeUpdate(PGLOBAL g);
-//bool MakeDelete(PGLOBAL g);
- int BindColumns(PGLOBAL g);
-
- // Members
- MYSQLC Myc; // MySQL connection class
- MYSQL_BIND *Bind; // To the MySQL bind structure array
- char *Host; // Host machine to use
- char *User; // User logon info
- char *Pwd; // Password logon info
- char *Database; // Database to be used by server
- char *Tabname; // External table name
- char *Query; // Points to SQL query
- char *Qbuf; // Used for not prepared insert
- bool Fetched; // True when fetch was done
- bool Prep; // Use prepared statement on insert
- bool Delayed; // Use delayed insert
- int m_Rc; // Return code from command
- int AftRows; // The number of affected rows
- int N; // The current table index
- int Port; // MySQL port number (0 = default)
- int Nparm; // The number of statement parameters
- }; // end of class TDBMYSQL
-
-/***********************************************************************/
-/* Class MYSQLCOL: MySQL table column. */
-/***********************************************************************/
-class MYSQLCOL : public COLBLK {
- friend class TDBMYSQL;
- public:
- // Constructors
- MYSQLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "MYSQL");
- MYSQLCOL(MYSQLCOL *colp, PTDB tdbp); // Constructor used in copy process
-
- // Implementation
- virtual int GetAmType(void) {return TYPE_AM_MYSQL;}
- void InitBind(PGLOBAL g);
-
- // Methods
- virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
- virtual void ReadColumn(PGLOBAL g);
- virtual void WriteColumn(PGLOBAL g);
-
- protected:
- // Default constructor not to be used
- MYSQLCOL(void) {}
-
- // Members
- MYSQL_BIND *Bind; // This column bind structure pointer
- PVAL To_Val; // To value used for Update/Insert
- unsigned long Slen; // Bind string lengh
- int Rank; // Rank (position) number in the query
- }; // end of class MYSQLCOL
-
+// TDBMYSQL.H Olivier Bertrand 2007-2012 +#include "myconn.h" // MySQL connection declares + +typedef class MYSQLDEF *PMYDEF; +typedef class TDBMYSQL *PTDBMY; +typedef class MYSQLC *PMYC; +typedef class MYSQLCOL *PMYCOL; + +/* ------------------------- MYSQL classes --------------------------- */ + +/***********************************************************************/ +/* MYSQL: table type that are MySQL tables. */ +/* Using embedded MySQL library (or optionally calling a MySQL server)*/ +/***********************************************************************/ + +/***********************************************************************/ +/* MYSQL table. */ +/***********************************************************************/ +class MYSQLDEF : public TABDEF {/* Logical table description */ + friend class TDBMYSQL; + public: + // Constructor + MYSQLDEF(void); + + + // Implementation + virtual const char *GetType(void) {return "MYSQL";} + inline PSZ GetHostname(void) {return Hostname;}; + inline PSZ GetDatabase(void) {return Database;}; + inline PSZ GetTabname(void) {return Tabname;} + inline PSZ GetUsername(void) {return Username;}; + inline PSZ GetPassword(void) {return Password;}; + inline int GetPortnumber(void) {return Portnumber;} + + // Methods + virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); + virtual PTDB GetTable(PGLOBAL g, MODE m); + + protected: + // Members + PSZ Hostname; /* Host machine to use */ + PSZ Database; /* Database to be used by server */ + PSZ Tabname; /* External table name */ + PSZ Username; /* User logon name */ + PSZ Password; /* Password logon info */ + int Portnumber; /* MySQL port number (0 = default) */ + bool Bind; /* Use prepared statement on insert */ + bool Delayed; /* Delayed insert */ + }; // end of MYSQLDEF + +/***********************************************************************/ +/* This is the class declaration for the MYSQL table. */ +/***********************************************************************/ +class TDBMYSQL : public TDBASE { + friend class MYSQLCOL; + public: + // Constructor + TDBMYSQL(PMYDEF tdp); + TDBMYSQL(PGLOBAL g, PTDBMY tdbp); + + // Implementation + virtual AMT GetAmType(void) {return TYPE_AM_MYSQL;} + virtual PTDB Duplicate(PGLOBAL g) {return (PTDB)new(g) TDBMYSQL(g, this);} + + // Methods + virtual PTDB CopyOne(PTABS t); + virtual int GetAffectedRows(void) {return AftRows;} + virtual int GetRecpos(void) {return N;} + virtual int GetProgMax(PGLOBAL g); + virtual void ResetDB(void) {N = 0;} + virtual int RowNumber(PGLOBAL g, bool b = FALSE); + + // 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: + // Internal functions + bool MakeSelect(PGLOBAL g); + bool MakeInsert(PGLOBAL g); +//bool MakeUpdate(PGLOBAL g); +//bool MakeDelete(PGLOBAL g); + int BindColumns(PGLOBAL g); + + // Members + MYSQLC Myc; // MySQL connection class + MYSQL_BIND *Bind; // To the MySQL bind structure array + char *Host; // Host machine to use + char *User; // User logon info + char *Pwd; // Password logon info + char *Database; // Database to be used by server + char *Tabname; // External table name + char *Query; // Points to SQL query + char *Qbuf; // Used for not prepared insert + bool Fetched; // True when fetch was done + bool Prep; // Use prepared statement on insert + bool Delayed; // Use delayed insert + int m_Rc; // Return code from command + int AftRows; // The number of affected rows + int N; // The current table index + int Port; // MySQL port number (0 = default) + int Nparm; // The number of statement parameters + }; // end of class TDBMYSQL + +/***********************************************************************/ +/* Class MYSQLCOL: MySQL table column. */ +/***********************************************************************/ +class MYSQLCOL : public COLBLK { + friend class TDBMYSQL; + public: + // Constructors + MYSQLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am = "MYSQL"); + MYSQLCOL(MYSQLCOL *colp, PTDB tdbp); // Constructor used in copy process + + // Implementation + virtual int GetAmType(void) {return TYPE_AM_MYSQL;} + void InitBind(PGLOBAL g); + + // Methods + virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); + virtual void ReadColumn(PGLOBAL g); + virtual void WriteColumn(PGLOBAL g); + + protected: + // Default constructor not to be used + MYSQLCOL(void) {} + + // Members + MYSQL_BIND *Bind; // This column bind structure pointer + PVAL To_Val; // To value used for Update/Insert + unsigned long Slen; // Bind string lengh + int Rank; // Rank (position) number in the query + }; // end of class MYSQLCOL + |