My Project
|
00001 /* 00002 Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; version 2 of the License. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 */ 00017 00018 #ifndef NDB_LOCAL_CONNECTION_H 00019 #define NDB_LOCAL_CONNECTION_H 00020 00021 #include <mysql/plugin.h> 00022 00023 /* 00024 Wrapper class for executing queries against the local 00025 MySQL Server without affecting the current THD's 00026 settings and status. 00027 00028 The functionality is implemented by concatenating SQL 00029 queries and executing those using Ed_connection. Should 00030 the SQL query fail, the exact error message and all 00031 warning that occured can be examined in order to handle 00032 the error in a graceful way. 00033 00034 */ 00035 00036 class Ndb_local_connection { 00037 public: 00038 Ndb_local_connection(THD* thd); 00039 00040 bool truncate_table(const char* db, size_t db_length, 00041 const char* table, size_t table_length, 00042 bool ignore_no_such_table); 00043 00044 bool flush_table(const char* db, size_t db_length, 00045 const char* table, size_t table_length); 00046 00047 bool delete_rows(const char* db, size_t db_length, 00048 const char* table, size_t table_length, 00049 bool ignore_no_such_table, 00050 ... /* where clause, NULL terminated list of strings */); 00051 00052 bool create_sys_table(const char* db, size_t db_length, 00053 const char* table, size_t table_length, 00054 bool create_if_not_exists, 00055 const char* create_definiton, 00056 const char* create_options); 00057 00058 /* Don't use this function for new implementation, backward compat. only */ 00059 bool raw_run_query(const char* query, size_t query_length, 00060 const int* suppress_errors); 00061 00062 private: 00063 bool execute_query(MYSQL_LEX_STRING sql_text, 00064 const unsigned int* ignore_mysql_errors, 00065 const class Suppressor* suppressor = NULL); 00066 bool execute_query_iso(MYSQL_LEX_STRING sql_text, 00067 const unsigned int* ignore_mysql_errors, 00068 const class Suppressor* suppressor = NULL); 00069 private: 00070 THD* m_thd; 00071 bool m_push_warnings; 00072 }; 00073 00074 00075 #endif