| 1 | /***********************************************************************/cxx . . $ `<file>/storage/connect/myconn.h`/ |
| 2 | /* MYCONN.H Olivier Bertrand 2007-2013 */ |
| 3 | /* */ |
| 4 | /* This is the declaration file for the MySQL connection class and */ |
| 5 | /* a few utility functions used to communicate with MySQL. */ |
| 6 | /* */ |
| 7 | /* DO NOT define DLL_EXPORT in your application so these items are */ |
| 8 | /* declared are imported from the Myconn DLL. */ |
| 9 | /***********************************************************************/ |
| 10 | #if defined(_WIN32) |
| 11 | #include <winsock.h> |
| 12 | #else // !_WIN32 |
| 13 | #include <sys/socket.h> |
| 14 | #endif // !_WIN32 |
| 15 | #include <mysql.h>cxx . . $ `<file>/include/mysql.h`/ |
| 16 | #include <errmsg.h>cxx . . $ `<file>/include/errmsg.h`/ |
| 17 | #include "myutil.h"cxx . . $ `<file>/storage/connect/myutil.h`/ |
| 18 | |
| 19 | #if defined(_WIN32) && defined(MYCONN_EXPORTS) |
| 20 | #if defined(DLL_EXPORT) |
| 21 | #define DllItem _declspec(dllexport) |
| 22 | #else // !DLL_EXPORT |
| 23 | #define DllItem _declspec(dllimport) |
| 24 | #endif // !DLL_EXPORT |
| 25 | #else // !_WIN32 || !MYCONN_EXPORTS |
| 26 | #define DllItemcxx . . $ `storage/connect/myconn.h:26:9`! |
| 27 | #endif // !_WIN32 |
| 28 | |
| 29 | #define MYSQL_ENABLEDcxx . . $ `storage/connect/myconn.h:29:9`! 0x00000001 |
| 30 | #define MYSQL_LOGONcxx . . $ `storage/connect/myconn.h:30:9`! 0x00000002 |
| 31 | |
| 32 | typedef class MYSQLCcxx . . $ MYSQLC# *PMYCcxx . . $ PMYC#; |
| 33 | |
| 34 | /***********************************************************************/ |
| 35 | /* Prototypes of info functions. */ |
| 36 | /***********************************************************************/ |
| 37 | PQRYREScxx . . $ PQRYRES# MyColumnscxx . . $ MyColumns(e5e22fd7a561e692).(PGLOBAL g, THDcxx . . $ THD# *thd, const char *host, const char *db, |
| 38 | const char *user, const char *pwd, |
| 39 | const char *table, const char *colpat, |
| 40 | int port, bool info); |
| 41 | |
| 42 | PQRYREScxx . . $ PQRYRES# SrcColumnscxx . . $ SrcColumns(f678d045c0041fa2).(PGLOBAL g, const char *host, const char *db, |
| 43 | const char *user, const char *pwd, |
| 44 | const char *srcdef, int port); |
| 45 | |
| 46 | uint GetDefaultPortcxx . . $ GetDefaultPort(db52760e79bf9054).(void); |
| 47 | |
| 48 | /* -------------------------- MYCONN class --------------------------- */ |
| 49 | |
| 50 | /***********************************************************************/ |
| 51 | /* MYSQLC exported/imported class. A MySQL connection. */ |
| 52 | /***********************************************************************/ |
| 53 | class DllItemcxx . . $ `storage/connect/myconn.h:26:9`! MYSQLCcxx . . $ MYSQLC# { |
| 54 | friend class TDBMYSQLcxx . . $ TDBMYSQL#; |
| 55 | friend class MYSQLCOLcxx . . $ MYSQLCOL#; |
| 56 | friend class TDBMYEXCcxx . . $ TDBMYEXC#; |
| 57 | // Construction |
| 58 | public: |
| 59 | MYSQLCcxx . . $ MYSQLC#MYSQLC(49f6e7a06ebc5aa8).(void); |
| 60 | |
| 61 | // Implementation |
| 62 | int GetRowscxx . . $ MYSQLC#GetRows(b126dc7c1de90089).(void) {return m_Rowscxx . . $ MYSQLC#m_Rows.;} |
| 63 | bool Connectedcxx . . $ MYSQLC#Connected(c9857a73d68e59ba).(void); |
| 64 | |
| 65 | // Methods |
| 66 | int GetResultSizecxx . . $ MYSQLC#GetResultSize(9f9b834732b68490).(PGLOBAL g, PSZcxx . . $ PSZ# sql); |
| 67 | int GetTableSizecxx . . $ MYSQLC#GetTableSize(9f9b834732b68490).(PGLOBAL g, PSZcxx . . $ PSZ# query); |
| 68 | int Opencxx . . $ MYSQLC#Open(3e0c462de4486302).(PGLOBAL g, const char *host, const char *db, |
| 69 | const char *user= "root", const char *pwd= "*", |
| 70 | int pt= 0, const char *csname = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 71 | int KillQuerycxx . . $ MYSQLC#KillQuery(15f694ef3c96d230).(ulong id); |
| 72 | int ExecSQLcxx . . $ MYSQLC#ExecSQL(df313dd2366cd755).(PGLOBAL g, const char *query, int *w = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 73 | int ExecSQLcmdcxx . . $ MYSQLC#ExecSQLcmd(df313dd2366cd755).(PGLOBAL g, const char *query, int *w); |
| 74 | #if defined(MYSQL_PREPARED_STATEMENTS) |
| 75 | int PrepareSQL(PGLOBAL g, const char *query); |
| 76 | int ExecStmt(PGLOBAL g); |
| 77 | int BindParams(PGLOBAL g, MYSQL_BIND *bind); |
| 78 | #endif // MYSQL_PREPARED_STATEMENTS |
| 79 | PQRYREScxx . . $ PQRYRES# GetResultcxx . . $ MYSQLC#GetResult(1c4bac3261777816).(PGLOBAL g, bool pdb = FALSEcxx . . $ `include/my_global.h:477:9`!); |
| 80 | int Fetchcxx . . $ MYSQLC#Fetch(25a4a41e78aa2f29).(PGLOBAL g, int pos); |
| 81 | char *GetCharFieldcxx . . $ MYSQLC#GetCharField(ff224f080444ee45).(int i); |
| 82 | int GetFieldLengthcxx . . $ MYSQLC#GetFieldLength(7864480464b09eea).(int i); |
| 83 | int Rewindcxx . . $ MYSQLC#Rewind(9f9b834732b68490).(PGLOBAL g, PSZcxx . . $ PSZ# sql); |
| 84 | void FreeResultcxx . . $ MYSQLC#FreeResult(49f6e7a06ebc5aa8).(void); |
| 85 | void Closecxx . . $ MYSQLC#Close(49f6e7a06ebc5aa8).(void); |
| 86 | |
| 87 | protected: |
| 88 | MYSQL_FIELDcxx . . $ MYSQL_FIELD# *GetNextFieldcxx . . $ MYSQLC#GetNextField(37a0f10573fdc654).(void); |
| 89 | void DataSeekcxx . . $ MYSQLC#DataSeek(891dc3055356b409).(my_ulonglongcxx . . $ my_ulonglong# row); |
| 90 | |
| 91 | // Members |
| 92 | MYSQL *m_DBcxx . . $ MYSQLC#m_DB.; // The return from MySQL connection |
| 93 | #if defined (MYSQL_PREPARED_STATEMENTS) |
| 94 | MYSQL_STMT *m_Stmt; // Prepared statement handle |
| 95 | #endif // MYSQL_PREPARED_STATEMENTS |
| 96 | MYSQL_RES *m_Rescxx . . $ MYSQLC#m_Res.; // Points to MySQL Result |
| 97 | MYSQL_ROW m_Rowcxx . . $ MYSQLC#m_Row.; // Point to current row |
| 98 | int m_Rowscxx . . $ MYSQLC#m_Rows.; // The number of rows of the result |
| 99 | int Ncxx . . $ MYSQLC#N.; |
| 100 | int m_Fieldscxx . . $ MYSQLC#m_Fields.; // The number of result fields |
| 101 | int m_Afrwcxx . . $ MYSQLC#m_Afrw.; // The number of affected rows |
| 102 | bool m_Usecxx . . $ MYSQLC#m_Use.; // Use or store result set |
| 103 | const char *csnamecxx . . $ MYSQLC#csname.; // Table charset name |
| 104 | }; // end of class MYSQLC |
| 105 |