| 1 | /* Copyright (C) MariaDB Corporation Ab |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation; version 2 of the License. |
| 6 | |
| 7 | This program is distributed in the hope that it will be useful, |
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | GNU General Public License for more details. |
| 11 | |
| 12 | You should have received a copy of the GNU General Public License |
| 13 | along with this program; if not, write to the Free Software |
| 14 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ |
| 15 | |
| 16 | /** @file user_connect.h |
| 17 | |
| 18 | @brief |
| 19 | Declaration of the user_connect class. |
| 20 | |
| 21 | @note |
| 22 | Author Olivier Bertrand |
| 23 | |
| 24 | @see |
| 25 | /sql/handler.h and /storage/connect/user_connect.cc |
| 26 | */ |
| 27 | |
| 28 | #ifdef USE_PRAGMA_INTERFACE |
| 29 | #pragma interface /* gcc class implementation */ |
| 30 | #endif |
| 31 | |
| 32 | /*****************************************************************************/ |
| 33 | /* This is the global structure having all CONNECT information. */ |
| 34 | /*****************************************************************************/ |
| 35 | //typedef struct _global *PGLOBAL; |
| 36 | typedef class user_connect *PCONNECT; |
| 37 | typedef class ha_connect *PHC; |
| 38 | static int connect_done_func(void *); |
| 39 | |
| 40 | /*****************************************************************************/ |
| 41 | /* The CONNECT users. There should be one by connected users. */ |
| 42 | /*****************************************************************************/ |
| 43 | class user_connect |
| 44 | { |
| 45 | friend class ha_connect; |
| 46 | friend int connect_done_func(void *); |
| 47 | public: |
| 48 | // Constructor |
| 49 | user_connect(THD *thd); |
| 50 | |
| 51 | // Destructor |
| 52 | virtual ~user_connect(); |
| 53 | |
| 54 | // Implementation |
| 55 | bool user_init(); |
| 56 | void SetHandler(ha_connect *hc); |
| 57 | bool CheckCleanup(bool force = false); |
| 58 | bool CheckQueryID(void) {return thdp->query_id > last_query_id;} |
| 59 | bool CheckQuery(query_id_t vid) {return last_query_id > vid;} |
| 60 | |
| 61 | // Members |
| 62 | THD *thdp; // To the user thread |
| 63 | static PCONNECT to_users; // To the chain of users |
| 64 | PCONNECT next; // Next user in chain |
| 65 | PCONNECT previous; // Previous user in chain |
| 66 | PGLOBAL g; // The common handle to CONNECT |
| 67 | query_id_t last_query_id; // the latest user query id |
| 68 | int count; // if used by several handlers |
| 69 | // Statistics |
| 70 | ulong nrd, fnd, nfd; |
| 71 | ulonglong tb1; |
| 72 | }; // end of user_connect class definition |
| 73 | |
| 74 | |