mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
5f64276fb2
modified: storage/connect/array.cpp modified: storage/connect/blkfil.cpp modified: storage/connect/block.h modified: storage/connect/bson.cpp modified: storage/connect/cmgoconn.cpp modified: storage/connect/colblk.cpp modified: storage/connect/domdoc.cpp modified: storage/connect/filamap.cpp modified: storage/connect/filamdbf.cpp modified: storage/connect/filamfix.cpp modified: storage/connect/filamgz.cpp modified: storage/connect/filamtxt.cpp modified: storage/connect/filamvct.cpp modified: storage/connect/filamzip.cpp modified: storage/connect/filter.cpp modified: storage/connect/filter.h modified: storage/connect/fmdlex.c modified: storage/connect/global.h modified: storage/connect/ha_connect.cc modified: storage/connect/javaconn.cpp modified: storage/connect/javaconn.h modified: storage/connect/jdbconn.cpp modified: storage/connect/jmgfam.cpp modified: storage/connect/json.cpp modified: storage/connect/macutil.cpp modified: storage/connect/macutil.h modified: storage/connect/maputil.cpp modified: storage/connect/mycat.cc modified: storage/connect/myconn.cpp modified: storage/connect/myconn.h modified: storage/connect/myutil.cpp modified: storage/connect/odbconn.cpp modified: storage/connect/odbconn.h modified: storage/connect/os.h modified: storage/connect/osutil.c modified: storage/connect/plgdbsem.h modified: storage/connect/plgdbutl.cpp modified: storage/connect/plugutil.cpp modified: storage/connect/rcmsg.c modified: storage/connect/reldef.cpp modified: storage/connect/reldef.h modified: storage/connect/tabdos.cpp modified: storage/connect/tabext.cpp modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjdbc.cpp modified: storage/connect/tabmac.cpp modified: storage/connect/tabmac.h modified: storage/connect/tabmul.cpp modified: storage/connect/tabmul.h modified: storage/connect/tabmysql.cpp modified: storage/connect/taboccur.cpp modified: storage/connect/tabodbc.cpp modified: storage/connect/tabpivot.cpp modified: storage/connect/tabrest.cpp modified: storage/connect/tabrest.h modified: storage/connect/tabsys.cpp modified: storage/connect/tabtbl.cpp modified: storage/connect/tabutil.cpp modified: storage/connect/tabvct.cpp modified: storage/connect/tabwmi.cpp modified: storage/connect/tabxcl.cpp modified: storage/connect/tabxml.cpp modified: storage/connect/valblk.cpp modified: storage/connect/value.cpp modified: storage/connect/xindex.cpp modified: storage/connect/xindex.h - Fix Date errors and SSL warnings modified: storage/connect/mysql-test/connect/r/jdbc.result modified: storage/connect/mysql-test/connect/r/jdbc_new.result modified: storage/connect/mysql-test/connect/t/jdbc.test modified: storage/connect/mysql-test/connect/t/jdbc_new.test - Update java source files modified: storage/connect/Mongo2Interface.java modified: storage/connect/Mongo3Interface.java added: storage/connect/Client2.java added: storage/connect/Client3.java added: storage/connect/TestInsert2.java added: storage/connect/TestInsert3.java
105 lines
3.9 KiB
C++
105 lines
3.9 KiB
C++
/***********************************************************************/
|
|
/* MYCONN.H Olivier Bertrand 2007-2013 */
|
|
/* */
|
|
/* This is the declaration file for the MySQL connection class and */
|
|
/* a few utility functions used to communicate with MySQL. */
|
|
/* */
|
|
/* DO NOT define DLL_EXPORT in your application so these items are */
|
|
/* declared are imported from the Myconn DLL. */
|
|
/***********************************************************************/
|
|
#if defined(_WIN32)
|
|
#include <winsock.h>
|
|
#else // !_WIN32
|
|
#include <sys/socket.h>
|
|
#endif // !_WIN32
|
|
#include <mysql.h>
|
|
#include <errmsg.h>
|
|
#include "myutil.h"
|
|
|
|
#if defined(_WIN32) && defined(MYCONN_EXPORTS)
|
|
#if defined(DLL_EXPORT)
|
|
#define DllItem _declspec(dllexport)
|
|
#else // !DLL_EXPORT
|
|
#define DllItem _declspec(dllimport)
|
|
#endif // !DLL_EXPORT
|
|
#else // !_WIN32 || !MYCONN_EXPORTS
|
|
#define DllItem
|
|
#endif // !_WIN32
|
|
|
|
#define MYSQL_ENABLED 0x00000001
|
|
#define MYSQL_LOGON 0x00000002
|
|
|
|
typedef class MYSQLC *PMYC;
|
|
|
|
/***********************************************************************/
|
|
/* Prototypes of info functions. */
|
|
/***********************************************************************/
|
|
PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
|
|
const char *user, const char *pwd,
|
|
const char *table, const char *colpat,
|
|
int port, bool info);
|
|
|
|
PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db,
|
|
const char *user, const char *pwd,
|
|
const char *srcdef, int port);
|
|
|
|
uint GetDefaultPort(void);
|
|
|
|
/* -------------------------- MYCONN class --------------------------- */
|
|
|
|
/***********************************************************************/
|
|
/* MYSQLC exported/imported class. A MySQL connection. */
|
|
/***********************************************************************/
|
|
class DllItem MYSQLC {
|
|
friend class TDBMYSQL;
|
|
friend class MYSQLCOL;
|
|
friend class TDBMYEXC;
|
|
// Construction
|
|
public:
|
|
MYSQLC(void);
|
|
|
|
// Implementation
|
|
int GetRows(void) {return m_Rows;}
|
|
bool Connected(void);
|
|
|
|
// Methods
|
|
int GetResultSize(PGLOBAL g, PSZ sql);
|
|
int GetTableSize(PGLOBAL g, PSZ query);
|
|
int Open(PGLOBAL g, const char *host, const char *db,
|
|
const char *user= "root", const char *pwd= "*",
|
|
int pt= 0, const char *csname = NULL);
|
|
int KillQuery(ulong id);
|
|
int ExecSQL(PGLOBAL g, const char *query, int *w = NULL);
|
|
int ExecSQLcmd(PGLOBAL g, const char *query, int *w);
|
|
#if defined(MYSQL_PREPARED_STATEMENTS)
|
|
int PrepareSQL(PGLOBAL g, const char *query);
|
|
int ExecStmt(PGLOBAL g);
|
|
int BindParams(PGLOBAL g, MYSQL_BIND *bind);
|
|
#endif // MYSQL_PREPARED_STATEMENTS
|
|
PQRYRES GetResult(PGLOBAL g, bool pdb = FALSE);
|
|
int Fetch(PGLOBAL g, int pos);
|
|
char *GetCharField(int i);
|
|
int GetFieldLength(int i);
|
|
int Rewind(PGLOBAL g, PSZ sql);
|
|
void FreeResult(void);
|
|
void Close(void);
|
|
|
|
protected:
|
|
MYSQL_FIELD *GetNextField(void);
|
|
void DataSeek(my_ulonglong row);
|
|
|
|
// Members
|
|
MYSQL *m_DB; // The return from MySQL connection
|
|
#if defined (MYSQL_PREPARED_STATEMENTS)
|
|
MYSQL_STMT *m_Stmt; // Prepared statement handle
|
|
#endif // MYSQL_PREPARED_STATEMENTS
|
|
MYSQL_RES *m_Res; // Points to MySQL Result
|
|
MYSQL_ROW m_Row; // Point to current row
|
|
int m_Rows; // The number of rows of the result
|
|
int N;
|
|
int m_Fields; // The number of result fields
|
|
int m_Afrw; // The number of affected rows
|
|
bool m_Use; // Use or store result set
|
|
const char *csname; // Table charset name
|
|
}; // end of class MYSQLC
|
|
|